# HG changeset patch # User jdv # Date 1561106268 -19800 # Node ID fd4ec73925c358831d735e43a03b3e91be7dd751 # Parent 28582d575a985beabef2468cff6f001978f8f292# Parent 00f29fe98900415af5dff737299d5ee84d9bb833 Merge diff -r 28582d575a98 -r fd4ec73925c3 .hgtags --- a/.hgtags Fri Jun 21 12:42:10 2019 +0530 +++ b/.hgtags Fri Jun 21 14:07:48 2019 +0530 @@ -562,3 +562,8 @@ 181986c5476468bc2dd4532af49599003ee8af37 jdk-13+22 b034d2dee5fc93d42a81b65e58ce3f91e42586ff jdk-13+23 7e2238451585029680f126ccbb46d01f2ff5607f jdk-13+24 +22b3b7983adab54e318f75aeb94471f7a4429c1e jdk-14+0 +22b3b7983adab54e318f75aeb94471f7a4429c1e jdk-13+25 +2f4e214781a1d597ed36bf5a36f20928c6c82996 jdk-14+1 +0692b67f54621991ba7afbf23e55b788f3555e69 jdk-13+26 +43627549a488b7d0b4df8fad436e36233df89877 jdk-14+2 diff -r 28582d575a98 -r fd4ec73925c3 doc/building.md --- a/doc/building.md Fri Jun 21 12:42:10 2019 +0530 +++ b/doc/building.md Fri Jun 21 14:07:48 2019 +0530 @@ -871,6 +871,7 @@ * `CONF_CHECK` * `COMPARE_BUILD` * `JDK_FILTER` + * `SPEC_FILTER` ## Running Tests diff -r 28582d575a98 -r fd4ec73925c3 make/Docs.gmk --- a/make/Docs.gmk Fri Jun 21 12:42:10 2019 +0530 +++ b/make/Docs.gmk Fri Jun 21 14:07:48 2019 +0530 @@ -487,11 +487,25 @@ ################################################################################ +# Use this variable to control which spec files are included in the output. +# Format: space-delimited list of names, including at most one '%' as a +# wildcard. Spec source files match if their filename or any enclosing folder +# name matches one of the items in SPEC_FILTER. +SPEC_FILTER := % + +ApplySpecFilter = \ + $(strip $(foreach file, $(1), \ + $(eval searchkeys := $(subst /, ,$(subst $(WORKSPACE_ROOT),,$(file)))) \ + $(if $(filter $(SPEC_FILTER), $(searchkeys)), \ + $(file) \ + ) \ + )) + # Copy the global resources, including the top-level redirect index.html -GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources/ +GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources $(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \ SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \ - FILES := $(call FindFiles, $(GLOBAL_SPECS_RESOURCES_DIR)), \ + FILES := $(call ApplySpecFilter, $(call FindFiles, $(GLOBAL_SPECS_RESOURCES_DIR))), \ DEST := $(DOCS_OUTPUTDIR), \ )) JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES) @@ -499,7 +513,7 @@ # Copy the legal notices distributed with the docs bundle $(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \ SRC := $(TOPDIR)/src/jdk.javadoc/share/legal, \ - FILES := $(wildcard $(TOPDIR)/src/jdk.javadoc/share/legal/*), \ + FILES := $(call ApplySpecFilter, $(wildcard $(TOPDIR)/src/jdk.javadoc/share/legal/*)), \ DEST := $(DOCS_OUTPUTDIR)/legal, \ )) JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES) @@ -516,10 +530,10 @@ $(foreach m, $(ALL_MODULES), \ $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ $(foreach d, $(SPECS_$m), \ - $(if $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d)), \ + $(if $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \ $(eval $(call SetupCopyFiles, COPY_$m, \ SRC := $d, \ - FILES := $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d)), \ + FILES := $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \ DEST := $(DOCS_OUTPUTDIR)/specs/, \ )) \ $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \ @@ -527,31 +541,27 @@ ) \ ) -# Create copyright footer files that can be provided as input to pandoc. We -# need different files for different relative paths to the copyright.html -# file. The number 0-2 below represent how many extra directory levels down -# below the specs dir the specs html file is located. Each file name is -# stored in a variable SPECS_BOTTOM_FILE_$n where $n is 0, 1 or 2. -SPECS_BOTTOM =
$(COPYRIGHT_BOTTOM) +# Create copyright footer variables. We need different variables for different +# relative paths to the copyright.html file. The number 0-2 below represent how +# many extra directory levels down below the specs dir the specs html file is +# located. +SPECS_BOTTOM = # The legal dir is one ../ below the specs dir, so start with one ../. specs_bottom_rel_path := ../ $(foreach n, 0 1 2, \ - $(eval SPECS_BOTTOM_FILE_$n := $(SUPPORT_OUTPUTDIR)/docs/full-specs-bottom-$n.txt) \ $(eval SPECS_BOTTOM_$n := $(call SPECS_BOTTOM,$(specs_bottom_rel_path))) \ - $(eval $(SPECS_BOTTOM_FILE_$n): \ - $(call DependOnVariable, SPECS_BOTTOM_$n) ; \ - $(PRINTF) '$(SPECS_BOTTOM_$n)' > $$@ \ - ) \ $(eval specs_bottom_rel_path := $(specs_bottom_rel_path)../) \ ) +SPECS_TOP := $(if $(filter true, $(IS_DRAFT)),
$(DRAFT_TEXT)
) + # For all html files in $module/share/specs directories, copy and add the # copyright footer. $(foreach m, $(ALL_MODULES), \ $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ $(foreach d, $(SPECS_$m), \ - $(foreach f, $(filter %.html, $(call FindFiles, $d)), \ + $(foreach f, $(call ApplySpecFilter, $(filter %.html, $(call FindFiles, $d))), \ $(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \ $(eval $m_$f_NAME := PROCESS_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \ $(eval $(call SetupTextFileProcessing, $($m_$f_NAME), \ @@ -559,6 +569,7 @@ SOURCE_BASE_DIR := $d, \ OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \ REPLACEMENTS := \ + => $(SPECS_TOP) ; \ => $(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS)), \ )) \ $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \ @@ -575,17 +586,16 @@ $(foreach m, $(ALL_MODULES), \ $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ $(foreach d, $(SPECS_$m), \ - $(foreach f, $(filter %.md, $(call FindFiles, $d)), \ + $(foreach f, $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, $d))), \ $(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \ - $(eval $m_$f_BOTTOM_FILE := $(SPECS_BOTTOM_FILE_$($m_$f_NOF_SUBDIRS))) \ $(eval $m_$f_NAME := SPECS_TO_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \ $(eval $(call SetupProcessMarkdown, $($m_$f_NAME), \ SRC := $d, \ FILES := $f, \ DEST := $(DOCS_OUTPUTDIR)/specs/, \ CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ - OPTIONS := -A $($m_$f_BOTTOM_FILE), \ - EXTRA_DEPS := $($m_$f_BOTTOM_FILE), \ + OPTIONS := -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS))', \ + REPLACEMENTS := @@VERSION_STRING@@ => $(VERSION_STRING), \ POST_PROCESS := $(TOOL_FIXUPPANDOC), \ )) \ $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \ @@ -607,7 +617,7 @@ $(foreach m, $(ALL_MODULES), \ $(eval MAN_$m := $(call FindModuleManDirs, $m)) \ $(foreach d, $(MAN_$m), \ - $(foreach f, $(filter %.md, $(call FindFiles, $d)), \ + $(foreach f, $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, $d))), \ $(eval $m_$f_NAME := MAN_TO_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \ $(eval $(call SetupProcessMarkdown, $($m_$f_NAME), \ SRC := $d, \ @@ -616,11 +626,10 @@ FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \ CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ REPLACEMENTS := @@VERSION_SHORT@@ => $(VERSION_SHORT), \ - OPTIONS := -A $(SPECS_BOTTOM_FILE_1), \ + OPTIONS := -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_1)', \ POST_PROCESS := $(TOOL_FIXUPPANDOC), \ EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \ - $(PANDOC_HTML_MANPAGE_FILTER_JAVASCRIPT) \ - $(SPECS_BOTTOM_FILE_1), \ + $(PANDOC_HTML_MANPAGE_FILTER_JAVASCRIPT), \ )) \ $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \ ) \ @@ -634,23 +643,29 @@ # Special treatment for generated documentation JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html -$(eval $(call SetupTextFileProcessing, PROCESS_JDWP_PROTOCOL, \ - SOURCE_FILES := $(JDWP_PROTOCOL), \ - OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/jdwp, \ - REPLACEMENTS := \ - => $(SPECS_BOTTOM_1), \ -)) -JDK_SPECS_TARGETS += $(PROCESS_JDWP_PROTOCOL) +ifneq ($(call ApplySpecFilter, $(JDWP_PROTOCOL)), ) + $(eval $(call SetupTextFileProcessing, PROCESS_JDWP_PROTOCOL, \ + SOURCE_FILES := $(JDWP_PROTOCOL), \ + OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/jdwp, \ + REPLACEMENTS := \ + => $(SPECS_TOP) ; \ + => $(SPECS_BOTTOM_1), \ + )) + JDK_SPECS_TARGETS += $(PROCESS_JDWP_PROTOCOL) +endif # Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical). JVMTI_HTML ?= $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html -$(eval $(call SetupTextFileProcessing, PROCESS_JVMTI_HTML, \ - SOURCE_FILES := $(JVMTI_HTML), \ - OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \ - REPLACEMENTS := \ - => $(SPECS_BOTTOM_0), \ -)) -JDK_SPECS_TARGETS += $(PROCESS_JVMTI_HTML) +ifneq ($(call ApplySpecFilter, $(JVMTI_HTML)), ) + $(eval $(call SetupTextFileProcessing, PROCESS_JVMTI_HTML, \ + SOURCE_FILES := $(JVMTI_HTML), \ + OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \ + REPLACEMENTS := \ + => $(SPECS_TOP) ; \ + => $(SPECS_BOTTOM_0), \ + )) + JDK_SPECS_TARGETS += $(PROCESS_JVMTI_HTML) +endif ################################################################################ # Optional target which bundles all generated javadocs into a zip archive. @@ -672,6 +687,20 @@ $(eval $(call IncludeCustomExtension, Docs-post.gmk)) ################################################################################ +# Bundles all generated specs into a zip archive, skipping javadocs. + +SPECS_ZIP_NAME := jdk-$(VERSION_STRING)-specs.zip +SPECS_ZIP_FILE := $(OUTPUTDIR)/bundles/$(SPECS_ZIP_NAME) + +$(eval $(call SetupZipArchive, BUILD_SPECS_ZIP, \ + SRC := $(DOCS_OUTPUTDIR), \ + ZIP := $(SPECS_ZIP_FILE), \ + EXTRA_DEPS := $(JDK_SPECS_TARGETS), \ +)) + +SPECS_ZIP_TARGETS += $(BUILD_SPECS_ZIP) + +################################################################################ docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS) @@ -691,11 +720,14 @@ docs-zip: $(ZIP_TARGETS) +docs-specs-zip: $(SPECS_ZIP_TARGETS) + all: docs-jdk-api-javadoc docs-jdk-api-modulegraph docs-javase-api-javadoc \ docs-javase-api-modulegraph docs-reference-api-javadoc \ - docs-reference-api-modulegraph docs-jdk-specs docs-jdk-index docs-zip + docs-reference-api-modulegraph docs-jdk-specs docs-jdk-index docs-zip \ + docs-specs-zip .PHONY: default all docs-jdk-api-javadoc docs-jdk-api-modulegraph \ docs-javase-api-javadoc docs-javase-api-modulegraph \ docs-reference-api-javadoc docs-reference-api-modulegraph docs-jdk-specs \ - docs-jdk-index docs-zip + docs-jdk-index docs-zip docs-specs-zip diff -r 28582d575a98 -r fd4ec73925c3 make/InitSupport.gmk --- a/make/InitSupport.gmk Fri Jun 21 12:42:10 2019 +0530 +++ b/make/InitSupport.gmk Fri Jun 21 14:07:48 2019 +0530 @@ -53,7 +53,7 @@ COMPARE_BUILD JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS # All known make control variables - MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER + MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER SPEC_FILTER # Define a simple reverse function. # Should maybe move to MakeBase.gmk, but we can't include that file now. diff -r 28582d575a98 -r fd4ec73925c3 make/Main.gmk --- a/make/Main.gmk Fri Jun 21 12:42:10 2019 +0530 +++ b/make/Main.gmk Fri Jun 21 14:07:48 2019 +0530 @@ -427,6 +427,9 @@ docs-zip: +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-zip) +docs-specs-zip: + +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-specs-zip) + update-build-docs: +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UpdateBuildDocs.gmk) @@ -436,7 +439,7 @@ ALL_TARGETS += docs-jdk-api-javadoc docs-jdk-api-modulegraph \ docs-javase-api-javadoc docs-javase-api-modulegraph \ docs-reference-api-javadoc docs-reference-api-modulegraph docs-jdk-specs \ - docs-jdk-index docs-zip update-build-docs update-x11wrappers + docs-jdk-index docs-zip docs-specs-zip update-build-docs update-x11wrappers ################################################################################ # Cross compilation support @@ -885,6 +888,8 @@ docs-zip: docs-jdk + docs-specs-zip: docs-jdk-specs + # Tests test: jdk-image test-image diff -r 28582d575a98 -r fd4ec73925c3 make/autoconf/bootcycle-spec.gmk.in --- a/make/autoconf/bootcycle-spec.gmk.in Fri Jun 21 12:42:10 2019 +0530 +++ b/make/autoconf/bootcycle-spec.gmk.in Fri Jun 21 14:07:48 2019 +0530 @@ -62,3 +62,7 @@ endif # The bootcycle JVM arguments may differ from the original boot jdk. JAVA_FLAGS_BIG := @BOOTCYCLE_JVM_ARGS_BIG@ +# Any CDS settings generated for the bootjdk are invalid in the bootcycle build. +# By filtering out those JVM args, the bootcycle JVM will use its default +# settings for CDS. +JAVA_FLAGS := $(filter-out -XX:SharedArchiveFile% -Xshare%, $(JAVA_FLAGS)) diff -r 28582d575a98 -r fd4ec73925c3 make/autoconf/build-aux/config.guess --- a/make/autoconf/build-aux/config.guess Fri Jun 21 12:42:10 2019 +0530 +++ b/make/autoconf/build-aux/config.guess Fri Jun 21 14:07:48 2019 +0530 @@ -63,7 +63,7 @@ # Test and fix wsl echo $OUT | grep x86_64-unknown-linux-gnu > /dev/null 2> /dev/null if test $? = 0; then - uname -r | grep Microsoft > /dev/null 2> /dev/null + uname -r | grep -i microsoft > /dev/null 2> /dev/null if test $? = 0; then OUT="x86_64-pc-wsl" fi diff -r 28582d575a98 -r fd4ec73925c3 make/autoconf/hotspot.m4 --- a/make/autoconf/hotspot.m4 Fri Jun 21 12:42:10 2019 +0530 +++ b/make/autoconf/hotspot.m4 Fri Jun 21 14:07:48 2019 +0530 @@ -350,7 +350,8 @@ # Only enable ZGC on supported platforms AC_MSG_CHECKING([if zgc can be built]) - if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then + if (test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xx86_64") || \ + (test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xaarch64"); then AC_MSG_RESULT([yes]) else DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES zgc" diff -r 28582d575a98 -r fd4ec73925c3 make/autoconf/version-numbers --- a/make/autoconf/version-numbers Fri Jun 21 12:42:10 2019 +0530 +++ b/make/autoconf/version-numbers Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -25,18 +25,18 @@ # Default version numbers to use unless overridden by configure -DEFAULT_VERSION_FEATURE=13 +DEFAULT_VERSION_FEATURE=14 DEFAULT_VERSION_INTERIM=0 DEFAULT_VERSION_UPDATE=0 DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 DEFAULT_VERSION_EXTRA3=0 -DEFAULT_VERSION_DATE=2019-09-17 -DEFAULT_VERSION_CLASSFILE_MAJOR=57 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" +DEFAULT_VERSION_DATE=2020-03-17 +DEFAULT_VERSION_CLASSFILE_MAJOR=58 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 -DEFAULT_ACCEPTABLE_BOOT_VERSIONS="12 13" -DEFAULT_JDK_SOURCE_TARGET_VERSION=13 +DEFAULT_ACCEPTABLE_BOOT_VERSIONS="12 13 14" +DEFAULT_JDK_SOURCE_TARGET_VERSION=14 DEFAULT_PROMOTED_VERSION_PRE=ea LAUNCHER_NAME=openjdk diff -r 28582d575a98 -r fd4ec73925c3 make/conf/jib-profiles.js --- a/make/conf/jib-profiles.js Fri Jun 21 12:42:10 2019 +0530 +++ b/make/conf/jib-profiles.js Fri Jun 21 14:07:48 2019 +0530 @@ -1041,7 +1041,7 @@ // build_number: "b07", // file: "bundles/jcov-3_0.zip", organization: common.organization, - revision: "3.0-57-support+1.0", + revision: "3.0-58-support+1.0", ext: "zip", environment_name: "JCOV_HOME", }, diff -r 28582d575a98 -r fd4ec73925c3 make/data/docs-resources/resources/jdk-default.css --- a/make/data/docs-resources/resources/jdk-default.css Fri Jun 21 12:42:10 2019 +0530 +++ b/make/data/docs-resources/resources/jdk-default.css Fri Jun 21 14:07:48 2019 +0530 @@ -25,7 +25,7 @@ body { margin: 2em 2em; - font-family: DejaVu Sans, Bitstream Vera Sans, Luxi Sans, Verdana, Arial, Helvetica; + font-family: DejaVu Sans, Bitstream Vera Sans, Luxi Sans, Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; line-height: 1.4; } @@ -68,12 +68,23 @@ margin: 1.5ex 0pt 1ex 0pt; } -h4 { +h4, h5 { + font-size: 100%; font-weight: bold; padding: 0pt; margin: 1.5ex 0pt 1ex 0pt; } +.subtitle { + font-style: italic; + font-weight: bold; + margin-bottom: 1em; +} + +h1.title + .subtitle { + margin-top: -1em; +} + a:link { color: #4A6782; } @@ -138,3 +149,16 @@ .centered { text-align: center; } + +.draft-header { + text-align: center; + font-size: 80%; + padding: 6px; + margin: -2.5em -2.5em 2.5em -2.5em; + background-color: #CBDAE4; +} + +.legal-footer { + font-style: italic; + font-size: 80%; +} diff -r 28582d575a98 -r fd4ec73925c3 make/data/jdwp/jdwp.spec --- a/make/data/jdwp/jdwp.spec Fri Jun 21 12:42:10 2019 +0530 +++ b/make/data/jdwp/jdwp.spec Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -602,7 +602,7 @@ (Command Signature=1 "Returns the JNI signature of a reference type. " "JNI signature formats are described in the " - "Java Native Inteface Specification" + "Java Native Interface Specification" "

"For primitive classes " "the returned signature is the signature of the corresponding primitive " diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/java.base-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/java.base-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,638 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/io/ObjectInputStream +header extends java/io/InputStream implements java/io/ObjectInput,java/io/ObjectStreamConstants nestMembers java/io/ObjectInputStream$GetField flags 21 +innerclass innerClass java/io/ObjectInputFilter$Config outerClass java/io/ObjectInputFilter innerClassName Config flags 19 +innerclass innerClass java/io/ObjectInputFilter$FilterInfo outerClass java/io/ObjectInputFilter innerClassName FilterInfo flags 609 +innerclass innerClass java/io/ObjectInputFilter$Status outerClass java/io/ObjectInputFilter innerClassName Status flags 4019 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/CharSequence +header extends java/lang/Object flags 601 +innerclass innerClass java/util/PrimitiveIterator$OfInt outerClass java/util/PrimitiveIterator innerClassName OfInt flags 609 +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/Character +header extends java/lang/Object implements java/io/Serializable,java/lang/Comparable nestMembers java/lang/Character$UnicodeScript,java/lang/Character$UnicodeBlock,java/lang/Character$Subset flags 31 signature Ljava/lang/Object;Ljava/io/Serializable;Ljava/lang/Comparable; +innerclass innerClass java/lang/Character$UnicodeBlock outerClass java/lang/Character innerClassName UnicodeBlock flags 19 +innerclass innerClass java/lang/Character$UnicodeScript outerClass java/lang/Character innerClassName UnicodeScript flags 4019 +innerclass innerClass java/lang/Character$Subset outerClass java/lang/Character innerClassName Subset flags 9 + +class name java/lang/Character$UnicodeBlock +header extends java/lang/Character$Subset nestHost java/lang/Character flags 31 +innerclass innerClass java/lang/Character$Subset outerClass java/lang/Character innerClassName Subset flags 9 +innerclass innerClass java/lang/Character$UnicodeBlock outerClass java/lang/Character innerClassName UnicodeBlock flags 19 +field name ELYMAIC descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name NANDINAGARI descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name TAMIL_SUPPLEMENT descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name SMALL_KANA_EXTENSION descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name NYIAKENG_PUACHUE_HMONG descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name WANCHO descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name OTTOMAN_SIYAQ_NUMBERS descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A descriptor Ljava/lang/Character$UnicodeBlock; flags 19 + +class name java/lang/Character$UnicodeScript +field name ELYMAIC descriptor Ljava/lang/Character$UnicodeScript; flags 4019 +field name NANDINAGARI descriptor Ljava/lang/Character$UnicodeScript; flags 4019 +field name NYIAKENG_PUACHUE_HMONG descriptor Ljava/lang/Character$UnicodeScript; flags 4019 +field name WANCHO descriptor Ljava/lang/Character$UnicodeScript; flags 4019 + +class name java/lang/Math +-method name abs descriptor (I)I +-method name abs descriptor (J)J +-method name abs descriptor (F)F +-method name max descriptor (FF)F +-method name max descriptor (DD)D +-method name min descriptor (FF)F +-method name min descriptor (DD)D +method name abs descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; +method name abs descriptor (J)J flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; +method name abs descriptor (F)F flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; +method name max descriptor (FF)F flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; +method name max descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; +method name min descriptor (FF)F flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; +method name min descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; + +class name java/lang/Process +header extends java/lang/Object flags 421 +innerclass innerClass java/util/concurrent/ForkJoinPool$ManagedBlocker outerClass java/util/concurrent/ForkJoinPool innerClassName ManagedBlocker flags 609 +innerclass innerClass java/lang/ProcessHandle$Info outerClass java/lang/ProcessHandle innerClassName Info flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/StrictMath +-method name max descriptor (FF)F +-method name max descriptor (DD)D +-method name min descriptor (FF)F +-method name min descriptor (DD)D +method name max descriptor (FF)F flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; +method name max descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; +method name min descriptor (FF)F flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; +method name min descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/HotSpotIntrinsicCandidate; + +class name java/lang/String +header extends java/lang/Object implements java/io/Serializable,java/lang/Comparable,java/lang/CharSequence,java/lang/constant/Constable,java/lang/constant/ConstantDesc flags 31 signature Ljava/lang/Object;Ljava/io/Serializable;Ljava/lang/Comparable;Ljava/lang/CharSequence;Ljava/lang/constant/Constable;Ljava/lang/constant/ConstantDesc; +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/System +header extends java/lang/Object nestMembers java/lang/System$LoggerFinder,java/lang/System$Logger,java/lang/System$Logger$Level flags 31 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$LoggerFinder outerClass java/lang/System innerClassName LoggerFinder flags 409 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/constant/DynamicConstantDesc +header extends java/lang/Object implements java/lang/constant/ConstantDesc flags 421 signature Ljava/lang/Object;Ljava/lang/constant/ConstantDesc; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +innerclass innerClass java/lang/Enum$EnumDesc outerClass java/lang/Enum innerClassName EnumDesc flags 19 +innerclass innerClass java/lang/invoke/VarHandle$VarHandleDesc outerClass java/lang/invoke/VarHandle innerClassName VarHandleDesc flags 19 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/lang/constant/MethodTypeDesc +header extends java/lang/Object implements java/lang/constant/ConstantDesc,java/lang/invoke/TypeDescriptor$OfMethod flags 601 signature Ljava/lang/Object;Ljava/lang/constant/ConstantDesc;Ljava/lang/invoke/TypeDescriptor$OfMethod; +innerclass innerClass java/lang/invoke/TypeDescriptor$OfMethod outerClass java/lang/invoke/TypeDescriptor innerClassName OfMethod flags 609 +innerclass innerClass java/lang/invoke/TypeDescriptor$OfField outerClass java/lang/invoke/TypeDescriptor innerClassName OfField flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/invoke/MethodType +header extends java/lang/Object implements java/lang/constant/Constable,java/lang/invoke/TypeDescriptor$OfMethod,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/lang/constant/Constable;Ljava/lang/invoke/TypeDescriptor$OfMethod;Ljava/lang/invoke/MethodType;>;Ljava/io/Serializable; +innerclass innerClass java/lang/invoke/TypeDescriptor$OfMethod outerClass java/lang/invoke/TypeDescriptor innerClassName OfMethod flags 609 +innerclass innerClass java/lang/invoke/TypeDescriptor$OfField outerClass java/lang/invoke/TypeDescriptor innerClassName OfField flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/invoke/TypeDescriptor$OfMethod +header extends java/lang/Object implements java/lang/invoke/TypeDescriptor nestHost java/lang/invoke/TypeDescriptor flags 601 signature ;M::Ljava/lang/invoke/TypeDescriptor$OfMethod;>Ljava/lang/Object;Ljava/lang/invoke/TypeDescriptor; +innerclass innerClass java/lang/invoke/TypeDescriptor$OfMethod outerClass java/lang/invoke/TypeDescriptor innerClassName OfMethod flags 609 +innerclass innerClass java/lang/invoke/TypeDescriptor$OfField outerClass java/lang/invoke/TypeDescriptor innerClassName OfField flags 609 + +class name java/lang/invoke/VarHandle +header extends java/lang/Object implements java/lang/constant/Constable nestMembers java/lang/invoke/VarHandle$VarHandleDesc,java/lang/invoke/VarHandle$AccessMode flags 421 +innerclass innerClass java/lang/invoke/VarHandle$AccessMode outerClass java/lang/invoke/VarHandle innerClassName AccessMode flags 4019 +innerclass innerClass java/lang/invoke/VarHandle$VarHandleDesc outerClass java/lang/invoke/VarHandle innerClassName VarHandleDesc flags 19 + +class name java/lang/module/ModuleDescriptor +header extends java/lang/Object implements java/lang/Comparable nestMembers java/lang/module/ModuleDescriptor$Builder,java/lang/module/ModuleDescriptor$Version,java/lang/module/ModuleDescriptor$Provides,java/lang/module/ModuleDescriptor$Opens,java/lang/module/ModuleDescriptor$Opens$Modifier,java/lang/module/ModuleDescriptor$Exports,java/lang/module/ModuleDescriptor$Exports$Modifier,java/lang/module/ModuleDescriptor$Requires,java/lang/module/ModuleDescriptor$Requires$Modifier,java/lang/module/ModuleDescriptor$Modifier flags 21 signature Ljava/lang/Object;Ljava/lang/Comparable; +innerclass innerClass java/lang/module/ModuleDescriptor$Version outerClass java/lang/module/ModuleDescriptor innerClassName Version flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Modifier outerClass java/lang/module/ModuleDescriptor innerClassName Modifier flags 4019 +innerclass innerClass java/lang/module/ModuleDescriptor$Builder outerClass java/lang/module/ModuleDescriptor innerClassName Builder flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Provides outerClass java/lang/module/ModuleDescriptor innerClassName Provides flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Opens outerClass java/lang/module/ModuleDescriptor innerClassName Opens flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Exports outerClass java/lang/module/ModuleDescriptor innerClassName Exports flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Requires outerClass java/lang/module/ModuleDescriptor innerClassName Requires flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Opens$Modifier outerClass java/lang/module/ModuleDescriptor$Opens innerClassName Modifier flags 4019 +innerclass innerClass java/lang/module/ModuleDescriptor$Exports$Modifier outerClass java/lang/module/ModuleDescriptor$Exports innerClassName Modifier flags 4019 +innerclass innerClass java/lang/module/ModuleDescriptor$Requires$Modifier outerClass java/lang/module/ModuleDescriptor$Requires innerClassName Modifier flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/module/ModuleDescriptor$Builder +header extends java/lang/Object nestHost java/lang/module/ModuleDescriptor flags 31 +innerclass innerClass java/lang/module/ModuleDescriptor$Builder outerClass java/lang/module/ModuleDescriptor innerClassName Builder flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Modifier outerClass java/lang/module/ModuleDescriptor innerClassName Modifier flags 4019 +innerclass innerClass java/lang/module/ModuleDescriptor$Requires outerClass java/lang/module/ModuleDescriptor innerClassName Requires flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Version outerClass java/lang/module/ModuleDescriptor innerClassName Version flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Requires$Modifier outerClass java/lang/module/ModuleDescriptor$Requires innerClassName Modifier flags 4019 +innerclass innerClass java/lang/module/ModuleDescriptor$Exports outerClass java/lang/module/ModuleDescriptor innerClassName Exports flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Opens outerClass java/lang/module/ModuleDescriptor innerClassName Opens flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Provides outerClass java/lang/module/ModuleDescriptor innerClassName Provides flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Exports$Modifier outerClass java/lang/module/ModuleDescriptor$Exports innerClassName Modifier flags 4019 +innerclass innerClass java/lang/module/ModuleDescriptor$Opens$Modifier outerClass java/lang/module/ModuleDescriptor$Opens innerClassName Modifier flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/module/ModuleDescriptor$Requires +header extends java/lang/Object implements java/lang/Comparable nestHost java/lang/module/ModuleDescriptor flags 31 signature Ljava/lang/Object;Ljava/lang/Comparable; +innerclass innerClass java/lang/module/ModuleDescriptor$Requires outerClass java/lang/module/ModuleDescriptor innerClassName Requires flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Version outerClass java/lang/module/ModuleDescriptor innerClassName Version flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Requires$Modifier outerClass java/lang/module/ModuleDescriptor$Requires innerClassName Modifier flags 4019 + +class name java/net/Socket +header extends java/lang/Object implements java/io/Closeable flags 21 +innerclass innerClass java/net/Proxy$Type outerClass java/net/Proxy innerClassName Type flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/net/SocketImpl +header extends java/lang/Object implements java/net/SocketOptions flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/net/URL +header extends java/lang/Object implements java/io/Serializable flags 31 +innerclass innerClass java/net/Proxy$Type outerClass java/net/Proxy innerClassName Type flags 4019 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 + +class name java/nio/Buffer +method name slice descriptor (II)Ljava/nio/Buffer; flags 401 + +class name java/nio/ByteBuffer +method name slice descriptor (II)Ljava/nio/ByteBuffer; flags 401 +method name get descriptor (I[BII)Ljava/nio/ByteBuffer; flags 1 +method name get descriptor (I[B)Ljava/nio/ByteBuffer; flags 1 +method name put descriptor (I[BII)Ljava/nio/ByteBuffer; flags 1 +method name put descriptor (I[B)Ljava/nio/ByteBuffer; flags 1 +method name slice descriptor (II)Ljava/nio/Buffer; flags 1041 + +class name java/nio/CharBuffer +method name slice descriptor (II)Ljava/nio/CharBuffer; flags 401 +method name get descriptor (I[CII)Ljava/nio/CharBuffer; flags 1 +method name get descriptor (I[C)Ljava/nio/CharBuffer; flags 1 +method name put descriptor (I[CII)Ljava/nio/CharBuffer; flags 1 +method name put descriptor (I[C)Ljava/nio/CharBuffer; flags 1 +method name slice descriptor (II)Ljava/nio/Buffer; flags 1041 + +class name java/nio/DoubleBuffer +method name slice descriptor (II)Ljava/nio/DoubleBuffer; flags 401 +method name get descriptor (I[DII)Ljava/nio/DoubleBuffer; flags 1 +method name get descriptor (I[D)Ljava/nio/DoubleBuffer; flags 1 +method name put descriptor (I[DII)Ljava/nio/DoubleBuffer; flags 1 +method name put descriptor (I[D)Ljava/nio/DoubleBuffer; flags 1 +method name slice descriptor (II)Ljava/nio/Buffer; flags 1041 + +class name java/nio/FloatBuffer +method name slice descriptor (II)Ljava/nio/FloatBuffer; flags 401 +method name get descriptor (I[FII)Ljava/nio/FloatBuffer; flags 1 +method name get descriptor (I[F)Ljava/nio/FloatBuffer; flags 1 +method name put descriptor (I[FII)Ljava/nio/FloatBuffer; flags 1 +method name put descriptor (I[F)Ljava/nio/FloatBuffer; flags 1 +method name slice descriptor (II)Ljava/nio/Buffer; flags 1041 + +class name java/nio/IntBuffer +method name slice descriptor (II)Ljava/nio/IntBuffer; flags 401 +method name get descriptor (I[III)Ljava/nio/IntBuffer; flags 1 +method name get descriptor (I[I)Ljava/nio/IntBuffer; flags 1 +method name put descriptor (I[III)Ljava/nio/IntBuffer; flags 1 +method name put descriptor (I[I)Ljava/nio/IntBuffer; flags 1 +method name slice descriptor (II)Ljava/nio/Buffer; flags 1041 + +class name java/nio/LongBuffer +method name slice descriptor (II)Ljava/nio/LongBuffer; flags 401 +method name get descriptor (I[JII)Ljava/nio/LongBuffer; flags 1 +method name get descriptor (I[J)Ljava/nio/LongBuffer; flags 1 +method name put descriptor (I[JII)Ljava/nio/LongBuffer; flags 1 +method name put descriptor (I[J)Ljava/nio/LongBuffer; flags 1 +method name slice descriptor (II)Ljava/nio/Buffer; flags 1041 + +class name java/nio/MappedByteBuffer +method name force descriptor (II)Ljava/nio/MappedByteBuffer; flags 11 + +class name java/nio/ShortBuffer +method name slice descriptor (II)Ljava/nio/ShortBuffer; flags 401 +method name get descriptor (I[SII)Ljava/nio/ShortBuffer; flags 1 +method name get descriptor (I[S)Ljava/nio/ShortBuffer; flags 1 +method name put descriptor (I[SII)Ljava/nio/ShortBuffer; flags 1 +method name put descriptor (I[S)Ljava/nio/ShortBuffer; flags 1 +method name slice descriptor (II)Ljava/nio/Buffer; flags 1041 + +class name java/nio/file/FileSystems +method name newFileSystem descriptor (Ljava/nio/file/Path;Ljava/util/Map;)Ljava/nio/file/FileSystem; thrownTypes java/io/IOException flags 9 signature (Ljava/nio/file/Path;Ljava/util/Map;)Ljava/nio/file/FileSystem; +method name newFileSystem descriptor (Ljava/nio/file/Path;)Ljava/nio/file/FileSystem; thrownTypes java/io/IOException flags 9 +method name newFileSystem descriptor (Ljava/nio/file/Path;Ljava/util/Map;Ljava/lang/ClassLoader;)Ljava/nio/file/FileSystem; thrownTypes java/io/IOException flags 9 signature (Ljava/nio/file/Path;Ljava/util/Map;Ljava/lang/ClassLoader;)Ljava/nio/file/FileSystem; + +class name java/nio/file/Path +header extends java/lang/Object implements java/lang/Comparable,java/lang/Iterable,java/nio/file/Watchable flags 601 signature Ljava/lang/Object;Ljava/lang/Comparable;Ljava/lang/Iterable;Ljava/nio/file/Watchable; +innerclass innerClass java/nio/file/WatchEvent$Modifier outerClass java/nio/file/WatchEvent innerClassName Modifier flags 609 +innerclass innerClass java/nio/file/WatchEvent$Kind outerClass java/nio/file/WatchEvent innerClassName Kind flags 609 + +class name java/security/DomainLoadStoreParameter +header extends java/lang/Object implements java/security/KeyStore$LoadStoreParameter flags 31 +innerclass innerClass java/security/KeyStore$LoadStoreParameter outerClass java/security/KeyStore innerClassName LoadStoreParameter flags 609 +innerclass innerClass java/security/KeyStore$ProtectionParameter outerClass java/security/KeyStore innerClassName ProtectionParameter flags 609 + +class name java/security/DrbgParameters +header extends java/lang/Object nestMembers java/security/DrbgParameters$Reseed,java/security/DrbgParameters$NextBytes,java/security/DrbgParameters$Instantiation,java/security/DrbgParameters$Capability flags 21 +innerclass innerClass java/security/DrbgParameters$Instantiation outerClass java/security/DrbgParameters innerClassName Instantiation flags 19 +innerclass innerClass java/security/DrbgParameters$Capability outerClass java/security/DrbgParameters innerClassName Capability flags 4019 +innerclass innerClass java/security/DrbgParameters$NextBytes outerClass java/security/DrbgParameters innerClassName NextBytes flags 19 +innerclass innerClass java/security/DrbgParameters$Reseed outerClass java/security/DrbgParameters innerClassName Reseed flags 19 + +class name java/security/DrbgParameters$Instantiation +header extends java/lang/Object implements java/security/SecureRandomParameters nestHost java/security/DrbgParameters flags 31 +innerclass innerClass java/security/DrbgParameters$Instantiation outerClass java/security/DrbgParameters innerClassName Instantiation flags 19 +innerclass innerClass java/security/DrbgParameters$Capability outerClass java/security/DrbgParameters innerClassName Capability flags 4019 + +class name java/security/KeyStore +header extends java/lang/Object nestMembers java/security/KeyStore$Builder,java/security/KeyStore$TrustedCertificateEntry,java/security/KeyStore$SecretKeyEntry,java/security/KeyStore$PrivateKeyEntry,java/security/KeyStore$Entry,java/security/KeyStore$Entry$Attribute,java/security/KeyStore$CallbackHandlerProtection,java/security/KeyStore$PasswordProtection,java/security/KeyStore$ProtectionParameter,java/security/KeyStore$LoadStoreParameter flags 21 +innerclass innerClass java/security/KeyStore$LoadStoreParameter outerClass java/security/KeyStore innerClassName LoadStoreParameter flags 609 +innerclass innerClass java/security/KeyStore$ProtectionParameter outerClass java/security/KeyStore innerClassName ProtectionParameter flags 609 +innerclass innerClass java/security/KeyStore$Entry outerClass java/security/KeyStore innerClassName Entry flags 609 +innerclass innerClass java/security/KeyStore$Builder outerClass java/security/KeyStore innerClassName Builder flags 409 +innerclass innerClass java/security/KeyStore$TrustedCertificateEntry outerClass java/security/KeyStore innerClassName TrustedCertificateEntry flags 19 +innerclass innerClass java/security/KeyStore$SecretKeyEntry outerClass java/security/KeyStore innerClassName SecretKeyEntry flags 19 +innerclass innerClass java/security/KeyStore$PrivateKeyEntry outerClass java/security/KeyStore innerClassName PrivateKeyEntry flags 19 +innerclass innerClass java/security/KeyStore$CallbackHandlerProtection outerClass java/security/KeyStore innerClassName CallbackHandlerProtection flags 9 +innerclass innerClass java/security/KeyStore$PasswordProtection outerClass java/security/KeyStore innerClassName PasswordProtection flags 9 +innerclass innerClass java/security/KeyStore$Entry$Attribute outerClass java/security/KeyStore$Entry innerClassName Attribute flags 609 + +class name java/security/KeyStore$LoadStoreParameter +header extends java/lang/Object nestHost java/security/KeyStore flags 601 +innerclass innerClass java/security/KeyStore$LoadStoreParameter outerClass java/security/KeyStore innerClassName LoadStoreParameter flags 609 +innerclass innerClass java/security/KeyStore$ProtectionParameter outerClass java/security/KeyStore innerClassName ProtectionParameter flags 609 + +class name java/security/KeyStore$PrivateKeyEntry +header extends java/lang/Object implements java/security/KeyStore$Entry nestHost java/security/KeyStore flags 31 +innerclass innerClass java/security/KeyStore$PrivateKeyEntry outerClass java/security/KeyStore innerClassName PrivateKeyEntry flags 19 +innerclass innerClass java/security/KeyStore$Entry outerClass java/security/KeyStore innerClassName Entry flags 609 +innerclass innerClass java/security/KeyStore$Entry$Attribute outerClass java/security/KeyStore$Entry innerClassName Attribute flags 609 + +class name java/security/KeyStore$SecretKeyEntry +header extends java/lang/Object implements java/security/KeyStore$Entry nestHost java/security/KeyStore flags 31 +innerclass innerClass java/security/KeyStore$SecretKeyEntry outerClass java/security/KeyStore innerClassName SecretKeyEntry flags 19 +innerclass innerClass java/security/KeyStore$Entry outerClass java/security/KeyStore innerClassName Entry flags 609 +innerclass innerClass java/security/KeyStore$Entry$Attribute outerClass java/security/KeyStore$Entry innerClassName Attribute flags 609 + +class name java/security/KeyStore$TrustedCertificateEntry +header extends java/lang/Object implements java/security/KeyStore$Entry nestHost java/security/KeyStore flags 31 +innerclass innerClass java/security/KeyStore$TrustedCertificateEntry outerClass java/security/KeyStore innerClassName TrustedCertificateEntry flags 19 +innerclass innerClass java/security/KeyStore$Entry outerClass java/security/KeyStore innerClassName Entry flags 609 +innerclass innerClass java/security/KeyStore$Entry$Attribute outerClass java/security/KeyStore$Entry innerClassName Attribute flags 609 + +class name java/security/KeyStoreSpi +header extends java/lang/Object flags 421 +innerclass innerClass java/security/KeyStore$LoadStoreParameter outerClass java/security/KeyStore innerClassName LoadStoreParameter flags 609 +innerclass innerClass java/security/KeyStore$ProtectionParameter outerClass java/security/KeyStore innerClassName ProtectionParameter flags 609 +innerclass innerClass java/security/KeyStore$PasswordProtection outerClass java/security/KeyStore innerClassName PasswordProtection flags 9 +innerclass innerClass java/security/KeyStore$CallbackHandlerProtection outerClass java/security/KeyStore innerClassName CallbackHandlerProtection flags 9 +innerclass innerClass java/security/KeyStore$TrustedCertificateEntry outerClass java/security/KeyStore innerClassName TrustedCertificateEntry flags 19 +innerclass innerClass java/security/KeyStore$PrivateKeyEntry outerClass java/security/KeyStore innerClassName PrivateKeyEntry flags 19 +innerclass innerClass java/security/KeyStore$SecretKeyEntry outerClass java/security/KeyStore innerClassName SecretKeyEntry flags 19 +innerclass innerClass java/security/KeyStore$Entry outerClass java/security/KeyStore innerClassName Entry flags 609 + +class name java/security/Permissions +header extends java/security/PermissionCollection implements java/io/Serializable flags 31 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/security/PrivilegedAction +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; + +class name java/security/PrivilegedExceptionAction +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; + +class name java/security/Provider +header extends java/util/Properties nestMembers java/security/Provider$Service flags 421 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/security/Provider$Service outerClass java/security/Provider innerClassName Service flags 9 + +class name java/security/cert/PKIXRevocationChecker +header extends java/security/cert/PKIXCertPathChecker nestMembers java/security/cert/PKIXRevocationChecker$Option flags 421 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/security/cert/PKIXRevocationChecker$Option outerClass java/security/cert/PKIXRevocationChecker innerClassName Option flags 4019 + +class name java/text/AttributedString +header extends java/lang/Object flags 21 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/text/AttributedCharacterIterator$Attribute outerClass java/text/AttributedCharacterIterator innerClassName Attribute flags 9 + +class name java/text/CompactNumberFormat +header extends java/text/NumberFormat flags 31 +innerclass innerClass java/text/NumberFormat$Field outerClass java/text/NumberFormat innerClassName Field flags 9 +innerclass innerClass java/text/Format$Field outerClass java/text/Format innerClassName Field flags 9 + +class name java/text/DateFormat +header extends java/text/Format nestMembers java/text/DateFormat$Field flags 421 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/text/DateFormat$Field outerClass java/text/DateFormat innerClassName Field flags 9 + +class name java/text/DecimalFormat +header extends java/text/NumberFormat flags 21 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/text/NumberFormat$Field outerClass java/text/NumberFormat innerClassName Field flags 9 +innerclass innerClass java/text/Format$Field outerClass java/text/Format innerClassName Field flags 9 + +class name java/text/DecimalFormatSymbols +header extends java/lang/Object implements java/lang/Cloneable,java/io/Serializable flags 21 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/text/Format +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable nestMembers java/text/Format$Field flags 421 +innerclass innerClass java/text/AttributedCharacterIterator$Attribute outerClass java/text/AttributedCharacterIterator innerClassName Attribute flags 9 +innerclass innerClass java/text/Format$Field outerClass java/text/Format innerClassName Field flags 9 + +class name java/text/Format$Field +header extends java/text/AttributedCharacterIterator$Attribute nestHost java/text/Format flags 21 +innerclass innerClass java/text/AttributedCharacterIterator$Attribute outerClass java/text/AttributedCharacterIterator innerClassName Attribute flags 9 +innerclass innerClass java/text/Format$Field outerClass java/text/Format innerClassName Field flags 9 + +class name java/text/MessageFormat +header extends java/text/Format nestMembers java/text/MessageFormat$Field flags 21 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/text/MessageFormat$Field outerClass java/text/MessageFormat innerClassName Field flags 9 +innerclass innerClass java/text/AttributedCharacterIterator$Attribute outerClass java/text/AttributedCharacterIterator innerClassName Attribute flags 9 +innerclass innerClass java/text/Format$Field outerClass java/text/Format innerClassName Field flags 9 + +class name java/text/MessageFormat$Field +header extends java/text/Format$Field nestHost java/text/MessageFormat flags 21 +innerclass innerClass java/text/Format$Field outerClass java/text/Format innerClassName Field flags 9 +innerclass innerClass java/text/MessageFormat$Field outerClass java/text/MessageFormat innerClassName Field flags 9 + +class name java/text/NumberFormat +header extends java/text/Format nestMembers java/text/NumberFormat$Style,java/text/NumberFormat$Field flags 421 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/text/NumberFormat$Style outerClass java/text/NumberFormat innerClassName Style flags 4019 +innerclass innerClass java/text/NumberFormat$Field outerClass java/text/NumberFormat innerClassName Field flags 9 + +class name java/text/NumberFormat$Field +header extends java/text/Format$Field nestHost java/text/NumberFormat flags 21 +innerclass innerClass java/text/Format$Field outerClass java/text/Format innerClassName Field flags 9 +innerclass innerClass java/text/NumberFormat$Field outerClass java/text/NumberFormat innerClassName Field flags 9 + +class name java/text/SimpleDateFormat +header extends java/text/DateFormat flags 21 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/text/DateFormat$Field outerClass java/text/DateFormat innerClassName Field flags 9 +innerclass innerClass java/text/Format$Field outerClass java/text/Format innerClassName Field flags 9 + +class name java/time/chrono/JapaneseEra +field name REIWA descriptor Ljava/time/chrono/JapaneseEra; flags 19 + +class name java/util/AbstractMap +header extends java/lang/Object implements java/util/Map nestMembers java/util/AbstractMap$SimpleImmutableEntry,java/util/AbstractMap$SimpleEntry flags 421 signature Ljava/lang/Object;Ljava/util/Map; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/util/AbstractMap$SimpleImmutableEntry outerClass java/util/AbstractMap innerClassName SimpleImmutableEntry flags 9 +innerclass innerClass java/util/AbstractMap$SimpleEntry outerClass java/util/AbstractMap innerClassName SimpleEntry flags 9 + +class name java/util/Base64 +header extends java/lang/Object nestMembers java/util/Base64$Decoder,java/util/Base64$Encoder flags 21 +innerclass innerClass java/util/Base64$Encoder outerClass java/util/Base64 innerClassName Encoder flags 9 +innerclass innerClass java/util/Base64$Decoder outerClass java/util/Base64 innerClassName Decoder flags 9 + +class name java/util/Calendar +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable,java/lang/Comparable nestMembers java/util/Calendar$Builder flags 421 signature Ljava/lang/Object;Ljava/io/Serializable;Ljava/lang/Cloneable;Ljava/lang/Comparable; +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/util/Calendar$Builder outerClass java/util/Calendar innerClassName Builder flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/Formatter +header extends java/lang/Object implements java/io/Closeable,java/io/Flushable nestMembers java/util/Formatter$BigDecimalLayoutForm flags 31 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/util/Formatter$BigDecimalLayoutForm outerClass java/util/Formatter innerClassName BigDecimalLayoutForm flags 4019 + +class name java/util/Locale +header extends java/lang/Object implements java/lang/Cloneable,java/io/Serializable nestMembers java/util/Locale$LanguageRange,java/util/Locale$FilteringMode,java/util/Locale$Builder,java/util/Locale$Category,java/util/Locale$IsoCountryCode flags 31 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/util/Locale$IsoCountryCode outerClass java/util/Locale innerClassName IsoCountryCode flags 4409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/util/Locale$FilteringMode outerClass java/util/Locale innerClassName FilteringMode flags 4019 +innerclass innerClass java/util/Locale$LanguageRange outerClass java/util/Locale innerClassName LanguageRange flags 19 +innerclass innerClass java/util/Locale$Builder outerClass java/util/Locale innerClassName Builder flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/Random +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/util/Spliterator$OfLong outerClass java/util/Spliterator innerClassName OfLong flags 609 +innerclass innerClass java/util/Spliterator$OfDouble outerClass java/util/Spliterator innerClassName OfDouble flags 609 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 + +class name java/util/Spliterators +header extends java/lang/Object nestMembers java/util/Spliterators$AbstractDoubleSpliterator,java/util/Spliterators$AbstractLongSpliterator,java/util/Spliterators$AbstractIntSpliterator,java/util/Spliterators$AbstractSpliterator flags 31 +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/util/Spliterator$OfLong outerClass java/util/Spliterator innerClassName OfLong flags 609 +innerclass innerClass java/util/Spliterator$OfDouble outerClass java/util/Spliterator innerClassName OfDouble flags 609 +innerclass innerClass java/util/PrimitiveIterator$OfInt outerClass java/util/PrimitiveIterator innerClassName OfInt flags 609 +innerclass innerClass java/util/PrimitiveIterator$OfLong outerClass java/util/PrimitiveIterator innerClassName OfLong flags 609 +innerclass innerClass java/util/PrimitiveIterator$OfDouble outerClass java/util/PrimitiveIterator innerClassName OfDouble flags 609 +innerclass innerClass java/util/Spliterators$AbstractDoubleSpliterator outerClass java/util/Spliterators innerClassName AbstractDoubleSpliterator flags 409 +innerclass innerClass java/util/Spliterators$AbstractLongSpliterator outerClass java/util/Spliterators innerClassName AbstractLongSpliterator flags 409 +innerclass innerClass java/util/Spliterators$AbstractIntSpliterator outerClass java/util/Spliterators innerClassName AbstractIntSpliterator flags 409 +innerclass innerClass java/util/Spliterators$AbstractSpliterator outerClass java/util/Spliterators innerClassName AbstractSpliterator flags 409 + +class name java/util/Spliterators$AbstractDoubleSpliterator +header extends java/lang/Object implements java/util/Spliterator$OfDouble nestHost java/util/Spliterators flags 421 +innerclass innerClass java/util/Spliterators$AbstractSpliterator outerClass java/util/Spliterators innerClassName AbstractSpliterator flags 409 +innerclass innerClass java/util/Spliterators$AbstractDoubleSpliterator outerClass java/util/Spliterators innerClassName AbstractDoubleSpliterator flags 409 +innerclass innerClass java/util/Spliterator$OfDouble outerClass java/util/Spliterator innerClassName OfDouble flags 609 +innerclass innerClass java/util/Spliterator$OfPrimitive outerClass java/util/Spliterator innerClassName OfPrimitive flags 609 + +class name java/util/Spliterators$AbstractIntSpliterator +header extends java/lang/Object implements java/util/Spliterator$OfInt nestHost java/util/Spliterators flags 421 +innerclass innerClass java/util/Spliterators$AbstractSpliterator outerClass java/util/Spliterators innerClassName AbstractSpliterator flags 409 +innerclass innerClass java/util/Spliterators$AbstractIntSpliterator outerClass java/util/Spliterators innerClassName AbstractIntSpliterator flags 409 +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/util/Spliterator$OfPrimitive outerClass java/util/Spliterator innerClassName OfPrimitive flags 609 + +class name java/util/Spliterators$AbstractLongSpliterator +header extends java/lang/Object implements java/util/Spliterator$OfLong nestHost java/util/Spliterators flags 421 +innerclass innerClass java/util/Spliterators$AbstractSpliterator outerClass java/util/Spliterators innerClassName AbstractSpliterator flags 409 +innerclass innerClass java/util/Spliterators$AbstractLongSpliterator outerClass java/util/Spliterators innerClassName AbstractLongSpliterator flags 409 +innerclass innerClass java/util/Spliterator$OfLong outerClass java/util/Spliterator innerClassName OfLong flags 609 +innerclass innerClass java/util/Spliterator$OfPrimitive outerClass java/util/Spliterator innerClassName OfPrimitive flags 609 + +class name java/util/concurrent/CompletableFuture +header extends java/lang/Object implements java/util/concurrent/Future,java/util/concurrent/CompletionStage nestMembers java/util/concurrent/CompletableFuture$AsynchronousCompletionTask flags 21 signature Ljava/lang/Object;Ljava/util/concurrent/Future;Ljava/util/concurrent/CompletionStage; +innerclass innerClass java/util/concurrent/ForkJoinPool$ManagedBlocker outerClass java/util/concurrent/ForkJoinPool innerClassName ManagedBlocker flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +innerclass innerClass java/util/concurrent/CompletableFuture$AsynchronousCompletionTask outerClass java/util/concurrent/CompletableFuture innerClassName AsynchronousCompletionTask flags 609 + +class name java/util/concurrent/ConcurrentHashMap +header extends java/util/AbstractMap implements java/util/concurrent/ConcurrentMap,java/io/Serializable nestMembers java/util/concurrent/ConcurrentHashMap$KeySetView,java/util/concurrent/ConcurrentHashMap$CollectionView flags 21 signature Ljava/util/AbstractMap;Ljava/util/concurrent/ConcurrentMap;Ljava/io/Serializable; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/util/concurrent/ConcurrentHashMap$KeySetView outerClass java/util/concurrent/ConcurrentHashMap innerClassName KeySetView flags 9 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/util/AbstractMap$SimpleImmutableEntry outerClass java/util/AbstractMap innerClassName SimpleImmutableEntry flags 9 +innerclass innerClass java/util/concurrent/ConcurrentHashMap$CollectionView outerClass java/util/concurrent/ConcurrentHashMap innerClassName CollectionView flags 408 + +class name java/util/concurrent/ConcurrentHashMap$KeySetView +header extends java/util/concurrent/ConcurrentHashMap$CollectionView implements java/util/Set,java/io/Serializable nestHost java/util/concurrent/ConcurrentHashMap flags 21 signature Ljava/util/concurrent/ConcurrentHashMap$CollectionView;Ljava/util/Set;Ljava/io/Serializable; +innerclass innerClass java/util/concurrent/ConcurrentHashMap$CollectionView outerClass java/util/concurrent/ConcurrentHashMap innerClassName CollectionView flags 408 +innerclass innerClass java/util/concurrent/ConcurrentHashMap$KeySetView outerClass java/util/concurrent/ConcurrentHashMap innerClassName KeySetView flags 9 + +class name java/util/concurrent/Flow$Processor +header extends java/lang/Object implements java/util/concurrent/Flow$Subscriber,java/util/concurrent/Flow$Publisher nestHost java/util/concurrent/Flow flags 601 signature Ljava/lang/Object;Ljava/util/concurrent/Flow$Subscriber;Ljava/util/concurrent/Flow$Publisher; +innerclass innerClass java/util/concurrent/Flow$Processor outerClass java/util/concurrent/Flow innerClassName Processor flags 609 +innerclass innerClass java/util/concurrent/Flow$Subscriber outerClass java/util/concurrent/Flow innerClassName Subscriber flags 609 +innerclass innerClass java/util/concurrent/Flow$Publisher outerClass java/util/concurrent/Flow innerClassName Publisher flags 609 + +class name java/util/concurrent/Flow$Publisher +header extends java/lang/Object nestHost java/util/concurrent/Flow flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/util/concurrent/Flow$Publisher outerClass java/util/concurrent/Flow innerClassName Publisher flags 609 +innerclass innerClass java/util/concurrent/Flow$Subscriber outerClass java/util/concurrent/Flow innerClassName Subscriber flags 609 + +class name java/util/concurrent/Flow$Subscriber +header extends java/lang/Object nestHost java/util/concurrent/Flow flags 601 signature Ljava/lang/Object; +innerclass innerClass java/util/concurrent/Flow$Subscriber outerClass java/util/concurrent/Flow innerClassName Subscriber flags 609 +innerclass innerClass java/util/concurrent/Flow$Subscription outerClass java/util/concurrent/Flow innerClassName Subscription flags 609 + +class name java/util/concurrent/ForkJoinPool +header extends java/util/concurrent/AbstractExecutorService nestMembers java/util/concurrent/ForkJoinPool$ManagedBlocker,java/util/concurrent/ForkJoinPool$ForkJoinWorkerThreadFactory flags 21 +innerclass innerClass java/util/concurrent/ForkJoinPool$ForkJoinWorkerThreadFactory outerClass java/util/concurrent/ForkJoinPool innerClassName ForkJoinWorkerThreadFactory flags 609 +innerclass innerClass java/lang/Thread$UncaughtExceptionHandler outerClass java/lang/Thread innerClassName UncaughtExceptionHandler flags 609 +innerclass innerClass java/lang/Thread$State outerClass java/lang/Thread innerClassName State flags 4019 +innerclass innerClass java/util/concurrent/ForkJoinPool$ManagedBlocker outerClass java/util/concurrent/ForkJoinPool innerClassName ManagedBlocker flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/Phaser +header extends java/lang/Object flags 21 +innerclass innerClass java/util/concurrent/ForkJoinPool$ManagedBlocker outerClass java/util/concurrent/ForkJoinPool innerClassName ManagedBlocker flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/ThreadLocalRandom +header extends java/util/Random flags 21 +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/util/Spliterator$OfLong outerClass java/util/Spliterator innerClassName OfLong flags 609 +innerclass innerClass java/util/Spliterator$OfDouble outerClass java/util/Spliterator innerClassName OfDouble flags 609 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 + +class name java/util/concurrent/ThreadPoolExecutor +header extends java/util/concurrent/AbstractExecutorService nestMembers java/util/concurrent/ThreadPoolExecutor$DiscardOldestPolicy,java/util/concurrent/ThreadPoolExecutor$DiscardPolicy,java/util/concurrent/ThreadPoolExecutor$AbortPolicy,java/util/concurrent/ThreadPoolExecutor$CallerRunsPolicy flags 21 +innerclass innerClass java/lang/Thread$State outerClass java/lang/Thread innerClassName State flags 4019 +innerclass innerClass java/util/concurrent/ThreadPoolExecutor$AbortPolicy outerClass java/util/concurrent/ThreadPoolExecutor innerClassName AbortPolicy flags 9 +innerclass innerClass java/util/concurrent/ThreadPoolExecutor$DiscardOldestPolicy outerClass java/util/concurrent/ThreadPoolExecutor innerClassName DiscardOldestPolicy flags 9 +innerclass innerClass java/util/concurrent/ThreadPoolExecutor$DiscardPolicy outerClass java/util/concurrent/ThreadPoolExecutor innerClassName DiscardPolicy flags 9 +innerclass innerClass java/util/concurrent/ThreadPoolExecutor$CallerRunsPolicy outerClass java/util/concurrent/ThreadPoolExecutor innerClassName CallerRunsPolicy flags 9 + +class name java/util/concurrent/locks/ReentrantReadWriteLock +header extends java/lang/Object implements java/util/concurrent/locks/ReadWriteLock,java/io/Serializable nestMembers java/util/concurrent/locks/ReentrantReadWriteLock$WriteLock,java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock flags 21 +innerclass innerClass java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock outerClass java/util/concurrent/locks/ReentrantReadWriteLock innerClassName ReadLock flags 9 +innerclass innerClass java/util/concurrent/locks/ReentrantReadWriteLock$WriteLock outerClass java/util/concurrent/locks/ReentrantReadWriteLock innerClassName WriteLock flags 9 +innerclass innerClass java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject outerClass java/util/concurrent/locks/AbstractQueuedSynchronizer innerClassName ConditionObject flags 1 + +class name java/util/jar/Pack200 +header extends java/lang/Object nestMembers java/util/jar/Pack200$Unpacker,java/util/jar/Pack200$Packer flags 421 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="11") +innerclass innerClass java/util/jar/Pack200$Packer outerClass java/util/jar/Pack200 innerClassName Packer flags 609 +innerclass innerClass java/util/jar/Pack200$Unpacker outerClass java/util/jar/Pack200 innerClassName Unpacker flags 609 + +class name java/util/stream/DoubleStream +header extends java/lang/Object implements java/util/stream/BaseStream nestMembers java/util/stream/DoubleStream$Builder flags 601 signature Ljava/lang/Object;Ljava/util/stream/BaseStream; +innerclass innerClass java/util/Spliterator$OfDouble outerClass java/util/Spliterator innerClassName OfDouble flags 609 +innerclass innerClass java/util/PrimitiveIterator$OfDouble outerClass java/util/PrimitiveIterator innerClassName OfDouble flags 609 +innerclass innerClass java/util/stream/DoubleStream$Builder outerClass java/util/stream/DoubleStream innerClassName Builder flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/stream/IntStream +header extends java/lang/Object implements java/util/stream/BaseStream nestMembers java/util/stream/IntStream$Builder flags 601 signature Ljava/lang/Object;Ljava/util/stream/BaseStream; +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/util/PrimitiveIterator$OfInt outerClass java/util/PrimitiveIterator innerClassName OfInt flags 609 +innerclass innerClass java/util/stream/IntStream$Builder outerClass java/util/stream/IntStream innerClassName Builder flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/stream/LongStream +header extends java/lang/Object implements java/util/stream/BaseStream nestMembers java/util/stream/LongStream$Builder flags 601 signature Ljava/lang/Object;Ljava/util/stream/BaseStream; +innerclass innerClass java/util/Spliterator$OfLong outerClass java/util/Spliterator innerClassName OfLong flags 609 +innerclass innerClass java/util/PrimitiveIterator$OfLong outerClass java/util/PrimitiveIterator innerClassName OfLong flags 609 +innerclass innerClass java/util/stream/LongStream$Builder outerClass java/util/stream/LongStream innerClassName Builder flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/net/ssl/HandshakeCompletedEvent +-method name getPeerCertificateChain descriptor ()[Ljavax/security/cert/X509Certificate; +method name getPeerCertificateChain descriptor ()[Ljavax/security/cert/X509Certificate; thrownTypes javax/net/ssl/SSLPeerUnverifiedException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name javax/net/ssl/SSLContext +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name getDefault descriptor ()Ljavax/net/ssl/SSLContext; +-method name setDefault descriptor (Ljavax/net/ssl/SSLContext;)V +method name getDefault descriptor ()Ljavax/net/ssl/SSLContext; thrownTypes java/security/NoSuchAlgorithmException flags 9 +method name setDefault descriptor (Ljavax/net/ssl/SSLContext;)V flags 9 + +class name javax/net/ssl/SSLEngineResult +header extends java/lang/Object nestMembers javax/net/ssl/SSLEngineResult$HandshakeStatus,javax/net/ssl/SSLEngineResult$Status flags 21 +innerclass innerClass javax/net/ssl/SSLEngineResult$Status outerClass javax/net/ssl/SSLEngineResult innerClassName Status flags 4019 +innerclass innerClass javax/net/ssl/SSLEngineResult$HandshakeStatus outerClass javax/net/ssl/SSLEngineResult innerClassName HandshakeStatus flags 4019 + +class name javax/net/ssl/SSLServerSocketFactory +-method name getDefault descriptor ()Ljavax/net/ServerSocketFactory; +method name getDefault descriptor ()Ljavax/net/ServerSocketFactory; flags 9 + +class name javax/net/ssl/SSLSession +-method name getPeerCertificateChain descriptor ()[Ljavax/security/cert/X509Certificate; +method name getPeerCertificateChain descriptor ()[Ljavax/security/cert/X509Certificate; thrownTypes javax/net/ssl/SSLPeerUnverifiedException flags 401 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name javax/net/ssl/SSLSocketFactory +-method name getDefault descriptor ()Ljavax/net/SocketFactory; +method name getDefault descriptor ()Ljavax/net/SocketFactory; flags 9 + +class name javax/security/cert/Certificate +header extends java/lang/Object flags 421 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name javax/security/cert/CertificateEncodingException +header extends javax/security/cert/CertificateException flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name javax/security/cert/CertificateException +header extends java/lang/Exception flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name javax/security/cert/CertificateExpiredException +header extends javax/security/cert/CertificateException flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name javax/security/cert/CertificateNotYetValidException +header extends javax/security/cert/CertificateException flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name javax/security/cert/CertificateParsingException +header extends javax/security/cert/CertificateException flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name javax/security/cert/X509Certificate +header extends javax/security/cert/Certificate flags 421 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/java.compiler-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/java.compiler-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,107 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/annotation/processing/ProcessingEnvironment +method name isPreviewEnabled descriptor ()Z flags 1 + +class name javax/lang/model/SourceVersion +header extends java/lang/Enum flags 4031 signature Ljava/lang/Enum; +innerclass innerClass java/lang/Runtime$Version outerClass java/lang/Runtime innerClassName Version flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name RELEASE_13 descriptor Ljavax/lang/model/SourceVersion; flags 4019 + +class name javax/lang/model/element/ExecutableElement +method name asType descriptor ()Ljavax/lang/model/type/TypeMirror; flags 401 + +class name javax/lang/model/element/ModuleElement +method name asType descriptor ()Ljavax/lang/model/type/TypeMirror; flags 401 + +class name javax/lang/model/element/ModuleElement$Directive +header extends java/lang/Object nestHost javax/lang/model/element/ModuleElement flags 601 +innerclass innerClass javax/lang/model/element/ModuleElement$Directive outerClass javax/lang/model/element/ModuleElement innerClassName Directive flags 609 +innerclass innerClass javax/lang/model/element/ModuleElement$DirectiveKind outerClass javax/lang/model/element/ModuleElement innerClassName DirectiveKind flags 4019 +innerclass innerClass javax/lang/model/element/ModuleElement$DirectiveVisitor outerClass javax/lang/model/element/ModuleElement innerClassName DirectiveVisitor flags 609 + +class name javax/lang/model/element/PackageElement +method name asType descriptor ()Ljavax/lang/model/type/TypeMirror; flags 401 + +class name javax/lang/model/element/TypeElement +method name asType descriptor ()Ljavax/lang/model/type/TypeMirror; flags 401 + +class name javax/lang/model/element/TypeParameterElement +method name asType descriptor ()Ljavax/lang/model/type/TypeMirror; flags 401 + +class name javax/lang/model/element/VariableElement +method name asType descriptor ()Ljavax/lang/model/type/TypeMirror; flags 401 + +class name javax/lang/model/util/AbstractAnnotationValueVisitor9 +header extends javax/lang/model/util/AbstractAnnotationValueVisitor8 flags 421 signature Ljavax/lang/model/util/AbstractAnnotationValueVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_13;) + +class name javax/lang/model/util/AbstractElementVisitor9 +header extends javax/lang/model/util/AbstractElementVisitor8 flags 421 signature Ljavax/lang/model/util/AbstractElementVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_13;) + +class name javax/lang/model/util/AbstractTypeVisitor9 +header extends javax/lang/model/util/AbstractTypeVisitor8 flags 421 signature Ljavax/lang/model/util/AbstractTypeVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_13;) + +class name javax/lang/model/util/ElementFilter +header extends java/lang/Object flags 21 +innerclass innerClass javax/lang/model/element/ModuleElement$DirectiveKind outerClass javax/lang/model/element/ModuleElement innerClassName DirectiveKind flags 4019 +innerclass innerClass javax/lang/model/element/ModuleElement$ExportsDirective outerClass javax/lang/model/element/ModuleElement innerClassName ExportsDirective flags 609 +innerclass innerClass javax/lang/model/element/ModuleElement$OpensDirective outerClass javax/lang/model/element/ModuleElement innerClassName OpensDirective flags 609 +innerclass innerClass javax/lang/model/element/ModuleElement$ProvidesDirective outerClass javax/lang/model/element/ModuleElement innerClassName ProvidesDirective flags 609 +innerclass innerClass javax/lang/model/element/ModuleElement$RequiresDirective outerClass javax/lang/model/element/ModuleElement innerClassName RequiresDirective flags 609 +innerclass innerClass javax/lang/model/element/ModuleElement$UsesDirective outerClass javax/lang/model/element/ModuleElement innerClassName UsesDirective flags 609 +innerclass innerClass javax/lang/model/element/ModuleElement$Directive outerClass javax/lang/model/element/ModuleElement innerClassName Directive flags 609 + +class name javax/lang/model/util/ElementKindVisitor9 +header extends javax/lang/model/util/ElementKindVisitor8 flags 21 signature Ljavax/lang/model/util/ElementKindVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_13;) + +class name javax/lang/model/util/ElementScanner9 +header extends javax/lang/model/util/ElementScanner8 flags 21 signature Ljavax/lang/model/util/ElementScanner8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_13;) + +class name javax/lang/model/util/SimpleAnnotationValueVisitor9 +header extends javax/lang/model/util/SimpleAnnotationValueVisitor8 flags 21 signature Ljavax/lang/model/util/SimpleAnnotationValueVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_13;) + +class name javax/lang/model/util/SimpleElementVisitor9 +header extends javax/lang/model/util/SimpleElementVisitor8 flags 21 signature Ljavax/lang/model/util/SimpleElementVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_13;) + +class name javax/lang/model/util/SimpleTypeVisitor9 +header extends javax/lang/model/util/SimpleTypeVisitor8 flags 21 signature Ljavax/lang/model/util/SimpleTypeVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_13;) + +class name javax/lang/model/util/TypeKindVisitor9 +header extends javax/lang/model/util/TypeKindVisitor8 flags 21 signature Ljavax/lang/model/util/TypeKindVisitor8; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_13;) + +class name javax/tools/StandardJavaFileManager +header extends java/lang/Object implements javax/tools/JavaFileManager nestMembers javax/tools/StandardJavaFileManager$PathFactory flags 601 +innerclass innerClass javax/tools/JavaFileManager$Location outerClass javax/tools/JavaFileManager innerClassName Location flags 609 +innerclass innerClass javax/tools/StandardJavaFileManager$PathFactory outerClass javax/tools/StandardJavaFileManager innerClassName PathFactory flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name getJavaFileObjectsFromPaths descriptor (Ljava/lang/Iterable;)Ljava/lang/Iterable; +method name getJavaFileObjectsFromPaths descriptor (Ljava/util/Collection;)Ljava/lang/Iterable; flags 1 signature (Ljava/util/Collection<+Ljava/nio/file/Path;>;)Ljava/lang/Iterable<+Ljavax/tools/JavaFileObject;>; +method name getJavaFileObjectsFromPaths descriptor (Ljava/lang/Iterable;)Ljava/lang/Iterable; flags 1 deprecated true signature (Ljava/lang/Iterable<+Ljava/nio/file/Path;>;)Ljava/lang/Iterable<+Ljavax/tools/JavaFileObject;>; runtimeAnnotations @Ljava/lang/Deprecated;(since="13") + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/java.desktop-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/java.desktop-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,1402 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/awt/Component +header extends java/lang/Object implements java/awt/image/ImageObserver,java/awt/MenuContainer,java/io/Serializable nestMembers java/awt/Component$AccessibleAWTComponent,java/awt/Component$AccessibleAWTComponent$AccessibleAWTFocusHandler,java/awt/Component$AccessibleAWTComponent$AccessibleAWTComponentHandler,java/awt/Component$BltBufferStrategy,java/awt/Component$FlipBufferStrategy,java/awt/Component$BaselineResizeBehavior flags 421 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass java/awt/BufferCapabilities$FlipContents outerClass java/awt/BufferCapabilities innerClassName FlipContents flags 19 +innerclass innerClass java/awt/Component$BltBufferStrategy outerClass java/awt/Component innerClassName BltBufferStrategy flags 4 +innerclass innerClass java/awt/Component$FlipBufferStrategy outerClass java/awt/Component innerClassName FlipBufferStrategy flags 4 +innerclass innerClass java/awt/event/FocusEvent$Cause outerClass java/awt/event/FocusEvent innerClassName Cause flags 4019 +innerclass innerClass java/awt/Component$AccessibleAWTComponent outerClass java/awt/Component innerClassName AccessibleAWTComponent flags 404 +innerclass innerClass java/awt/Component$AccessibleAWTComponent$AccessibleAWTFocusHandler outerClass java/awt/Component$AccessibleAWTComponent innerClassName AccessibleAWTFocusHandler flags 4 +innerclass innerClass java/awt/Component$AccessibleAWTComponent$AccessibleAWTComponentHandler outerClass java/awt/Component$AccessibleAWTComponent innerClassName AccessibleAWTComponentHandler flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Component$AccessibleAWTComponent +header extends javax/accessibility/AccessibleContext implements java/io/Serializable,javax/accessibility/AccessibleComponent nestHost java/awt/Component flags 421 +innerclass innerClass java/awt/Component$AccessibleAWTComponent outerClass java/awt/Component innerClassName AccessibleAWTComponent flags 404 +innerclass innerClass java/awt/Component$AccessibleAWTComponent$AccessibleAWTComponentHandler outerClass java/awt/Component$AccessibleAWTComponent innerClassName AccessibleAWTComponentHandler flags 4 +innerclass innerClass java/awt/Component$AccessibleAWTComponent$AccessibleAWTFocusHandler outerClass java/awt/Component$AccessibleAWTComponent innerClassName AccessibleAWTFocusHandler flags 4 + +class name java/awt/Container +header extends java/awt/Component nestMembers java/awt/Container$AccessibleAWTContainer,java/awt/Container$AccessibleAWTContainer$AccessibleContainerHandler flags 21 +innerclass innerClass java/awt/event/FocusEvent$Cause outerClass java/awt/event/FocusEvent innerClassName Cause flags 4019 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/awt/Container$AccessibleAWTContainer outerClass java/awt/Container innerClassName AccessibleAWTContainer flags 4 +innerclass innerClass java/awt/Container$AccessibleAWTContainer$AccessibleContainerHandler outerClass java/awt/Container$AccessibleAWTContainer innerClassName AccessibleContainerHandler flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Container$AccessibleAWTContainer +header extends java/awt/Component$AccessibleAWTComponent nestHost java/awt/Container flags 21 +innerclass innerClass java/awt/Container$AccessibleAWTContainer outerClass java/awt/Container innerClassName AccessibleAWTContainer flags 4 +innerclass innerClass java/awt/Component$AccessibleAWTComponent outerClass java/awt/Component innerClassName AccessibleAWTComponent flags 404 +innerclass innerClass java/awt/Container$AccessibleAWTContainer$AccessibleContainerHandler outerClass java/awt/Container$AccessibleAWTContainer innerClassName AccessibleContainerHandler flags 4 + +class name java/awt/Dialog +header extends java/awt/Window nestMembers java/awt/Dialog$AccessibleAWTDialog,java/awt/Dialog$ModalExclusionType,java/awt/Dialog$ModalityType flags 21 +innerclass innerClass java/awt/Dialog$ModalityType outerClass java/awt/Dialog innerClassName ModalityType flags 4019 +innerclass innerClass java/awt/Dialog$ModalExclusionType outerClass java/awt/Dialog innerClassName ModalExclusionType flags 4019 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/awt/Dialog$AccessibleAWTDialog outerClass java/awt/Dialog innerClassName AccessibleAWTDialog flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/JobAttributes +header extends java/lang/Object implements java/lang/Cloneable nestMembers java/awt/JobAttributes$SidesType,java/awt/JobAttributes$MultipleDocumentHandlingType,java/awt/JobAttributes$DialogType,java/awt/JobAttributes$DestinationType,java/awt/JobAttributes$DefaultSelectionType flags 31 +innerclass innerClass java/awt/JobAttributes$DefaultSelectionType outerClass java/awt/JobAttributes innerClassName DefaultSelectionType flags 19 +innerclass innerClass java/awt/JobAttributes$DestinationType outerClass java/awt/JobAttributes innerClassName DestinationType flags 19 +innerclass innerClass java/awt/JobAttributes$DialogType outerClass java/awt/JobAttributes innerClassName DialogType flags 19 +innerclass innerClass java/awt/JobAttributes$MultipleDocumentHandlingType outerClass java/awt/JobAttributes innerClassName MultipleDocumentHandlingType flags 19 +innerclass innerClass java/awt/JobAttributes$SidesType outerClass java/awt/JobAttributes innerClassName SidesType flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/LinearGradientPaint +header extends java/awt/MultipleGradientPaint flags 31 +innerclass innerClass java/awt/geom/Point2D$Float outerClass java/awt/geom/Point2D innerClassName Float flags 9 +innerclass innerClass java/awt/MultipleGradientPaint$CycleMethod outerClass java/awt/MultipleGradientPaint innerClassName CycleMethod flags 4019 +innerclass innerClass java/awt/MultipleGradientPaint$ColorSpaceType outerClass java/awt/MultipleGradientPaint innerClassName ColorSpaceType flags 4019 +innerclass innerClass java/awt/geom/Point2D$Double outerClass java/awt/geom/Point2D innerClassName Double flags 9 + +class name java/awt/List$AccessibleAWTList +header extends java/awt/Component$AccessibleAWTComponent implements javax/accessibility/AccessibleSelection,java/awt/event/ItemListener,java/awt/event/ActionListener nestHost java/awt/List flags 21 +innerclass innerClass java/awt/List$AccessibleAWTList outerClass java/awt/List innerClassName AccessibleAWTList flags 4 +innerclass innerClass java/awt/Component$AccessibleAWTComponent outerClass java/awt/Component innerClassName AccessibleAWTComponent flags 404 +innerclass innerClass java/awt/List$AccessibleAWTList$AccessibleAWTListChild outerClass java/awt/List$AccessibleAWTList innerClassName AccessibleAWTListChild flags 4 + +class name java/awt/PageAttributes +header extends java/lang/Object implements java/lang/Cloneable nestMembers java/awt/PageAttributes$PrintQualityType,java/awt/PageAttributes$OriginType,java/awt/PageAttributes$OrientationRequestedType,java/awt/PageAttributes$MediaType,java/awt/PageAttributes$ColorType flags 31 +innerclass innerClass java/awt/PageAttributes$ColorType outerClass java/awt/PageAttributes innerClassName ColorType flags 19 +innerclass innerClass java/awt/PageAttributes$OriginType outerClass java/awt/PageAttributes innerClassName OriginType flags 19 +innerclass innerClass java/awt/PageAttributes$MediaType outerClass java/awt/PageAttributes innerClassName MediaType flags 19 +innerclass innerClass java/awt/PageAttributes$OrientationRequestedType outerClass java/awt/PageAttributes innerClassName OrientationRequestedType flags 19 +innerclass innerClass java/awt/PageAttributes$PrintQualityType outerClass java/awt/PageAttributes innerClassName PrintQualityType flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/RadialGradientPaint +header extends java/awt/MultipleGradientPaint flags 31 +innerclass innerClass java/awt/MultipleGradientPaint$CycleMethod outerClass java/awt/MultipleGradientPaint innerClassName CycleMethod flags 4019 +innerclass innerClass java/awt/geom/Point2D$Float outerClass java/awt/geom/Point2D innerClassName Float flags 9 +innerclass innerClass java/awt/MultipleGradientPaint$ColorSpaceType outerClass java/awt/MultipleGradientPaint innerClassName ColorSpaceType flags 4019 +innerclass innerClass java/awt/geom/Point2D$Double outerClass java/awt/geom/Point2D innerClassName Double flags 9 + +class name java/awt/ScrollPane +header extends java/awt/Container implements javax/accessibility/Accessible nestMembers java/awt/ScrollPane$AccessibleAWTScrollPane flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/awt/ScrollPane$AccessibleAWTScrollPane outerClass java/awt/ScrollPane innerClassName AccessibleAWTScrollPane flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Taskbar +header extends java/lang/Object nestMembers java/awt/Taskbar$State,java/awt/Taskbar$Feature flags 21 +innerclass innerClass java/awt/Taskbar$Feature outerClass java/awt/Taskbar innerClassName Feature flags 4019 +innerclass innerClass java/awt/Taskbar$State outerClass java/awt/Taskbar innerClassName State flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Window +header extends java/awt/Container implements javax/accessibility/Accessible nestMembers java/awt/Window$AccessibleAWTWindow,java/awt/Window$Type flags 21 +innerclass innerClass java/awt/Window$Type outerClass java/awt/Window innerClassName Type flags 4019 +innerclass innerClass java/awt/Dialog$ModalExclusionType outerClass java/awt/Dialog innerClassName ModalExclusionType flags 4019 +innerclass innerClass java/awt/event/FocusEvent$Cause outerClass java/awt/event/FocusEvent innerClassName Cause flags 4019 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/awt/Window$AccessibleAWTWindow outerClass java/awt/Window innerClassName AccessibleAWTWindow flags 4 +innerclass innerClass java/awt/GraphicsDevice$WindowTranslucency outerClass java/awt/GraphicsDevice innerClassName WindowTranslucency flags 4019 +innerclass innerClass java/awt/geom/Path2D$Float outerClass java/awt/geom/Path2D innerClassName Float flags 9 +innerclass innerClass java/awt/geom/Point2D$Double outerClass java/awt/geom/Point2D innerClassName Double flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/dnd/DropTarget +header extends java/lang/Object implements java/awt/dnd/DropTargetListener,java/io/Serializable nestMembers java/awt/dnd/DropTarget$DropTargetAutoScroller flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/awt/dnd/DropTarget$DropTargetAutoScroller outerClass java/awt/dnd/DropTarget innerClassName DropTargetAutoScroller flags c + +class name java/awt/font/TextLayout +header extends java/lang/Object implements java/lang/Cloneable nestMembers java/awt/font/TextLayout$CaretPolicy flags 31 +innerclass innerClass java/text/AttributedCharacterIterator$Attribute outerClass java/text/AttributedCharacterIterator innerClassName Attribute flags 9 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 +innerclass innerClass java/awt/font/TextLayout$CaretPolicy outerClass java/awt/font/TextLayout innerClassName CaretPolicy flags 9 +innerclass innerClass java/awt/geom/Point2D$Float outerClass java/awt/geom/Point2D innerClassName Float flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/geom/Arc2D +header extends java/awt/geom/RectangularShape nestMembers java/awt/geom/Arc2D$Double,java/awt/geom/Arc2D$Float flags 421 +innerclass innerClass java/awt/geom/Point2D$Double outerClass java/awt/geom/Point2D innerClassName Double flags 9 +innerclass innerClass java/awt/geom/Rectangle2D$Double outerClass java/awt/geom/Rectangle2D innerClassName Double flags 9 +innerclass innerClass java/awt/geom/Arc2D$Double outerClass java/awt/geom/Arc2D innerClassName Double flags 9 +innerclass innerClass java/awt/geom/Arc2D$Float outerClass java/awt/geom/Arc2D innerClassName Float flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/geom/Line2D +header extends java/lang/Object implements java/awt/Shape,java/lang/Cloneable nestMembers java/awt/geom/Line2D$Double,java/awt/geom/Line2D$Float flags 421 +innerclass innerClass java/awt/geom/Rectangle2D$Double outerClass java/awt/geom/Rectangle2D innerClassName Double flags 9 +innerclass innerClass java/awt/geom/Line2D$Double outerClass java/awt/geom/Line2D innerClassName Double flags 9 +innerclass innerClass java/awt/geom/Line2D$Float outerClass java/awt/geom/Line2D innerClassName Float flags 9 + +class name java/awt/image/AffineTransformOp +header extends java/lang/Object implements java/awt/image/BufferedImageOp,java/awt/image/RasterOp flags 21 +innerclass innerClass java/awt/RenderingHints$Key outerClass java/awt/RenderingHints innerClassName Key flags 409 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/beans/beancontext/BeanContextServicesSupport +header extends java/beans/beancontext/BeanContextSupport implements java/beans/beancontext/BeanContextServices nestMembers java/beans/beancontext/BeanContextServicesSupport$BCSSProxyServiceProvider,java/beans/beancontext/BeanContextServicesSupport$BCSSServiceProvider,java/beans/beancontext/BeanContextServicesSupport$BCSSChild flags 21 +innerclass innerClass java/beans/beancontext/BeanContextServicesSupport$BCSSChild outerClass java/beans/beancontext/BeanContextServicesSupport innerClassName BCSSChild flags 4 +innerclass innerClass java/beans/beancontext/BeanContextServicesSupport$BCSSServiceProvider outerClass java/beans/beancontext/BeanContextServicesSupport innerClassName BCSSServiceProvider flags c +innerclass innerClass java/beans/beancontext/BeanContextServicesSupport$BCSSProxyServiceProvider outerClass java/beans/beancontext/BeanContextServicesSupport innerClassName BCSSProxyServiceProvider flags 4 +innerclass innerClass java/beans/beancontext/BeanContextSupport$BCSIterator outerClass java/beans/beancontext/BeanContextSupport innerClassName BCSIterator flags 1c +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/beans/beancontext/BeanContextSupport$BCSChild outerClass java/beans/beancontext/BeanContextSupport innerClassName BCSChild flags 4 + +class name java/beans/beancontext/BeanContextServicesSupport$BCSSChild +header extends java/beans/beancontext/BeanContextSupport$BCSChild nestHost java/beans/beancontext/BeanContextServicesSupport flags 21 +innerclass innerClass java/beans/beancontext/BeanContextServicesSupport$BCSSChild outerClass java/beans/beancontext/BeanContextServicesSupport innerClassName BCSSChild flags 4 +innerclass innerClass java/beans/beancontext/BeanContextSupport$BCSChild outerClass java/beans/beancontext/BeanContextSupport innerClassName BCSChild flags 4 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/beans/beancontext/BeanContextServicesSupport$BCSSProxyServiceProvider +header extends java/lang/Object implements java/beans/beancontext/BeanContextServiceProvider,java/beans/beancontext/BeanContextServiceRevokedListener nestHost java/beans/beancontext/BeanContextServicesSupport flags 21 +innerclass innerClass java/beans/beancontext/BeanContextServicesSupport$BCSSProxyServiceProvider outerClass java/beans/beancontext/BeanContextServicesSupport innerClassName BCSSProxyServiceProvider flags 4 +innerclass innerClass java/beans/beancontext/BeanContextServicesSupport$BCSSChild outerClass java/beans/beancontext/BeanContextServicesSupport innerClassName BCSSChild flags 4 +innerclass innerClass java/beans/beancontext/BeanContextSupport$BCSChild outerClass java/beans/beancontext/BeanContextSupport innerClassName BCSChild flags 4 + +class name java/beans/beancontext/BeanContextSupport +header extends java/beans/beancontext/BeanContextChildSupport implements java/beans/beancontext/BeanContext,java/io/Serializable,java/beans/PropertyChangeListener,java/beans/VetoableChangeListener nestMembers java/beans/beancontext/BeanContextSupport$BCSChild,java/beans/beancontext/BeanContextSupport$BCSIterator flags 21 +innerclass innerClass java/beans/beancontext/BeanContextSupport$BCSIterator outerClass java/beans/beancontext/BeanContextSupport innerClassName BCSIterator flags 1c +innerclass innerClass java/beans/beancontext/BeanContextSupport$BCSChild outerClass java/beans/beancontext/BeanContextSupport innerClassName BCSChild flags 4 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name javax/accessibility/AccessibleBundle +header extends java/lang/Object flags 421 classAnnotations @Ljdk/Profile+Annotation;(value=I4) + +class name javax/print/attribute/standard/MediaSize +header extends javax/print/attribute/Size2DSyntax implements javax/print/attribute/Attribute nestMembers javax/print/attribute/standard/MediaSize$Other,javax/print/attribute/standard/MediaSize$Engineering,javax/print/attribute/standard/MediaSize$NA,javax/print/attribute/standard/MediaSize$JIS,javax/print/attribute/standard/MediaSize$ISO flags 21 +innerclass innerClass javax/print/attribute/standard/MediaSize$ISO outerClass javax/print/attribute/standard/MediaSize innerClassName ISO flags 19 +innerclass innerClass javax/print/attribute/standard/MediaSize$JIS outerClass javax/print/attribute/standard/MediaSize innerClassName JIS flags 19 +innerclass innerClass javax/print/attribute/standard/MediaSize$NA outerClass javax/print/attribute/standard/MediaSize innerClassName NA flags 19 +innerclass innerClass javax/print/attribute/standard/MediaSize$Engineering outerClass javax/print/attribute/standard/MediaSize innerClassName Engineering flags 19 +innerclass innerClass javax/print/attribute/standard/MediaSize$Other outerClass javax/print/attribute/standard/MediaSize innerClassName Other flags 19 + +class name javax/sound/sampled/AudioSystem +header extends java/lang/Object flags 21 +innerclass innerClass javax/sound/sampled/Mixer$Info outerClass javax/sound/sampled/Mixer innerClassName Info flags 9 +innerclass innerClass javax/sound/sampled/Line$Info outerClass javax/sound/sampled/Line innerClassName Info flags 9 +innerclass innerClass javax/sound/sampled/AudioFormat$Encoding outerClass javax/sound/sampled/AudioFormat innerClassName Encoding flags 9 +innerclass innerClass javax/sound/sampled/DataLine$Info outerClass javax/sound/sampled/DataLine innerClassName Info flags 9 +innerclass innerClass javax/sound/sampled/AudioFileFormat$Type outerClass javax/sound/sampled/AudioFileFormat innerClassName Type flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/sampled/BooleanControl +header extends javax/sound/sampled/Control nestMembers javax/sound/sampled/BooleanControl$Type flags 421 +innerclass innerClass javax/sound/sampled/Control$Type outerClass javax/sound/sampled/Control innerClassName Type flags 9 +innerclass innerClass javax/sound/sampled/BooleanControl$Type outerClass javax/sound/sampled/BooleanControl innerClassName Type flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/sampled/BooleanControl$Type +header extends javax/sound/sampled/Control$Type nestHost javax/sound/sampled/BooleanControl flags 21 +innerclass innerClass javax/sound/sampled/Control$Type outerClass javax/sound/sampled/Control innerClassName Type flags 9 +innerclass innerClass javax/sound/sampled/BooleanControl$Type outerClass javax/sound/sampled/BooleanControl innerClassName Type flags 9 + +class name javax/sound/sampled/CompoundControl +header extends javax/sound/sampled/Control nestMembers javax/sound/sampled/CompoundControl$Type flags 421 +innerclass innerClass javax/sound/sampled/Control$Type outerClass javax/sound/sampled/Control innerClassName Type flags 9 +innerclass innerClass javax/sound/sampled/CompoundControl$Type outerClass javax/sound/sampled/CompoundControl innerClassName Type flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/sampled/CompoundControl$Type +header extends javax/sound/sampled/Control$Type nestHost javax/sound/sampled/CompoundControl flags 21 +innerclass innerClass javax/sound/sampled/Control$Type outerClass javax/sound/sampled/Control innerClassName Type flags 9 +innerclass innerClass javax/sound/sampled/CompoundControl$Type outerClass javax/sound/sampled/CompoundControl innerClassName Type flags 9 + +class name javax/sound/sampled/DataLine$Info +header extends javax/sound/sampled/Line$Info nestHost javax/sound/sampled/DataLine flags 21 +innerclass innerClass javax/sound/sampled/Line$Info outerClass javax/sound/sampled/Line innerClassName Info flags 9 +innerclass innerClass javax/sound/sampled/DataLine$Info outerClass javax/sound/sampled/DataLine innerClassName Info flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/sampled/EnumControl +header extends javax/sound/sampled/Control nestMembers javax/sound/sampled/EnumControl$Type flags 421 +innerclass innerClass javax/sound/sampled/Control$Type outerClass javax/sound/sampled/Control innerClassName Type flags 9 +innerclass innerClass javax/sound/sampled/EnumControl$Type outerClass javax/sound/sampled/EnumControl innerClassName Type flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/sampled/EnumControl$Type +header extends javax/sound/sampled/Control$Type nestHost javax/sound/sampled/EnumControl flags 21 +innerclass innerClass javax/sound/sampled/Control$Type outerClass javax/sound/sampled/Control innerClassName Type flags 9 +innerclass innerClass javax/sound/sampled/EnumControl$Type outerClass javax/sound/sampled/EnumControl innerClassName Type flags 9 + +class name javax/sound/sampled/FloatControl +header extends javax/sound/sampled/Control nestMembers javax/sound/sampled/FloatControl$Type flags 421 +innerclass innerClass javax/sound/sampled/Control$Type outerClass javax/sound/sampled/Control innerClassName Type flags 9 +innerclass innerClass javax/sound/sampled/FloatControl$Type outerClass javax/sound/sampled/FloatControl innerClassName Type flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/sampled/FloatControl$Type +header extends javax/sound/sampled/Control$Type nestHost javax/sound/sampled/FloatControl flags 21 +innerclass innerClass javax/sound/sampled/Control$Type outerClass javax/sound/sampled/Control innerClassName Type flags 9 +innerclass innerClass javax/sound/sampled/FloatControl$Type outerClass javax/sound/sampled/FloatControl innerClassName Type flags 9 + +class name javax/sound/sampled/Line$Info +header extends java/lang/Object nestHost javax/sound/sampled/Line flags 21 +innerclass innerClass javax/sound/sampled/Line$Info outerClass javax/sound/sampled/Line innerClassName Info flags 9 + +class name javax/sound/sampled/Port$Info +header extends javax/sound/sampled/Line$Info nestHost javax/sound/sampled/Port flags 21 +innerclass innerClass javax/sound/sampled/Line$Info outerClass javax/sound/sampled/Line innerClassName Info flags 9 +innerclass innerClass javax/sound/sampled/Port$Info outerClass javax/sound/sampled/Port innerClassName Info flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/AbstractButton$AccessibleAbstractButton +header extends javax/swing/JComponent$AccessibleJComponent implements javax/accessibility/AccessibleAction,javax/accessibility/AccessibleValue,javax/accessibility/AccessibleText,javax/accessibility/AccessibleExtendedComponent nestHost javax/swing/AbstractButton flags 421 +innerclass innerClass javax/swing/AbstractButton$AccessibleAbstractButton outerClass javax/swing/AbstractButton innerClassName AccessibleAbstractButton flags 404 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 + +class name javax/swing/Box +header extends javax/swing/JComponent implements javax/accessibility/Accessible nestMembers javax/swing/Box$AccessibleBox,javax/swing/Box$Filler,javax/swing/Box$Filler$AccessibleBoxFiller flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="accessibleContext") +innerclass innerClass javax/swing/Box$Filler outerClass javax/swing/Box innerClassName Filler flags 9 +innerclass innerClass javax/swing/Box$AccessibleBox outerClass javax/swing/Box innerClassName AccessibleBox flags 4 +innerclass innerClass javax/swing/Box$Filler$AccessibleBoxFiller outerClass javax/swing/Box$Filler innerClassName AccessibleBoxFiller flags 4 + +class name javax/swing/DefaultListCellRenderer +header extends javax/swing/JLabel implements javax/swing/ListCellRenderer,java/io/Serializable nestMembers javax/swing/DefaultListCellRenderer$UIResource flags 21 signature Ljavax/swing/JLabel;Ljavax/swing/ListCellRenderer;Ljava/io/Serializable; +innerclass innerClass javax/swing/JList$DropLocation outerClass javax/swing/JList innerClassName DropLocation flags 19 +innerclass innerClass javax/swing/DefaultListCellRenderer$UIResource outerClass javax/swing/DefaultListCellRenderer innerClassName UIResource flags 9 + +class name javax/swing/GroupLayout +header extends java/lang/Object implements java/awt/LayoutManager2 nestMembers javax/swing/GroupLayout$ParallelGroup,javax/swing/GroupLayout$SequentialGroup,javax/swing/GroupLayout$Group,javax/swing/GroupLayout$Spring,javax/swing/GroupLayout$Alignment flags 21 +innerclass innerClass javax/swing/GroupLayout$Alignment outerClass javax/swing/GroupLayout innerClassName Alignment flags 4019 +innerclass innerClass javax/swing/GroupLayout$ParallelGroup outerClass javax/swing/GroupLayout innerClassName ParallelGroup flags 1 +innerclass innerClass javax/swing/GroupLayout$Group outerClass javax/swing/GroupLayout innerClassName Group flags 401 +innerclass innerClass javax/swing/GroupLayout$SequentialGroup outerClass javax/swing/GroupLayout innerClassName SequentialGroup flags 1 +innerclass innerClass javax/swing/GroupLayout$Spring outerClass javax/swing/GroupLayout innerClassName Spring flags 402 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/GroupLayout$Group +header extends javax/swing/GroupLayout$Spring nestHost javax/swing/GroupLayout flags 421 +innerclass innerClass javax/swing/GroupLayout$Group outerClass javax/swing/GroupLayout innerClassName Group flags 401 +innerclass innerClass javax/swing/GroupLayout$Spring outerClass javax/swing/GroupLayout innerClassName Spring flags 402 + +class name javax/swing/GroupLayout$ParallelGroup +header extends javax/swing/GroupLayout$Group nestHost javax/swing/GroupLayout flags 21 +innerclass innerClass javax/swing/GroupLayout$ParallelGroup outerClass javax/swing/GroupLayout innerClassName ParallelGroup flags 1 +innerclass innerClass javax/swing/GroupLayout$Group outerClass javax/swing/GroupLayout innerClassName Group flags 401 +innerclass innerClass javax/swing/GroupLayout$Alignment outerClass javax/swing/GroupLayout innerClassName Alignment flags 4019 +innerclass innerClass javax/swing/GroupLayout$Spring outerClass javax/swing/GroupLayout innerClassName Spring flags 402 + +class name javax/swing/GroupLayout$SequentialGroup +header extends javax/swing/GroupLayout$Group nestHost javax/swing/GroupLayout flags 21 +innerclass innerClass javax/swing/GroupLayout$SequentialGroup outerClass javax/swing/GroupLayout innerClassName SequentialGroup flags 1 +innerclass innerClass javax/swing/GroupLayout$Group outerClass javax/swing/GroupLayout innerClassName Group flags 401 +innerclass innerClass javax/swing/GroupLayout$Spring outerClass javax/swing/GroupLayout innerClassName Spring flags 402 +innerclass innerClass javax/swing/LayoutStyle$ComponentPlacement outerClass javax/swing/LayoutStyle innerClassName ComponentPlacement flags 4019 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 + +class name javax/swing/JCheckBoxMenuItem +header extends javax/swing/JMenuItem implements javax/swing/SwingConstants,javax/accessibility/Accessible nestMembers javax/swing/JCheckBoxMenuItem$AccessibleJCheckBoxMenuItem flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(description="A\u005C;u0020;menu\u005C;u0020;item\u005C;u0020;which\u005C;u0020;can\u005C;u0020;be\u005C;u0020;selected\u005C;u0020;or\u005C;u0020;deselected.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/JToggleButton$ToggleButtonModel outerClass javax/swing/JToggleButton innerClassName ToggleButtonModel flags 9 +innerclass innerClass javax/swing/JCheckBoxMenuItem$AccessibleJCheckBoxMenuItem outerClass javax/swing/JCheckBoxMenuItem innerClassName AccessibleJCheckBoxMenuItem flags 4 + +class name javax/swing/JComboBox +header extends javax/swing/JComponent implements java/awt/ItemSelectable,javax/swing/event/ListDataListener,java/awt/event/ActionListener,javax/accessibility/Accessible nestMembers javax/swing/JComboBox$AccessibleJComboBox,javax/swing/JComboBox$KeySelectionManager flags 21 signature Ljavax/swing/JComponent;Ljava/awt/ItemSelectable;Ljavax/swing/event/ListDataListener;Ljava/awt/event/ActionListener;Ljavax/accessibility/Accessible; runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;combination\u005C;u0020;of\u005C;u0020;a\u005C;u0020;text\u005C;u0020;field\u005C;u0020;and\u005C;u0020;a\u005C;u0020;drop-down\u005C;u0020;list.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/JComboBox$KeySelectionManager outerClass javax/swing/JComboBox innerClassName KeySelectionManager flags 609 +innerclass innerClass javax/swing/JComboBox$AccessibleJComboBox outerClass javax/swing/JComboBox innerClassName AccessibleJComboBox flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JComponent +header extends java/awt/Container implements java/io/Serializable,javax/swing/TransferHandler$HasGetTransferHandler nestMembers javax/swing/JComponent$AccessibleJComponent,javax/swing/JComponent$AccessibleJComponent$AccessibleFocusHandler,javax/swing/JComponent$AccessibleJComponent$AccessibleContainerHandler flags 421 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UIClassID") +innerclass innerClass java/awt/RenderingHints$Key outerClass java/awt/RenderingHints innerClassName Key flags 409 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass javax/swing/TransferHandler$HasGetTransferHandler outerClass javax/swing/TransferHandler innerClassName HasGetTransferHandler flags 608 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent$AccessibleFocusHandler outerClass javax/swing/JComponent$AccessibleJComponent innerClassName AccessibleFocusHandler flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent$AccessibleContainerHandler outerClass javax/swing/JComponent$AccessibleJComponent innerClassName AccessibleContainerHandler flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JComponent$AccessibleJComponent +header extends java/awt/Container$AccessibleAWTContainer implements javax/accessibility/AccessibleExtendedComponent nestHost javax/swing/JComponent flags 421 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +innerclass innerClass java/awt/Container$AccessibleAWTContainer outerClass java/awt/Container innerClassName AccessibleAWTContainer flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent$AccessibleFocusHandler outerClass javax/swing/JComponent$AccessibleJComponent innerClassName AccessibleFocusHandler flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent$AccessibleContainerHandler outerClass javax/swing/JComponent$AccessibleJComponent innerClassName AccessibleContainerHandler flags 4 + +class name javax/swing/JDesktopPane +header extends javax/swing/JLayeredPane implements javax/accessibility/Accessible nestMembers javax/swing/JDesktopPane$AccessibleJDesktopPane flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI") +innerclass innerClass javax/swing/JInternalFrame$JDesktopIcon outerClass javax/swing/JInternalFrame innerClassName JDesktopIcon flags 9 +innerclass innerClass javax/swing/JDesktopPane$AccessibleJDesktopPane outerClass javax/swing/JDesktopPane innerClassName AccessibleJDesktopPane flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JDialog +header extends java/awt/Dialog implements javax/swing/WindowConstants,javax/accessibility/Accessible,javax/swing/RootPaneContainer,javax/swing/TransferHandler$HasGetTransferHandler nestMembers javax/swing/JDialog$AccessibleJDialog flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="JMenuBar",description="A\u005C;u0020;toplevel\u005C;u0020;window\u005C;u0020;for\u005C;u0020;creating\u005C;u0020;dialog\u005C;u0020;boxes.")@Ljavax/swing/SwingContainer;(delegate="getContentPane") +innerclass innerClass java/awt/Dialog$ModalityType outerClass java/awt/Dialog innerClassName ModalityType flags 4019 +innerclass innerClass javax/swing/JDialog$AccessibleJDialog outerClass javax/swing/JDialog innerClassName AccessibleJDialog flags 4 +innerclass innerClass javax/swing/TransferHandler$HasGetTransferHandler outerClass javax/swing/TransferHandler innerClassName HasGetTransferHandler flags 608 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JEditorPane +header extends javax/swing/text/JTextComponent nestMembers javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport,javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport$HTMLLink,javax/swing/JEditorPane$AccessibleJEditorPaneHTML,javax/swing/JEditorPane$AccessibleJEditorPane flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UIClassID",description="A\u005C;u0020;text\u005C;u0020;component\u005C;u0020;to\u005C;u0020;edit\u005C;u0020;various\u005C;u0020;types\u005C;u0020;of\u005C;u0020;content.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTMLDocument$Iterator outerClass javax/swing/text/html/HTMLDocument innerClassName Iterator flags 409 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/JEditorPane$AccessibleJEditorPaneHTML outerClass javax/swing/JEditorPane innerClassName AccessibleJEditorPaneHTML flags 4 +innerclass innerClass javax/swing/JEditorPane$AccessibleJEditorPane outerClass javax/swing/JEditorPane innerClassName AccessibleJEditorPane flags 4 +innerclass innerClass javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport outerClass javax/swing/JEditorPane innerClassName JEditorPaneAccessibleHypertextSupport flags 4 +innerclass innerClass javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport$HTMLLink outerClass javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport innerClassName HTMLLink flags 1 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JEditorPane$AccessibleJEditorPaneHTML +header extends javax/swing/JEditorPane$AccessibleJEditorPane nestHost javax/swing/JEditorPane flags 21 +innerclass innerClass javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport outerClass javax/swing/JEditorPane innerClassName JEditorPaneAccessibleHypertextSupport flags 4 +innerclass innerClass javax/swing/JEditorPane$AccessibleJEditorPaneHTML outerClass javax/swing/JEditorPane innerClassName AccessibleJEditorPaneHTML flags 4 +innerclass innerClass javax/swing/JEditorPane$AccessibleJEditorPane outerClass javax/swing/JEditorPane innerClassName AccessibleJEditorPane flags 4 + +class name javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport +header extends javax/swing/JEditorPane$AccessibleJEditorPane implements javax/accessibility/AccessibleHypertext nestHost javax/swing/JEditorPane flags 21 +innerclass innerClass javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport outerClass javax/swing/JEditorPane innerClassName JEditorPaneAccessibleHypertextSupport flags 4 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport$HTMLLink outerClass javax/swing/JEditorPane$JEditorPaneAccessibleHypertextSupport innerClassName HTMLLink flags 1 +innerclass innerClass javax/swing/JEditorPane$AccessibleJEditorPane outerClass javax/swing/JEditorPane innerClassName AccessibleJEditorPane flags 4 + +class name javax/swing/JFileChooser +header extends javax/swing/JComponent implements javax/accessibility/Accessible nestMembers javax/swing/JFileChooser$AccessibleJFileChooser flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;component\u005C;u0020;which\u005C;u0020;allows\u005C;u0020;for\u005C;u0020;the\u005C;u0020;interactive\u005C;u0020;selection\u005C;u0020;of\u005C;u0020;a\u005C;u0020;file.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass javax/swing/JFileChooser$AccessibleJFileChooser outerClass javax/swing/JFileChooser innerClassName AccessibleJFileChooser flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JFormattedTextField +header extends javax/swing/JTextField nestMembers javax/swing/JFormattedTextField$AbstractFormatter,javax/swing/JFormattedTextField$AbstractFormatterFactory flags 21 runtimeAnnotations @Ljava/beans/JavaBean; +innerclass innerClass javax/swing/JFormattedTextField$AbstractFormatterFactory outerClass javax/swing/JFormattedTextField innerClassName AbstractFormatterFactory flags 409 +innerclass innerClass javax/swing/JFormattedTextField$AbstractFormatter outerClass javax/swing/JFormattedTextField innerClassName AbstractFormatter flags 409 + +class name javax/swing/JLabel$AccessibleJLabel +header extends javax/swing/JComponent$AccessibleJComponent implements javax/accessibility/AccessibleText,javax/accessibility/AccessibleExtendedComponent nestHost javax/swing/JLabel flags 21 +innerclass innerClass javax/swing/JLabel$AccessibleJLabel outerClass javax/swing/JLabel innerClassName AccessibleJLabel flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 + +class name javax/swing/JList +header extends javax/swing/JComponent implements javax/swing/Scrollable,javax/accessibility/Accessible nestMembers javax/swing/JList$AccessibleJList,javax/swing/JList$AccessibleJList$AccessibleJListChild,javax/swing/JList$DropLocation flags 21 signature Ljavax/swing/JComponent;Ljavax/swing/Scrollable;Ljavax/accessibility/Accessible; runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;component\u005C;u0020;which\u005C;u0020;allows\u005C;u0020;for\u005C;u0020;the\u005C;u0020;selection\u005C;u0020;of\u005C;u0020;one\u005C;u0020;or\u005C;u0020;more\u005C;u0020;objects\u005C;u0020;from\u005C;u0020;a\u005C;u0020;list.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/JList$DropLocation outerClass javax/swing/JList innerClassName DropLocation flags 19 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/JList$AccessibleJList outerClass javax/swing/JList innerClassName AccessibleJList flags 4 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass javax/swing/JList$AccessibleJList$AccessibleJListChild outerClass javax/swing/JList$AccessibleJList innerClassName AccessibleJListChild flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JList$AccessibleJList +header extends javax/swing/JComponent$AccessibleJComponent implements javax/accessibility/AccessibleSelection,java/beans/PropertyChangeListener,javax/swing/event/ListSelectionListener,javax/swing/event/ListDataListener nestHost javax/swing/JList flags 21 +innerclass innerClass javax/swing/JList$AccessibleJList outerClass javax/swing/JList innerClassName AccessibleJList flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +innerclass innerClass javax/swing/JList$AccessibleJList$AccessibleJListChild outerClass javax/swing/JList$AccessibleJList innerClassName AccessibleJListChild flags 4 + +class name javax/swing/JList$DropLocation +header extends javax/swing/TransferHandler$DropLocation nestHost javax/swing/JList flags 31 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass javax/swing/JList$DropLocation outerClass javax/swing/JList innerClassName DropLocation flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JMenu +header extends javax/swing/JMenuItem implements javax/accessibility/Accessible,javax/swing/MenuElement nestMembers javax/swing/JMenu$AccessibleJMenu,javax/swing/JMenu$WinListener flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(description="A\u005C;u0020;popup\u005C;u0020;window\u005C;u0020;containing\u005C;u0020;menu\u005C;u0020;items\u005C;u0020;displayed\u005C;u0020;in\u005C;u0020;a\u005C;u0020;menu\u005C;u0020;bar.")@Ljavax/swing/SwingContainer; +innerclass innerClass javax/swing/JMenu$WinListener outerClass javax/swing/JMenu innerClassName WinListener flags 4 +innerclass innerClass javax/swing/JPopupMenu$Separator outerClass javax/swing/JPopupMenu innerClassName Separator flags 9 +innerclass innerClass javax/swing/JMenu$AccessibleJMenu outerClass javax/swing/JMenu innerClassName AccessibleJMenu flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JOptionPane +header extends javax/swing/JComponent implements javax/accessibility/Accessible nestMembers javax/swing/JOptionPane$AccessibleJOptionPane flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;component\u005C;u0020;which\u005C;u0020;implements\u005C;u0020;standard\u005C;u0020;dialog\u005C;u0020;box\u005C;u0020;controls.")@Ljavax/swing/SwingContainer; +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass javax/swing/JOptionPane$AccessibleJOptionPane outerClass javax/swing/JOptionPane innerClassName AccessibleJOptionPane flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JRadioButtonMenuItem +header extends javax/swing/JMenuItem implements javax/accessibility/Accessible nestMembers javax/swing/JRadioButtonMenuItem$AccessibleJRadioButtonMenuItem flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(description="A\u005C;u0020;component\u005C;u0020;within\u005C;u0020;a\u005C;u0020;group\u005C;u0020;of\u005C;u0020;menu\u005C;u0020;items\u005C;u0020;which\u005C;u0020;can\u005C;u0020;be\u005C;u0020;selected.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/JToggleButton$ToggleButtonModel outerClass javax/swing/JToggleButton innerClassName ToggleButtonModel flags 9 +innerclass innerClass javax/swing/JRadioButtonMenuItem$AccessibleJRadioButtonMenuItem outerClass javax/swing/JRadioButtonMenuItem innerClassName AccessibleJRadioButtonMenuItem flags 4 + +class name javax/swing/JRootPane +header extends javax/swing/JComponent implements javax/accessibility/Accessible nestMembers javax/swing/JRootPane$AccessibleJRootPane,javax/swing/JRootPane$RootLayout flags 21 +innerclass innerClass javax/swing/JRootPane$RootLayout outerClass javax/swing/JRootPane innerClassName RootLayout flags 4 +innerclass innerClass javax/swing/JRootPane$AccessibleJRootPane outerClass javax/swing/JRootPane innerClassName AccessibleJRootPane flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JScrollPane +header extends javax/swing/JComponent implements javax/swing/ScrollPaneConstants,javax/accessibility/Accessible nestMembers javax/swing/JScrollPane$AccessibleJScrollPane,javax/swing/JScrollPane$ScrollBar flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;specialized\u005C;u0020;container\u005C;u0020;that\u005C;u0020;manages\u005C;u0020;a\u005C;u0020;viewport,\u005C;u0020;optional\u005C;u0020;scrollbars\u005C;u0020;and\u005C;u0020;headers")@Ljavax/swing/SwingContainer;(delegate="getViewport") +innerclass innerClass javax/swing/ScrollPaneLayout$UIResource outerClass javax/swing/ScrollPaneLayout innerClassName UIResource flags 9 +innerclass innerClass javax/swing/JScrollPane$ScrollBar outerClass javax/swing/JScrollPane innerClassName ScrollBar flags 4 +innerclass innerClass javax/swing/JScrollPane$AccessibleJScrollPane outerClass javax/swing/JScrollPane innerClassName AccessibleJScrollPane flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JSpinner +header extends javax/swing/JComponent implements javax/accessibility/Accessible nestMembers javax/swing/JSpinner$AccessibleJSpinner,javax/swing/JSpinner$ListEditor,javax/swing/JSpinner$NumberEditor,javax/swing/JSpinner$DateEditor,javax/swing/JSpinner$DefaultEditor flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;single\u005C;u0020;line\u005C;u0020;input\u005C;u0020;field\u005C;u0020;that\u005C;u0020;lets\u005C;u0020;the\u005C;u0020;user\u005C;u0020;select\u005C;u0020;a\u005C;u0020;number\u005C;u0020;or\u005C;u0020;an\u005C;u0020;object\u005C;u0020;value\u005C;u0020;from\u005C;u0020;an\u005C;u0020;ordered\u005C;u0020;set.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/JSpinner$DateEditor outerClass javax/swing/JSpinner innerClassName DateEditor flags 9 +innerclass innerClass javax/swing/JSpinner$ListEditor outerClass javax/swing/JSpinner innerClassName ListEditor flags 9 +innerclass innerClass javax/swing/JSpinner$NumberEditor outerClass javax/swing/JSpinner innerClassName NumberEditor flags 9 +innerclass innerClass javax/swing/JSpinner$DefaultEditor outerClass javax/swing/JSpinner innerClassName DefaultEditor flags 9 +innerclass innerClass javax/swing/JSpinner$AccessibleJSpinner outerClass javax/swing/JSpinner innerClassName AccessibleJSpinner flags 4 + +class name javax/swing/JSpinner$AccessibleJSpinner +header extends javax/swing/JComponent$AccessibleJComponent implements javax/accessibility/AccessibleValue,javax/accessibility/AccessibleAction,javax/accessibility/AccessibleText,javax/accessibility/AccessibleEditableText,javax/swing/event/ChangeListener nestHost javax/swing/JSpinner flags 21 +innerclass innerClass javax/swing/JSpinner$AccessibleJSpinner outerClass javax/swing/JSpinner innerClassName AccessibleJSpinner flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +innerclass innerClass javax/swing/JSpinner$DefaultEditor outerClass javax/swing/JSpinner innerClassName DefaultEditor flags 9 + +class name javax/swing/JSpinner$ListEditor +header extends javax/swing/JSpinner$DefaultEditor nestHost javax/swing/JSpinner flags 21 +innerclass innerClass javax/swing/JSpinner$DefaultEditor outerClass javax/swing/JSpinner innerClassName DefaultEditor flags 9 +innerclass innerClass javax/swing/JSpinner$ListEditor outerClass javax/swing/JSpinner innerClassName ListEditor flags 9 +innerclass innerClass javax/swing/JFormattedTextField$AbstractFormatter outerClass javax/swing/JFormattedTextField innerClassName AbstractFormatter flags 409 +innerclass innerClass javax/swing/JFormattedTextField$AbstractFormatterFactory outerClass javax/swing/JFormattedTextField innerClassName AbstractFormatterFactory flags 409 + +class name javax/swing/JTabbedPane +header extends javax/swing/JComponent implements java/io/Serializable,javax/accessibility/Accessible,javax/swing/SwingConstants nestMembers javax/swing/JTabbedPane$AccessibleJTabbedPane,javax/swing/JTabbedPane$ModelListener flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;component\u005C;u0020;which\u005C;u0020;provides\u005C;u0020;a\u005C;u0020;tab\u005C;u0020;folder\u005C;u0020;metaphor\u005C;u0020;for\u005C;u0020;displaying\u005C;u0020;one\u005C;u0020;component\u005C;u0020;from\u005C;u0020;a\u005C;u0020;set\u005C;u0020;of\u005C;u0020;components.")@Ljavax/swing/SwingContainer; +innerclass innerClass javax/swing/JTabbedPane$ModelListener outerClass javax/swing/JTabbedPane innerClassName ModelListener flags 4 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass javax/swing/JTabbedPane$AccessibleJTabbedPane outerClass javax/swing/JTabbedPane innerClassName AccessibleJTabbedPane flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JTable +header extends javax/swing/JComponent implements javax/swing/event/TableModelListener,javax/swing/Scrollable,javax/swing/event/TableColumnModelListener,javax/swing/event/ListSelectionListener,javax/swing/event/CellEditorListener,javax/accessibility/Accessible,javax/swing/event/RowSorterListener nestMembers javax/swing/JTable$AccessibleJTable,javax/swing/JTable$AccessibleJTable$AccessibleJTableCell,javax/swing/JTable$AccessibleJTable$AccessibleJTableModelChange,javax/swing/JTable$DropLocation,javax/swing/JTable$PrintMode flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;component\u005C;u0020;which\u005C;u0020;displays\u005C;u0020;data\u005C;u0020;in\u005C;u0020;a\u005C;u0020;two\u005C;u0020;dimensional\u005C;u0020;grid.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/JTable$DropLocation outerClass javax/swing/JTable innerClassName DropLocation flags 19 +innerclass innerClass javax/swing/event/RowSorterEvent$Type outerClass javax/swing/event/RowSorterEvent innerClassName Type flags 4019 +innerclass innerClass javax/swing/UIDefaults$LazyValue outerClass javax/swing/UIDefaults innerClassName LazyValue flags 609 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass javax/swing/JTable$PrintMode outerClass javax/swing/JTable innerClassName PrintMode flags 4019 +innerclass innerClass javax/swing/JTable$AccessibleJTable outerClass javax/swing/JTable innerClassName AccessibleJTable flags 4 +innerclass innerClass javax/swing/table/DefaultTableCellRenderer$UIResource outerClass javax/swing/table/DefaultTableCellRenderer innerClassName UIResource flags 9 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass javax/swing/JTable$AccessibleJTable$AccessibleJTableCell outerClass javax/swing/JTable$AccessibleJTable innerClassName AccessibleJTableCell flags 4 +innerclass innerClass javax/swing/JTable$AccessibleJTable$AccessibleJTableModelChange outerClass javax/swing/JTable$AccessibleJTable innerClassName AccessibleJTableModelChange flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JTable$AccessibleJTable +header extends javax/swing/JComponent$AccessibleJComponent implements javax/accessibility/AccessibleSelection,javax/swing/event/ListSelectionListener,javax/swing/event/TableModelListener,javax/swing/event/TableColumnModelListener,javax/swing/event/CellEditorListener,java/beans/PropertyChangeListener,javax/accessibility/AccessibleExtendedTable nestHost javax/swing/JTable flags 21 +innerclass innerClass javax/swing/JTable$AccessibleJTable outerClass javax/swing/JTable innerClassName AccessibleJTable flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +innerclass innerClass javax/swing/JTable$AccessibleJTable$AccessibleJTableModelChange outerClass javax/swing/JTable$AccessibleJTable innerClassName AccessibleJTableModelChange flags 4 +innerclass innerClass javax/swing/JTable$AccessibleJTable$AccessibleJTableCell outerClass javax/swing/JTable$AccessibleJTable innerClassName AccessibleJTableCell flags 4 + +class name javax/swing/JTable$DropLocation +header extends javax/swing/TransferHandler$DropLocation nestHost javax/swing/JTable flags 31 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass javax/swing/JTable$DropLocation outerClass javax/swing/JTable innerClassName DropLocation flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JToggleButton +header extends javax/swing/AbstractButton implements javax/accessibility/Accessible nestMembers javax/swing/JToggleButton$AccessibleJToggleButton,javax/swing/JToggleButton$ToggleButtonModel flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UIClassID",description="An\u005C;u0020;implementation\u005C;u0020;of\u005C;u0020;a\u005C;u0020;two-state\u005C;u0020;button.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/JToggleButton$ToggleButtonModel outerClass javax/swing/JToggleButton innerClassName ToggleButtonModel flags 9 +innerclass innerClass java/awt/event/FocusEvent$Cause outerClass java/awt/event/FocusEvent innerClassName Cause flags 4019 +innerclass innerClass javax/swing/JToggleButton$AccessibleJToggleButton outerClass javax/swing/JToggleButton innerClassName AccessibleJToggleButton flags 4 + +class name javax/swing/JToolBar +header extends javax/swing/JComponent implements javax/swing/SwingConstants,javax/accessibility/Accessible nestMembers javax/swing/JToolBar$AccessibleJToolBar,javax/swing/JToolBar$Separator flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;component\u005C;u0020;which\u005C;u0020;displays\u005C;u0020;commonly\u005C;u0020;used\u005C;u0020;controls\u005C;u0020;or\u005C;u0020;Actions.")@Ljavax/swing/SwingContainer; +innerclass innerClass javax/swing/JToolBar$Separator outerClass javax/swing/JToolBar innerClassName Separator flags 9 +innerclass innerClass javax/swing/JToolBar$AccessibleJToolBar outerClass javax/swing/JToolBar innerClassName AccessibleJToolBar flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JTree +header extends javax/swing/JComponent implements javax/swing/Scrollable,javax/accessibility/Accessible nestMembers javax/swing/JTree$AccessibleJTree,javax/swing/JTree$AccessibleJTree$AccessibleJTreeNode,javax/swing/JTree$DynamicUtilTreeNode,javax/swing/JTree$TreeModelHandler,javax/swing/JTree$TreeSelectionRedirector,javax/swing/JTree$EmptySelectionModel,javax/swing/JTree$DropLocation flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI",description="A\u005C;u0020;component\u005C;u0020;that\u005C;u0020;displays\u005C;u0020;a\u005C;u0020;set\u005C;u0020;of\u005C;u0020;hierarchical\u005C;u0020;data\u005C;u0020;as\u005C;u0020;an\u005C;u0020;outline.")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/JTree$DynamicUtilTreeNode outerClass javax/swing/JTree innerClassName DynamicUtilTreeNode flags 9 +innerclass innerClass javax/swing/JTree$AccessibleJTree outerClass javax/swing/JTree innerClassName AccessibleJTree flags 4 +innerclass innerClass javax/swing/JTree$DropLocation outerClass javax/swing/JTree innerClassName DropLocation flags 19 +innerclass innerClass javax/swing/JTree$EmptySelectionModel outerClass javax/swing/JTree innerClassName EmptySelectionModel flags c +innerclass innerClass javax/swing/JTree$TreeSelectionRedirector outerClass javax/swing/JTree innerClassName TreeSelectionRedirector flags 4 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass javax/swing/JTree$TreeModelHandler outerClass javax/swing/JTree innerClassName TreeModelHandler flags 4 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass javax/swing/JTree$AccessibleJTree$AccessibleJTreeNode outerClass javax/swing/JTree$AccessibleJTree innerClassName AccessibleJTreeNode flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JTree$AccessibleJTree +header extends javax/swing/JComponent$AccessibleJComponent implements javax/accessibility/AccessibleSelection,javax/swing/event/TreeSelectionListener,javax/swing/event/TreeModelListener,javax/swing/event/TreeExpansionListener nestHost javax/swing/JTree flags 21 +innerclass innerClass javax/swing/JTree$AccessibleJTree outerClass javax/swing/JTree innerClassName AccessibleJTree flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +innerclass innerClass javax/swing/JTree$AccessibleJTree$AccessibleJTreeNode outerClass javax/swing/JTree$AccessibleJTree innerClassName AccessibleJTreeNode flags 4 + +class name javax/swing/JTree$DropLocation +header extends javax/swing/TransferHandler$DropLocation nestHost javax/swing/JTree flags 31 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass javax/swing/JTree$DropLocation outerClass javax/swing/JTree innerClassName DropLocation flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/JViewport +header extends javax/swing/JComponent implements javax/accessibility/Accessible nestMembers javax/swing/JViewport$AccessibleJViewport,javax/swing/JViewport$ViewListener flags 21 +innerclass innerClass javax/swing/JViewport$ViewListener outerClass javax/swing/JViewport innerClassName ViewListener flags 4 +innerclass innerClass javax/swing/JViewport$AccessibleJViewport outerClass javax/swing/JViewport innerClassName AccessibleJViewport flags 4 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/RowFilter +header extends java/lang/Object nestMembers javax/swing/RowFilter$Entry,javax/swing/RowFilter$ComparisonType flags 421 signature Ljava/lang/Object; +innerclass innerClass javax/swing/RowFilter$ComparisonType outerClass javax/swing/RowFilter innerClassName ComparisonType flags 4019 +innerclass innerClass javax/swing/RowFilter$Entry outerClass javax/swing/RowFilter innerClassName Entry flags 409 + +class name javax/swing/RowSorter +header extends java/lang/Object nestMembers javax/swing/RowSorter$SortKey flags 421 signature Ljava/lang/Object; +innerclass innerClass javax/swing/event/RowSorterEvent$Type outerClass javax/swing/event/RowSorterEvent innerClassName Type flags 4019 +innerclass innerClass javax/swing/RowSorter$SortKey outerClass javax/swing/RowSorter innerClassName SortKey flags 9 + +class name javax/swing/ToolTipManager +header extends java/awt/event/MouseAdapter implements java/awt/event/MouseMotionListener nestMembers javax/swing/ToolTipManager$stillInsideTimerAction,javax/swing/ToolTipManager$outsideTimerAction,javax/swing/ToolTipManager$insideTimerAction flags 21 +innerclass innerClass javax/swing/ToolTipManager$insideTimerAction outerClass javax/swing/ToolTipManager innerClassName insideTimerAction flags 4 +innerclass innerClass javax/swing/ToolTipManager$outsideTimerAction outerClass javax/swing/ToolTipManager innerClassName outsideTimerAction flags 4 +innerclass innerClass javax/swing/ToolTipManager$stillInsideTimerAction outerClass javax/swing/ToolTipManager innerClassName stillInsideTimerAction flags 4 + +class name javax/swing/TransferHandler$TransferSupport +header extends java/lang/Object nestHost javax/swing/TransferHandler flags 31 +innerclass innerClass javax/swing/TransferHandler$TransferSupport outerClass javax/swing/TransferHandler innerClassName TransferSupport flags 19 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/UIDefaults +header extends java/util/Hashtable nestMembers javax/swing/UIDefaults$LazyInputMap,javax/swing/UIDefaults$ProxyLazyValue,javax/swing/UIDefaults$ActiveValue,javax/swing/UIDefaults$LazyValue flags 21 signature Ljava/util/Hashtable; +innerclass innerClass javax/swing/UIDefaults$ActiveValue outerClass javax/swing/UIDefaults innerClassName ActiveValue flags 609 +innerclass innerClass javax/swing/UIDefaults$LazyValue outerClass javax/swing/UIDefaults innerClassName LazyValue flags 609 +innerclass innerClass javax/swing/UIDefaults$LazyInputMap outerClass javax/swing/UIDefaults innerClassName LazyInputMap flags 9 +innerclass innerClass javax/swing/UIDefaults$ProxyLazyValue outerClass javax/swing/UIDefaults innerClassName ProxyLazyValue flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/border/StrokeBorder +header extends javax/swing/border/AbstractBorder flags 21 +innerclass innerClass java/awt/RenderingHints$Key outerClass java/awt/RenderingHints innerClassName Key flags 409 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 + +class name javax/swing/border/TitledBorder +header extends javax/swing/border/AbstractBorder flags 21 +innerclass innerClass java/awt/geom/Path2D$Float outerClass java/awt/geom/Path2D innerClassName Float flags 9 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass java/lang/ref/Cleaner$Cleanable outerClass java/lang/ref/Cleaner innerClassName Cleanable flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/BorderUIResource +header extends java/lang/Object implements javax/swing/border/Border,javax/swing/plaf/UIResource,java/io/Serializable nestMembers javax/swing/plaf/BorderUIResource$TitledBorderUIResource,javax/swing/plaf/BorderUIResource$MatteBorderUIResource,javax/swing/plaf/BorderUIResource$EtchedBorderUIResource,javax/swing/plaf/BorderUIResource$BevelBorderUIResource,javax/swing/plaf/BorderUIResource$LineBorderUIResource,javax/swing/plaf/BorderUIResource$EmptyBorderUIResource,javax/swing/plaf/BorderUIResource$CompoundBorderUIResource flags 21 +innerclass innerClass javax/swing/plaf/BorderUIResource$EtchedBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName EtchedBorderUIResource flags 9 +innerclass innerClass javax/swing/plaf/BorderUIResource$BevelBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName BevelBorderUIResource flags 9 +innerclass innerClass javax/swing/plaf/BorderUIResource$LineBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName LineBorderUIResource flags 9 +innerclass innerClass javax/swing/plaf/BorderUIResource$TitledBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName TitledBorderUIResource flags 9 +innerclass innerClass javax/swing/plaf/BorderUIResource$MatteBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName MatteBorderUIResource flags 9 +innerclass innerClass javax/swing/plaf/BorderUIResource$EmptyBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName EmptyBorderUIResource flags 9 +innerclass innerClass javax/swing/plaf/BorderUIResource$CompoundBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName CompoundBorderUIResource flags 9 + +class name javax/swing/plaf/basic/BasicBorders +header extends java/lang/Object nestMembers javax/swing/plaf/basic/BasicBorders$SplitPaneBorder,javax/swing/plaf/basic/BasicBorders$FieldBorder,javax/swing/plaf/basic/BasicBorders$MarginBorder,javax/swing/plaf/basic/BasicBorders$MenuBarBorder,javax/swing/plaf/basic/BasicBorders$RadioButtonBorder,javax/swing/plaf/basic/BasicBorders$ToggleButtonBorder,javax/swing/plaf/basic/BasicBorders$ButtonBorder,javax/swing/plaf/basic/BasicBorders$RolloverButtonBorder flags 21 +innerclass innerClass javax/swing/plaf/BorderUIResource$CompoundBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName CompoundBorderUIResource flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$ButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName ButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$MarginBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName MarginBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$RadioButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName RadioButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$ToggleButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName ToggleButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$MenuBarBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName MenuBarBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$SplitPaneBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName SplitPaneBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$FieldBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName FieldBorder flags 9 +innerclass innerClass javax/swing/plaf/BorderUIResource$LineBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName LineBorderUIResource flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$RolloverButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName RolloverButtonBorder flags 9 + +class name javax/swing/plaf/basic/BasicBorders$RadioButtonBorder +header extends javax/swing/plaf/basic/BasicBorders$ButtonBorder nestHost javax/swing/plaf/basic/BasicBorders flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$ButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName ButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$RadioButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName RadioButtonBorder flags 9 + +class name javax/swing/plaf/basic/BasicBorders$RolloverButtonBorder +header extends javax/swing/plaf/basic/BasicBorders$ButtonBorder nestHost javax/swing/plaf/basic/BasicBorders flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$ButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName ButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$RolloverButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName RolloverButtonBorder flags 9 + +class name javax/swing/plaf/basic/BasicBorders$ToggleButtonBorder +header extends javax/swing/plaf/basic/BasicBorders$ButtonBorder nestHost javax/swing/plaf/basic/BasicBorders flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$ButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName ButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$ToggleButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName ToggleButtonBorder flags 9 + +class name javax/swing/plaf/basic/BasicComboBoxUI +header extends javax/swing/plaf/ComboBoxUI nestMembers javax/swing/plaf/basic/BasicComboBoxUI$ComboBoxLayoutManager,javax/swing/plaf/basic/BasicComboBoxUI$PropertyChangeHandler,javax/swing/plaf/basic/BasicComboBoxUI$ItemHandler,javax/swing/plaf/basic/BasicComboBoxUI$ListDataHandler,javax/swing/plaf/basic/BasicComboBoxUI$FocusHandler,javax/swing/plaf/basic/BasicComboBoxUI$KeyHandler flags 21 +innerclass innerClass javax/swing/JComboBox$KeySelectionManager outerClass javax/swing/JComboBox innerClassName KeySelectionManager flags 609 +innerclass innerClass javax/swing/plaf/basic/BasicComboBoxRenderer$UIResource outerClass javax/swing/plaf/basic/BasicComboBoxRenderer innerClassName UIResource flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicComboBoxEditor$UIResource outerClass javax/swing/plaf/basic/BasicComboBoxEditor innerClassName UIResource flags 9 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass javax/swing/plaf/basic/BasicComboBoxUI$ComboBoxLayoutManager outerClass javax/swing/plaf/basic/BasicComboBoxUI innerClassName ComboBoxLayoutManager flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicComboBoxUI$PropertyChangeHandler outerClass javax/swing/plaf/basic/BasicComboBoxUI innerClassName PropertyChangeHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicComboBoxUI$ItemHandler outerClass javax/swing/plaf/basic/BasicComboBoxUI innerClassName ItemHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicComboBoxUI$ListDataHandler outerClass javax/swing/plaf/basic/BasicComboBoxUI innerClassName ListDataHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicComboBoxUI$FocusHandler outerClass javax/swing/plaf/basic/BasicComboBoxUI innerClassName FocusHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicComboBoxUI$KeyHandler outerClass javax/swing/plaf/basic/BasicComboBoxUI innerClassName KeyHandler flags 1 + +class name javax/swing/plaf/basic/BasicDesktopIconUI +header extends javax/swing/plaf/DesktopIconUI nestMembers javax/swing/plaf/basic/BasicDesktopIconUI$MouseInputHandler flags 21 +innerclass innerClass javax/swing/JInternalFrame$JDesktopIcon outerClass javax/swing/JInternalFrame innerClassName JDesktopIcon flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicDesktopIconUI$MouseInputHandler outerClass javax/swing/plaf/basic/BasicDesktopIconUI innerClassName MouseInputHandler flags 1 + +class name javax/swing/plaf/basic/BasicFileChooserUI +header extends javax/swing/plaf/FileChooserUI nestMembers javax/swing/plaf/basic/BasicFileChooserUI$BasicFileView,javax/swing/plaf/basic/BasicFileChooserUI$AcceptAllFileFilter,javax/swing/plaf/basic/BasicFileChooserUI$UpdateAction,javax/swing/plaf/basic/BasicFileChooserUI$CancelSelectionAction,javax/swing/plaf/basic/BasicFileChooserUI$ApproveSelectionAction,javax/swing/plaf/basic/BasicFileChooserUI$ChangeToParentDirectoryAction,javax/swing/plaf/basic/BasicFileChooserUI$GoHomeAction,javax/swing/plaf/basic/BasicFileChooserUI$NewFolderAction,javax/swing/plaf/basic/BasicFileChooserUI$SelectionListener,javax/swing/plaf/basic/BasicFileChooserUI$DoubleClickListener flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$ApproveSelectionAction outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName ApproveSelectionAction flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$CancelSelectionAction outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName CancelSelectionAction flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$UpdateAction outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName UpdateAction flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$GoHomeAction outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName GoHomeAction flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$ChangeToParentDirectoryAction outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName ChangeToParentDirectoryAction flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$AcceptAllFileFilter outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName AcceptAllFileFilter flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$BasicFileView outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName BasicFileView flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$NewFolderAction outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName NewFolderAction flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$SelectionListener outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName SelectionListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicFileChooserUI$DoubleClickListener outerClass javax/swing/plaf/basic/BasicFileChooserUI innerClassName DoubleClickListener flags 4 + +class name javax/swing/plaf/basic/BasicInternalFrameTitlePane +header extends javax/swing/JComponent nestMembers javax/swing/plaf/basic/BasicInternalFrameTitlePane$SystemMenuBar,javax/swing/plaf/basic/BasicInternalFrameTitlePane$SizeAction,javax/swing/plaf/basic/BasicInternalFrameTitlePane$MoveAction,javax/swing/plaf/basic/BasicInternalFrameTitlePane$RestoreAction,javax/swing/plaf/basic/BasicInternalFrameTitlePane$IconifyAction,javax/swing/plaf/basic/BasicInternalFrameTitlePane$MaximizeAction,javax/swing/plaf/basic/BasicInternalFrameTitlePane$CloseAction,javax/swing/plaf/basic/BasicInternalFrameTitlePane$TitlePaneLayout,javax/swing/plaf/basic/BasicInternalFrameTitlePane$PropertyChangeHandler flags 21 +innerclass innerClass java/awt/RenderingHints$Key outerClass java/awt/RenderingHints innerClassName Key flags 409 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane$MaximizeAction outerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane innerClassName MaximizeAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane$IconifyAction outerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane innerClassName IconifyAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane$CloseAction outerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane innerClassName CloseAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane$RestoreAction outerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane innerClassName RestoreAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane$MoveAction outerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane innerClassName MoveAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane$SizeAction outerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane innerClassName SizeAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane$SystemMenuBar outerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane innerClassName SystemMenuBar flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane$TitlePaneLayout outerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane innerClassName TitlePaneLayout flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane$PropertyChangeHandler outerClass javax/swing/plaf/basic/BasicInternalFrameTitlePane innerClassName PropertyChangeHandler flags 1 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/basic/BasicInternalFrameUI +header extends javax/swing/plaf/InternalFrameUI nestMembers javax/swing/plaf/basic/BasicInternalFrameUI$BasicInternalFrameListener,javax/swing/plaf/basic/BasicInternalFrameUI$GlassPaneDispatcher,javax/swing/plaf/basic/BasicInternalFrameUI$ComponentHandler,javax/swing/plaf/basic/BasicInternalFrameUI$BorderListener,javax/swing/plaf/basic/BasicInternalFrameUI$InternalFrameLayout,javax/swing/plaf/basic/BasicInternalFrameUI$InternalFramePropertyChangeListener flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameUI$BorderListener outerClass javax/swing/plaf/basic/BasicInternalFrameUI innerClassName BorderListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameUI$BasicInternalFrameListener outerClass javax/swing/plaf/basic/BasicInternalFrameUI innerClassName BasicInternalFrameListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameUI$GlassPaneDispatcher outerClass javax/swing/plaf/basic/BasicInternalFrameUI innerClassName GlassPaneDispatcher flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameUI$ComponentHandler outerClass javax/swing/plaf/basic/BasicInternalFrameUI innerClassName ComponentHandler flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameUI$InternalFrameLayout outerClass javax/swing/plaf/basic/BasicInternalFrameUI innerClassName InternalFrameLayout flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicInternalFrameUI$InternalFramePropertyChangeListener outerClass javax/swing/plaf/basic/BasicInternalFrameUI innerClassName InternalFramePropertyChangeListener flags 1 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/basic/BasicListUI +header extends javax/swing/plaf/ListUI nestMembers javax/swing/plaf/basic/BasicListUI$PropertyChangeHandler,javax/swing/plaf/basic/BasicListUI$ListDataHandler,javax/swing/plaf/basic/BasicListUI$ListSelectionHandler,javax/swing/plaf/basic/BasicListUI$FocusHandler,javax/swing/plaf/basic/BasicListUI$MouseInputHandler flags 21 +innerclass innerClass javax/swing/JList$DropLocation outerClass javax/swing/JList innerClassName DropLocation flags 19 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass javax/swing/plaf/basic/BasicListUI$PropertyChangeHandler outerClass javax/swing/plaf/basic/BasicListUI innerClassName PropertyChangeHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicListUI$ListDataHandler outerClass javax/swing/plaf/basic/BasicListUI innerClassName ListDataHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicListUI$ListSelectionHandler outerClass javax/swing/plaf/basic/BasicListUI innerClassName ListSelectionHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicListUI$FocusHandler outerClass javax/swing/plaf/basic/BasicListUI innerClassName FocusHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicListUI$MouseInputHandler outerClass javax/swing/plaf/basic/BasicListUI innerClassName MouseInputHandler flags 1 + +class name javax/swing/plaf/basic/BasicOptionPaneUI +header extends javax/swing/plaf/OptionPaneUI nestMembers javax/swing/plaf/basic/BasicOptionPaneUI$ButtonActionListener,javax/swing/plaf/basic/BasicOptionPaneUI$PropertyChangeHandler,javax/swing/plaf/basic/BasicOptionPaneUI$ButtonAreaLayout flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicOptionPaneUI$ButtonAreaLayout outerClass javax/swing/plaf/basic/BasicOptionPaneUI innerClassName ButtonAreaLayout flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicOptionPaneUI$ButtonActionListener outerClass javax/swing/plaf/basic/BasicOptionPaneUI innerClassName ButtonActionListener flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicOptionPaneUI$PropertyChangeHandler outerClass javax/swing/plaf/basic/BasicOptionPaneUI innerClassName PropertyChangeHandler flags 1 + +class name javax/swing/plaf/basic/BasicProgressBarUI +header extends javax/swing/plaf/ProgressBarUI nestMembers javax/swing/plaf/basic/BasicProgressBarUI$ChangeHandler flags 21 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass javax/swing/plaf/basic/BasicProgressBarUI$ChangeHandler outerClass javax/swing/plaf/basic/BasicProgressBarUI innerClassName ChangeHandler flags 1 + +class name javax/swing/plaf/basic/BasicScrollBarUI +header extends javax/swing/plaf/ScrollBarUI implements java/awt/LayoutManager,javax/swing/SwingConstants nestMembers javax/swing/plaf/basic/BasicScrollBarUI$PropertyChangeHandler,javax/swing/plaf/basic/BasicScrollBarUI$ScrollListener,javax/swing/plaf/basic/BasicScrollBarUI$ArrowButtonListener,javax/swing/plaf/basic/BasicScrollBarUI$TrackListener,javax/swing/plaf/basic/BasicScrollBarUI$ModelListener flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicScrollBarUI$TrackListener outerClass javax/swing/plaf/basic/BasicScrollBarUI innerClassName TrackListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicScrollBarUI$ArrowButtonListener outerClass javax/swing/plaf/basic/BasicScrollBarUI innerClassName ArrowButtonListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicScrollBarUI$ModelListener outerClass javax/swing/plaf/basic/BasicScrollBarUI innerClassName ModelListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicScrollBarUI$ScrollListener outerClass javax/swing/plaf/basic/BasicScrollBarUI innerClassName ScrollListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicScrollBarUI$PropertyChangeHandler outerClass javax/swing/plaf/basic/BasicScrollBarUI innerClassName PropertyChangeHandler flags 1 + +class name javax/swing/plaf/basic/BasicScrollPaneUI +header extends javax/swing/plaf/ScrollPaneUI implements javax/swing/ScrollPaneConstants nestMembers javax/swing/plaf/basic/BasicScrollPaneUI$PropertyChangeHandler,javax/swing/plaf/basic/BasicScrollPaneUI$MouseWheelHandler,javax/swing/plaf/basic/BasicScrollPaneUI$VSBChangeListener,javax/swing/plaf/basic/BasicScrollPaneUI$HSBChangeListener,javax/swing/plaf/basic/BasicScrollPaneUI$ViewportChangeHandler flags 21 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass javax/swing/plaf/basic/BasicScrollPaneUI$PropertyChangeHandler outerClass javax/swing/plaf/basic/BasicScrollPaneUI innerClassName PropertyChangeHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicScrollPaneUI$MouseWheelHandler outerClass javax/swing/plaf/basic/BasicScrollPaneUI innerClassName MouseWheelHandler flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicScrollPaneUI$VSBChangeListener outerClass javax/swing/plaf/basic/BasicScrollPaneUI innerClassName VSBChangeListener flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicScrollPaneUI$HSBChangeListener outerClass javax/swing/plaf/basic/BasicScrollPaneUI innerClassName HSBChangeListener flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicScrollPaneUI$ViewportChangeHandler outerClass javax/swing/plaf/basic/BasicScrollPaneUI innerClassName ViewportChangeHandler flags 1 + +class name javax/swing/plaf/basic/BasicSliderUI +header extends javax/swing/plaf/SliderUI nestMembers javax/swing/plaf/basic/BasicSliderUI$ActionScroller,javax/swing/plaf/basic/BasicSliderUI$FocusHandler,javax/swing/plaf/basic/BasicSliderUI$ComponentHandler,javax/swing/plaf/basic/BasicSliderUI$ScrollListener,javax/swing/plaf/basic/BasicSliderUI$TrackListener,javax/swing/plaf/basic/BasicSliderUI$ChangeHandler,javax/swing/plaf/basic/BasicSliderUI$PropertyChangeHandler flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicSliderUI$TrackListener outerClass javax/swing/plaf/basic/BasicSliderUI innerClassName TrackListener flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSliderUI$ScrollListener outerClass javax/swing/plaf/basic/BasicSliderUI innerClassName ScrollListener flags 1 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass javax/swing/plaf/basic/BasicSliderUI$ActionScroller outerClass javax/swing/plaf/basic/BasicSliderUI innerClassName ActionScroller flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSliderUI$FocusHandler outerClass javax/swing/plaf/basic/BasicSliderUI innerClassName FocusHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSliderUI$ComponentHandler outerClass javax/swing/plaf/basic/BasicSliderUI innerClassName ComponentHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSliderUI$ChangeHandler outerClass javax/swing/plaf/basic/BasicSliderUI innerClassName ChangeHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSliderUI$PropertyChangeHandler outerClass javax/swing/plaf/basic/BasicSliderUI innerClassName PropertyChangeHandler flags 1 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/basic/BasicSpinnerUI +header extends javax/swing/plaf/SpinnerUI flags 21 +innerclass innerClass javax/swing/JSpinner$DefaultEditor outerClass javax/swing/JSpinner innerClassName DefaultEditor flags 9 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 + +class name javax/swing/plaf/basic/BasicSplitPaneDivider +header extends java/awt/Container implements java/beans/PropertyChangeListener nestMembers javax/swing/plaf/basic/BasicSplitPaneDivider$DividerLayout,javax/swing/plaf/basic/BasicSplitPaneDivider$VerticalDragController,javax/swing/plaf/basic/BasicSplitPaneDivider$DragController,javax/swing/plaf/basic/BasicSplitPaneDivider$MouseHandler flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneDivider$DividerLayout outerClass javax/swing/plaf/basic/BasicSplitPaneDivider innerClassName DividerLayout flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneDivider$MouseHandler outerClass javax/swing/plaf/basic/BasicSplitPaneDivider innerClassName MouseHandler flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneDivider$VerticalDragController outerClass javax/swing/plaf/basic/BasicSplitPaneDivider innerClassName VerticalDragController flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneDivider$DragController outerClass javax/swing/plaf/basic/BasicSplitPaneDivider innerClassName DragController flags 4 + +class name javax/swing/plaf/basic/BasicSplitPaneUI +header extends javax/swing/plaf/SplitPaneUI nestMembers javax/swing/plaf/basic/BasicSplitPaneUI$BasicVerticalLayoutManager,javax/swing/plaf/basic/BasicSplitPaneUI$BasicHorizontalLayoutManager,javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardResizeToggleHandler,javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardEndHandler,javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardHomeHandler,javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardDownRightHandler,javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardUpLeftHandler,javax/swing/plaf/basic/BasicSplitPaneUI$FocusHandler,javax/swing/plaf/basic/BasicSplitPaneUI$PropertyHandler flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneUI$BasicHorizontalLayoutManager outerClass javax/swing/plaf/basic/BasicSplitPaneUI innerClassName BasicHorizontalLayoutManager flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardUpLeftHandler outerClass javax/swing/plaf/basic/BasicSplitPaneUI innerClassName KeyboardUpLeftHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardDownRightHandler outerClass javax/swing/plaf/basic/BasicSplitPaneUI innerClassName KeyboardDownRightHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardHomeHandler outerClass javax/swing/plaf/basic/BasicSplitPaneUI innerClassName KeyboardHomeHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardEndHandler outerClass javax/swing/plaf/basic/BasicSplitPaneUI innerClassName KeyboardEndHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneUI$KeyboardResizeToggleHandler outerClass javax/swing/plaf/basic/BasicSplitPaneUI innerClassName KeyboardResizeToggleHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneUI$BasicVerticalLayoutManager outerClass javax/swing/plaf/basic/BasicSplitPaneUI innerClassName BasicVerticalLayoutManager flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneUI$FocusHandler outerClass javax/swing/plaf/basic/BasicSplitPaneUI innerClassName FocusHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicSplitPaneUI$PropertyHandler outerClass javax/swing/plaf/basic/BasicSplitPaneUI innerClassName PropertyHandler flags 1 + +class name javax/swing/plaf/basic/BasicTabbedPaneUI +header extends javax/swing/plaf/TabbedPaneUI implements javax/swing/SwingConstants nestMembers javax/swing/plaf/basic/BasicTabbedPaneUI$FocusHandler,javax/swing/plaf/basic/BasicTabbedPaneUI$MouseHandler,javax/swing/plaf/basic/BasicTabbedPaneUI$TabSelectionHandler,javax/swing/plaf/basic/BasicTabbedPaneUI$PropertyChangeHandler,javax/swing/plaf/basic/BasicTabbedPaneUI$TabbedPaneLayout flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicTabbedPaneUI$TabbedPaneLayout outerClass javax/swing/plaf/basic/BasicTabbedPaneUI innerClassName TabbedPaneLayout flags 1 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass javax/swing/plaf/basic/BasicTabbedPaneUI$FocusHandler outerClass javax/swing/plaf/basic/BasicTabbedPaneUI innerClassName FocusHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTabbedPaneUI$MouseHandler outerClass javax/swing/plaf/basic/BasicTabbedPaneUI innerClassName MouseHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTabbedPaneUI$TabSelectionHandler outerClass javax/swing/plaf/basic/BasicTabbedPaneUI innerClassName TabSelectionHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTabbedPaneUI$PropertyChangeHandler outerClass javax/swing/plaf/basic/BasicTabbedPaneUI innerClassName PropertyChangeHandler flags 1 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/basic/BasicTableUI +header extends javax/swing/plaf/TableUI nestMembers javax/swing/plaf/basic/BasicTableUI$MouseInputHandler,javax/swing/plaf/basic/BasicTableUI$FocusHandler,javax/swing/plaf/basic/BasicTableUI$KeyHandler flags 21 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass javax/swing/JTable$PrintMode outerClass javax/swing/JTable innerClassName PrintMode flags 4019 +innerclass innerClass javax/swing/JTable$DropLocation outerClass javax/swing/JTable innerClassName DropLocation flags 19 +innerclass innerClass javax/swing/plaf/basic/BasicTableUI$MouseInputHandler outerClass javax/swing/plaf/basic/BasicTableUI innerClassName MouseInputHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTableUI$FocusHandler outerClass javax/swing/plaf/basic/BasicTableUI innerClassName FocusHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTableUI$KeyHandler outerClass javax/swing/plaf/basic/BasicTableUI innerClassName KeyHandler flags 1 + +class name javax/swing/plaf/basic/BasicTextUI +header extends javax/swing/plaf/TextUI implements javax/swing/text/ViewFactory nestMembers javax/swing/plaf/basic/BasicTextUI$BasicHighlighter,javax/swing/plaf/basic/BasicTextUI$BasicCaret flags 421 +innerclass innerClass javax/swing/plaf/basic/BasicTextUI$BasicCaret outerClass javax/swing/plaf/basic/BasicTextUI innerClassName BasicCaret flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicTextUI$BasicHighlighter outerClass javax/swing/plaf/basic/BasicTextUI innerClassName BasicHighlighter flags 9 +innerclass innerClass javax/swing/text/JTextComponent$KeyBinding outerClass javax/swing/text/JTextComponent innerClassName KeyBinding flags 9 +innerclass innerClass javax/swing/text/DefaultEditorKit$InsertBreakAction outerClass javax/swing/text/DefaultEditorKit innerClassName InsertBreakAction flags 9 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/basic/BasicToolBarUI +header extends javax/swing/plaf/ToolBarUI implements javax/swing/SwingConstants nestMembers javax/swing/plaf/basic/BasicToolBarUI$DragWindow,javax/swing/plaf/basic/BasicToolBarUI$DockingListener,javax/swing/plaf/basic/BasicToolBarUI$PropertyListener,javax/swing/plaf/basic/BasicToolBarUI$ToolBarFocusListener,javax/swing/plaf/basic/BasicToolBarUI$ToolBarContListener,javax/swing/plaf/basic/BasicToolBarUI$FrameListener flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicToolBarUI$DragWindow outerClass javax/swing/plaf/basic/BasicToolBarUI innerClassName DragWindow flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$RolloverButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName RolloverButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$ButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName ButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$RadioButtonBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName RadioButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicToolBarUI$FrameListener outerClass javax/swing/plaf/basic/BasicToolBarUI innerClassName FrameListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicToolBarUI$DockingListener outerClass javax/swing/plaf/basic/BasicToolBarUI innerClassName DockingListener flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicToolBarUI$PropertyListener outerClass javax/swing/plaf/basic/BasicToolBarUI innerClassName PropertyListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicToolBarUI$ToolBarFocusListener outerClass javax/swing/plaf/basic/BasicToolBarUI innerClassName ToolBarFocusListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicToolBarUI$ToolBarContListener outerClass javax/swing/plaf/basic/BasicToolBarUI innerClassName ToolBarContListener flags 4 + +class name javax/swing/plaf/basic/BasicTreeUI +header extends javax/swing/plaf/TreeUI nestMembers javax/swing/plaf/basic/BasicTreeUI$MouseInputHandler,javax/swing/plaf/basic/BasicTreeUI$TreeCancelEditingAction,javax/swing/plaf/basic/BasicTreeUI$TreeToggleAction,javax/swing/plaf/basic/BasicTreeUI$TreeHomeAction,javax/swing/plaf/basic/BasicTreeUI$TreeIncrementAction,javax/swing/plaf/basic/BasicTreeUI$TreePageAction,javax/swing/plaf/basic/BasicTreeUI$TreeTraverseAction,javax/swing/plaf/basic/BasicTreeUI$SelectionModelPropertyChangeHandler,javax/swing/plaf/basic/BasicTreeUI$PropertyChangeHandler,javax/swing/plaf/basic/BasicTreeUI$MouseHandler,javax/swing/plaf/basic/BasicTreeUI$NodeDimensionsHandler,javax/swing/plaf/basic/BasicTreeUI$FocusHandler,javax/swing/plaf/basic/BasicTreeUI$KeyHandler,javax/swing/plaf/basic/BasicTreeUI$CellEditorHandler,javax/swing/plaf/basic/BasicTreeUI$TreeSelectionHandler,javax/swing/plaf/basic/BasicTreeUI$TreeModelHandler,javax/swing/plaf/basic/BasicTreeUI$ComponentHandler,javax/swing/plaf/basic/BasicTreeUI$TreeExpansionHandler flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$NodeDimensionsHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName NodeDimensionsHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$ComponentHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName ComponentHandler flags 1 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass javax/swing/JTree$DropLocation outerClass javax/swing/JTree innerClassName DropLocation flags 19 +innerclass innerClass javax/swing/tree/AbstractLayoutCache$NodeDimensions outerClass javax/swing/tree/AbstractLayoutCache innerClassName NodeDimensions flags 409 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$MouseInputHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName MouseInputHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$TreeCancelEditingAction outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName TreeCancelEditingAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$TreeToggleAction outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName TreeToggleAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$TreeHomeAction outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName TreeHomeAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$TreeIncrementAction outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName TreeIncrementAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$TreePageAction outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName TreePageAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$TreeTraverseAction outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName TreeTraverseAction flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$SelectionModelPropertyChangeHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName SelectionModelPropertyChangeHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$PropertyChangeHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName PropertyChangeHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$MouseHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName MouseHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$FocusHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName FocusHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$KeyHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName KeyHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$CellEditorHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName CellEditorHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$TreeSelectionHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName TreeSelectionHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$TreeModelHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName TreeModelHandler flags 1 +innerclass innerClass javax/swing/plaf/basic/BasicTreeUI$TreeExpansionHandler outerClass javax/swing/plaf/basic/BasicTreeUI innerClassName TreeExpansionHandler flags 1 + +class name javax/swing/plaf/metal/MetalBorders +header extends java/lang/Object nestMembers javax/swing/plaf/metal/MetalBorders$TableHeaderBorder,javax/swing/plaf/metal/MetalBorders$ToggleButtonBorder,javax/swing/plaf/metal/MetalBorders$ScrollPaneBorder,javax/swing/plaf/metal/MetalBorders$TextFieldBorder,javax/swing/plaf/metal/MetalBorders$ToolBarBorder,javax/swing/plaf/metal/MetalBorders$RolloverButtonBorder,javax/swing/plaf/metal/MetalBorders$PopupMenuBorder,javax/swing/plaf/metal/MetalBorders$MenuItemBorder,javax/swing/plaf/metal/MetalBorders$MenuBarBorder,javax/swing/plaf/metal/MetalBorders$OptionDialogBorder,javax/swing/plaf/metal/MetalBorders$PaletteBorder,javax/swing/plaf/metal/MetalBorders$InternalFrameBorder,javax/swing/plaf/metal/MetalBorders$ButtonBorder,javax/swing/plaf/metal/MetalBorders$Flush3DBorder flags 21 +innerclass innerClass javax/swing/plaf/BorderUIResource$CompoundBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName CompoundBorderUIResource flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$ButtonBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName ButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/basic/BasicBorders$MarginBorder outerClass javax/swing/plaf/basic/BasicBorders innerClassName MarginBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$Flush3DBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName Flush3DBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$TextFieldBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName TextFieldBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$ToggleButtonBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName ToggleButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$RolloverButtonBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName RolloverButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$TableHeaderBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName TableHeaderBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$ScrollPaneBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName ScrollPaneBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$ToolBarBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName ToolBarBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$PopupMenuBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName PopupMenuBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$MenuItemBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName MenuItemBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$MenuBarBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName MenuBarBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$OptionDialogBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName OptionDialogBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$PaletteBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName PaletteBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$InternalFrameBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName InternalFrameBorder flags 9 + +class name javax/swing/plaf/metal/MetalBorders$RolloverButtonBorder +header extends javax/swing/plaf/metal/MetalBorders$ButtonBorder nestHost javax/swing/plaf/metal/MetalBorders flags 21 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$ButtonBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName ButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$RolloverButtonBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName RolloverButtonBorder flags 9 + +class name javax/swing/plaf/metal/MetalBorders$TextFieldBorder +header extends javax/swing/plaf/metal/MetalBorders$Flush3DBorder nestHost javax/swing/plaf/metal/MetalBorders flags 21 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$Flush3DBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName Flush3DBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$TextFieldBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName TextFieldBorder flags 9 + +class name javax/swing/plaf/metal/MetalBorders$ToggleButtonBorder +header extends javax/swing/plaf/metal/MetalBorders$ButtonBorder nestHost javax/swing/plaf/metal/MetalBorders flags 21 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$ButtonBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName ButtonBorder flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalBorders$ToggleButtonBorder outerClass javax/swing/plaf/metal/MetalBorders innerClassName ToggleButtonBorder flags 9 + +class name javax/swing/plaf/metal/MetalComboBoxUI +header extends javax/swing/plaf/basic/BasicComboBoxUI nestMembers javax/swing/plaf/metal/MetalComboBoxUI$MetalComboPopup,javax/swing/plaf/metal/MetalComboBoxUI$MetalComboBoxLayoutManager,javax/swing/plaf/metal/MetalComboBoxUI$MetalPropertyChangeListener flags 21 +innerclass innerClass javax/swing/plaf/metal/MetalComboBoxEditor$UIResource outerClass javax/swing/plaf/metal/MetalComboBoxEditor innerClassName UIResource flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalComboBoxUI$MetalPropertyChangeListener outerClass javax/swing/plaf/metal/MetalComboBoxUI innerClassName MetalPropertyChangeListener flags 1 +innerclass innerClass javax/swing/plaf/metal/MetalComboBoxUI$MetalComboBoxLayoutManager outerClass javax/swing/plaf/metal/MetalComboBoxUI innerClassName MetalComboBoxLayoutManager flags 1 +innerclass innerClass javax/swing/plaf/metal/MetalComboBoxUI$MetalComboPopup outerClass javax/swing/plaf/metal/MetalComboBoxUI innerClassName MetalComboPopup flags 1 + +class name javax/swing/plaf/metal/MetalFileChooserUI +header extends javax/swing/plaf/basic/BasicFileChooserUI nestMembers javax/swing/plaf/metal/MetalFileChooserUI$DirectoryComboBoxAction,javax/swing/plaf/metal/MetalFileChooserUI$FilterComboBoxModel,javax/swing/plaf/metal/MetalFileChooserUI$FilterComboBoxRenderer,javax/swing/plaf/metal/MetalFileChooserUI$DirectoryComboBoxModel,javax/swing/plaf/metal/MetalFileChooserUI$FileRenderer,javax/swing/plaf/metal/MetalFileChooserUI$SingleClickListener flags 21 +innerclass innerClass javax/swing/plaf/metal/MetalFileChooserUI$DirectoryComboBoxAction outerClass javax/swing/plaf/metal/MetalFileChooserUI innerClassName DirectoryComboBoxAction flags 4 +innerclass innerClass javax/swing/plaf/metal/MetalFileChooserUI$DirectoryComboBoxModel outerClass javax/swing/plaf/metal/MetalFileChooserUI innerClassName DirectoryComboBoxModel flags 4 +innerclass innerClass javax/swing/plaf/metal/MetalFileChooserUI$FilterComboBoxModel outerClass javax/swing/plaf/metal/MetalFileChooserUI innerClassName FilterComboBoxModel flags 4 +innerclass innerClass javax/swing/plaf/metal/MetalFileChooserUI$FilterComboBoxRenderer outerClass javax/swing/plaf/metal/MetalFileChooserUI innerClassName FilterComboBoxRenderer flags 1 +innerclass innerClass javax/swing/plaf/metal/MetalFileChooserUI$FileRenderer outerClass javax/swing/plaf/metal/MetalFileChooserUI innerClassName FileRenderer flags 4 +innerclass innerClass javax/swing/plaf/metal/MetalFileChooserUI$SingleClickListener outerClass javax/swing/plaf/metal/MetalFileChooserUI innerClassName SingleClickListener flags 4 + +class name javax/swing/plaf/metal/MetalIconFactory +header extends java/lang/Object implements java/io/Serializable nestMembers javax/swing/plaf/metal/MetalIconFactory$TreeControlIcon,javax/swing/plaf/metal/MetalIconFactory$TreeLeafIcon,javax/swing/plaf/metal/MetalIconFactory$FileIcon16,javax/swing/plaf/metal/MetalIconFactory$TreeFolderIcon,javax/swing/plaf/metal/MetalIconFactory$FolderIcon16,javax/swing/plaf/metal/MetalIconFactory$PaletteCloseIcon flags 21 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$TreeFolderIcon outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName TreeFolderIcon flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$TreeLeafIcon outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName TreeLeafIcon flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$TreeControlIcon outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName TreeControlIcon flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$FileIcon16 outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName FileIcon16 flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$FolderIcon16 outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName FolderIcon16 flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$PaletteCloseIcon outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName PaletteCloseIcon flags 9 + +class name javax/swing/plaf/metal/MetalIconFactory$TreeFolderIcon +header extends javax/swing/plaf/metal/MetalIconFactory$FolderIcon16 nestHost javax/swing/plaf/metal/MetalIconFactory flags 21 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$FolderIcon16 outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName FolderIcon16 flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$TreeFolderIcon outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName TreeFolderIcon flags 9 + +class name javax/swing/plaf/metal/MetalIconFactory$TreeLeafIcon +header extends javax/swing/plaf/metal/MetalIconFactory$FileIcon16 nestHost javax/swing/plaf/metal/MetalIconFactory flags 21 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$FileIcon16 outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName FileIcon16 flags 9 +innerclass innerClass javax/swing/plaf/metal/MetalIconFactory$TreeLeafIcon outerClass javax/swing/plaf/metal/MetalIconFactory innerClassName TreeLeafIcon flags 9 + +class name javax/swing/plaf/metal/MetalSliderUI +header extends javax/swing/plaf/basic/BasicSliderUI nestMembers javax/swing/plaf/metal/MetalSliderUI$MetalPropertyListener flags 21 +innerclass innerClass javax/swing/plaf/basic/BasicSliderUI$ScrollListener outerClass javax/swing/plaf/basic/BasicSliderUI innerClassName ScrollListener flags 1 +innerclass innerClass javax/swing/plaf/metal/MetalSliderUI$MetalPropertyListener outerClass javax/swing/plaf/metal/MetalSliderUI innerClassName MetalPropertyListener flags 4 + +class name javax/swing/plaf/metal/MetalToolBarUI +header extends javax/swing/plaf/basic/BasicToolBarUI nestMembers javax/swing/plaf/metal/MetalToolBarUI$MetalDockingListener,javax/swing/plaf/metal/MetalToolBarUI$MetalRolloverListener,javax/swing/plaf/metal/MetalToolBarUI$MetalContainerListener flags 21 +innerclass innerClass javax/swing/plaf/metal/MetalToolBarUI$MetalDockingListener outerClass javax/swing/plaf/metal/MetalToolBarUI innerClassName MetalDockingListener flags 4 +innerclass innerClass javax/swing/plaf/basic/BasicToolBarUI$DragWindow outerClass javax/swing/plaf/basic/BasicToolBarUI innerClassName DragWindow flags 4 +innerclass innerClass javax/swing/plaf/metal/MetalToolBarUI$MetalRolloverListener outerClass javax/swing/plaf/metal/MetalToolBarUI innerClassName MetalRolloverListener flags 4 +innerclass innerClass javax/swing/plaf/metal/MetalToolBarUI$MetalContainerListener outerClass javax/swing/plaf/metal/MetalToolBarUI innerClassName MetalContainerListener flags 4 + +class name javax/swing/table/DefaultTableCellRenderer +header extends javax/swing/JLabel implements javax/swing/table/TableCellRenderer,java/io/Serializable nestMembers javax/swing/table/DefaultTableCellRenderer$UIResource flags 21 +innerclass innerClass javax/swing/JTable$DropLocation outerClass javax/swing/JTable innerClassName DropLocation flags 19 +innerclass innerClass javax/swing/table/DefaultTableCellRenderer$UIResource outerClass javax/swing/table/DefaultTableCellRenderer innerClassName UIResource flags 9 + +class name javax/swing/table/JTableHeader$AccessibleJTableHeader +header extends javax/swing/JComponent$AccessibleJComponent nestHost javax/swing/table/JTableHeader flags 21 +innerclass innerClass javax/swing/table/JTableHeader$AccessibleJTableHeader outerClass javax/swing/table/JTableHeader innerClassName AccessibleJTableHeader flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +innerclass innerClass javax/swing/table/JTableHeader$AccessibleJTableHeader$AccessibleJTableHeaderEntry outerClass javax/swing/table/JTableHeader$AccessibleJTableHeader innerClassName AccessibleJTableHeaderEntry flags 4 + +class name javax/swing/text/AbstractDocument +header extends java/lang/Object implements javax/swing/text/Document,java/io/Serializable nestMembers javax/swing/text/AbstractDocument$ElementEdit,javax/swing/text/AbstractDocument$DefaultDocumentEvent,javax/swing/text/AbstractDocument$LeafElement,javax/swing/text/AbstractDocument$BranchElement,javax/swing/text/AbstractDocument$AbstractElement,javax/swing/text/AbstractDocument$AttributeContext,javax/swing/text/AbstractDocument$Content flags 421 +innerclass innerClass javax/swing/text/AbstractDocument$Content outerClass javax/swing/text/AbstractDocument innerClassName Content flags 609 +innerclass innerClass javax/swing/text/AbstractDocument$AttributeContext outerClass javax/swing/text/AbstractDocument innerClassName AttributeContext flags 609 +innerclass innerClass javax/swing/text/AbstractDocument$BranchElement outerClass javax/swing/text/AbstractDocument innerClassName BranchElement flags 1 +innerclass innerClass javax/swing/text/AbstractDocument$DefaultDocumentEvent outerClass javax/swing/text/AbstractDocument innerClassName DefaultDocumentEvent flags 1 +innerclass innerClass javax/swing/event/DocumentEvent$EventType outerClass javax/swing/event/DocumentEvent innerClassName EventType flags 19 +innerclass innerClass javax/swing/text/DocumentFilter$FilterBypass outerClass javax/swing/text/DocumentFilter innerClassName FilterBypass flags 409 +innerclass innerClass javax/swing/text/AbstractDocument$ElementEdit outerClass javax/swing/text/AbstractDocument innerClassName ElementEdit flags 9 +innerclass innerClass javax/swing/text/AbstractDocument$AbstractElement outerClass javax/swing/text/AbstractDocument innerClassName AbstractElement flags 401 +innerclass innerClass javax/swing/text/AbstractDocument$LeafElement outerClass javax/swing/text/AbstractDocument innerClassName LeafElement flags 1 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/AbstractDocument$AbstractElement +header extends java/lang/Object implements javax/swing/text/Element,javax/swing/text/MutableAttributeSet,java/io/Serializable,javax/swing/tree/TreeNode nestHost javax/swing/text/AbstractDocument flags 421 +innerclass innerClass javax/swing/text/AbstractDocument$AbstractElement outerClass javax/swing/text/AbstractDocument innerClassName AbstractElement flags 401 +innerclass innerClass javax/swing/text/AbstractDocument$AttributeContext outerClass javax/swing/text/AbstractDocument innerClassName AttributeContext flags 609 +innerclass innerClass javax/swing/text/AbstractDocument$Content outerClass javax/swing/text/AbstractDocument innerClassName Content flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/AbstractDocument$BranchElement +header extends javax/swing/text/AbstractDocument$AbstractElement nestHost javax/swing/text/AbstractDocument flags 21 +innerclass innerClass javax/swing/text/AbstractDocument$BranchElement outerClass javax/swing/text/AbstractDocument innerClassName BranchElement flags 1 +innerclass innerClass javax/swing/text/AbstractDocument$AbstractElement outerClass javax/swing/text/AbstractDocument innerClassName AbstractElement flags 401 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/AbstractDocument$DefaultDocumentEvent +header extends javax/swing/undo/CompoundEdit implements javax/swing/event/DocumentEvent nestHost javax/swing/text/AbstractDocument flags 21 +innerclass innerClass javax/swing/text/AbstractDocument$DefaultDocumentEvent outerClass javax/swing/text/AbstractDocument innerClassName DefaultDocumentEvent flags 1 +innerclass innerClass javax/swing/event/DocumentEvent$EventType outerClass javax/swing/event/DocumentEvent innerClassName EventType flags 19 +innerclass innerClass javax/swing/event/DocumentEvent$ElementChange outerClass javax/swing/event/DocumentEvent innerClassName ElementChange flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/AsyncBoxView +header extends javax/swing/text/View nestMembers javax/swing/text/AsyncBoxView$ChildState,javax/swing/text/AsyncBoxView$ChildLocator flags 21 +innerclass innerClass javax/swing/text/AsyncBoxView$ChildLocator outerClass javax/swing/text/AsyncBoxView innerClassName ChildLocator flags 1 +innerclass innerClass javax/swing/text/AsyncBoxView$ChildState outerClass javax/swing/text/AsyncBoxView innerClassName ChildState flags 1 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/event/DocumentEvent$ElementChange outerClass javax/swing/event/DocumentEvent innerClassName ElementChange flags 609 + +class name javax/swing/text/AsyncBoxView$ChildLocator +header extends java/lang/Object nestHost javax/swing/text/AsyncBoxView flags 21 +innerclass innerClass javax/swing/text/AsyncBoxView$ChildLocator outerClass javax/swing/text/AsyncBoxView innerClassName ChildLocator flags 1 +innerclass innerClass javax/swing/text/AsyncBoxView$ChildState outerClass javax/swing/text/AsyncBoxView innerClassName ChildState flags 1 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 + +class name javax/swing/text/DefaultCaret +header extends java/awt/Rectangle implements javax/swing/text/Caret,java/awt/event/FocusListener,java/awt/event/MouseListener,java/awt/event/MouseMotionListener flags 21 +innerclass innerClass javax/swing/text/LayeredHighlighter$LayerPainter outerClass javax/swing/text/LayeredHighlighter innerClassName LayerPainter flags 409 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/awt/event/FocusEvent$Cause outerClass java/awt/event/FocusEvent innerClassName Cause flags 4019 +innerclass innerClass javax/swing/text/Highlighter$HighlightPainter outerClass javax/swing/text/Highlighter innerClassName HighlightPainter flags 609 +innerclass innerClass javax/swing/text/NavigationFilter$FilterBypass outerClass javax/swing/text/NavigationFilter innerClassName FilterBypass flags 409 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/DefaultEditorKit +header extends javax/swing/text/EditorKit nestMembers javax/swing/text/DefaultEditorKit$BeepAction,javax/swing/text/DefaultEditorKit$PasteAction,javax/swing/text/DefaultEditorKit$CopyAction,javax/swing/text/DefaultEditorKit$CutAction,javax/swing/text/DefaultEditorKit$InsertTabAction,javax/swing/text/DefaultEditorKit$InsertBreakAction,javax/swing/text/DefaultEditorKit$InsertContentAction,javax/swing/text/DefaultEditorKit$DefaultKeyTypedAction flags 21 +innerclass innerClass javax/swing/text/DefaultEditorKit$InsertContentAction outerClass javax/swing/text/DefaultEditorKit innerClassName InsertContentAction flags 9 +innerclass innerClass javax/swing/text/DefaultEditorKit$CutAction outerClass javax/swing/text/DefaultEditorKit innerClassName CutAction flags 9 +innerclass innerClass javax/swing/text/DefaultEditorKit$CopyAction outerClass javax/swing/text/DefaultEditorKit innerClassName CopyAction flags 9 +innerclass innerClass javax/swing/text/DefaultEditorKit$PasteAction outerClass javax/swing/text/DefaultEditorKit innerClassName PasteAction flags 9 +innerclass innerClass javax/swing/text/DefaultEditorKit$InsertBreakAction outerClass javax/swing/text/DefaultEditorKit innerClassName InsertBreakAction flags 9 +innerclass innerClass javax/swing/text/DefaultEditorKit$BeepAction outerClass javax/swing/text/DefaultEditorKit innerClassName BeepAction flags 9 +innerclass innerClass javax/swing/text/DefaultEditorKit$DefaultKeyTypedAction outerClass javax/swing/text/DefaultEditorKit innerClassName DefaultKeyTypedAction flags 9 +innerclass innerClass javax/swing/text/DefaultEditorKit$InsertTabAction outerClass javax/swing/text/DefaultEditorKit innerClassName InsertTabAction flags 9 + +class name javax/swing/text/DefaultFormatter +header extends javax/swing/JFormattedTextField$AbstractFormatter implements java/lang/Cloneable,java/io/Serializable flags 21 +innerclass innerClass javax/swing/JFormattedTextField$AbstractFormatter outerClass javax/swing/JFormattedTextField innerClassName AbstractFormatter flags 409 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/text/DocumentFilter$FilterBypass outerClass javax/swing/text/DocumentFilter innerClassName FilterBypass flags 409 +innerclass innerClass javax/swing/text/NavigationFilter$FilterBypass outerClass javax/swing/text/NavigationFilter innerClassName FilterBypass flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/DefaultFormatterFactory +header extends javax/swing/JFormattedTextField$AbstractFormatterFactory implements java/io/Serializable flags 21 +innerclass innerClass javax/swing/JFormattedTextField$AbstractFormatterFactory outerClass javax/swing/JFormattedTextField innerClassName AbstractFormatterFactory flags 409 +innerclass innerClass javax/swing/JFormattedTextField$AbstractFormatter outerClass javax/swing/JFormattedTextField innerClassName AbstractFormatter flags 409 + +class name javax/swing/text/DefaultHighlighter +header extends javax/swing/text/LayeredHighlighter nestMembers javax/swing/text/DefaultHighlighter$DefaultHighlightPainter flags 21 +innerclass innerClass javax/swing/text/Highlighter$HighlightPainter outerClass javax/swing/text/Highlighter innerClassName HighlightPainter flags 609 +innerclass innerClass javax/swing/text/LayeredHighlighter$LayerPainter outerClass javax/swing/text/LayeredHighlighter innerClassName LayerPainter flags 409 +innerclass innerClass javax/swing/text/Highlighter$Highlight outerClass javax/swing/text/Highlighter innerClassName Highlight flags 609 +innerclass innerClass javax/swing/text/DefaultHighlighter$DefaultHighlightPainter outerClass javax/swing/text/DefaultHighlighter innerClassName DefaultHighlightPainter flags 9 + +class name javax/swing/text/DefaultHighlighter$DefaultHighlightPainter +header extends javax/swing/text/LayeredHighlighter$LayerPainter nestHost javax/swing/text/DefaultHighlighter flags 21 +innerclass innerClass javax/swing/text/LayeredHighlighter$LayerPainter outerClass javax/swing/text/LayeredHighlighter innerClassName LayerPainter flags 409 +innerclass innerClass javax/swing/text/DefaultHighlighter$DefaultHighlightPainter outerClass javax/swing/text/DefaultHighlighter innerClassName DefaultHighlightPainter flags 9 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 + +class name javax/swing/text/DefaultStyledDocument +header extends javax/swing/text/AbstractDocument implements javax/swing/text/StyledDocument nestMembers javax/swing/text/DefaultStyledDocument$AttributeUndoableEdit,javax/swing/text/DefaultStyledDocument$ElementBuffer,javax/swing/text/DefaultStyledDocument$ElementSpec,javax/swing/text/DefaultStyledDocument$SectionElement flags 21 +innerclass innerClass javax/swing/text/AbstractDocument$Content outerClass javax/swing/text/AbstractDocument innerClassName Content flags 609 +innerclass innerClass javax/swing/text/AbstractDocument$AttributeContext outerClass javax/swing/text/AbstractDocument innerClassName AttributeContext flags 609 +innerclass innerClass javax/swing/text/DefaultStyledDocument$ElementBuffer outerClass javax/swing/text/DefaultStyledDocument innerClassName ElementBuffer flags 1 +innerclass innerClass javax/swing/text/AbstractDocument$AbstractElement outerClass javax/swing/text/AbstractDocument innerClassName AbstractElement flags 401 +innerclass innerClass javax/swing/text/DefaultStyledDocument$ElementSpec outerClass javax/swing/text/DefaultStyledDocument innerClassName ElementSpec flags 9 +innerclass innerClass javax/swing/text/AbstractDocument$DefaultDocumentEvent outerClass javax/swing/text/AbstractDocument innerClassName DefaultDocumentEvent flags 1 +innerclass innerClass javax/swing/event/DocumentEvent$EventType outerClass javax/swing/event/DocumentEvent innerClassName EventType flags 19 +innerclass innerClass javax/swing/text/AbstractDocument$BranchElement outerClass javax/swing/text/AbstractDocument innerClassName BranchElement flags 1 +innerclass innerClass javax/swing/text/AbstractDocument$ElementEdit outerClass javax/swing/text/AbstractDocument innerClassName ElementEdit flags 9 +innerclass innerClass javax/swing/text/DefaultStyledDocument$AttributeUndoableEdit outerClass javax/swing/text/DefaultStyledDocument innerClassName AttributeUndoableEdit flags 9 +innerclass innerClass javax/swing/text/DefaultStyledDocument$SectionElement outerClass javax/swing/text/DefaultStyledDocument innerClassName SectionElement flags 4 +innerclass innerClass javax/swing/text/AbstractDocument$LeafElement outerClass javax/swing/text/AbstractDocument innerClassName LeafElement flags 1 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 + +class name javax/swing/text/DefaultStyledDocument$ElementBuffer +header extends java/lang/Object implements java/io/Serializable nestHost javax/swing/text/DefaultStyledDocument flags 21 +innerclass innerClass javax/swing/text/DefaultStyledDocument$ElementBuffer outerClass javax/swing/text/DefaultStyledDocument innerClassName ElementBuffer flags 1 +innerclass innerClass javax/swing/text/DefaultStyledDocument$ElementSpec outerClass javax/swing/text/DefaultStyledDocument innerClassName ElementSpec flags 9 +innerclass innerClass javax/swing/text/AbstractDocument$DefaultDocumentEvent outerClass javax/swing/text/AbstractDocument innerClassName DefaultDocumentEvent flags 1 +innerclass innerClass javax/swing/text/DefaultStyledDocument$AttributeUndoableEdit outerClass javax/swing/text/DefaultStyledDocument innerClassName AttributeUndoableEdit flags 9 +innerclass innerClass javax/swing/text/AbstractDocument$BranchElement outerClass javax/swing/text/AbstractDocument innerClassName BranchElement flags 1 +innerclass innerClass javax/swing/text/AbstractDocument$ElementEdit outerClass javax/swing/text/AbstractDocument innerClassName ElementEdit flags 9 + +class name javax/swing/text/GlyphView$GlyphPainter +header extends java/lang/Object nestHost javax/swing/text/GlyphView flags 421 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/text/GlyphView$GlyphPainter outerClass javax/swing/text/GlyphView innerClassName GlyphPainter flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/Highlighter$Highlight +header extends java/lang/Object nestHost javax/swing/text/Highlighter flags 601 +innerclass innerClass javax/swing/text/Highlighter$Highlight outerClass javax/swing/text/Highlighter innerClassName Highlight flags 609 +innerclass innerClass javax/swing/text/Highlighter$HighlightPainter outerClass javax/swing/text/Highlighter innerClassName HighlightPainter flags 609 + +class name javax/swing/text/JTextComponent +header extends javax/swing/JComponent implements javax/swing/Scrollable,javax/accessibility/Accessible nestMembers javax/swing/text/JTextComponent$DropLocation,javax/swing/text/JTextComponent$AccessibleJTextComponent,javax/swing/text/JTextComponent$KeyBinding flags 421 runtimeAnnotations @Ljava/beans/JavaBean;(defaultProperty="UI")@Ljavax/swing/SwingContainer;(value=Zfalse) +innerclass innerClass javax/swing/text/JTextComponent$AccessibleJTextComponent outerClass javax/swing/text/JTextComponent innerClassName AccessibleJTextComponent flags 1 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/text/JTextComponent$DropLocation outerClass javax/swing/text/JTextComponent innerClassName DropLocation flags 19 +innerclass innerClass javax/swing/text/DefaultEditorKit$DefaultKeyTypedAction outerClass javax/swing/text/DefaultEditorKit innerClassName DefaultKeyTypedAction flags 9 +innerclass innerClass javax/swing/text/JTextComponent$KeyBinding outerClass javax/swing/text/JTextComponent innerClassName KeyBinding flags 9 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/JTextComponent$DropLocation +header extends javax/swing/TransferHandler$DropLocation nestHost javax/swing/text/JTextComponent flags 31 +innerclass innerClass javax/swing/TransferHandler$DropLocation outerClass javax/swing/TransferHandler innerClassName DropLocation flags 9 +innerclass innerClass javax/swing/text/JTextComponent$DropLocation outerClass javax/swing/text/JTextComponent innerClassName DropLocation flags 19 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/ParagraphView +header extends javax/swing/text/FlowView implements javax/swing/text/TabExpander flags 21 +innerclass innerClass javax/swing/text/FlowView$FlowStrategy outerClass javax/swing/text/FlowView innerClassName FlowStrategy flags 9 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/PlainDocument +header extends javax/swing/text/AbstractDocument flags 21 +innerclass innerClass javax/swing/text/AbstractDocument$Content outerClass javax/swing/text/AbstractDocument innerClassName Content flags 609 +innerclass innerClass javax/swing/text/AbstractDocument$AbstractElement outerClass javax/swing/text/AbstractDocument innerClassName AbstractElement flags 401 +innerclass innerClass javax/swing/text/AbstractDocument$BranchElement outerClass javax/swing/text/AbstractDocument innerClassName BranchElement flags 1 +innerclass innerClass javax/swing/text/AbstractDocument$DefaultDocumentEvent outerClass javax/swing/text/AbstractDocument innerClassName DefaultDocumentEvent flags 1 +innerclass innerClass javax/swing/text/AbstractDocument$ElementEdit outerClass javax/swing/text/AbstractDocument innerClassName ElementEdit flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/PlainView +header extends javax/swing/text/View implements javax/swing/text/TabExpander flags 21 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/event/DocumentEvent$ElementChange outerClass javax/swing/event/DocumentEvent innerClassName ElementChange flags 609 +innerclass innerClass javax/swing/event/DocumentEvent$EventType outerClass javax/swing/event/DocumentEvent innerClassName EventType flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/StyleConstants +header extends java/lang/Object nestMembers javax/swing/text/StyleConstants$FontConstants,javax/swing/text/StyleConstants$ColorConstants,javax/swing/text/StyleConstants$CharacterConstants,javax/swing/text/StyleConstants$ParagraphConstants flags 21 +innerclass innerClass javax/swing/text/StyleConstants$CharacterConstants outerClass javax/swing/text/StyleConstants innerClassName CharacterConstants flags 9 +innerclass innerClass javax/swing/text/StyleConstants$FontConstants outerClass javax/swing/text/StyleConstants innerClassName FontConstants flags 9 +innerclass innerClass javax/swing/text/StyleConstants$ColorConstants outerClass javax/swing/text/StyleConstants innerClassName ColorConstants flags 9 +innerclass innerClass javax/swing/text/StyleConstants$ParagraphConstants outerClass javax/swing/text/StyleConstants innerClassName ParagraphConstants flags 9 + +class name javax/swing/text/StyledEditorKit +header extends javax/swing/text/DefaultEditorKit nestMembers javax/swing/text/StyledEditorKit$UnderlineAction,javax/swing/text/StyledEditorKit$ItalicAction,javax/swing/text/StyledEditorKit$BoldAction,javax/swing/text/StyledEditorKit$AlignmentAction,javax/swing/text/StyledEditorKit$ForegroundAction,javax/swing/text/StyledEditorKit$FontSizeAction,javax/swing/text/StyledEditorKit$FontFamilyAction,javax/swing/text/StyledEditorKit$StyledTextAction flags 21 +innerclass innerClass javax/swing/text/StyledEditorKit$FontFamilyAction outerClass javax/swing/text/StyledEditorKit innerClassName FontFamilyAction flags 9 +innerclass innerClass javax/swing/text/StyledEditorKit$FontSizeAction outerClass javax/swing/text/StyledEditorKit innerClassName FontSizeAction flags 9 +innerclass innerClass javax/swing/text/StyledEditorKit$AlignmentAction outerClass javax/swing/text/StyledEditorKit innerClassName AlignmentAction flags 9 +innerclass innerClass javax/swing/text/StyledEditorKit$BoldAction outerClass javax/swing/text/StyledEditorKit innerClassName BoldAction flags 9 +innerclass innerClass javax/swing/text/StyledEditorKit$ItalicAction outerClass javax/swing/text/StyledEditorKit innerClassName ItalicAction flags 9 +innerclass innerClass javax/swing/text/StyledEditorKit$UnderlineAction outerClass javax/swing/text/StyledEditorKit innerClassName UnderlineAction flags 9 +innerclass innerClass javax/swing/text/StyledEditorKit$ForegroundAction outerClass javax/swing/text/StyledEditorKit innerClassName ForegroundAction flags 9 +innerclass innerClass javax/swing/text/StyledEditorKit$StyledTextAction outerClass javax/swing/text/StyledEditorKit innerClassName StyledTextAction flags 409 + +class name javax/swing/text/StyledEditorKit$AlignmentAction +header extends javax/swing/text/StyledEditorKit$StyledTextAction nestHost javax/swing/text/StyledEditorKit flags 21 +innerclass innerClass javax/swing/text/StyledEditorKit$StyledTextAction outerClass javax/swing/text/StyledEditorKit innerClassName StyledTextAction flags 409 +innerclass innerClass javax/swing/text/StyledEditorKit$AlignmentAction outerClass javax/swing/text/StyledEditorKit innerClassName AlignmentAction flags 9 + +class name javax/swing/text/StyledEditorKit$BoldAction +header extends javax/swing/text/StyledEditorKit$StyledTextAction nestHost javax/swing/text/StyledEditorKit flags 21 +innerclass innerClass javax/swing/text/StyledEditorKit$StyledTextAction outerClass javax/swing/text/StyledEditorKit innerClassName StyledTextAction flags 409 +innerclass innerClass javax/swing/text/StyledEditorKit$BoldAction outerClass javax/swing/text/StyledEditorKit innerClassName BoldAction flags 9 + +class name javax/swing/text/StyledEditorKit$FontFamilyAction +header extends javax/swing/text/StyledEditorKit$StyledTextAction nestHost javax/swing/text/StyledEditorKit flags 21 +innerclass innerClass javax/swing/text/StyledEditorKit$StyledTextAction outerClass javax/swing/text/StyledEditorKit innerClassName StyledTextAction flags 409 +innerclass innerClass javax/swing/text/StyledEditorKit$FontFamilyAction outerClass javax/swing/text/StyledEditorKit innerClassName FontFamilyAction flags 9 + +class name javax/swing/text/StyledEditorKit$FontSizeAction +header extends javax/swing/text/StyledEditorKit$StyledTextAction nestHost javax/swing/text/StyledEditorKit flags 21 +innerclass innerClass javax/swing/text/StyledEditorKit$StyledTextAction outerClass javax/swing/text/StyledEditorKit innerClassName StyledTextAction flags 409 +innerclass innerClass javax/swing/text/StyledEditorKit$FontSizeAction outerClass javax/swing/text/StyledEditorKit innerClassName FontSizeAction flags 9 + +class name javax/swing/text/StyledEditorKit$ForegroundAction +header extends javax/swing/text/StyledEditorKit$StyledTextAction nestHost javax/swing/text/StyledEditorKit flags 21 +innerclass innerClass javax/swing/text/StyledEditorKit$StyledTextAction outerClass javax/swing/text/StyledEditorKit innerClassName StyledTextAction flags 409 +innerclass innerClass javax/swing/text/StyledEditorKit$ForegroundAction outerClass javax/swing/text/StyledEditorKit innerClassName ForegroundAction flags 9 + +class name javax/swing/text/StyledEditorKit$ItalicAction +header extends javax/swing/text/StyledEditorKit$StyledTextAction nestHost javax/swing/text/StyledEditorKit flags 21 +innerclass innerClass javax/swing/text/StyledEditorKit$StyledTextAction outerClass javax/swing/text/StyledEditorKit innerClassName StyledTextAction flags 409 +innerclass innerClass javax/swing/text/StyledEditorKit$ItalicAction outerClass javax/swing/text/StyledEditorKit innerClassName ItalicAction flags 9 + +class name javax/swing/text/StyledEditorKit$UnderlineAction +header extends javax/swing/text/StyledEditorKit$StyledTextAction nestHost javax/swing/text/StyledEditorKit flags 21 +innerclass innerClass javax/swing/text/StyledEditorKit$StyledTextAction outerClass javax/swing/text/StyledEditorKit innerClassName StyledTextAction flags 409 +innerclass innerClass javax/swing/text/StyledEditorKit$UnderlineAction outerClass javax/swing/text/StyledEditorKit innerClassName UnderlineAction flags 9 + +class name javax/swing/text/TableView +header extends javax/swing/text/BoxView nestMembers javax/swing/text/TableView$GridCell,javax/swing/text/TableView$TableCell,javax/swing/text/TableView$TableRow flags 421 +innerclass innerClass javax/swing/text/TableView$TableRow outerClass javax/swing/text/TableView innerClassName TableRow flags 1 +innerclass innerClass javax/swing/text/TableView$TableCell outerClass javax/swing/text/TableView innerClassName TableCell flags 1 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/event/DocumentEvent$ElementChange outerClass javax/swing/event/DocumentEvent innerClassName ElementChange flags 609 +innerclass innerClass javax/swing/text/TableView$GridCell outerClass javax/swing/text/TableView innerClassName GridCell flags 608 + +class name javax/swing/text/Utilities +header extends java/lang/Object flags 21 +innerclass innerClass java/text/AttributedCharacterIterator$Attribute outerClass java/text/AttributedCharacterIterator innerClassName Attribute flags 9 +innerclass innerClass javax/swing/text/GlyphView$GlyphPainter outerClass javax/swing/text/GlyphView innerClassName GlyphPainter flags 409 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/ZoneView +header extends javax/swing/text/BoxView flags 21 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/event/DocumentEvent$ElementChange outerClass javax/swing/event/DocumentEvent innerClassName ElementChange flags 609 + +class name javax/swing/text/html/BlockView +header extends javax/swing/text/BoxView flags 21 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/StyleSheet$BoxPainter outerClass javax/swing/text/html/StyleSheet innerClassName BoxPainter flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/CSS +header extends java/lang/Object implements java/io/Serializable nestMembers javax/swing/text/html/CSS$Attribute flags 21 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/FormSubmitEvent +header extends javax/swing/text/html/HTMLFrameHyperlinkEvent nestMembers javax/swing/text/html/FormSubmitEvent$MethodType flags 21 +innerclass innerClass javax/swing/event/HyperlinkEvent$EventType outerClass javax/swing/event/HyperlinkEvent innerClassName EventType flags 19 +innerclass innerClass javax/swing/text/html/FormSubmitEvent$MethodType outerClass javax/swing/text/html/FormSubmitEvent innerClassName MethodType flags 4019 + +class name javax/swing/text/html/FormView +header extends javax/swing/text/ComponentView implements java/awt/event/ActionListener nestMembers javax/swing/text/html/FormView$MouseEventListener flags 21 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/FormView$MouseEventListener outerClass javax/swing/text/html/FormView innerClassName MouseEventListener flags 4 +innerclass innerClass javax/swing/JToggleButton$ToggleButtonModel outerClass javax/swing/JToggleButton innerClassName ToggleButtonModel flags 9 +innerclass innerClass javax/swing/text/html/FormSubmitEvent$MethodType outerClass javax/swing/text/html/FormSubmitEvent innerClassName MethodType flags 4019 +innerclass innerClass javax/swing/event/HyperlinkEvent$EventType outerClass javax/swing/event/HyperlinkEvent innerClassName EventType flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/HTML +header extends java/lang/Object nestMembers javax/swing/text/html/HTML$Attribute,javax/swing/text/html/HTML$UnknownTag,javax/swing/text/html/HTML$Tag flags 21 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTML$UnknownTag outerClass javax/swing/text/html/HTML innerClassName UnknownTag flags 9 + +class name javax/swing/text/html/HTML$UnknownTag +header extends javax/swing/text/html/HTML$Tag implements java/io/Serializable nestHost javax/swing/text/html/HTML flags 21 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$UnknownTag outerClass javax/swing/text/html/HTML innerClassName UnknownTag flags 9 + +class name javax/swing/text/html/HTMLDocument +header extends javax/swing/text/DefaultStyledDocument nestMembers javax/swing/text/html/HTMLDocument$BlockElement,javax/swing/text/html/HTMLDocument$RunElement,javax/swing/text/html/HTMLDocument$HTMLReader,javax/swing/text/html/HTMLDocument$HTMLReader$FormAction,javax/swing/text/html/HTMLDocument$HTMLReader$CharacterAction,javax/swing/text/html/HTMLDocument$HTMLReader$PreAction,javax/swing/text/html/HTMLDocument$HTMLReader$HiddenAction,javax/swing/text/html/HTMLDocument$HTMLReader$IsindexAction,javax/swing/text/html/HTMLDocument$HTMLReader$SpecialAction,javax/swing/text/html/HTMLDocument$HTMLReader$ParagraphAction,javax/swing/text/html/HTMLDocument$HTMLReader$BlockAction,javax/swing/text/html/HTMLDocument$HTMLReader$TagAction,javax/swing/text/html/HTMLDocument$Iterator flags 21 +innerclass innerClass javax/swing/text/AbstractDocument$DefaultDocumentEvent outerClass javax/swing/text/AbstractDocument innerClassName DefaultDocumentEvent flags 1 +innerclass innerClass javax/swing/text/AbstractDocument$Content outerClass javax/swing/text/AbstractDocument innerClassName Content flags 609 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$ParserCallback outerClass javax/swing/text/html/HTMLEditorKit innerClassName ParserCallback flags 9 +innerclass innerClass javax/swing/text/DefaultStyledDocument$ElementSpec outerClass javax/swing/text/DefaultStyledDocument innerClassName ElementSpec flags 9 +innerclass innerClass javax/swing/event/DocumentEvent$EventType outerClass javax/swing/event/DocumentEvent innerClassName EventType flags 19 +innerclass innerClass javax/swing/text/DefaultStyledDocument$AttributeUndoableEdit outerClass javax/swing/text/DefaultStyledDocument innerClassName AttributeUndoableEdit flags 9 +innerclass innerClass javax/swing/text/AbstractDocument$AttributeContext outerClass javax/swing/text/AbstractDocument innerClassName AttributeContext flags 609 +innerclass innerClass javax/swing/text/html/HTMLDocument$RunElement outerClass javax/swing/text/html/HTMLDocument innerClassName RunElement flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$BlockElement outerClass javax/swing/text/html/HTMLDocument innerClassName BlockElement flags 1 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$Parser outerClass javax/swing/text/html/HTMLEditorKit innerClassName Parser flags 409 +innerclass innerClass javax/swing/text/AbstractDocument$ElementEdit outerClass javax/swing/text/AbstractDocument innerClassName ElementEdit flags 9 +innerclass innerClass javax/swing/text/AbstractDocument$BranchElement outerClass javax/swing/text/AbstractDocument innerClassName BranchElement flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$Iterator outerClass javax/swing/text/html/HTMLDocument innerClassName Iterator flags 409 +innerclass innerClass javax/swing/text/AbstractDocument$AbstractElement outerClass javax/swing/text/AbstractDocument innerClassName AbstractElement flags 401 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$FormAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName FormAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$CharacterAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName CharacterAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$PreAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName PreAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$HiddenAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName HiddenAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$IsindexAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName IsindexAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$SpecialAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName SpecialAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$ParagraphAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName ParagraphAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$BlockAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName BlockAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$TagAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName TagAction flags 1 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/HTMLDocument$HTMLReader +header extends javax/swing/text/html/HTMLEditorKit$ParserCallback nestHost javax/swing/text/html/HTMLDocument flags 21 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$ParserCallback outerClass javax/swing/text/html/HTMLEditorKit innerClassName ParserCallback flags 9 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$TagAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName TagAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$BlockAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName BlockAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$ParagraphAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName ParagraphAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$CharacterAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName CharacterAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$SpecialAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName SpecialAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$FormAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName FormAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$HiddenAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName HiddenAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$IsindexAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName IsindexAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$PreAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName PreAction flags 1 +innerclass innerClass javax/swing/text/DefaultStyledDocument$ElementSpec outerClass javax/swing/text/DefaultStyledDocument innerClassName ElementSpec flags 9 +innerclass innerClass javax/swing/text/AbstractDocument$BranchElement outerClass javax/swing/text/AbstractDocument innerClassName BranchElement flags 1 +innerclass innerClass javax/swing/text/AbstractDocument$ElementEdit outerClass javax/swing/text/AbstractDocument innerClassName ElementEdit flags 9 +innerclass innerClass javax/swing/text/AbstractDocument$DefaultDocumentEvent outerClass javax/swing/text/AbstractDocument innerClassName DefaultDocumentEvent flags 1 +innerclass innerClass javax/swing/event/DocumentEvent$EventType outerClass javax/swing/event/DocumentEvent innerClassName EventType flags 19 +innerclass innerClass javax/swing/text/AbstractDocument$Content outerClass javax/swing/text/AbstractDocument innerClassName Content flags 609 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTML$UnknownTag outerClass javax/swing/text/html/HTML innerClassName UnknownTag flags 9 + +class name javax/swing/text/html/HTMLDocument$HTMLReader$BlockAction +header extends javax/swing/text/html/HTMLDocument$HTMLReader$TagAction nestHost javax/swing/text/html/HTMLDocument flags 21 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$BlockAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName BlockAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$TagAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName TagAction flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 + +class name javax/swing/text/html/HTMLDocument$HTMLReader$CharacterAction +header extends javax/swing/text/html/HTMLDocument$HTMLReader$TagAction nestHost javax/swing/text/html/HTMLDocument flags 21 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$CharacterAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName CharacterAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$TagAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName TagAction flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$ParserCallback outerClass javax/swing/text/html/HTMLEditorKit innerClassName ParserCallback flags 9 + +class name javax/swing/text/html/HTMLDocument$HTMLReader$FormAction +header extends javax/swing/text/html/HTMLDocument$HTMLReader$SpecialAction nestHost javax/swing/text/html/HTMLDocument flags 21 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$FormAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName FormAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$SpecialAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName SpecialAction flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/JToggleButton$ToggleButtonModel outerClass javax/swing/JToggleButton innerClassName ToggleButtonModel flags 9 + +class name javax/swing/text/html/HTMLDocument$HTMLReader$HiddenAction +header extends javax/swing/text/html/HTMLDocument$HTMLReader$TagAction nestHost javax/swing/text/html/HTMLDocument flags 21 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$HiddenAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName HiddenAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$TagAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName TagAction flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 + +class name javax/swing/text/html/HTMLDocument$HTMLReader$IsindexAction +header extends javax/swing/text/html/HTMLDocument$HTMLReader$TagAction nestHost javax/swing/text/html/HTMLDocument flags 21 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$IsindexAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName IsindexAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$TagAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName TagAction flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 + +class name javax/swing/text/html/HTMLDocument$HTMLReader$ParagraphAction +header extends javax/swing/text/html/HTMLDocument$HTMLReader$BlockAction nestHost javax/swing/text/html/HTMLDocument flags 21 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$ParagraphAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName ParagraphAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$BlockAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName BlockAction flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 + +class name javax/swing/text/html/HTMLDocument$HTMLReader$PreAction +header extends javax/swing/text/html/HTMLDocument$HTMLReader$BlockAction nestHost javax/swing/text/html/HTMLDocument flags 21 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$PreAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName PreAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$BlockAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName BlockAction flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 + +class name javax/swing/text/html/HTMLDocument$HTMLReader$SpecialAction +header extends javax/swing/text/html/HTMLDocument$HTMLReader$TagAction nestHost javax/swing/text/html/HTMLDocument flags 21 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader outerClass javax/swing/text/html/HTMLDocument innerClassName HTMLReader flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$SpecialAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName SpecialAction flags 1 +innerclass innerClass javax/swing/text/html/HTMLDocument$HTMLReader$TagAction outerClass javax/swing/text/html/HTMLDocument$HTMLReader innerClassName TagAction flags 1 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 + +class name javax/swing/text/html/HTMLEditorKit +header extends javax/swing/text/StyledEditorKit implements javax/accessibility/Accessible nestMembers javax/swing/text/html/HTMLEditorKit$InsertHTMLTextAction,javax/swing/text/html/HTMLEditorKit$HTMLTextAction,javax/swing/text/html/HTMLEditorKit$HTMLFactory,javax/swing/text/html/HTMLEditorKit$ParserCallback,javax/swing/text/html/HTMLEditorKit$Parser,javax/swing/text/html/HTMLEditorKit$LinkController flags 21 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$LinkController outerClass javax/swing/text/html/HTMLEditorKit innerClassName LinkController flags 9 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$Parser outerClass javax/swing/text/html/HTMLEditorKit innerClassName Parser flags 409 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$ParserCallback outerClass javax/swing/text/html/HTMLEditorKit innerClassName ParserCallback flags 9 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTML$UnknownTag outerClass javax/swing/text/html/HTML innerClassName UnknownTag flags 9 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$HTMLFactory outerClass javax/swing/text/html/HTMLEditorKit innerClassName HTMLFactory flags 9 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$InsertHTMLTextAction outerClass javax/swing/text/html/HTMLEditorKit innerClassName InsertHTMLTextAction flags 9 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$HTMLTextAction outerClass javax/swing/text/html/HTMLEditorKit innerClassName HTMLTextAction flags 409 + +class name javax/swing/text/html/HTMLEditorKit$HTMLFactory +header extends java/lang/Object implements javax/swing/text/ViewFactory nestHost javax/swing/text/html/HTMLEditorKit flags 21 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$HTMLFactory outerClass javax/swing/text/html/HTMLEditorKit innerClassName HTMLFactory flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTML$UnknownTag outerClass javax/swing/text/html/HTML innerClassName UnknownTag flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/HTMLEditorKit$HTMLTextAction +header extends javax/swing/text/StyledEditorKit$StyledTextAction nestHost javax/swing/text/html/HTMLEditorKit flags 421 +innerclass innerClass javax/swing/text/StyledEditorKit$StyledTextAction outerClass javax/swing/text/StyledEditorKit innerClassName StyledTextAction flags 409 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$HTMLTextAction outerClass javax/swing/text/html/HTMLEditorKit innerClassName HTMLTextAction flags 409 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 + +class name javax/swing/text/html/HTMLEditorKit$InsertHTMLTextAction +header extends javax/swing/text/html/HTMLEditorKit$HTMLTextAction nestHost javax/swing/text/html/HTMLEditorKit flags 21 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$InsertHTMLTextAction outerClass javax/swing/text/html/HTMLEditorKit innerClassName InsertHTMLTextAction flags 9 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$HTMLTextAction outerClass javax/swing/text/html/HTMLEditorKit innerClassName HTMLTextAction flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/HTMLEditorKit$LinkController +header extends java/awt/event/MouseAdapter implements java/awt/event/MouseMotionListener,java/io/Serializable nestHost javax/swing/text/html/HTMLEditorKit flags 21 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$LinkController outerClass javax/swing/text/html/HTMLEditorKit innerClassName LinkController flags 9 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/event/HyperlinkEvent$EventType outerClass javax/swing/event/HyperlinkEvent innerClassName EventType flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/HTMLWriter +header extends javax/swing/text/AbstractWriter flags 21 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/ImageView +header extends javax/swing/text/View flags 21 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/StyleSheet +header extends javax/swing/text/StyleContext nestMembers javax/swing/text/html/StyleSheet$ListPainter,javax/swing/text/html/StyleSheet$BoxPainter flags 21 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/StyleSheet$BoxPainter outerClass javax/swing/text/html/StyleSheet innerClassName BoxPainter flags 9 +innerclass innerClass javax/swing/text/html/StyleSheet$ListPainter outerClass javax/swing/text/html/StyleSheet innerClassName ListPainter flags 9 +innerclass innerClass javax/swing/text/StyleContext$SmallAttributeSet outerClass javax/swing/text/StyleContext innerClassName SmallAttributeSet flags 1 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/StyleSheet$ListPainter +header extends java/lang/Object implements java/io/Serializable nestHost javax/swing/text/html/StyleSheet flags 21 +innerclass innerClass javax/swing/text/html/StyleSheet$ListPainter outerClass javax/swing/text/html/StyleSheet innerClassName ListPainter flags 9 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass java/awt/RenderingHints$Key outerClass java/awt/RenderingHints innerClassName Key flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/parser/ParserDelegator +header extends javax/swing/text/html/HTMLEditorKit$Parser implements java/io/Serializable flags 21 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$Parser outerClass javax/swing/text/html/HTMLEditorKit innerClassName Parser flags 409 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$ParserCallback outerClass javax/swing/text/html/HTMLEditorKit innerClassName ParserCallback flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/java.management-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/java.management-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,102 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/management/modelmbean/DescriptorSupport +header extends java/lang/Object implements javax/management/Descriptor flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/modelmbean/ModelMBeanAttributeInfo +header extends javax/management/MBeanAttributeInfo implements javax/management/DescriptorAccess flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/modelmbean/ModelMBeanConstructorInfo +header extends javax/management/MBeanConstructorInfo implements javax/management/DescriptorAccess flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/modelmbean/ModelMBeanInfoSupport +header extends javax/management/MBeanInfo implements javax/management/modelmbean/ModelMBeanInfo flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/modelmbean/ModelMBeanNotificationInfo +header extends javax/management/MBeanNotificationInfo implements javax/management/DescriptorAccess flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/modelmbean/ModelMBeanOperationInfo +header extends javax/management/MBeanOperationInfo implements javax/management/DescriptorAccess flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/relation/MBeanServerNotificationFilter +header extends javax/management/NotificationFilterSupport flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/relation/RelationService +header extends javax/management/NotificationBroadcasterSupport implements javax/management/relation/RelationServiceMBean,javax/management/MBeanRegistration,javax/management/NotificationListener flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/relation/RelationTypeSupport +header extends java/lang/Object implements javax/management/relation/RelationType flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 + +class name javax/management/timer/Timer +header extends javax/management/NotificationBroadcasterSupport implements javax/management/timer/TimerMBean,javax/management/MBeanRegistration flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/java.management.rmi-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/java.management.rmi-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,35 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/management/remote/rmi/RMIJRMPServerImpl +header extends javax/management/remote/rmi/RMIServerImpl flags 21 +innerclass innerClass java/io/ObjectInputFilter$Config outerClass java/io/ObjectInputFilter innerClassName Config flags 19 +innerclass innerClass java/io/ObjectInputFilter$Status outerClass java/io/ObjectInputFilter innerClassName Status flags 4019 +innerclass innerClass java/io/ObjectInputFilter$FilterInfo outerClass java/io/ObjectInputFilter innerClassName FilterInfo flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/java.net.http-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/java.net.http-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,89 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/net/http/HttpClient +header extends java/lang/Object nestMembers java/net/http/HttpClient$Redirect,java/net/http/HttpClient$Version,java/net/http/HttpClient$Builder flags 421 +innerclass innerClass java/net/http/HttpClient$Builder outerClass java/net/http/HttpClient innerClassName Builder flags 609 +innerclass innerClass java/net/http/HttpClient$Redirect outerClass java/net/http/HttpClient innerClassName Redirect flags 4019 +innerclass innerClass java/net/http/HttpClient$Version outerClass java/net/http/HttpClient innerClassName Version flags 4019 +innerclass innerClass java/net/http/HttpResponse$BodyHandler outerClass java/net/http/HttpResponse innerClassName BodyHandler flags 609 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler outerClass java/net/http/HttpResponse innerClassName PushPromiseHandler flags 609 +innerclass innerClass java/net/http/WebSocket$Builder outerClass java/net/http/WebSocket innerClassName Builder flags 609 + +class name java/net/http/HttpRequest$BodyPublisher +header extends java/lang/Object implements java/util/concurrent/Flow$Publisher nestHost java/net/http/HttpRequest flags 601 signature Ljava/lang/Object;Ljava/util/concurrent/Flow$Publisher; +innerclass innerClass java/net/http/HttpRequest$BodyPublisher outerClass java/net/http/HttpRequest innerClassName BodyPublisher flags 609 +innerclass innerClass java/util/concurrent/Flow$Publisher outerClass java/util/concurrent/Flow innerClassName Publisher flags 609 + +class name java/net/http/HttpRequest$BodyPublishers +header extends java/lang/Object nestHost java/net/http/HttpRequest flags 21 +innerclass innerClass java/util/concurrent/Flow$Publisher outerClass java/util/concurrent/Flow innerClassName Publisher flags 609 +innerclass innerClass java/net/http/HttpRequest$BodyPublishers outerClass java/net/http/HttpRequest innerClassName BodyPublishers flags 9 +innerclass innerClass java/net/http/HttpRequest$BodyPublisher outerClass java/net/http/HttpRequest innerClassName BodyPublisher flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/net/http/HttpResponse$BodyHandler +header extends java/lang/Object nestHost java/net/http/HttpResponse flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/net/http/HttpResponse$BodyHandler outerClass java/net/http/HttpResponse innerClassName BodyHandler flags 609 +innerclass innerClass java/net/http/HttpResponse$ResponseInfo outerClass java/net/http/HttpResponse innerClassName ResponseInfo flags 609 +innerclass innerClass java/net/http/HttpResponse$BodySubscriber outerClass java/net/http/HttpResponse innerClassName BodySubscriber flags 609 + +class name java/net/http/HttpResponse$BodyHandlers +header extends java/lang/Object nestHost java/net/http/HttpResponse flags 21 +innerclass innerClass java/util/concurrent/Flow$Subscriber outerClass java/util/concurrent/Flow innerClassName Subscriber flags 609 +innerclass innerClass java/net/http/HttpResponse$BodyHandler outerClass java/net/http/HttpResponse innerClassName BodyHandler flags 609 +innerclass innerClass java/net/http/HttpResponse$BodyHandlers outerClass java/net/http/HttpResponse innerClassName BodyHandlers flags 9 +innerclass innerClass java/net/http/HttpResponse$ResponseInfo outerClass java/net/http/HttpResponse innerClassName ResponseInfo flags 609 +innerclass innerClass java/net/http/HttpResponse$BodySubscriber outerClass java/net/http/HttpResponse innerClassName BodySubscriber flags 609 +innerclass innerClass java/net/http/HttpResponse$BodySubscribers outerClass java/net/http/HttpResponse innerClassName BodySubscribers flags 9 +innerclass innerClass java/util/concurrent/Flow$Publisher outerClass java/util/concurrent/Flow innerClassName Publisher flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/net/http/HttpResponse$BodySubscriber +header extends java/lang/Object implements java/util/concurrent/Flow$Subscriber nestHost java/net/http/HttpResponse flags 601 signature Ljava/lang/Object;Ljava/util/concurrent/Flow$Subscriber;>; +innerclass innerClass java/net/http/HttpResponse$BodySubscriber outerClass java/net/http/HttpResponse innerClassName BodySubscriber flags 609 +innerclass innerClass java/util/concurrent/Flow$Subscriber outerClass java/util/concurrent/Flow innerClassName Subscriber flags 609 + +class name java/net/http/HttpResponse$BodySubscribers +header extends java/lang/Object nestHost java/net/http/HttpResponse flags 21 +innerclass innerClass java/util/concurrent/Flow$Subscriber outerClass java/util/concurrent/Flow innerClassName Subscriber flags 609 +innerclass innerClass java/net/http/HttpResponse$BodySubscribers outerClass java/net/http/HttpResponse innerClassName BodySubscribers flags 9 +innerclass innerClass java/net/http/HttpResponse$BodySubscriber outerClass java/net/http/HttpResponse innerClassName BodySubscriber flags 609 +innerclass innerClass java/util/concurrent/Flow$Publisher outerClass java/util/concurrent/Flow innerClassName Publisher flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/net/http/HttpResponse$PushPromiseHandler +header extends java/lang/Object nestHost java/net/http/HttpResponse flags 601 signature Ljava/lang/Object; +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler outerClass java/net/http/HttpResponse innerClassName PushPromiseHandler flags 609 +innerclass innerClass java/net/http/HttpResponse$BodyHandler outerClass java/net/http/HttpResponse innerClassName BodyHandler flags 609 + +class name java/net/http/HttpResponse$ResponseInfo +header extends java/lang/Object nestHost java/net/http/HttpResponse flags 601 +innerclass innerClass java/net/http/HttpResponse$ResponseInfo outerClass java/net/http/HttpResponse innerClassName ResponseInfo flags 609 +innerclass innerClass java/net/http/HttpClient$Version outerClass java/net/http/HttpClient innerClassName Version flags 4019 + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/java.xml-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/java.xml-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,47 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/xml/catalog/CatalogFeatures$Builder +header extends java/lang/Object nestHost javax/xml/catalog/CatalogFeatures flags 21 +innerclass innerClass javax/xml/catalog/CatalogFeatures$Builder outerClass javax/xml/catalog/CatalogFeatures innerClassName Builder flags 9 +innerclass innerClass javax/xml/catalog/CatalogFeatures$Feature outerClass javax/xml/catalog/CatalogFeatures innerClassName Feature flags 4019 + +class name javax/xml/parsers/DocumentBuilderFactory +method name newDefaultNSInstance descriptor ()Ljavax/xml/parsers/DocumentBuilderFactory; flags 9 +method name newNSInstance descriptor ()Ljavax/xml/parsers/DocumentBuilderFactory; flags 9 +method name newNSInstance descriptor (Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/parsers/DocumentBuilderFactory; flags 9 + +class name javax/xml/parsers/SAXParserFactory +method name newDefaultNSInstance descriptor ()Ljavax/xml/parsers/SAXParserFactory; flags 9 +method name newNSInstance descriptor ()Ljavax/xml/parsers/SAXParserFactory; flags 9 +method name newNSInstance descriptor (Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/parsers/SAXParserFactory; flags 9 + +class name javax/xml/stream/XMLInputFactory +method name newFactory descriptor ()Ljavax/xml/stream/XMLInputFactory; thrownTypes javax/xml/stream/FactoryConfigurationError flags 9 +-method name newFactory descriptor ()Ljavax/xml/stream/XMLInputFactory; + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/java.xml.crypto-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/java.xml.crypto-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,35 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/xml/crypto/dsig/CanonicalizationMethod +field name INCLUSIVE_11 descriptor Ljava/lang/String; constantValue http://www.w3.org/2006/12/xml-c14n11 flags 19 +field name INCLUSIVE_11_WITH_COMMENTS descriptor Ljava/lang/String; constantValue http://www.w3.org/2006/12/xml-c14n11#WithComments flags 19 + +class name javax/xml/crypto/dsig/keyinfo/KeyValue +field name EC_TYPE descriptor Ljava/lang/String; constantValue http://www.w3.org/2009/xmldsig11#ECKeyValue flags 19 + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/jdk.compiler-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/jdk.compiler-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,35 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/source/util/JavacTask +method name setParameterNameProvider descriptor (Lcom/sun/source/util/ParameterNameProvider;)V flags 1 + +class name com/sun/source/util/ParameterNameProvider +header extends java/lang/Object flags 601 +method name getParameterName descriptor (Ljavax/lang/model/element/VariableElement;)Ljava/lang/CharSequence; flags 401 + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/jdk.httpserver-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/jdk.httpserver-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,52 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/net/httpserver/Authenticator$Failure +header extends com/sun/net/httpserver/Authenticator$Result nestHost com/sun/net/httpserver/Authenticator flags 21 +innerclass innerClass com/sun/net/httpserver/Authenticator$Result outerClass com/sun/net/httpserver/Authenticator innerClassName Result flags 409 +innerclass innerClass com/sun/net/httpserver/Authenticator$Failure outerClass com/sun/net/httpserver/Authenticator innerClassName Failure flags 9 + +class name com/sun/net/httpserver/Authenticator$Retry +header extends com/sun/net/httpserver/Authenticator$Result nestHost com/sun/net/httpserver/Authenticator flags 21 +innerclass innerClass com/sun/net/httpserver/Authenticator$Result outerClass com/sun/net/httpserver/Authenticator innerClassName Result flags 409 +innerclass innerClass com/sun/net/httpserver/Authenticator$Retry outerClass com/sun/net/httpserver/Authenticator innerClassName Retry flags 9 + +class name com/sun/net/httpserver/Authenticator$Success +header extends com/sun/net/httpserver/Authenticator$Result nestHost com/sun/net/httpserver/Authenticator flags 21 +innerclass innerClass com/sun/net/httpserver/Authenticator$Result outerClass com/sun/net/httpserver/Authenticator innerClassName Result flags 409 +innerclass innerClass com/sun/net/httpserver/Authenticator$Success outerClass com/sun/net/httpserver/Authenticator innerClassName Success flags 9 + +class name com/sun/net/httpserver/BasicAuthenticator +header extends com/sun/net/httpserver/Authenticator flags 421 +innerclass innerClass com/sun/net/httpserver/Authenticator$Retry outerClass com/sun/net/httpserver/Authenticator innerClassName Retry flags 9 +innerclass innerClass com/sun/net/httpserver/Authenticator$Failure outerClass com/sun/net/httpserver/Authenticator innerClassName Failure flags 9 +innerclass innerClass java/util/Base64$Decoder outerClass java/util/Base64 innerClassName Decoder flags 9 +innerclass innerClass com/sun/net/httpserver/Authenticator$Success outerClass com/sun/net/httpserver/Authenticator innerClassName Success flags 9 +innerclass innerClass com/sun/net/httpserver/Authenticator$Result outerClass com/sun/net/httpserver/Authenticator innerClassName Result flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/jdk.javadoc-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/jdk.javadoc-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,93 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.javadoc +header exports jdk/javadoc/doclet requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.xml\u0020;flags\u0020;0,name\u0020;java.compiler\u0020;flags\u0020;20,name\u0020;jdk.compiler\u0020;flags\u0020;20 provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;jdk/javadoc/internal/tool/JavadocToolProvider,interface\u0020;javax/tools/DocumentationTool\u0020;impls\u0020;jdk/javadoc/internal/api/JavadocTool,interface\u0020;javax/tools/Tool\u0020;impls\u0020;jdk/javadoc/internal/api/JavadocTool target linux-amd64 flags 8000 + +-class name com/sun/javadoc/AnnotatedType + +-class name com/sun/javadoc/AnnotationDesc + +-class name com/sun/javadoc/AnnotationDesc$ElementValuePair + +-class name com/sun/javadoc/AnnotationTypeDoc + +-class name com/sun/javadoc/AnnotationTypeElementDoc + +-class name com/sun/javadoc/AnnotationValue + +-class name com/sun/javadoc/ClassDoc + +-class name com/sun/javadoc/ConstructorDoc + +-class name com/sun/javadoc/Doc + +-class name com/sun/javadoc/DocErrorReporter + +-class name com/sun/javadoc/Doclet + +-class name com/sun/javadoc/ExecutableMemberDoc + +-class name com/sun/javadoc/FieldDoc + +-class name com/sun/javadoc/LanguageVersion + +-class name com/sun/javadoc/MemberDoc + +-class name com/sun/javadoc/MethodDoc + +-class name com/sun/javadoc/PackageDoc + +-class name com/sun/javadoc/ParamTag + +-class name com/sun/javadoc/Parameter + +-class name com/sun/javadoc/ParameterizedType + +-class name com/sun/javadoc/ProgramElementDoc + +-class name com/sun/javadoc/RootDoc + +-class name com/sun/javadoc/SeeTag + +-class name com/sun/javadoc/SerialFieldTag + +-class name com/sun/javadoc/SourcePosition + +-class name com/sun/javadoc/Tag + +-class name com/sun/javadoc/ThrowsTag + +-class name com/sun/javadoc/Type + +-class name com/sun/javadoc/TypeVariable + +-class name com/sun/javadoc/WildcardType + +-class name com/sun/tools/javadoc/Main + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/jdk.jlink-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/jdk.jlink-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,31 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jlink +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.internal.opt\u0020;flags\u0020;0,name\u0020;jdk.jdeps\u0020;flags\u0020;0 uses jdk/tools/jlink/plugin/Plugin provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;jdk/tools/jmod/Main$JmodToolProvider\u005C;u002C;jdk/tools/jlink/internal/Main$JlinkToolProvider,interface\u0020;jdk/tools/jlink/plugin/Plugin\u0020;impls\u0020;jdk/tools/jlink/internal/plugins/DefaultStripDebugPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludePlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludeJmodSectionPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/SystemModulesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/OrderResourcesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/DefaultCompressPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludeVMPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/StripNativeDebugSymbolsPlugin target linux-amd64 flags 8000 + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/jdk.jshell-D.sym.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/data/symbols/jdk.jshell-D.sym.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,148 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/jshell/ErroneousSnippet +header extends jdk/jshell/Snippet flags 21 +innerclass innerClass jdk/jshell/Snippet$SubKind outerClass jdk/jshell/Snippet innerClassName SubKind flags 4019 +innerclass innerClass jdk/jshell/Snippet$Kind outerClass jdk/jshell/Snippet innerClassName Kind flags 4019 + +class name jdk/jshell/JShell +header extends java/lang/Object implements java/lang/AutoCloseable nestMembers jdk/jshell/JShell$Subscription,jdk/jshell/JShell$Builder flags 21 +innerclass innerClass jdk/jshell/JShell$Builder outerClass jdk/jshell/JShell innerClassName Builder flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ExecutionControlException outerClass jdk/jshell/spi/ExecutionControl innerClassName ExecutionControlException flags 409 +innerclass innerClass jdk/jshell/Snippet$Status outerClass jdk/jshell/Snippet innerClassName Status flags 4019 +innerclass innerClass jdk/jshell/spi/ExecutionControl$EngineTerminationException outerClass jdk/jshell/spi/ExecutionControl innerClassName EngineTerminationException flags 9 +innerclass innerClass jdk/jshell/JShell$Subscription outerClass jdk/jshell/JShell innerClassName Subscription flags 1 +innerclass innerClass jdk/jshell/Snippet$Kind outerClass jdk/jshell/Snippet innerClassName Kind flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/Snippet +header extends java/lang/Object nestMembers jdk/jshell/Snippet$Status,jdk/jshell/Snippet$SubKind,jdk/jshell/Snippet$Kind flags 421 +innerclass innerClass jdk/jshell/Snippet$SubKind outerClass jdk/jshell/Snippet innerClassName SubKind flags 4019 +innerclass innerClass jdk/jshell/Snippet$Status outerClass jdk/jshell/Snippet innerClassName Status flags 4019 +innerclass innerClass jdk/jshell/Snippet$Kind outerClass jdk/jshell/Snippet innerClassName Kind flags 4019 + +class name jdk/jshell/SourceCodeAnalysis$CompletionInfo +header extends java/lang/Object nestHost jdk/jshell/SourceCodeAnalysis flags 601 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionInfo outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionInfo flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Completeness outerClass jdk/jshell/SourceCodeAnalysis innerClassName Completeness flags 4019 + +class name jdk/jshell/SourceCodeAnalysis$SnippetWrapper +header extends java/lang/Object nestHost jdk/jshell/SourceCodeAnalysis flags 601 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$SnippetWrapper outerClass jdk/jshell/SourceCodeAnalysis innerClassName SnippetWrapper flags 609 +innerclass innerClass jdk/jshell/Snippet$Kind outerClass jdk/jshell/Snippet innerClassName Kind flags 4019 + +class name jdk/jshell/execution/DirectExecutionControl +header extends java/lang/Object implements jdk/jshell/spi/ExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassBytecodes outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassBytecodes flags 19 +innerclass innerClass jdk/jshell/spi/ExecutionControl$NotImplementedException outerClass jdk/jshell/spi/ExecutionControl innerClassName NotImplementedException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$InternalException outerClass jdk/jshell/spi/ExecutionControl innerClassName InternalException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$RunException outerClass jdk/jshell/spi/ExecutionControl innerClassName RunException flags 409 +innerclass innerClass jdk/jshell/spi/ExecutionControl$EngineTerminationException outerClass jdk/jshell/spi/ExecutionControl innerClassName EngineTerminationException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ResolutionException outerClass jdk/jshell/spi/ExecutionControl innerClassName ResolutionException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$UserException outerClass jdk/jshell/spi/ExecutionControl innerClassName UserException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassInstallException outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassInstallException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ExecutionControlException outerClass jdk/jshell/spi/ExecutionControl innerClassName ExecutionControlException flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/execution/JdiExecutionControl +header extends jdk/jshell/execution/StreamingExecutionControl implements jdk/jshell/spi/ExecutionControl flags 421 +innerclass innerClass jdk/jshell/spi/ExecutionControl$EngineTerminationException outerClass jdk/jshell/spi/ExecutionControl innerClassName EngineTerminationException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassInstallException outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassInstallException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassBytecodes outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassBytecodes flags 19 +innerclass innerClass jdk/jshell/spi/ExecutionControl$NotImplementedException outerClass jdk/jshell/spi/ExecutionControl innerClassName NotImplementedException flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/execution/JdiInitiator +header extends java/lang/Object flags 21 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass com/sun/jdi/connect/Connector$Argument outerClass com/sun/jdi/connect/Connector innerClassName Argument flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/execution/LocalExecutionControl +header extends jdk/jshell/execution/DirectExecutionControl flags 21 +innerclass innerClass java/lang/Thread$UncaughtExceptionHandler outerClass java/lang/Thread innerClassName UncaughtExceptionHandler flags 609 +innerclass innerClass jdk/jshell/spi/ExecutionControl$StoppedException outerClass jdk/jshell/spi/ExecutionControl innerClassName StoppedException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$InternalException outerClass jdk/jshell/spi/ExecutionControl innerClassName InternalException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$EngineTerminationException outerClass jdk/jshell/spi/ExecutionControl innerClassName EngineTerminationException flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/execution/StreamingExecutionControl +header extends java/lang/Object implements jdk/jshell/spi/ExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$EngineTerminationException outerClass jdk/jshell/spi/ExecutionControl innerClassName EngineTerminationException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$NotImplementedException outerClass jdk/jshell/spi/ExecutionControl innerClassName NotImplementedException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$InternalException outerClass jdk/jshell/spi/ExecutionControl innerClassName InternalException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassInstallException outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassInstallException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$UserException outerClass jdk/jshell/spi/ExecutionControl innerClassName UserException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ResolutionException outerClass jdk/jshell/spi/ExecutionControl innerClassName ResolutionException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$RunException outerClass jdk/jshell/spi/ExecutionControl innerClassName RunException flags 409 +innerclass innerClass jdk/jshell/spi/ExecutionControl$StoppedException outerClass jdk/jshell/spi/ExecutionControl innerClassName StoppedException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassBytecodes outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassBytecodes flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/spi/ExecutionControl$ClassInstallException +header extends jdk/jshell/spi/ExecutionControl$ExecutionControlException nestHost jdk/jshell/spi/ExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ExecutionControlException outerClass jdk/jshell/spi/ExecutionControl innerClassName ExecutionControlException flags 409 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassInstallException outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassInstallException flags 9 + +class name jdk/jshell/spi/ExecutionControl$EngineTerminationException +header extends jdk/jshell/spi/ExecutionControl$ExecutionControlException nestHost jdk/jshell/spi/ExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ExecutionControlException outerClass jdk/jshell/spi/ExecutionControl innerClassName ExecutionControlException flags 409 +innerclass innerClass jdk/jshell/spi/ExecutionControl$EngineTerminationException outerClass jdk/jshell/spi/ExecutionControl innerClassName EngineTerminationException flags 9 + +class name jdk/jshell/spi/ExecutionControl$InternalException +header extends jdk/jshell/spi/ExecutionControl$ExecutionControlException nestHost jdk/jshell/spi/ExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ExecutionControlException outerClass jdk/jshell/spi/ExecutionControl innerClassName ExecutionControlException flags 409 +innerclass innerClass jdk/jshell/spi/ExecutionControl$InternalException outerClass jdk/jshell/spi/ExecutionControl innerClassName InternalException flags 9 + +class name jdk/jshell/spi/ExecutionControl$NotImplementedException +header extends jdk/jshell/spi/ExecutionControl$InternalException nestHost jdk/jshell/spi/ExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$InternalException outerClass jdk/jshell/spi/ExecutionControl innerClassName InternalException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$NotImplementedException outerClass jdk/jshell/spi/ExecutionControl innerClassName NotImplementedException flags 9 + +class name jdk/jshell/spi/ExecutionControl$ResolutionException +header extends jdk/jshell/spi/ExecutionControl$RunException nestHost jdk/jshell/spi/ExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$RunException outerClass jdk/jshell/spi/ExecutionControl innerClassName RunException flags 409 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ResolutionException outerClass jdk/jshell/spi/ExecutionControl innerClassName ResolutionException flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/spi/ExecutionControl$RunException +header extends jdk/jshell/spi/ExecutionControl$ExecutionControlException nestHost jdk/jshell/spi/ExecutionControl flags 421 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ExecutionControlException outerClass jdk/jshell/spi/ExecutionControl innerClassName ExecutionControlException flags 409 +innerclass innerClass jdk/jshell/spi/ExecutionControl$RunException outerClass jdk/jshell/spi/ExecutionControl innerClassName RunException flags 409 + +class name jdk/jshell/spi/ExecutionControl$StoppedException +header extends jdk/jshell/spi/ExecutionControl$RunException nestHost jdk/jshell/spi/ExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$RunException outerClass jdk/jshell/spi/ExecutionControl innerClassName RunException flags 409 +innerclass innerClass jdk/jshell/spi/ExecutionControl$StoppedException outerClass jdk/jshell/spi/ExecutionControl innerClassName StoppedException flags 9 + +class name jdk/jshell/spi/ExecutionControl$UserException +header extends jdk/jshell/spi/ExecutionControl$RunException nestHost jdk/jshell/spi/ExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$RunException outerClass jdk/jshell/spi/ExecutionControl innerClassName RunException flags 409 +innerclass innerClass jdk/jshell/spi/ExecutionControl$UserException outerClass jdk/jshell/spi/ExecutionControl innerClassName UserException flags 9 + diff -r 28582d575a98 -r fd4ec73925c3 make/data/symbols/symbols --- a/make/data/symbols/symbols Fri Jun 21 12:42:10 2019 +0530 +++ b/make/data/symbols/symbols Fri Jun 21 14:07:48 2019 +0530 @@ -29,10 +29,11 @@ #command used to generate this file: #build.tools.symbolgenerator.CreateSymbols build-description-incremental symbols include.list # -generate platforms 7:8:9:A:B:C +generate platforms 7:8:9:A:B:C:D platform version 8 files java.activation-8.sym.txt:java.base-8.sym.txt:java.compiler-8.sym.txt:java.corba-8.sym.txt:java.datatransfer-8.sym.txt:java.desktop-8.sym.txt:java.instrument-8.sym.txt:java.logging-8.sym.txt:java.management-8.sym.txt:java.management.rmi-8.sym.txt:java.naming-8.sym.txt:java.prefs-8.sym.txt:java.rmi-8.sym.txt:java.scripting-8.sym.txt:java.security.jgss-8.sym.txt:java.security.sasl-8.sym.txt:java.sql-8.sym.txt:java.sql.rowset-8.sym.txt:java.transaction-8.sym.txt:java.xml-8.sym.txt:java.xml.bind-8.sym.txt:java.xml.crypto-8.sym.txt:java.xml.ws-8.sym.txt:java.xml.ws.annotation-8.sym.txt:jdk.httpserver-8.sym.txt:jdk.management-8.sym.txt:jdk.scripting.nashorn-8.sym.txt:jdk.sctp-8.sym.txt:jdk.security.auth-8.sym.txt:jdk.security.jgss-8.sym.txt platform version 7 base 8 files java.base-7.sym.txt:java.compiler-7.sym.txt:java.datatransfer-7.sym.txt:java.desktop-7.sym.txt:java.logging-7.sym.txt:java.management-7.sym.txt:java.naming-7.sym.txt:java.prefs-7.sym.txt:java.rmi-7.sym.txt:java.scripting-7.sym.txt:java.security.jgss-7.sym.txt:java.security.sasl-7.sym.txt:java.sql-7.sym.txt:java.sql.rowset-7.sym.txt:java.xml-7.sym.txt:java.xml.bind-7.sym.txt:java.xml.ws.annotation-7.sym.txt:jdk.httpserver-7.sym.txt:jdk.management-7.sym.txt:jdk.scripting.nashorn-7.sym.txt:jdk.sctp-7.sym.txt:jdk.security.auth-7.sym.txt:jdk.security.jgss-7.sym.txt platform version 9 base 8 files java.activation-9.sym.txt:java.base-9.sym.txt:java.compiler-9.sym.txt:java.corba-9.sym.txt:java.datatransfer-9.sym.txt:java.desktop-9.sym.txt:java.instrument-9.sym.txt:java.logging-9.sym.txt:java.management-9.sym.txt:java.management.rmi-9.sym.txt:java.naming-9.sym.txt:java.prefs-9.sym.txt:java.rmi-9.sym.txt:java.scripting-9.sym.txt:java.se-9.sym.txt:java.se.ee-9.sym.txt:java.security.jgss-9.sym.txt:java.security.sasl-9.sym.txt:java.smartcardio-9.sym.txt:java.sql-9.sym.txt:java.sql.rowset-9.sym.txt:java.transaction-9.sym.txt:java.xml-9.sym.txt:java.xml.bind-9.sym.txt:java.xml.crypto-9.sym.txt:java.xml.ws-9.sym.txt:java.xml.ws.annotation-9.sym.txt:jdk.accessibility-9.sym.txt:jdk.attach-9.sym.txt:jdk.charsets-9.sym.txt:jdk.compiler-9.sym.txt:jdk.crypto.cryptoki-9.sym.txt:jdk.crypto.ec-9.sym.txt:jdk.dynalink-9.sym.txt:jdk.editpad-9.sym.txt:jdk.hotspot.agent-9.sym.txt:jdk.httpserver-9.sym.txt:jdk.incubator.httpclient-9.sym.txt:jdk.jartool-9.sym.txt:jdk.javadoc-9.sym.txt:jdk.jcmd-9.sym.txt:jdk.jconsole-9.sym.txt:jdk.jdeps-9.sym.txt:jdk.jdi-9.sym.txt:jdk.jdwp.agent-9.sym.txt:jdk.jlink-9.sym.txt:jdk.jshell-9.sym.txt:jdk.jsobject-9.sym.txt:jdk.jstatd-9.sym.txt:jdk.localedata-9.sym.txt:jdk.management-9.sym.txt:jdk.management.agent-9.sym.txt:jdk.naming.dns-9.sym.txt:jdk.naming.rmi-9.sym.txt:jdk.net-9.sym.txt:jdk.pack-9.sym.txt:jdk.policytool-9.sym.txt:jdk.rmic-9.sym.txt:jdk.scripting.nashorn-9.sym.txt:jdk.sctp-9.sym.txt:jdk.security.auth-9.sym.txt:jdk.security.jgss-9.sym.txt:jdk.unsupported-9.sym.txt:jdk.xml.dom-9.sym.txt:jdk.zipfs-9.sym.txt platform version A base 9 files java.activation-A.sym.txt:java.base-A.sym.txt:java.compiler-A.sym.txt:java.corba-A.sym.txt:java.datatransfer-A.sym.txt:java.desktop-A.sym.txt:java.instrument-A.sym.txt:java.logging-A.sym.txt:java.management-A.sym.txt:java.management.rmi-A.sym.txt:java.naming-A.sym.txt:java.prefs-A.sym.txt:java.rmi-A.sym.txt:java.scripting-A.sym.txt:java.se-A.sym.txt:java.se.ee-A.sym.txt:java.security.jgss-A.sym.txt:java.security.sasl-A.sym.txt:java.smartcardio-A.sym.txt:java.sql-A.sym.txt:java.sql.rowset-A.sym.txt:java.transaction-A.sym.txt:java.xml-A.sym.txt:java.xml.bind-A.sym.txt:java.xml.crypto-A.sym.txt:java.xml.ws-A.sym.txt:java.xml.ws.annotation-A.sym.txt:jdk.accessibility-A.sym.txt:jdk.attach-A.sym.txt:jdk.charsets-A.sym.txt:jdk.compiler-A.sym.txt:jdk.crypto.cryptoki-A.sym.txt:jdk.crypto.ec-A.sym.txt:jdk.dynalink-A.sym.txt:jdk.editpad-A.sym.txt:jdk.hotspot.agent-A.sym.txt:jdk.httpserver-A.sym.txt:jdk.incubator.httpclient-A.sym.txt:jdk.jartool-A.sym.txt:jdk.javadoc-A.sym.txt:jdk.jcmd-A.sym.txt:jdk.jconsole-A.sym.txt:jdk.jdeps-A.sym.txt:jdk.jdi-A.sym.txt:jdk.jdwp.agent-A.sym.txt:jdk.jlink-A.sym.txt:jdk.jshell-A.sym.txt:jdk.jsobject-A.sym.txt:jdk.jstatd-A.sym.txt:jdk.localedata-A.sym.txt:jdk.management-A.sym.txt:jdk.management.agent-A.sym.txt:jdk.naming.dns-A.sym.txt:jdk.naming.rmi-A.sym.txt:jdk.net-A.sym.txt:jdk.pack-A.sym.txt:jdk.policytool-A.sym.txt:jdk.rmic-A.sym.txt:jdk.scripting.nashorn-A.sym.txt:jdk.sctp-A.sym.txt:jdk.security.auth-A.sym.txt:jdk.security.jgss-A.sym.txt:jdk.unsupported-A.sym.txt:jdk.xml.dom-A.sym.txt:jdk.zipfs-A.sym.txt platform version B base A files java.activation-B.sym.txt:java.base-B.sym.txt:java.compiler-B.sym.txt:java.corba-B.sym.txt:java.datatransfer-B.sym.txt:java.desktop-B.sym.txt:java.instrument-B.sym.txt:java.logging-B.sym.txt:java.management-B.sym.txt:java.management.rmi-B.sym.txt:java.naming-B.sym.txt:java.net.http-B.sym.txt:java.prefs-B.sym.txt:java.rmi-B.sym.txt:java.scripting-B.sym.txt:java.se-B.sym.txt:java.se.ee-B.sym.txt:java.security.jgss-B.sym.txt:java.security.sasl-B.sym.txt:java.smartcardio-B.sym.txt:java.sql-B.sym.txt:java.sql.rowset-B.sym.txt:java.transaction-B.sym.txt:java.transaction.xa-B.sym.txt:java.xml-B.sym.txt:java.xml.bind-B.sym.txt:java.xml.crypto-B.sym.txt:java.xml.ws-B.sym.txt:java.xml.ws.annotation-B.sym.txt:jdk.accessibility-B.sym.txt:jdk.attach-B.sym.txt:jdk.charsets-B.sym.txt:jdk.compiler-B.sym.txt:jdk.crypto.cryptoki-B.sym.txt:jdk.crypto.ec-B.sym.txt:jdk.dynalink-B.sym.txt:jdk.editpad-B.sym.txt:jdk.hotspot.agent-B.sym.txt:jdk.httpserver-B.sym.txt:jdk.incubator.httpclient-B.sym.txt:jdk.jartool-B.sym.txt:jdk.javadoc-B.sym.txt:jdk.jcmd-B.sym.txt:jdk.jconsole-B.sym.txt:jdk.jdeps-B.sym.txt:jdk.jdi-B.sym.txt:jdk.jdwp.agent-B.sym.txt:jdk.jfr-B.sym.txt:jdk.jlink-B.sym.txt:jdk.jshell-B.sym.txt:jdk.jsobject-B.sym.txt:jdk.jstatd-B.sym.txt:jdk.localedata-B.sym.txt:jdk.management-B.sym.txt:jdk.management.agent-B.sym.txt:jdk.management.jfr-B.sym.txt:jdk.naming.dns-B.sym.txt:jdk.naming.rmi-B.sym.txt:jdk.net-B.sym.txt:jdk.pack-B.sym.txt:jdk.rmic-B.sym.txt:jdk.scripting.nashorn-B.sym.txt:jdk.sctp-B.sym.txt:jdk.security.auth-B.sym.txt:jdk.security.jgss-B.sym.txt:jdk.unsupported-B.sym.txt:jdk.xml.dom-B.sym.txt:jdk.zipfs-B.sym.txt platform version C base B files java.base-C.sym.txt:java.compiler-C.sym.txt:java.desktop-C.sym.txt:java.naming-C.sym.txt:java.rmi-C.sym.txt:java.xml-C.sym.txt:jdk.compiler-C.sym.txt:jdk.jfr-C.sym.txt:jdk.jsobject-C.sym.txt:jdk.unsupported-C.sym.txt +platform version D base C files java.base-D.sym.txt:java.compiler-D.sym.txt:java.desktop-D.sym.txt:java.management-D.sym.txt:java.management.rmi-D.sym.txt:java.net.http-D.sym.txt:java.xml-D.sym.txt:java.xml.crypto-D.sym.txt:jdk.compiler-D.sym.txt:jdk.httpserver-D.sym.txt:jdk.javadoc-D.sym.txt:jdk.jlink-D.sym.txt:jdk.jshell-D.sym.txt diff -r 28582d575a98 -r fd4ec73925c3 make/jdk/src/classes/build/tools/generatecacerts/GenerateCacerts.java --- a/make/jdk/src/classes/build/tools/generatecacerts/GenerateCacerts.java Fri Jun 21 12:42:10 2019 +0530 +++ b/make/jdk/src/classes/build/tools/generatecacerts/GenerateCacerts.java Fri Jun 21 14:07:48 2019 +0530 @@ -25,12 +25,23 @@ package build.tools.generatecacerts; +import java.io.DataOutputStream; import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; import java.nio.file.Files; import java.nio.file.Path; -import java.security.KeyStore; +import java.security.DigestOutputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; /** * Generate cacerts @@ -39,23 +50,99 @@ */ public class GenerateCacerts { public static void main(String[] args) throws Exception { - KeyStore ks = KeyStore.getInstance("JKS"); - ks.load(null, null); - CertificateFactory cf = CertificateFactory.getInstance("X509"); - Files.list(Path.of(args[0])) - .filter(p -> !p.getFileName().toString().equals("README")) - .forEach(p -> { - try { - String alias = p.getFileName().toString() + " [jdk]"; - try (InputStream fis = Files.newInputStream(p)) { - ks.setCertificateEntry(alias, cf.generateCertificate(fis)); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - }); try (FileOutputStream fos = new FileOutputStream(args[1])) { - ks.store(fos, "changeit".toCharArray()); + store(args[0], fos, "changeit".toCharArray()); } } + + // The following code are copied from JavaKeyStore.java. + + private static final int MAGIC = 0xfeedfeed; + private static final int VERSION_2 = 0x02; + + // This method is a simplified version of JavaKeyStore::engineStore. + // A new "dir" argument is added. All cert names in "dir" is collected into + // a sorted array. Each cert is stored with a creation date set to its + // notBefore value. Thus the output is determined as long as the certs + // are the same. + public static void store(String dir, OutputStream stream, char[] password) + throws IOException, NoSuchAlgorithmException, CertificateException + { + byte[] encoded; // the certificate encoding + CertificateFactory cf = CertificateFactory.getInstance("X509"); + + MessageDigest md = getPreKeyedHash(password); + DataOutputStream dos + = new DataOutputStream(new DigestOutputStream(stream, md)); + + dos.writeInt(MAGIC); + // always write the latest version + dos.writeInt(VERSION_2); + + // All file names in dir sorted. + // README is excluded. Name starting with "." excluded. + List entries = Files.list(Path.of(dir)) + .map(p -> p.getFileName().toString()) + .filter(s -> !s.equals("README") && !s.startsWith(".")) + .collect(Collectors.toList()); + + entries.sort(String::compareTo); + + dos.writeInt(entries.size()); + + for (String entry : entries) { + + String alias = entry + " [jdk]"; + X509Certificate cert; + try (InputStream fis = Files.newInputStream(Path.of(dir, entry))) { + cert = (X509Certificate) cf.generateCertificate(fis); + } + + dos.writeInt(2); + + // Write the alias + dos.writeUTF(alias); + + // Write the (entry creation) date, which is notBefore of the cert + dos.writeLong(cert.getNotBefore().getTime()); + + // Write the trusted certificate + encoded = cert.getEncoded(); + dos.writeUTF(cert.getType()); + dos.writeInt(encoded.length); + dos.write(encoded); + } + + /* + * Write the keyed hash which is used to detect tampering with + * the keystore (such as deleting or modifying key or + * certificate entries). + */ + byte[] digest = md.digest(); + + dos.write(digest); + dos.flush(); + } + + private static MessageDigest getPreKeyedHash(char[] password) + throws NoSuchAlgorithmException, UnsupportedEncodingException + { + + MessageDigest md = MessageDigest.getInstance("SHA"); + byte[] passwdBytes = convertToBytes(password); + md.update(passwdBytes); + Arrays.fill(passwdBytes, (byte) 0x00); + md.update("Mighty Aphrodite".getBytes("UTF8")); + return md; + } + + private static byte[] convertToBytes(char[] password) { + int i, j; + byte[] passwdBytes = new byte[password.length * 2]; + for (i=0, j=0; i> 8); + passwdBytes[j++] = (byte)password[i]; + } + return passwdBytes; + } } diff -r 28582d575a98 -r fd4ec73925c3 make/lib/Lib-java.security.jgss.gmk --- a/make/lib/Lib-java.security.jgss.gmk Fri Jun 21 12:42:10 2019 +0530 +++ b/make/lib/Lib-java.security.jgss.gmk Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -57,6 +57,17 @@ )) TARGETS += $(BUILD_LIBW2K_LSA_AUTH) + + $(eval $(call SetupJdkLibrary, BUILD_LIBSSPI_BRIDGE, \ + NAME := sspi_bridge, \ + OPTIMIZATION := LOW, \ + CFLAGS := $(CFLAGS_JDKLIB) \ + -I$(TOPDIR)/src/java.security.jgss/share/native/libj2gss, \ + LDFLAGS := $(LDFLAGS_JDKLIB) \ + $(call SET_SHARED_LIBRARY_ORIGIN) \ + )) + + TARGETS += $(BUILD_LIBSSPI_BRIDGE) endif ifeq ($(call isTargetOs, macosx), true) diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/aarch64-asmtest.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/cpu/aarch64/aarch64-asmtest.py Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,1177 @@ +import random + +AARCH64_AS = "" +AARCH64_OBJDUMP = "" +AARCH64_OBJCOPY = "" + +class Operand(object): + + def generate(self): + return self + +class Register(Operand): + + def generate(self): + self.number = random.randint(0, 30) + return self + + def astr(self, prefix): + return prefix + str(self.number) + +class FloatRegister(Register): + + def __str__(self): + return self.astr("v") + + def nextReg(self): + next = FloatRegister() + next.number = (self.number + 1) % 32 + return next + +class GeneralRegister(Register): + + def __str__(self): + return self.astr("r") + +class GeneralRegisterOrZr(Register): + + def generate(self): + self.number = random.randint(0, 31) + return self + + def astr(self, prefix = ""): + if (self.number == 31): + return prefix + "zr" + else: + return prefix + str(self.number) + + def __str__(self): + if (self.number == 31): + return self.astr() + else: + return self.astr("r") + +class GeneralRegisterOrSp(Register): + def generate(self): + self.number = random.randint(0, 31) + return self + + def astr(self, prefix = ""): + if (self.number == 31): + return "sp" + else: + return prefix + str(self.number) + + def __str__(self): + if (self.number == 31): + return self.astr() + else: + return self.astr("r") + +class FloatZero(Operand): + + def __str__(self): + return "0.0" + + def astr(self, ignored): + return "#0.0" + +class OperandFactory: + + _modes = {'x' : GeneralRegister, + 'w' : GeneralRegister, + 's' : FloatRegister, + 'd' : FloatRegister, + 'z' : FloatZero} + + @classmethod + def create(cls, mode): + return OperandFactory._modes[mode]() + +class ShiftKind: + + def generate(self): + self.kind = ["LSL", "LSR", "ASR"][random.randint(0,2)] + return self + + def cstr(self): + return self.kind + +class Instruction(object): + + def __init__(self, name): + self._name = name + self.isWord = name.endswith("w") | name.endswith("wi") + self.asmRegPrefix = ["x", "w"][self.isWord] + + def aname(self): + if (self._name.endswith("wi")): + return self._name[:len(self._name)-2] + else: + if (self._name.endswith("i") | self._name.endswith("w")): + return self._name[:len(self._name)-1] + else: + return self._name + + def emit(self) : + pass + + def compare(self) : + pass + + def generate(self) : + return self + + def cstr(self): + return '__ %s(' % self.name() + + def astr(self): + return '%s\t' % self.aname() + + def name(self): + name = self._name + if name == "and": + name = "andr" # Special case: the name "and" can't be used + # in HotSpot, even for a member. + return name + + def multipleForms(self): + return 0 + +class InstructionWithModes(Instruction): + + def __init__(self, name, mode): + Instruction.__init__(self, name) + self.mode = mode + self.isFloat = (mode == 'd') | (mode == 's') + if self.isFloat: + self.isWord = mode != 'd' + self.asmRegPrefix = ["d", "s"][self.isWord] + else: + self.isWord = mode != 'x' + self.asmRegPrefix = ["x", "w"][self.isWord] + + def name(self): + return self._name + (self.mode if self.mode != 'x' else '') + + def aname(self): + return (self._name+mode if (mode == 'b' or mode == 'h') + else self._name) + +class ThreeRegInstruction(Instruction): + + def generate(self): + self.reg = [GeneralRegister().generate(), GeneralRegister().generate(), + GeneralRegister().generate()] + return self + + + def cstr(self): + return (super(ThreeRegInstruction, self).cstr() + + ('%s, %s, %s' + % (self.reg[0], + self.reg[1], self.reg[2]))) + + def astr(self): + prefix = self.asmRegPrefix + return (super(ThreeRegInstruction, self).astr() + + ('%s, %s, %s' + % (self.reg[0].astr(prefix), + self.reg[1].astr(prefix), self.reg[2].astr(prefix)))) + +class FourRegInstruction(ThreeRegInstruction): + + def generate(self): + self.reg = ThreeRegInstruction.generate(self).reg + [GeneralRegister().generate()] + return self + + + def cstr(self): + return (super(FourRegInstruction, self).cstr() + + (', %s' % self.reg[3])) + + def astr(self): + prefix = self.asmRegPrefix + return (super(FourRegInstruction, self).astr() + + (', %s' % self.reg[3].astr(prefix))) + +class TwoRegInstruction(Instruction): + + def generate(self): + self.reg = [GeneralRegister().generate(), GeneralRegister().generate()] + return self + + def cstr(self): + return (super(TwoRegInstruction, self).cstr() + + '%s, %s' % (self.reg[0], + self.reg[1])) + + def astr(self): + prefix = self.asmRegPrefix + return (super(TwoRegInstruction, self).astr() + + ('%s, %s' + % (self.reg[0].astr(prefix), + self.reg[1].astr(prefix)))) + +class TwoRegImmedInstruction(TwoRegInstruction): + + def generate(self): + super(TwoRegImmedInstruction, self).generate() + self.immed = random.randint(0, 1<<11 -1) + return self + + def cstr(self): + return (super(TwoRegImmedInstruction, self).cstr() + + ', %su' % self.immed) + + def astr(self): + return (super(TwoRegImmedInstruction, self).astr() + + ', #%s' % self.immed) + +class OneRegOp(Instruction): + + def generate(self): + self.reg = GeneralRegister().generate() + return self + + def cstr(self): + return (super(OneRegOp, self).cstr() + + '%s);' % self.reg) + + def astr(self): + return (super(OneRegOp, self).astr() + + '%s' % self.reg.astr(self.asmRegPrefix)) + +class ArithOp(ThreeRegInstruction): + + def generate(self): + super(ArithOp, self).generate() + self.kind = ShiftKind().generate() + self.distance = random.randint(0, (1<<5)-1 if self.isWord else (1<<6)-1) + return self + + def cstr(self): + return ('%s, Assembler::%s, %s);' + % (ThreeRegInstruction.cstr(self), + self.kind.cstr(), self.distance)) + + def astr(self): + return ('%s, %s #%s' + % (ThreeRegInstruction.astr(self), + self.kind.cstr(), + self.distance)) + +class AddSubCarryOp(ThreeRegInstruction): + + def cstr(self): + return ('%s);' + % (ThreeRegInstruction.cstr(self))) + +class AddSubExtendedOp(ThreeRegInstruction): + + uxtb, uxth, uxtw, uxtx, sxtb, sxth, sxtw, sxtx = range(8) + optNames = ["uxtb", "uxth", "uxtw", "uxtx", "sxtb", "sxth", "sxtw", "sxtx"] + + def generate(self): + super(AddSubExtendedOp, self).generate() + self.amount = random.randint(1, 4) + self.option = random.randint(0, 7) + return self + + def cstr(self): + return (super(AddSubExtendedOp, self).cstr() + + (", ext::" + AddSubExtendedOp.optNames[self.option] + + ", " + str(self.amount) + ");")) + + def astr(self): + return (super(AddSubExtendedOp, self).astr() + + (", " + AddSubExtendedOp.optNames[self.option] + + " #" + str(self.amount))) + +class AddSubImmOp(TwoRegImmedInstruction): + + def cstr(self): + return super(AddSubImmOp, self).cstr() + ");" + +class LogicalImmOp(AddSubImmOp): + + # These tables are legal immediate logical operands + immediates32 \ + = [0x1, 0x3f, 0x1f0, 0x7e0, + 0x1c00, 0x3ff0, 0x8000, 0x1e000, + 0x3e000, 0x78000, 0xe0000, 0x100000, + 0x1fffe0, 0x3fe000, 0x780000, 0x7ffff8, + 0xff8000, 0x1800180, 0x1fffc00, 0x3c003c0, + 0x3ffff00, 0x7c00000, 0x7fffe00, 0xf000f00, + 0xfffe000, 0x18181818, 0x1ffc0000, 0x1ffffffe, + 0x3f003f00, 0x3fffe000, 0x60006000, 0x7f807f80, + 0x7ffffc00, 0x800001ff, 0x803fffff, 0x9f9f9f9f, + 0xc0000fff, 0xc0c0c0c0, 0xe0000000, 0xe003e003, + 0xe3ffffff, 0xf0000fff, 0xf0f0f0f0, 0xf80000ff, + 0xf83ff83f, 0xfc00007f, 0xfc1fffff, 0xfe0001ff, + 0xfe3fffff, 0xff003fff, 0xff800003, 0xff87ff87, + 0xffc00fff, 0xffe0000f, 0xffefffef, 0xfff1fff1, + 0xfff83fff, 0xfffc0fff, 0xfffe0fff, 0xffff3fff, + 0xffffc007, 0xffffe1ff, 0xfffff80f, 0xfffffe07, + 0xffffffbf, 0xfffffffd] + + immediates \ + = [0x1, 0x1f80, 0x3fff0, 0x3ffffc, + 0x3fe0000, 0x1ffc0000, 0xf8000000, 0x3ffffc000, + 0xffffffe00, 0x3ffffff800, 0xffffc00000, 0x3f000000000, + 0x7fffffff800, 0x1fe000001fe0, 0x3ffffff80000, 0xc00000000000, + 0x1ffc000000000, 0x3ffff0003ffff, 0x7ffffffe00000, 0xfffffffffc000, + 0x1ffffffffffc00, 0x3fffffffffff00, 0x7ffffffffffc00, 0xffffffffff8000, + 0x1ffffffff800000, 0x3fffffc03fffffc, 0x7fffc0000000000, 0xff80ff80ff80ff8, + 0x1c00000000000000, 0x1fffffffffff0000, 0x3fffff803fffff80, 0x7fc000007fc00000, + 0x8000000000000000, 0x803fffff803fffff, 0xc000007fc000007f, 0xe00000000000ffff, + 0xe3ffffffffffffff, 0xf007f007f007f007, 0xf80003ffffffffff, 0xfc000003fc000003, + 0xfe000000007fffff, 0xff00000000007fff, 0xff800000000003ff, 0xffc00000000000ff, + 0xffe00000000003ff, 0xfff0000000003fff, 0xfff80000001fffff, 0xfffc0000fffc0000, + 0xfffe003fffffffff, 0xffff3fffffffffff, 0xffffc0000007ffff, 0xffffe01fffffe01f, + 0xfffff800000007ff, 0xfffffc0fffffffff, 0xffffff00003fffff, 0xffffffc0000007ff, + 0xfffffff0000001ff, 0xfffffffc00003fff, 0xffffffff07ffffff, 0xffffffffe003ffff, + 0xfffffffffc01ffff, 0xffffffffffc00003, 0xfffffffffffc000f, 0xffffffffffffe07f] + + def generate(self): + AddSubImmOp.generate(self) + self.immed = \ + self.immediates32[random.randint(0, len(self.immediates32)-1)] \ + if self.isWord \ + else \ + self.immediates[random.randint(0, len(self.immediates)-1)] + + return self + + def astr(self): + return (super(TwoRegImmedInstruction, self).astr() + + ', #0x%x' % self.immed) + + def cstr(self): + return super(AddSubImmOp, self).cstr() + "l);" + +class MultiOp(): + + def multipleForms(self): + return 3 + + def forms(self): + return ["__ pc()", "back", "forth"] + + def aforms(self): + return [".", "back", "forth"] + +class AbsOp(MultiOp, Instruction): + + def cstr(self): + return super(AbsOp, self).cstr() + "%s);" + + def astr(self): + return Instruction.astr(self) + "%s" + +class RegAndAbsOp(MultiOp, Instruction): + + def multipleForms(self): + if self.name() == "adrp": + # We can only test one form of adrp because anything other + # than "adrp ." requires relocs in the assembler output + return 1 + return 3 + + def generate(self): + Instruction.generate(self) + self.reg = GeneralRegister().generate() + return self + + def cstr(self): + if self.name() == "adrp": + return "__ _adrp(" + "%s, %s);" % (self.reg, "%s") + return (super(RegAndAbsOp, self).cstr() + + "%s, %s);" % (self.reg, "%s")) + + def astr(self): + return (super(RegAndAbsOp, self).astr() + + self.reg.astr(self.asmRegPrefix) + ", %s") + +class RegImmAbsOp(RegAndAbsOp): + + def cstr(self): + return (Instruction.cstr(self) + + "%s, %s, %s);" % (self.reg, self.immed, "%s")) + + def astr(self): + return (Instruction.astr(self) + + ("%s, #%s, %s" + % (self.reg.astr(self.asmRegPrefix), self.immed, "%s"))) + + def generate(self): + super(RegImmAbsOp, self).generate() + self.immed = random.randint(0, 1<<5 -1) + return self + +class MoveWideImmOp(RegImmAbsOp): + + def multipleForms(self): + return 0 + + def cstr(self): + return (Instruction.cstr(self) + + "%s, %s, %s);" % (self.reg, self.immed, self.shift)) + + def astr(self): + return (Instruction.astr(self) + + ("%s, #%s, lsl %s" + % (self.reg.astr(self.asmRegPrefix), + self.immed, self.shift))) + + def generate(self): + super(RegImmAbsOp, self).generate() + self.immed = random.randint(0, 1<<16 -1) + if self.isWord: + self.shift = random.randint(0, 1) * 16 + else: + self.shift = random.randint(0, 3) * 16 + return self + +class BitfieldOp(TwoRegInstruction): + + def cstr(self): + return (Instruction.cstr(self) + + ("%s, %s, %s, %s);" + % (self.reg[0], self.reg[1], self.immr, self.imms))) + + def astr(self): + return (TwoRegInstruction.astr(self) + + (", #%s, #%s" + % (self.immr, self.imms))) + + def generate(self): + TwoRegInstruction.generate(self) + self.immr = random.randint(0, 31) + self.imms = random.randint(0, 31) + return self + +class ExtractOp(ThreeRegInstruction): + + def generate(self): + super(ExtractOp, self).generate() + self.lsb = random.randint(0, (1<<5)-1 if self.isWord else (1<<6)-1) + return self + + def cstr(self): + return (ThreeRegInstruction.cstr(self) + + (", %s);" % self.lsb)) + + def astr(self): + return (ThreeRegInstruction.astr(self) + + (", #%s" % self.lsb)) + +class CondBranchOp(MultiOp, Instruction): + + def cstr(self): + return "__ br(Assembler::" + self.name() + ", %s);" + + def astr(self): + return "b." + self.name() + "\t%s" + +class ImmOp(Instruction): + + def cstr(self): + return "%s%s);" % (Instruction.cstr(self), self.immed) + + def astr(self): + return Instruction.astr(self) + "#" + str(self.immed) + + def generate(self): + self.immed = random.randint(0, 1<<16 -1) + return self + +class Op(Instruction): + + def cstr(self): + return Instruction.cstr(self) + ");" + +class SystemOp(Instruction): + + def __init__(self, op): + Instruction.__init__(self, op[0]) + self.barriers = op[1] + + def generate(self): + Instruction.generate(self) + self.barrier \ + = self.barriers[random.randint(0, len(self.barriers)-1)] + return self + + def cstr(self): + return Instruction.cstr(self) + "Assembler::" + self.barrier + ");" + + def astr(self): + return Instruction.astr(self) + self.barrier + +conditionCodes = ["EQ", "NE", "HS", "CS", "LO", "CC", "MI", "PL", "VS", \ + "VC", "HI", "LS", "GE", "LT", "GT", "LE", "AL", "NV"] + +class ConditionalCompareOp(TwoRegImmedInstruction): + + def generate(self): + TwoRegImmedInstruction.generate(self) + self.cond = random.randint(0, 15) + self.immed = random.randint(0, 15) + return self + + def cstr(self): + return (super(ConditionalCompareOp, self).cstr() + ", " + + "Assembler::" + conditionCodes[self.cond] + ");") + + def astr(self): + return (super(ConditionalCompareOp, self).astr() + + ", " + conditionCodes[self.cond]) + +class ConditionalCompareImmedOp(Instruction): + + def generate(self): + self.reg = GeneralRegister().generate() + self.cond = random.randint(0, 15) + self.immed2 = random.randint(0, 15) + self.immed = random.randint(0, 31) + return self + + def cstr(self): + return (Instruction.cstr(self) + str(self.reg) + ", " + + str(self.immed) + ", " + + str(self.immed2) + ", " + + "Assembler::" + conditionCodes[self.cond] + ");") + + def astr(self): + return (Instruction.astr(self) + + self.reg.astr(self.asmRegPrefix) + + ", #" + str(self.immed) + + ", #" + str(self.immed2) + + ", " + conditionCodes[self.cond]) + +class TwoRegOp(TwoRegInstruction): + + def cstr(self): + return TwoRegInstruction.cstr(self) + ");" + +class ThreeRegOp(ThreeRegInstruction): + + def cstr(self): + return ThreeRegInstruction.cstr(self) + ");" + +class FourRegMulOp(FourRegInstruction): + + def cstr(self): + return FourRegInstruction.cstr(self) + ");" + + def astr(self): + isMaddsub = self.name().startswith("madd") | self.name().startswith("msub") + midPrefix = self.asmRegPrefix if isMaddsub else "w" + return (Instruction.astr(self) + + self.reg[0].astr(self.asmRegPrefix) + + ", " + self.reg[1].astr(midPrefix) + + ", " + self.reg[2].astr(midPrefix) + + ", " + self.reg[3].astr(self.asmRegPrefix)) + +class ConditionalSelectOp(ThreeRegInstruction): + + def generate(self): + ThreeRegInstruction.generate(self) + self.cond = random.randint(0, 15) + return self + + def cstr(self): + return (ThreeRegInstruction.cstr(self) + ", " + + "Assembler::" + conditionCodes[self.cond] + ");") + + def astr(self): + return (ThreeRegInstruction.astr(self) + + ", " + conditionCodes[self.cond]) + +class LoadStoreExclusiveOp(InstructionWithModes): + + def __init__(self, op): # op is a tuple of ["name", "mode", registers] + InstructionWithModes.__init__(self, op[0], op[1]) + self.num_registers = op[2] + + def astr(self): + result = self.aname() + '\t' + regs = list(self.regs) + index = regs.pop() # The last reg is the index register + prefix = ('x' if (self.mode == 'x') + & ((self.name().startswith("ld")) + | (self.name().startswith("stlr"))) # Ewww :-( + else 'w') + result = result + regs.pop(0).astr(prefix) + ", " + for s in regs: + result = result + s.astr(self.asmRegPrefix) + ", " + result = result + "[" + index.astr("x") + "]" + return result + + def cstr(self): + result = InstructionWithModes.cstr(self) + regs = list(self.regs) + index = regs.pop() # The last reg is the index register + for s in regs: + result = result + str(s) + ", " + result = result + str(index) + ");" + return result + + def appendUniqueReg(self): + result = 0 + while result == 0: + newReg = GeneralRegister().generate() + result = 1 + for i in self.regs: + result = result and (i.number != newReg.number) + self.regs.append(newReg) + + def generate(self): + self.regs = [] + for i in range(self.num_registers): + self.appendUniqueReg() + return self + + def name(self): + if self.mode == 'x': + return self._name + else: + return self._name + self.mode + + def aname(self): + if (self.mode == 'b') | (self.mode == 'h'): + return self._name + self.mode + else: + return self._name + +class Address(object): + + base_plus_unscaled_offset, pre, post, base_plus_reg, \ + base_plus_scaled_offset, pcrel, post_reg, base_only = range(8) + kinds = ["base_plus_unscaled_offset", "pre", "post", "base_plus_reg", + "base_plus_scaled_offset", "pcrel", "post_reg", "base_only"] + extend_kinds = ["uxtw", "lsl", "sxtw", "sxtx"] + + @classmethod + def kindToStr(cls, i): + return cls.kinds[i] + + def generate(self, kind, shift_distance): + self.kind = kind + self.base = GeneralRegister().generate() + self.index = GeneralRegister().generate() + self.offset = { + Address.base_plus_unscaled_offset: random.randint(-1<<8, 1<<8-1) | 1, + Address.pre: random.randint(-1<<8, 1<<8-1), + Address.post: random.randint(-1<<8, 1<<8-1), + Address.pcrel: random.randint(0, 2), + Address.base_plus_reg: 0, + Address.base_plus_scaled_offset: (random.randint(0, 1<<11-1) | (3 << 9))*8, + Address.post_reg: 0, + Address.base_only: 0} [kind] + self.offset >>= (3 - shift_distance) + self.extend_kind = Address.extend_kinds[random.randint(0, 3)] + self.shift_distance = random.randint(0, 1) * shift_distance + return self + + def __str__(self): + result = { + Address.base_plus_unscaled_offset: "Address(%s, %s)" \ + % (str(self.base), self.offset), + Address.pre: "Address(__ pre(%s, %s))" % (str(self.base), self.offset), + Address.post: "Address(__ post(%s, %s))" % (str(self.base), self.offset), + Address.post_reg: "Address(__ post(%s, %s))" % (str(self.base), self.index), + Address.base_only: "Address(%s)" % (str(self.base)), + Address.pcrel: "", + Address.base_plus_reg: "Address(%s, %s, Address::%s(%s))" \ + % (self.base, self.index, self.extend_kind, self.shift_distance), + Address.base_plus_scaled_offset: + "Address(%s, %s)" % (self.base, self.offset) } [self.kind] + if (self.kind == Address.pcrel): + result = ["__ pc()", "back", "forth"][self.offset] + return result + + def astr(self, prefix): + extend_prefix = prefix + if self.kind == Address.base_plus_reg: + if self.extend_kind.endswith("w"): + extend_prefix = "w" + result = { + Address.base_plus_unscaled_offset: "[%s, %s]" \ + % (self.base.astr(prefix), self.offset), + Address.pre: "[%s, %s]!" % (self.base.astr(prefix), self.offset), + Address.post: "[%s], %s" % (self.base.astr(prefix), self.offset), + Address.post_reg: "[%s], %s" % (self.base.astr(prefix), self.index.astr(prefix)), + Address.base_only: "[%s]" % (self.base.astr(prefix)), + Address.pcrel: "", + Address.base_plus_reg: "[%s, %s, %s #%s]" \ + % (self.base.astr(prefix), self.index.astr(extend_prefix), + self.extend_kind, self.shift_distance), + Address.base_plus_scaled_offset: \ + "[%s, %s]" \ + % (self.base.astr(prefix), self.offset) + } [self.kind] + if (self.kind == Address.pcrel): + result = [".", "back", "forth"][self.offset] + return result + +class LoadStoreOp(InstructionWithModes): + + def __init__(self, args): + name, self.asmname, self.kind, mode = args + InstructionWithModes.__init__(self, name, mode) + + def generate(self): + + # This is something of a kludge, but the offset needs to be + # scaled by the memory datamode somehow. + shift = 3 + if (self.mode == 'b') | (self.asmname.endswith("b")): + shift = 0 + elif (self.mode == 'h') | (self.asmname.endswith("h")): + shift = 1 + elif (self.mode == 'w') | (self.asmname.endswith("w")) \ + | (self.mode == 's') : + shift = 2 + + self.adr = Address().generate(self.kind, shift) + + isFloat = (self.mode == 'd') | (self.mode == 's') + + regMode = FloatRegister if isFloat else GeneralRegister + self.reg = regMode().generate() + return self + + def cstr(self): + if not(self._name.startswith("prfm")): + return "%s%s, %s);" % (Instruction.cstr(self), str(self.reg), str(self.adr)) + else: # No target register for a prefetch + return "%s%s);" % (Instruction.cstr(self), str(self.adr)) + + def astr(self): + if not(self._name.startswith("prfm")): + return "%s\t%s, %s" % (self.aname(), self.reg.astr(self.asmRegPrefix), + self.adr.astr("x")) + else: # No target register for a prefetch + return "%s %s" % (self.aname(), + self.adr.astr("x")) + + def aname(self): + result = self.asmname + # if self.kind == Address.base_plus_unscaled_offset: + # result = result.replace("ld", "ldu", 1) + # result = result.replace("st", "stu", 1) + return result + +class LoadStorePairOp(InstructionWithModes): + + numRegs = 2 + + def __init__(self, args): + name, self.asmname, self.kind, mode = args + InstructionWithModes.__init__(self, name, mode) + self.offset = random.randint(-1<<4, 1<<4-1) << 4 + + def generate(self): + self.reg = [OperandFactory.create(self.mode).generate() + for i in range(self.numRegs)] + self.base = OperandFactory.create('x').generate() + return self + + def astr(self): + address = ["[%s, #%s]", "[%s, #%s]!", "[%s], #%s"][self.kind] + address = address % (self.base.astr('x'), self.offset) + result = "%s\t%s, %s, %s" \ + % (self.asmname, + self.reg[0].astr(self.asmRegPrefix), + self.reg[1].astr(self.asmRegPrefix), address) + return result + + def cstr(self): + address = { + Address.base_plus_unscaled_offset: "Address(%s, %s)" \ + % (str(self.base), self.offset), + Address.pre: "Address(__ pre(%s, %s))" % (str(self.base), self.offset), + Address.post: "Address(__ post(%s, %s))" % (str(self.base), self.offset), + } [self.kind] + result = "__ %s(%s, %s, %s);" \ + % (self.name(), self.reg[0], self.reg[1], address) + return result + +class FloatInstruction(Instruction): + + def aname(self): + if (self._name.endswith("s") | self._name.endswith("d")): + return self._name[:len(self._name)-1] + else: + return self._name + + def __init__(self, args): + name, self.modes = args + Instruction.__init__(self, name) + + def generate(self): + self.reg = [OperandFactory.create(self.modes[i]).generate() + for i in range(self.numRegs)] + return self + + def cstr(self): + formatStr = "%s%s" + ''.join([", %s" for i in range(1, self.numRegs)] + [");"]) + return (formatStr + % tuple([Instruction.cstr(self)] + + [str(self.reg[i]) for i in range(self.numRegs)])) # Yowza + + def astr(self): + formatStr = "%s%s" + ''.join([", %s" for i in range(1, self.numRegs)]) + return (formatStr + % tuple([Instruction.astr(self)] + + [(self.reg[i].astr(self.modes[i])) for i in range(self.numRegs)])) + +class LdStSIMDOp(Instruction): + def __init__(self, args): + self._name, self.regnum, self.arrangement, self.addresskind = args + + def generate(self): + self.address = Address().generate(self.addresskind, 0) + self._firstSIMDreg = FloatRegister().generate() + if (self.addresskind == Address.post): + if (self._name in ["ld1r", "ld2r", "ld3r", "ld4r"]): + elem_size = {"8B" : 1, "16B" : 1, "4H" : 2, "8H" : 2, "2S" : 4, "4S" : 4, "1D" : 8, "2D" : 8} [self.arrangement] + self.address.offset = self.regnum * elem_size + else: + if (self.arrangement in ["8B", "4H", "2S", "1D"]): + self.address.offset = self.regnum * 8 + else: + self.address.offset = self.regnum * 16 + return self + + def cstr(self): + buf = super(LdStSIMDOp, self).cstr() + str(self._firstSIMDreg) + current = self._firstSIMDreg + for cnt in range(1, self.regnum): + buf = '%s, %s' % (buf, current.nextReg()) + current = current.nextReg() + return '%s, __ T%s, %s);' % (buf, self.arrangement, str(self.address)) + + def astr(self): + buf = '%s\t{%s.%s' % (self._name, self._firstSIMDreg, self.arrangement) + current = self._firstSIMDreg + for cnt in range(1, self.regnum): + buf = '%s, %s.%s' % (buf, current.nextReg(), self.arrangement) + current = current.nextReg() + return '%s}, %s' % (buf, self.address.astr("x")) + + def aname(self): + return self._name + +class LSEOp(Instruction): + def __init__(self, args): + self._name, self.asmname, self.size, self.suffix = args + + def generate(self): + self._name = "%s%s" % (self._name, self.suffix) + self.asmname = "%s%s" % (self.asmname, self.suffix) + self.srcReg = GeneralRegisterOrZr().generate() + self.tgtReg = GeneralRegisterOrZr().generate() + self.adrReg = GeneralRegisterOrSp().generate() + + return self + + def cstr(self): + sizeSpec = {"x" : "Assembler::xword", "w" : "Assembler::word"} [self.size] + return super(LSEOp, self).cstr() + "%s, %s, %s, %s);" % (sizeSpec, self.srcReg, self.tgtReg, self.adrReg) + + def astr(self): + return "%s\t%s, %s, [%s]" % (self.asmname, self.srcReg.astr(self.size), self.tgtReg.astr(self.size), self.adrReg.astr("x")) + + def aname(self): + return self.asmname + +class TwoRegFloatOp(FloatInstruction): + numRegs = 2 + +class ThreeRegFloatOp(TwoRegFloatOp): + numRegs = 3 + +class FourRegFloatOp(TwoRegFloatOp): + numRegs = 4 + +class FloatConvertOp(TwoRegFloatOp): + + def __init__(self, args): + self._cname, self._aname, modes = args + TwoRegFloatOp.__init__(self, [self._cname, modes]) + + def aname(self): + return self._aname + + def cname(self): + return self._cname + +class SpecialCases(Instruction): + def __init__(self, data): + self._name = data[0] + self._cstr = data[1] + self._astr = data[2] + + def cstr(self): + return self._cstr + + def astr(self): + return self._astr + +def generate(kind, names): + outfile.write("# " + kind.__name__ + "\n"); + print "\n// " + kind.__name__ + for name in names: + for i in range(1): + op = kind(name).generate() + if op.multipleForms(): + forms = op.forms() + aforms = op.aforms() + for i in range(op.multipleForms()): + cstr = op.cstr() % forms[i] + astr = op.astr() % aforms[i] + print " %-50s //\t%s" % (cstr, astr) + outfile.write("\t" + astr + "\n") + else: + print " %-50s //\t%s" % (op.cstr(), op.astr()) + outfile.write("\t" + op.astr() + "\n") + +outfile = open("aarch64ops.s", "w") + +print "// BEGIN Generated code -- do not edit" +print "// Generated by aarch64-asmtest.py" + +print " Label back, forth;" +print " __ bind(back);" + +outfile.write("back:\n") + +generate (ArithOp, + [ "add", "sub", "adds", "subs", + "addw", "subw", "addsw", "subsw", + "and", "orr", "eor", "ands", + "andw", "orrw", "eorw", "andsw", + "bic", "orn", "eon", "bics", + "bicw", "ornw", "eonw", "bicsw" ]) + +generate (AddSubImmOp, + [ "addw", "addsw", "subw", "subsw", + "add", "adds", "sub", "subs"]) +generate (LogicalImmOp, + [ "andw", "orrw", "eorw", "andsw", + "and", "orr", "eor", "ands"]) + +generate (AbsOp, [ "b", "bl" ]) + +generate (RegAndAbsOp, ["cbzw", "cbnzw", "cbz", "cbnz", "adr", "adrp"]) + +generate (RegImmAbsOp, ["tbz", "tbnz"]) + +generate (MoveWideImmOp, ["movnw", "movzw", "movkw", "movn", "movz", "movk"]) + +generate (BitfieldOp, ["sbfm", "bfmw", "ubfmw", "sbfm", "bfm", "ubfm"]) + +generate (ExtractOp, ["extrw", "extr"]) + +generate (CondBranchOp, ["EQ", "NE", "HS", "CS", "LO", "CC", "MI", "PL", "VS", "VC", + "HI", "LS", "GE", "LT", "GT", "LE", "AL", "NV" ]) + +generate (ImmOp, ["svc", "hvc", "smc", "brk", "hlt", # "dpcs1", "dpcs2", "dpcs3" + ]) + +generate (Op, ["nop", "eret", "drps", "isb"]) + +barriers = ["OSHLD", "OSHST", "OSH", "NSHLD", "NSHST", "NSH", + "ISHLD", "ISHST", "ISH", "LD", "ST", "SY"] + +generate (SystemOp, [["dsb", barriers], ["dmb", barriers]]) + +generate (OneRegOp, ["br", "blr"]) + +for mode in 'xwhb': + generate (LoadStoreExclusiveOp, [["stxr", mode, 3], ["stlxr", mode, 3], + ["ldxr", mode, 2], ["ldaxr", mode, 2], + ["stlr", mode, 2], ["ldar", mode, 2]]) + +for mode in 'xw': + generate (LoadStoreExclusiveOp, [["ldxp", mode, 3], ["ldaxp", mode, 3], + ["stxp", mode, 4], ["stlxp", mode, 4]]) + +for kind in range(6): + print "\n// " + Address.kindToStr(kind), + if kind != Address.pcrel: + generate (LoadStoreOp, + [["str", "str", kind, "x"], ["str", "str", kind, "w"], + ["str", "strb", kind, "b"], ["str", "strh", kind, "h"], + ["ldr", "ldr", kind, "x"], ["ldr", "ldr", kind, "w"], + ["ldr", "ldrb", kind, "b"], ["ldr", "ldrh", kind, "h"], + ["ldrsb", "ldrsb", kind, "x"], ["ldrsh", "ldrsh", kind, "x"], + ["ldrsh", "ldrsh", kind, "w"], ["ldrsw", "ldrsw", kind, "x"], + ["ldr", "ldr", kind, "d"], ["ldr", "ldr", kind, "s"], + ["str", "str", kind, "d"], ["str", "str", kind, "s"], + ]) + else: + generate (LoadStoreOp, + [["ldr", "ldr", kind, "x"], ["ldr", "ldr", kind, "w"]]) + + +for kind in (Address.base_plus_unscaled_offset, Address.pcrel, Address.base_plus_reg, \ + Address.base_plus_scaled_offset): + generate (LoadStoreOp, + [["prfm", "prfm\tPLDL1KEEP,", kind, "x"]]) + +generate(AddSubCarryOp, ["adcw", "adcsw", "sbcw", "sbcsw", "adc", "adcs", "sbc", "sbcs"]) + +generate(AddSubExtendedOp, ["addw", "addsw", "sub", "subsw", "add", "adds", "sub", "subs"]) + +generate(ConditionalCompareOp, ["ccmnw", "ccmpw", "ccmn", "ccmp"]) +generate(ConditionalCompareImmedOp, ["ccmnw", "ccmpw", "ccmn", "ccmp"]) +generate(ConditionalSelectOp, + ["cselw", "csincw", "csinvw", "csnegw", "csel", "csinc", "csinv", "csneg"]) + +generate(TwoRegOp, + ["rbitw", "rev16w", "revw", "clzw", "clsw", "rbit", + "rev16", "rev32", "rev", "clz", "cls"]) +generate(ThreeRegOp, + ["udivw", "sdivw", "lslvw", "lsrvw", "asrvw", "rorvw", "udiv", "sdiv", + "lslv", "lsrv", "asrv", "rorv", "umulh", "smulh"]) +generate(FourRegMulOp, + ["maddw", "msubw", "madd", "msub", "smaddl", "smsubl", "umaddl", "umsubl"]) + +generate(ThreeRegFloatOp, + [["fmuls", "sss"], ["fdivs", "sss"], ["fadds", "sss"], ["fsubs", "sss"], + ["fmuls", "sss"], + ["fmuld", "ddd"], ["fdivd", "ddd"], ["faddd", "ddd"], ["fsubd", "ddd"], + ["fmuld", "ddd"]]) + +generate(FourRegFloatOp, + [["fmadds", "ssss"], ["fmsubs", "ssss"], ["fnmadds", "ssss"], ["fnmadds", "ssss"], + ["fmaddd", "dddd"], ["fmsubd", "dddd"], ["fnmaddd", "dddd"], ["fnmaddd", "dddd"],]) + +generate(TwoRegFloatOp, + [["fmovs", "ss"], ["fabss", "ss"], ["fnegs", "ss"], ["fsqrts", "ss"], + ["fcvts", "ds"], + ["fmovd", "dd"], ["fabsd", "dd"], ["fnegd", "dd"], ["fsqrtd", "dd"], + ["fcvtd", "sd"], + ]) + +generate(FloatConvertOp, [["fcvtzsw", "fcvtzs", "ws"], ["fcvtzs", "fcvtzs", "xs"], + ["fcvtzdw", "fcvtzs", "wd"], ["fcvtzd", "fcvtzs", "xd"], + ["scvtfws", "scvtf", "sw"], ["scvtfs", "scvtf", "sx"], + ["scvtfwd", "scvtf", "dw"], ["scvtfd", "scvtf", "dx"], + ["fmovs", "fmov", "ws"], ["fmovd", "fmov", "xd"], + ["fmovs", "fmov", "sw"], ["fmovd", "fmov", "dx"]]) + +generate(TwoRegFloatOp, [["fcmps", "ss"], ["fcmpd", "dd"], + ["fcmps", "sz"], ["fcmpd", "dz"]]) + +for kind in range(3): + generate(LoadStorePairOp, [["stp", "stp", kind, "w"], ["ldp", "ldp", kind, "w"], + ["ldpsw", "ldpsw", kind, "x"], + ["stp", "stp", kind, "x"], ["ldp", "ldp", kind, "x"] + ]) +generate(LoadStorePairOp, [["stnp", "stnp", 0, "w"], ["ldnp", "ldnp", 0, "w"], + ["stnp", "stnp", 0, "x"], ["ldnp", "ldnp", 0, "x"]]) + +generate(LdStSIMDOp, [["ld1", 1, "8B", Address.base_only], + ["ld1", 2, "16B", Address.post], + ["ld1", 3, "1D", Address.post_reg], + ["ld1", 4, "8H", Address.post], + ["ld1r", 1, "8B", Address.base_only], + ["ld1r", 1, "4S", Address.post], + ["ld1r", 1, "1D", Address.post_reg], + ["ld2", 2, "2D", Address.base_only], + ["ld2", 2, "4H", Address.post], + ["ld2r", 2, "16B", Address.base_only], + ["ld2r", 2, "2S", Address.post], + ["ld2r", 2, "2D", Address.post_reg], + ["ld3", 3, "4S", Address.post_reg], + ["ld3", 3, "2S", Address.base_only], + ["ld3r", 3, "8H", Address.base_only], + ["ld3r", 3, "4S", Address.post], + ["ld3r", 3, "1D", Address.post_reg], + ["ld4", 4, "8H", Address.post], + ["ld4", 4, "8B", Address.post_reg], + ["ld4r", 4, "8B", Address.base_only], + ["ld4r", 4, "4H", Address.post], + ["ld4r", 4, "2S", Address.post_reg], +]) + +generate(SpecialCases, [["ccmn", "__ ccmn(zr, zr, 3u, Assembler::LE);", "ccmn\txzr, xzr, #3, LE"], + ["ccmnw", "__ ccmnw(zr, zr, 5u, Assembler::EQ);", "ccmn\twzr, wzr, #5, EQ"], + ["ccmp", "__ ccmp(zr, 1, 4u, Assembler::NE);", "ccmp\txzr, 1, #4, NE"], + ["ccmpw", "__ ccmpw(zr, 2, 2, Assembler::GT);", "ccmp\twzr, 2, #2, GT"], + ["extr", "__ extr(zr, zr, zr, 0);", "extr\txzr, xzr, xzr, 0"], + ["stlxp", "__ stlxp(r0, zr, zr, sp);", "stlxp\tw0, xzr, xzr, [sp]"], + ["stlxpw", "__ stlxpw(r2, zr, zr, r3);", "stlxp\tw2, wzr, wzr, [x3]"], + ["stxp", "__ stxp(r4, zr, zr, r5);", "stxp\tw4, xzr, xzr, [x5]"], + ["stxpw", "__ stxpw(r6, zr, zr, sp);", "stxp\tw6, wzr, wzr, [sp]"], + ["dup", "__ dup(v0, __ T16B, zr);", "dup\tv0.16b, wzr"], + ["mov", "__ mov(v1, __ T1D, 0, zr);", "mov\tv1.d[0], xzr"], + ["mov", "__ mov(v1, __ T2S, 1, zr);", "mov\tv1.s[1], wzr"], + ["mov", "__ mov(v1, __ T4H, 2, zr);", "mov\tv1.h[2], wzr"], + ["mov", "__ mov(v1, __ T8B, 3, zr);", "mov\tv1.b[3], wzr"], + ["ld1", "__ ld1(v31, v0, __ T2D, Address(__ post(r1, r0)));", "ld1\t{v31.2d, v0.2d}, [x1], x0"]]) + +print "\n// FloatImmediateOp" +for float in ("2.0", "2.125", "4.0", "4.25", "8.0", "8.5", "16.0", "17.0", "0.125", + "0.1328125", "0.25", "0.265625", "0.5", "0.53125", "1.0", "1.0625", + "-2.0", "-2.125", "-4.0", "-4.25", "-8.0", "-8.5", "-16.0", "-17.0", + "-0.125", "-0.1328125", "-0.25", "-0.265625", "-0.5", "-0.53125", "-1.0", "-1.0625"): + astr = "fmov d0, #" + float + cstr = "__ fmovd(v0, " + float + ");" + print " %-50s //\t%s" % (cstr, astr) + outfile.write("\t" + astr + "\n") + +# ARMv8.1A +for size in ("x", "w"): + for suffix in ("", "a", "al", "l"): + generate(LSEOp, [["swp", "swp", size, suffix], + ["ldadd", "ldadd", size, suffix], + ["ldbic", "ldclr", size, suffix], + ["ldeor", "ldeor", size, suffix], + ["ldorr", "ldset", size, suffix], + ["ldsmin", "ldsmin", size, suffix], + ["ldsmax", "ldsmax", size, suffix], + ["ldumin", "ldumin", size, suffix], + ["ldumax", "ldumax", size, suffix]]); + +print "\n __ bind(forth);" +outfile.write("forth:\n") + +outfile.close() + +import subprocess +import sys + +# compile for 8.1 because of lse atomics +subprocess.check_call([AARCH64_AS, "-march=armv8.1-a", "aarch64ops.s", "-o", "aarch64ops.o"]) + +print +print "/*", +sys.stdout.flush() +subprocess.check_call([AARCH64_OBJDUMP, "-d", "aarch64ops.o"]) +print "*/" + +subprocess.check_call([AARCH64_OBJCOPY, "-O", "binary", "-j", ".text", "aarch64ops.o", "aarch64ops.bin"]) + +infile = open("aarch64ops.bin", "r") +bytes = bytearray(infile.read()) + +print +print " static const unsigned int insns[] =" +print " {" + +i = 0 +while i < len(bytes): + print " 0x%02x%02x%02x%02x," % (bytes[i+3], bytes[i+2], bytes[i+1], bytes[i]), + i += 4 + if i%16 == 0: + print +print "\n };" +print "// END Generated code -- do not edit" + + diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/aarch64.ad --- a/src/hotspot/cpu/aarch64/aarch64.ad Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/aarch64.ad Fri Jun 21 14:07:48 2019 +0530 @@ -957,6 +957,146 @@ V3, V3_H ); +// Class for 128 bit register v4 +reg_class v4_reg( + V4, V4_H +); + +// Class for 128 bit register v5 +reg_class v5_reg( + V5, V5_H +); + +// Class for 128 bit register v6 +reg_class v6_reg( + V6, V6_H +); + +// Class for 128 bit register v7 +reg_class v7_reg( + V7, V7_H +); + +// Class for 128 bit register v8 +reg_class v8_reg( + V8, V8_H +); + +// Class for 128 bit register v9 +reg_class v9_reg( + V9, V9_H +); + +// Class for 128 bit register v10 +reg_class v10_reg( + V10, V10_H +); + +// Class for 128 bit register v11 +reg_class v11_reg( + V11, V11_H +); + +// Class for 128 bit register v12 +reg_class v12_reg( + V12, V12_H +); + +// Class for 128 bit register v13 +reg_class v13_reg( + V13, V13_H +); + +// Class for 128 bit register v14 +reg_class v14_reg( + V14, V14_H +); + +// Class for 128 bit register v15 +reg_class v15_reg( + V15, V15_H +); + +// Class for 128 bit register v16 +reg_class v16_reg( + V16, V16_H +); + +// Class for 128 bit register v17 +reg_class v17_reg( + V17, V17_H +); + +// Class for 128 bit register v18 +reg_class v18_reg( + V18, V18_H +); + +// Class for 128 bit register v19 +reg_class v19_reg( + V19, V19_H +); + +// Class for 128 bit register v20 +reg_class v20_reg( + V20, V20_H +); + +// Class for 128 bit register v21 +reg_class v21_reg( + V21, V21_H +); + +// Class for 128 bit register v22 +reg_class v22_reg( + V22, V22_H +); + +// Class for 128 bit register v23 +reg_class v23_reg( + V23, V23_H +); + +// Class for 128 bit register v24 +reg_class v24_reg( + V24, V24_H +); + +// Class for 128 bit register v25 +reg_class v25_reg( + V25, V25_H +); + +// Class for 128 bit register v26 +reg_class v26_reg( + V26, V26_H +); + +// Class for 128 bit register v27 +reg_class v27_reg( + V27, V27_H +); + +// Class for 128 bit register v28 +reg_class v28_reg( + V28, V28_H +); + +// Class for 128 bit register v29 +reg_class v29_reg( + V29, V29_H +); + +// Class for 128 bit register v30 +reg_class v30_reg( + V30, V30_H +); + +// Class for 128 bit register v31 +reg_class v31_reg( + V31, V31_H +); + // Singleton class for condition codes reg_class int_flags(RFLAGS); @@ -4774,6 +4914,258 @@ interface(REG_INTER); %} +operand vRegD_V4() +%{ + constraint(ALLOC_IN_RC(v4_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V5() +%{ + constraint(ALLOC_IN_RC(v5_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V6() +%{ + constraint(ALLOC_IN_RC(v6_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V7() +%{ + constraint(ALLOC_IN_RC(v7_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V8() +%{ + constraint(ALLOC_IN_RC(v8_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V9() +%{ + constraint(ALLOC_IN_RC(v9_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V10() +%{ + constraint(ALLOC_IN_RC(v10_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V11() +%{ + constraint(ALLOC_IN_RC(v11_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V12() +%{ + constraint(ALLOC_IN_RC(v12_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V13() +%{ + constraint(ALLOC_IN_RC(v13_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V14() +%{ + constraint(ALLOC_IN_RC(v14_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V15() +%{ + constraint(ALLOC_IN_RC(v15_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V16() +%{ + constraint(ALLOC_IN_RC(v16_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V17() +%{ + constraint(ALLOC_IN_RC(v17_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V18() +%{ + constraint(ALLOC_IN_RC(v18_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V19() +%{ + constraint(ALLOC_IN_RC(v19_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V20() +%{ + constraint(ALLOC_IN_RC(v20_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V21() +%{ + constraint(ALLOC_IN_RC(v21_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V22() +%{ + constraint(ALLOC_IN_RC(v22_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V23() +%{ + constraint(ALLOC_IN_RC(v23_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V24() +%{ + constraint(ALLOC_IN_RC(v24_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V25() +%{ + constraint(ALLOC_IN_RC(v25_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V26() +%{ + constraint(ALLOC_IN_RC(v26_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V27() +%{ + constraint(ALLOC_IN_RC(v27_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V28() +%{ + constraint(ALLOC_IN_RC(v28_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V29() +%{ + constraint(ALLOC_IN_RC(v29_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V30() +%{ + constraint(ALLOC_IN_RC(v30_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + +operand vRegD_V31() +%{ + constraint(ALLOC_IN_RC(v31_reg)); + match(RegD); + op_cost(0); + format %{ %} + interface(REG_INTER); +%} + // Flags register, used as output of signed compare instructions // note that on AArch64 we also use this register as the output for @@ -13863,7 +14255,7 @@ format %{ "fcmps $src1, 0.0" %} ins_encode %{ - __ fcmps(as_FloatRegister($src1$$reg), 0.0D); + __ fcmps(as_FloatRegister($src1$$reg), 0.0); %} ins_pipe(pipe_class_compare); @@ -13892,7 +14284,7 @@ format %{ "fcmpd $src1, 0.0" %} ins_encode %{ - __ fcmpd(as_FloatRegister($src1$$reg), 0.0D); + __ fcmpd(as_FloatRegister($src1$$reg), 0.0); %} ins_pipe(pipe_class_compare); @@ -13968,7 +14360,7 @@ Label done; FloatRegister s1 = as_FloatRegister($src1$$reg); Register d = as_Register($dst$$reg); - __ fcmps(s1, 0.0D); + __ fcmps(s1, 0.0); // installs 0 if EQ else -1 __ csinvw(d, zr, zr, Assembler::EQ); // keeps -1 if less or unordered else installs 1 @@ -13995,7 +14387,7 @@ Label done; FloatRegister s1 = as_FloatRegister($src1$$reg); Register d = as_Register($dst$$reg); - __ fcmpd(s1, 0.0D); + __ fcmpd(s1, 0.0); // installs 0 if EQ else -1 __ csinvw(d, zr, zr, Assembler::EQ); // keeps -1 if less or unordered else installs 1 diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/assembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/assembler_aarch64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/assembler_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -103,531 +103,662 @@ __ bind(back); // ArithOp - __ add(r19, r22, r7, Assembler::LSL, 28); // add x19, x22, x7, LSL #28 - __ sub(r16, r11, r10, Assembler::LSR, 13); // sub x16, x11, x10, LSR #13 - __ adds(r27, r13, r28, Assembler::ASR, 2); // adds x27, x13, x28, ASR #2 - __ subs(r20, r28, r26, Assembler::ASR, 41); // subs x20, x28, x26, ASR #41 - __ addw(r8, r19, r19, Assembler::ASR, 19); // add w8, w19, w19, ASR #19 - __ subw(r4, r9, r10, Assembler::LSL, 14); // sub w4, w9, w10, LSL #14 - __ addsw(r8, r11, r30, Assembler::LSL, 13); // adds w8, w11, w30, LSL #13 - __ subsw(r0, r25, r19, Assembler::LSL, 9); // subs w0, w25, w19, LSL #9 - __ andr(r20, r0, r21, Assembler::LSL, 19); // and x20, x0, x21, LSL #19 - __ orr(r21, r14, r20, Assembler::LSL, 17); // orr x21, x14, x20, LSL #17 - __ eor(r25, r28, r1, Assembler::LSL, 51); // eor x25, x28, x1, LSL #51 - __ ands(r10, r27, r11, Assembler::ASR, 15); // ands x10, x27, x11, ASR #15 - __ andw(r25, r5, r12, Assembler::ASR, 23); // and w25, w5, w12, ASR #23 - __ orrw(r18, r14, r10, Assembler::LSR, 4); // orr w18, w14, w10, LSR #4 - __ eorw(r4, r21, r5, Assembler::ASR, 22); // eor w4, w21, w5, ASR #22 - __ andsw(r21, r0, r5, Assembler::ASR, 29); // ands w21, w0, w5, ASR #29 - __ bic(r26, r30, r6, Assembler::ASR, 37); // bic x26, x30, x6, ASR #37 - __ orn(r3, r1, r13, Assembler::LSR, 29); // orn x3, x1, x13, LSR #29 - __ eon(r0, r28, r9, Assembler::LSL, 47); // eon x0, x28, x9, LSL #47 - __ bics(r29, r5, r28, Assembler::LSL, 46); // bics x29, x5, x28, LSL #46 - __ bicw(r9, r18, r7, Assembler::LSR, 20); // bic w9, w18, w7, LSR #20 - __ ornw(r26, r13, r25, Assembler::ASR, 24); // orn w26, w13, w25, ASR #24 - __ eonw(r25, r4, r19, Assembler::LSL, 6); // eon w25, w4, w19, LSL #6 - __ bicsw(r5, r26, r4, Assembler::LSR, 24); // bics w5, w26, w4, LSR #24 + __ add(r15, r12, r16, Assembler::LSR, 30); // add x15, x12, x16, LSR #30 + __ sub(r1, r15, r3, Assembler::LSR, 32); // sub x1, x15, x3, LSR #32 + __ adds(r13, r25, r5, Assembler::LSL, 13); // adds x13, x25, x5, LSL #13 + __ subs(r22, r28, r6, Assembler::ASR, 17); // subs x22, x28, x6, ASR #17 + __ addw(r0, r9, r22, Assembler::ASR, 6); // add w0, w9, w22, ASR #6 + __ subw(r19, r3, r25, Assembler::LSL, 21); // sub w19, w3, w25, LSL #21 + __ addsw(r4, r19, r11, Assembler::LSL, 20); // adds w4, w19, w11, LSL #20 + __ subsw(r24, r7, r19, Assembler::ASR, 0); // subs w24, w7, w19, ASR #0 + __ andr(r30, r7, r11, Assembler::LSL, 48); // and x30, x7, x11, LSL #48 + __ orr(r24, r8, r15, Assembler::LSL, 12); // orr x24, x8, x15, LSL #12 + __ eor(r17, r9, r23, Assembler::LSL, 1); // eor x17, x9, x23, LSL #1 + __ ands(r14, r11, r4, Assembler::LSR, 55); // ands x14, x11, x4, LSR #55 + __ andw(r19, r7, r12, Assembler::LSR, 17); // and w19, w7, w12, LSR #17 + __ orrw(r19, r27, r11, Assembler::ASR, 28); // orr w19, w27, w11, ASR #28 + __ eorw(r30, r3, r22, Assembler::LSR, 31); // eor w30, w3, w22, LSR #31 + __ andsw(r19, r26, r28, Assembler::ASR, 0); // ands w19, w26, w28, ASR #0 + __ bic(r29, r6, r26, Assembler::LSL, 51); // bic x29, x6, x26, LSL #51 + __ orn(r26, r27, r17, Assembler::LSL, 35); // orn x26, x27, x17, LSL #35 + __ eon(r21, r4, r14, Assembler::LSL, 5); // eon x21, x4, x14, LSL #5 + __ bics(r2, r15, r0, Assembler::ASR, 5); // bics x2, x15, x0, ASR #5 + __ bicw(r2, r7, r2, Assembler::LSL, 29); // bic w2, w7, w2, LSL #29 + __ ornw(r24, r12, r21, Assembler::LSR, 5); // orn w24, w12, w21, LSR #5 + __ eonw(r30, r15, r19, Assembler::LSL, 2); // eon w30, w15, w19, LSL #2 + __ bicsw(r30, r23, r17, Assembler::ASR, 28); // bics w30, w23, w17, ASR #28 // AddSubImmOp - __ addw(r7, r19, 340u); // add w7, w19, #340 - __ addsw(r8, r0, 401u); // adds w8, w0, #401 - __ subw(r29, r20, 163u); // sub w29, w20, #163 - __ subsw(r8, r23, 759u); // subs w8, w23, #759 - __ add(r1, r12, 523u); // add x1, x12, #523 - __ adds(r2, r11, 426u); // adds x2, x11, #426 - __ sub(r14, r29, 716u); // sub x14, x29, #716 - __ subs(r11, r5, 582u); // subs x11, x5, #582 + __ addw(r4, r20, 660u); // add w4, w20, #660 + __ addsw(r2, r10, 710u); // adds w2, w10, #710 + __ subw(r19, r26, 244u); // sub w19, w26, #244 + __ subsw(r28, r13, 73u); // subs w28, w13, #73 + __ add(r2, r30, 862u); // add x2, x30, #862 + __ adds(r27, r16, 574u); // adds x27, x16, #574 + __ sub(r22, r9, 589u); // sub x22, x9, #589 + __ subs(r4, r1, 698u); // subs x4, x1, #698 // LogicalImmOp - __ andw(r23, r22, 32768ul); // and w23, w22, #0x8000 - __ orrw(r4, r10, 4042322160ul); // orr w4, w10, #0xf0f0f0f0 - __ eorw(r0, r24, 4042322160ul); // eor w0, w24, #0xf0f0f0f0 - __ andsw(r19, r29, 2139127680ul); // ands w19, w29, #0x7f807f80 - __ andr(r5, r10, 4503599627354112ul); // and x5, x10, #0xfffffffffc000 - __ orr(r12, r30, 18445618178097414144ul); // orr x12, x30, #0xfffc0000fffc0000 - __ eor(r30, r5, 262128ul); // eor x30, x5, #0x3fff0 - __ ands(r26, r23, 4194300ul); // ands x26, x23, #0x3ffffc + __ andw(r28, r19, 4294709247ul); // and w28, w19, #0xfffc0fff + __ orrw(r27, r5, 536870910ul); // orr w27, w5, #0x1ffffffe + __ eorw(r30, r20, 4294840319ul); // eor w30, w20, #0xfffe0fff + __ andsw(r22, r26, 4294959615ul); // ands w22, w26, #0xffffe1ff + __ andr(r5, r7, 4194300ul); // and x5, x7, #0x3ffffc + __ orr(r13, r7, 18014398509481728ul); // orr x13, x7, #0x3fffffffffff00 + __ eor(r7, r9, 18442240474082197503ul); // eor x7, x9, #0xfff0000000003fff + __ ands(r3, r0, 18374686479671656447ul); // ands x3, x0, #0xff00000000007fff // AbsOp - __ b(__ pc()); // b . - __ b(back); // b back - __ b(forth); // b forth - __ bl(__ pc()); // bl . - __ bl(back); // bl back - __ bl(forth); // bl forth + __ b(__ pc()); // b . + __ b(back); // b back + __ b(forth); // b forth + __ bl(__ pc()); // bl . + __ bl(back); // bl back + __ bl(forth); // bl forth // RegAndAbsOp - __ cbzw(r12, __ pc()); // cbz w12, . - __ cbzw(r12, back); // cbz w12, back - __ cbzw(r12, forth); // cbz w12, forth - __ cbnzw(r20, __ pc()); // cbnz w20, . - __ cbnzw(r20, back); // cbnz w20, back - __ cbnzw(r20, forth); // cbnz w20, forth - __ cbz(r12, __ pc()); // cbz x12, . - __ cbz(r12, back); // cbz x12, back - __ cbz(r12, forth); // cbz x12, forth - __ cbnz(r24, __ pc()); // cbnz x24, . - __ cbnz(r24, back); // cbnz x24, back - __ cbnz(r24, forth); // cbnz x24, forth - __ adr(r6, __ pc()); // adr x6, . - __ adr(r6, back); // adr x6, back - __ adr(r6, forth); // adr x6, forth - __ _adrp(r21, __ pc()); // adrp x21, . + __ cbzw(r16, __ pc()); // cbz w16, . + __ cbzw(r16, back); // cbz w16, back + __ cbzw(r16, forth); // cbz w16, forth + __ cbnzw(r19, __ pc()); // cbnz w19, . + __ cbnzw(r19, back); // cbnz w19, back + __ cbnzw(r19, forth); // cbnz w19, forth + __ cbz(r5, __ pc()); // cbz x5, . + __ cbz(r5, back); // cbz x5, back + __ cbz(r5, forth); // cbz x5, forth + __ cbnz(r4, __ pc()); // cbnz x4, . + __ cbnz(r4, back); // cbnz x4, back + __ cbnz(r4, forth); // cbnz x4, forth + __ adr(r27, __ pc()); // adr x27, . + __ adr(r27, back); // adr x27, back + __ adr(r27, forth); // adr x27, forth + __ _adrp(r16, __ pc()); // adrp x16, . // RegImmAbsOp - __ tbz(r1, 1, __ pc()); // tbz x1, #1, . - __ tbz(r1, 1, back); // tbz x1, #1, back - __ tbz(r1, 1, forth); // tbz x1, #1, forth - __ tbnz(r8, 9, __ pc()); // tbnz x8, #9, . - __ tbnz(r8, 9, back); // tbnz x8, #9, back - __ tbnz(r8, 9, forth); // tbnz x8, #9, forth + __ tbz(r28, 8, __ pc()); // tbz x28, #8, . + __ tbz(r28, 8, back); // tbz x28, #8, back + __ tbz(r28, 8, forth); // tbz x28, #8, forth + __ tbnz(r1, 1, __ pc()); // tbnz x1, #1, . + __ tbnz(r1, 1, back); // tbnz x1, #1, back + __ tbnz(r1, 1, forth); // tbnz x1, #1, forth // MoveWideImmOp - __ movnw(r12, 23175, 0); // movn w12, #23175, lsl 0 - __ movzw(r11, 20476, 16); // movz w11, #20476, lsl 16 - __ movkw(r21, 3716, 0); // movk w21, #3716, lsl 0 - __ movn(r29, 28661, 48); // movn x29, #28661, lsl 48 - __ movz(r3, 6927, 0); // movz x3, #6927, lsl 0 - __ movk(r22, 9828, 16); // movk x22, #9828, lsl 16 + __ movnw(r20, 8639, 16); // movn w20, #8639, lsl 16 + __ movzw(r7, 25835, 0); // movz w7, #25835, lsl 0 + __ movkw(r17, 7261, 0); // movk w17, #7261, lsl 0 + __ movn(r14, 2097, 32); // movn x14, #2097, lsl 32 + __ movz(r9, 16082, 0); // movz x9, #16082, lsl 0 + __ movk(r19, 13962, 16); // movk x19, #13962, lsl 16 // BitfieldOp - __ sbfm(r12, r8, 6, 22); // sbfm x12, x8, #6, #22 - __ bfmw(r19, r25, 25, 19); // bfm w19, w25, #25, #19 - __ ubfmw(r9, r12, 29, 15); // ubfm w9, w12, #29, #15 - __ sbfm(r28, r25, 16, 16); // sbfm x28, x25, #16, #16 - __ bfm(r12, r5, 4, 25); // bfm x12, x5, #4, #25 - __ ubfm(r0, r10, 6, 8); // ubfm x0, x10, #6, #8 + __ sbfm(r9, r22, 6, 22); // sbfm x9, x22, #6, #22 + __ bfmw(r19, r0, 11, 0); // bfm w19, w0, #11, #0 + __ ubfmw(r10, r19, 11, 19); // ubfm w10, w19, #11, #19 + __ sbfm(r4, r15, 5, 17); // sbfm x4, x15, #5, #17 + __ bfm(r3, r5, 19, 28); // bfm x3, x5, #19, #28 + __ ubfm(r12, r28, 17, 2); // ubfm x12, x28, #17, #2 // ExtractOp - __ extrw(r4, r13, r26, 24); // extr w4, w13, w26, #24 - __ extr(r23, r30, r24, 31); // extr x23, x30, x24, #31 + __ extrw(r15, r0, r22, 3); // extr w15, w0, w22, #3 + __ extr(r6, r14, r14, 55); // extr x6, x14, x14, #55 // CondBranchOp - __ br(Assembler::EQ, __ pc()); // b.EQ . - __ br(Assembler::EQ, back); // b.EQ back - __ br(Assembler::EQ, forth); // b.EQ forth - __ br(Assembler::NE, __ pc()); // b.NE . - __ br(Assembler::NE, back); // b.NE back - __ br(Assembler::NE, forth); // b.NE forth - __ br(Assembler::HS, __ pc()); // b.HS . - __ br(Assembler::HS, back); // b.HS back - __ br(Assembler::HS, forth); // b.HS forth - __ br(Assembler::CS, __ pc()); // b.CS . - __ br(Assembler::CS, back); // b.CS back - __ br(Assembler::CS, forth); // b.CS forth - __ br(Assembler::LO, __ pc()); // b.LO . - __ br(Assembler::LO, back); // b.LO back - __ br(Assembler::LO, forth); // b.LO forth - __ br(Assembler::CC, __ pc()); // b.CC . - __ br(Assembler::CC, back); // b.CC back - __ br(Assembler::CC, forth); // b.CC forth - __ br(Assembler::MI, __ pc()); // b.MI . - __ br(Assembler::MI, back); // b.MI back - __ br(Assembler::MI, forth); // b.MI forth - __ br(Assembler::PL, __ pc()); // b.PL . - __ br(Assembler::PL, back); // b.PL back - __ br(Assembler::PL, forth); // b.PL forth - __ br(Assembler::VS, __ pc()); // b.VS . - __ br(Assembler::VS, back); // b.VS back - __ br(Assembler::VS, forth); // b.VS forth - __ br(Assembler::VC, __ pc()); // b.VC . - __ br(Assembler::VC, back); // b.VC back - __ br(Assembler::VC, forth); // b.VC forth - __ br(Assembler::HI, __ pc()); // b.HI . - __ br(Assembler::HI, back); // b.HI back - __ br(Assembler::HI, forth); // b.HI forth - __ br(Assembler::LS, __ pc()); // b.LS . - __ br(Assembler::LS, back); // b.LS back - __ br(Assembler::LS, forth); // b.LS forth - __ br(Assembler::GE, __ pc()); // b.GE . - __ br(Assembler::GE, back); // b.GE back - __ br(Assembler::GE, forth); // b.GE forth - __ br(Assembler::LT, __ pc()); // b.LT . - __ br(Assembler::LT, back); // b.LT back - __ br(Assembler::LT, forth); // b.LT forth - __ br(Assembler::GT, __ pc()); // b.GT . - __ br(Assembler::GT, back); // b.GT back - __ br(Assembler::GT, forth); // b.GT forth - __ br(Assembler::LE, __ pc()); // b.LE . - __ br(Assembler::LE, back); // b.LE back - __ br(Assembler::LE, forth); // b.LE forth - __ br(Assembler::AL, __ pc()); // b.AL . - __ br(Assembler::AL, back); // b.AL back - __ br(Assembler::AL, forth); // b.AL forth - __ br(Assembler::NV, __ pc()); // b.NV . - __ br(Assembler::NV, back); // b.NV back - __ br(Assembler::NV, forth); // b.NV forth + __ br(Assembler::EQ, __ pc()); // b.EQ . + __ br(Assembler::EQ, back); // b.EQ back + __ br(Assembler::EQ, forth); // b.EQ forth + __ br(Assembler::NE, __ pc()); // b.NE . + __ br(Assembler::NE, back); // b.NE back + __ br(Assembler::NE, forth); // b.NE forth + __ br(Assembler::HS, __ pc()); // b.HS . + __ br(Assembler::HS, back); // b.HS back + __ br(Assembler::HS, forth); // b.HS forth + __ br(Assembler::CS, __ pc()); // b.CS . + __ br(Assembler::CS, back); // b.CS back + __ br(Assembler::CS, forth); // b.CS forth + __ br(Assembler::LO, __ pc()); // b.LO . + __ br(Assembler::LO, back); // b.LO back + __ br(Assembler::LO, forth); // b.LO forth + __ br(Assembler::CC, __ pc()); // b.CC . + __ br(Assembler::CC, back); // b.CC back + __ br(Assembler::CC, forth); // b.CC forth + __ br(Assembler::MI, __ pc()); // b.MI . + __ br(Assembler::MI, back); // b.MI back + __ br(Assembler::MI, forth); // b.MI forth + __ br(Assembler::PL, __ pc()); // b.PL . + __ br(Assembler::PL, back); // b.PL back + __ br(Assembler::PL, forth); // b.PL forth + __ br(Assembler::VS, __ pc()); // b.VS . + __ br(Assembler::VS, back); // b.VS back + __ br(Assembler::VS, forth); // b.VS forth + __ br(Assembler::VC, __ pc()); // b.VC . + __ br(Assembler::VC, back); // b.VC back + __ br(Assembler::VC, forth); // b.VC forth + __ br(Assembler::HI, __ pc()); // b.HI . + __ br(Assembler::HI, back); // b.HI back + __ br(Assembler::HI, forth); // b.HI forth + __ br(Assembler::LS, __ pc()); // b.LS . + __ br(Assembler::LS, back); // b.LS back + __ br(Assembler::LS, forth); // b.LS forth + __ br(Assembler::GE, __ pc()); // b.GE . + __ br(Assembler::GE, back); // b.GE back + __ br(Assembler::GE, forth); // b.GE forth + __ br(Assembler::LT, __ pc()); // b.LT . + __ br(Assembler::LT, back); // b.LT back + __ br(Assembler::LT, forth); // b.LT forth + __ br(Assembler::GT, __ pc()); // b.GT . + __ br(Assembler::GT, back); // b.GT back + __ br(Assembler::GT, forth); // b.GT forth + __ br(Assembler::LE, __ pc()); // b.LE . + __ br(Assembler::LE, back); // b.LE back + __ br(Assembler::LE, forth); // b.LE forth + __ br(Assembler::AL, __ pc()); // b.AL . + __ br(Assembler::AL, back); // b.AL back + __ br(Assembler::AL, forth); // b.AL forth + __ br(Assembler::NV, __ pc()); // b.NV . + __ br(Assembler::NV, back); // b.NV back + __ br(Assembler::NV, forth); // b.NV forth // ImmOp - __ svc(12729); // svc #12729 - __ hvc(6788); // hvc #6788 - __ smc(1535); // smc #1535 - __ brk(16766); // brk #16766 - __ hlt(9753); // hlt #9753 + __ svc(22064); // svc #22064 + __ hvc(533); // hvc #533 + __ smc(9942); // smc #9942 + __ brk(4714); // brk #4714 + __ hlt(4302); // hlt #4302 // Op - __ nop(); // nop - __ eret(); // eret - __ drps(); // drps - __ isb(); // isb + __ nop(); // nop + __ eret(); // eret + __ drps(); // drps + __ isb(); // isb // SystemOp - __ dsb(Assembler::SY); // dsb SY - __ dmb(Assembler::ISHST); // dmb ISHST + __ dsb(Assembler::OSH); // dsb OSH + __ dmb(Assembler::NSHLD); // dmb NSHLD // OneRegOp - __ br(r2); // br x2 - __ blr(r5); // blr x5 + __ br(r20); // br x20 + __ blr(r2); // blr x2 // LoadStoreExclusiveOp - __ stxr(r20, r21, r2); // stxr w20, x21, [x2] - __ stlxr(r5, r29, r7); // stlxr w5, x29, [x7] - __ ldxr(r5, r16); // ldxr x5, [x16] - __ ldaxr(r27, r29); // ldaxr x27, [x29] - __ stlr(r0, r29); // stlr x0, [x29] - __ ldar(r21, r28); // ldar x21, [x28] + __ stxr(r18, r23, r0); // stxr w18, x23, [x0] + __ stlxr(r30, r5, r22); // stlxr w30, x5, [x22] + __ ldxr(r5, r8); // ldxr x5, [x8] + __ ldaxr(r20, r16); // ldaxr x20, [x16] + __ stlr(r6, r11); // stlr x6, [x11] + __ ldar(r6, r27); // ldar x6, [x27] // LoadStoreExclusiveOp - __ stxrw(r21, r24, r7); // stxr w21, w24, [x7] - __ stlxrw(r21, r26, r28); // stlxr w21, w26, [x28] - __ ldxrw(r21, r6); // ldxr w21, [x6] - __ ldaxrw(r15, r30); // ldaxr w15, [x30] - __ stlrw(r19, r3); // stlr w19, [x3] - __ ldarw(r22, r2); // ldar w22, [x2] + __ stxrw(r10, r17, r5); // stxr w10, w17, [x5] + __ stlxrw(r22, r9, r12); // stlxr w22, w9, [x12] + __ ldxrw(r27, r8); // ldxr w27, [x8] + __ ldaxrw(r23, r2); // ldaxr w23, [x2] + __ stlrw(r26, r29); // stlr w26, [x29] + __ ldarw(r13, r10); // ldar w13, [x10] // LoadStoreExclusiveOp - __ stxrh(r18, r15, r0); // stxrh w18, w15, [x0] - __ stlxrh(r11, r5, r28); // stlxrh w11, w5, [x28] - __ ldxrh(r29, r6); // ldxrh w29, [x6] - __ ldaxrh(r18, r7); // ldaxrh w18, [x7] - __ stlrh(r25, r28); // stlrh w25, [x28] - __ ldarh(r2, r19); // ldarh w2, [x19] + __ stxrh(r25, r28, r27); // stxrh w25, w28, [x27] + __ stlxrh(r29, r22, r12); // stlxrh w29, w22, [x12] + __ ldxrh(r22, r28); // ldxrh w22, [x28] + __ ldaxrh(r3, r30); // ldaxrh w3, [x30] + __ stlrh(r24, r15); // stlrh w24, [x15] + __ ldarh(r27, r26); // ldarh w27, [x26] // LoadStoreExclusiveOp - __ stxrb(r10, r30, r1); // stxrb w10, w30, [x1] - __ stlxrb(r20, r21, r22); // stlxrb w20, w21, [x22] - __ ldxrb(r25, r2); // ldxrb w25, [x2] - __ ldaxrb(r24, r5); // ldaxrb w24, [x5] - __ stlrb(r16, r3); // stlrb w16, [x3] - __ ldarb(r22, r29); // ldarb w22, [x29] + __ stxrb(r11, r10, r19); // stxrb w11, w10, [x19] + __ stlxrb(r23, r27, r22); // stlxrb w23, w27, [x22] + __ ldxrb(r24, r16); // ldxrb w24, [x16] + __ ldaxrb(r24, r1); // ldaxrb w24, [x1] + __ stlrb(r5, r29); // stlrb w5, [x29] + __ ldarb(r24, r16); // ldarb w24, [x16] // LoadStoreExclusiveOp - __ ldxp(r8, r2, r19); // ldxp x8, x2, [x19] - __ ldaxp(r7, r19, r14); // ldaxp x7, x19, [x14] - __ stxp(r8, r27, r28, r5); // stxp w8, x27, x28, [x5] - __ stlxp(r5, r8, r14, r6); // stlxp w5, x8, x14, [x6] + __ ldxp(r25, r24, r17); // ldxp x25, x24, [x17] + __ ldaxp(r22, r12, r19); // ldaxp x22, x12, [x19] + __ stxp(r0, r26, r21, r25); // stxp w0, x26, x21, [x25] + __ stlxp(r1, r6, r11, r5); // stlxp w1, x6, x11, [x5] // LoadStoreExclusiveOp - __ ldxpw(r25, r4, r22); // ldxp w25, w4, [x22] - __ ldaxpw(r13, r14, r15); // ldaxp w13, w14, [x15] - __ stxpw(r20, r26, r8, r10); // stxp w20, w26, w8, [x10] - __ stlxpw(r23, r18, r18, r18); // stlxp w23, w18, w18, [x18] + __ ldxpw(r13, r14, r4); // ldxp w13, w14, [x4] + __ ldaxpw(r17, r2, r6); // ldaxp w17, w2, [x6] + __ stxpw(r15, r3, r9, r18); // stxp w15, w3, w9, [x18] + __ stlxpw(r18, r17, r4, r9); // stlxp w18, w17, w4, [x9] // base_plus_unscaled_offset // LoadStoreOp - __ str(r30, Address(r11, 99)); // str x30, [x11, 99] - __ strw(r23, Address(r25, -77)); // str w23, [x25, -77] - __ strb(r2, Address(r14, 3)); // strb w2, [x14, 3] - __ strh(r9, Address(r10, 5)); // strh w9, [x10, 5] - __ ldr(r20, Address(r15, 57)); // ldr x20, [x15, 57] - __ ldrw(r12, Address(r16, -78)); // ldr w12, [x16, -78] - __ ldrb(r22, Address(r26, -3)); // ldrb w22, [x26, -3] - __ ldrh(r30, Address(r19, -47)); // ldrh w30, [x19, -47] - __ ldrsb(r9, Address(r10, -12)); // ldrsb x9, [x10, -12] - __ ldrsh(r28, Address(r17, 14)); // ldrsh x28, [x17, 14] - __ ldrshw(r3, Address(r5, 10)); // ldrsh w3, [x5, 10] - __ ldrsw(r17, Address(r17, -91)); // ldrsw x17, [x17, -91] - __ ldrd(v2, Address(r20, -17)); // ldr d2, [x20, -17] - __ ldrs(v22, Address(r7, -10)); // ldr s22, [x7, -10] - __ strd(v30, Address(r18, -223)); // str d30, [x18, -223] - __ strs(v13, Address(r22, 21)); // str s13, [x22, 21] + __ str(r23, Address(r21, -49)); // str x23, [x21, -49] + __ strw(r21, Address(r2, 63)); // str w21, [x2, 63] + __ strb(r27, Address(r28, 11)); // strb w27, [x28, 11] + __ strh(r29, Address(r15, -13)); // strh w29, [x15, -13] + __ ldr(r14, Address(r30, -45)); // ldr x14, [x30, -45] + __ ldrw(r29, Address(r28, 53)); // ldr w29, [x28, 53] + __ ldrb(r20, Address(r26, 7)); // ldrb w20, [x26, 7] + __ ldrh(r25, Address(r2, -50)); // ldrh w25, [x2, -50] + __ ldrsb(r3, Address(r10, -15)); // ldrsb x3, [x10, -15] + __ ldrsh(r14, Address(r15, 19)); // ldrsh x14, [x15, 19] + __ ldrshw(r29, Address(r11, -5)); // ldrsh w29, [x11, -5] + __ ldrsw(r15, Address(r5, -71)); // ldrsw x15, [x5, -71] + __ ldrd(v19, Address(r12, 3)); // ldr d19, [x12, 3] + __ ldrs(v12, Address(r27, 42)); // ldr s12, [x27, 42] + __ strd(v22, Address(r28, 125)); // str d22, [x28, 125] + __ strs(v24, Address(r15, -20)); // str s24, [x15, -20] // pre // LoadStoreOp - __ str(r9, Address(__ pre(r18, -112))); // str x9, [x18, -112]! - __ strw(r29, Address(__ pre(r23, 11))); // str w29, [x23, 11]! - __ strb(r18, Address(__ pre(r12, -1))); // strb w18, [x12, -1]! - __ strh(r16, Address(__ pre(r20, -23))); // strh w16, [x20, -23]! - __ ldr(r3, Address(__ pre(r29, 9))); // ldr x3, [x29, 9]! - __ ldrw(r25, Address(__ pre(r3, 19))); // ldr w25, [x3, 19]! - __ ldrb(r1, Address(__ pre(r29, -1))); // ldrb w1, [x29, -1]! - __ ldrh(r8, Address(__ pre(r29, -57))); // ldrh w8, [x29, -57]! - __ ldrsb(r5, Address(__ pre(r14, -13))); // ldrsb x5, [x14, -13]! - __ ldrsh(r10, Address(__ pre(r27, 1))); // ldrsh x10, [x27, 1]! - __ ldrshw(r11, Address(__ pre(r10, 25))); // ldrsh w11, [x10, 25]! - __ ldrsw(r4, Address(__ pre(r22, -92))); // ldrsw x4, [x22, -92]! - __ ldrd(v11, Address(__ pre(r23, 8))); // ldr d11, [x23, 8]! - __ ldrs(v25, Address(__ pre(r19, 54))); // ldr s25, [x19, 54]! - __ strd(v1, Address(__ pre(r7, -174))); // str d1, [x7, -174]! - __ strs(v8, Address(__ pre(r25, 54))); // str s8, [x25, 54]! + __ str(r8, Address(__ pre(r28, -24))); // str x8, [x28, -24]! + __ strw(r6, Address(__ pre(r15, 37))); // str w6, [x15, 37]! + __ strb(r7, Address(__ pre(r1, 7))); // strb w7, [x1, 7]! + __ strh(r0, Address(__ pre(r17, 30))); // strh w0, [x17, 30]! + __ ldr(r25, Address(__ pre(r29, 84))); // ldr x25, [x29, 84]! + __ ldrw(r26, Address(__ pre(r20, -52))); // ldr w26, [x20, -52]! + __ ldrb(r26, Address(__ pre(r29, -25))); // ldrb w26, [x29, -25]! + __ ldrh(r4, Address(__ pre(r25, 26))); // ldrh w4, [x25, 26]! + __ ldrsb(r28, Address(__ pre(r8, -21))); // ldrsb x28, [x8, -21]! + __ ldrsh(r17, Address(__ pre(r14, -6))); // ldrsh x17, [x14, -6]! + __ ldrshw(r28, Address(__ pre(r23, 10))); // ldrsh w28, [x23, 10]! + __ ldrsw(r30, Address(__ pre(r27, -64))); // ldrsw x30, [x27, -64]! + __ ldrd(v20, Address(__ pre(r30, -242))); // ldr d20, [x30, -242]! + __ ldrs(v17, Address(__ pre(r27, 20))); // ldr s17, [x27, 20]! + __ strd(v7, Address(__ pre(r3, 17))); // str d7, [x3, 17]! + __ strs(v13, Address(__ pre(r11, -16))); // str s13, [x11, -16]! // post // LoadStoreOp - __ str(r5, Address(__ post(r11, 37))); // str x5, [x11], 37 - __ strw(r24, Address(__ post(r15, 19))); // str w24, [x15], 19 - __ strb(r15, Address(__ post(r26, -1))); // strb w15, [x26], -1 - __ strh(r18, Address(__ post(r18, -6))); // strh w18, [x18], -6 - __ ldr(r7, Address(__ post(r2, -230))); // ldr x7, [x2], -230 - __ ldrw(r27, Address(__ post(r11, -27))); // ldr w27, [x11], -27 - __ ldrb(r18, Address(__ post(r3, -25))); // ldrb w18, [x3], -25 - __ ldrh(r10, Address(__ post(r24, -32))); // ldrh w10, [x24], -32 - __ ldrsb(r22, Address(__ post(r10, 4))); // ldrsb x22, [x10], 4 - __ ldrsh(r17, Address(__ post(r12, 25))); // ldrsh x17, [x12], 25 - __ ldrshw(r8, Address(__ post(r7, -62))); // ldrsh w8, [x7], -62 - __ ldrsw(r23, Address(__ post(r22, -51))); // ldrsw x23, [x22], -51 - __ ldrd(v24, Address(__ post(r25, 48))); // ldr d24, [x25], 48 - __ ldrs(v21, Address(__ post(r12, -10))); // ldr s21, [x12], -10 - __ strd(v18, Address(__ post(r13, -222))); // str d18, [x13], -222 - __ strs(v16, Address(__ post(r1, -41))); // str s16, [x1], -41 + __ str(r6, Address(__ post(r9, -61))); // str x6, [x9], -61 + __ strw(r16, Address(__ post(r5, -29))); // str w16, [x5], -29 + __ strb(r29, Address(__ post(r29, 15))); // strb w29, [x29], 15 + __ strh(r4, Address(__ post(r20, 18))); // strh w4, [x20], 18 + __ ldr(r19, Address(__ post(r18, 46))); // ldr x19, [x18], 46 + __ ldrw(r22, Address(__ post(r2, 23))); // ldr w22, [x2], 23 + __ ldrb(r7, Address(__ post(r3, -30))); // ldrb w7, [x3], -30 + __ ldrh(r11, Address(__ post(r12, -29))); // ldrh w11, [x12], -29 + __ ldrsb(r8, Address(__ post(r6, -29))); // ldrsb x8, [x6], -29 + __ ldrsh(r24, Address(__ post(r23, 4))); // ldrsh x24, [x23], 4 + __ ldrshw(r17, Address(__ post(r16, 0))); // ldrsh w17, [x16], 0 + __ ldrsw(r0, Address(__ post(r20, -8))); // ldrsw x0, [x20], -8 + __ ldrd(v20, Address(__ post(r2, -126))); // ldr d20, [x2], -126 + __ ldrs(v19, Address(__ post(r30, -104))); // ldr s19, [x30], -104 + __ strd(v4, Address(__ post(r17, 118))); // str d4, [x17], 118 + __ strs(v21, Address(__ post(r19, -112))); // str s21, [x19], -112 // base_plus_reg // LoadStoreOp - __ str(r2, Address(r22, r15, Address::sxtw(0))); // str x2, [x22, w15, sxtw #0] - __ strw(r2, Address(r16, r29, Address::lsl(0))); // str w2, [x16, x29, lsl #0] - __ strb(r20, Address(r18, r14, Address::uxtw(0))); // strb w20, [x18, w14, uxtw #0] - __ strh(r6, Address(r19, r20, Address::sxtx(1))); // strh w6, [x19, x20, sxtx #1] - __ ldr(r14, Address(r29, r14, Address::sxtw(0))); // ldr x14, [x29, w14, sxtw #0] - __ ldrw(r16, Address(r20, r12, Address::sxtw(2))); // ldr w16, [x20, w12, sxtw #2] - __ ldrb(r9, Address(r12, r0, Address::sxtw(0))); // ldrb w9, [x12, w0, sxtw #0] - __ ldrh(r12, Address(r17, r3, Address::lsl(1))); // ldrh w12, [x17, x3, lsl #1] - __ ldrsb(r2, Address(r17, r3, Address::sxtx(0))); // ldrsb x2, [x17, x3, sxtx #0] - __ ldrsh(r7, Address(r1, r17, Address::uxtw(1))); // ldrsh x7, [x1, w17, uxtw #1] - __ ldrshw(r25, Address(r15, r18, Address::sxtw(1))); // ldrsh w25, [x15, w18, sxtw #1] - __ ldrsw(r23, Address(r21, r12, Address::lsl(0))); // ldrsw x23, [x21, x12, lsl #0] - __ ldrd(v5, Address(r13, r8, Address::lsl(3))); // ldr d5, [x13, x8, lsl #3] - __ ldrs(v3, Address(r10, r22, Address::lsl(2))); // ldr s3, [x10, x22, lsl #2] - __ strd(v14, Address(r2, r27, Address::sxtw(0))); // str d14, [x2, w27, sxtw #0] - __ strs(v20, Address(r6, r25, Address::lsl(0))); // str s20, [x6, x25, lsl #0] + __ str(r26, Address(r2, r19, Address::lsl(3))); // str x26, [x2, x19, lsl #3] + __ strw(r9, Address(r0, r15, Address::sxtw(2))); // str w9, [x0, w15, sxtw #2] + __ strb(r26, Address(r12, r1, Address::lsl(0))); // strb w26, [x12, x1, lsl #0] + __ strh(r21, Address(r11, r10, Address::lsl(1))); // strh w21, [x11, x10, lsl #1] + __ ldr(r16, Address(r23, r16, Address::sxtx(0))); // ldr x16, [x23, x16, sxtx #0] + __ ldrw(r10, Address(r11, r17, Address::sxtw(2))); // ldr w10, [x11, w17, sxtw #2] + __ ldrb(r13, Address(r23, r11, Address::lsl(0))); // ldrb w13, [x23, x11, lsl #0] + __ ldrh(r27, Address(r4, r21, Address::lsl(0))); // ldrh w27, [x4, x21, lsl #0] + __ ldrsb(r26, Address(r8, r15, Address::sxtw(0))); // ldrsb x26, [x8, w15, sxtw #0] + __ ldrsh(r21, Address(r10, r2, Address::sxtw(0))); // ldrsh x21, [x10, w2, sxtw #0] + __ ldrshw(r8, Address(r30, r14, Address::lsl(0))); // ldrsh w8, [x30, x14, lsl #0] + __ ldrsw(r29, Address(r14, r20, Address::sxtx(2))); // ldrsw x29, [x14, x20, sxtx #2] + __ ldrd(v30, Address(r27, r22, Address::sxtx(0))); // ldr d30, [x27, x22, sxtx #0] + __ ldrs(v13, Address(r9, r22, Address::lsl(0))); // ldr s13, [x9, x22, lsl #0] + __ strd(v8, Address(r25, r17, Address::sxtw(3))); // str d8, [x25, w17, sxtw #3] + __ strs(v1, Address(r24, r5, Address::uxtw(2))); // str s1, [x24, w5, uxtw #2] // base_plus_scaled_offset // LoadStoreOp - __ str(r30, Address(r7, 16256)); // str x30, [x7, 16256] - __ strw(r15, Address(r8, 7588)); // str w15, [x8, 7588] - __ strb(r11, Address(r0, 1866)); // strb w11, [x0, 1866] - __ strh(r3, Address(r17, 3734)); // strh w3, [x17, 3734] - __ ldr(r2, Address(r7, 14224)); // ldr x2, [x7, 14224] - __ ldrw(r5, Address(r9, 7396)); // ldr w5, [x9, 7396] - __ ldrb(r28, Address(r9, 1721)); // ldrb w28, [x9, 1721] - __ ldrh(r2, Address(r20, 3656)); // ldrh w2, [x20, 3656] - __ ldrsb(r22, Address(r14, 1887)); // ldrsb x22, [x14, 1887] - __ ldrsh(r8, Address(r0, 4080)); // ldrsh x8, [x0, 4080] - __ ldrshw(r0, Address(r30, 3916)); // ldrsh w0, [x30, 3916] - __ ldrsw(r24, Address(r19, 6828)); // ldrsw x24, [x19, 6828] - __ ldrd(v24, Address(r12, 13032)); // ldr d24, [x12, 13032] - __ ldrs(v8, Address(r8, 7452)); // ldr s8, [x8, 7452] - __ strd(v10, Address(r15, 15992)); // str d10, [x15, 15992] - __ strs(v26, Address(r19, 6688)); // str s26, [x19, 6688] + __ str(r10, Address(r21, 14496)); // str x10, [x21, 14496] + __ strw(r18, Address(r29, 7228)); // str w18, [x29, 7228] + __ strb(r23, Address(r3, 2018)); // strb w23, [x3, 2018] + __ strh(r28, Address(r11, 3428)); // strh w28, [x11, 3428] + __ ldr(r24, Address(r26, 14376)); // ldr x24, [x26, 14376] + __ ldrw(r21, Address(r2, 6972)); // ldr w21, [x2, 6972] + __ ldrb(r4, Address(r5, 1848)); // ldrb w4, [x5, 1848] + __ ldrh(r14, Address(r14, 3112)); // ldrh w14, [x14, 3112] + __ ldrsb(r4, Address(r27, 1959)); // ldrsb x4, [x27, 1959] + __ ldrsh(r4, Address(r27, 3226)); // ldrsh x4, [x27, 3226] + __ ldrshw(r10, Address(r28, 3286)); // ldrsh w10, [x28, 3286] + __ ldrsw(r10, Address(r17, 7912)); // ldrsw x10, [x17, 7912] + __ ldrd(v13, Address(r28, 13400)); // ldr d13, [x28, 13400] + __ ldrs(v24, Address(r3, 7596)); // ldr s24, [x3, 7596] + __ strd(v2, Address(r12, 15360)); // str d2, [x12, 15360] + __ strs(v17, Address(r1, 6492)); // str s17, [x1, 6492] // pcrel // LoadStoreOp - __ ldr(r10, forth); // ldr x10, forth - __ ldrw(r3, __ pc()); // ldr w3, . + __ ldr(r16, __ pc()); // ldr x16, . + __ ldrw(r13, __ pc()); // ldr w13, . // LoadStoreOp - __ prfm(Address(r23, 9)); // prfm PLDL1KEEP, [x23, 9] + __ prfm(Address(r18, -127)); // prfm PLDL1KEEP, [x18, -127] // LoadStoreOp - __ prfm(back); // prfm PLDL1KEEP, back + __ prfm(back); // prfm PLDL1KEEP, back // LoadStoreOp - __ prfm(Address(r3, r8, Address::uxtw(0))); // prfm PLDL1KEEP, [x3, w8, uxtw #0] + __ prfm(Address(r20, r2, Address::lsl(3))); // prfm PLDL1KEEP, [x20, x2, lsl #3] // LoadStoreOp - __ prfm(Address(r11, 15080)); // prfm PLDL1KEEP, [x11, 15080] + __ prfm(Address(r9, 13808)); // prfm PLDL1KEEP, [x9, 13808] // AddSubCarryOp - __ adcw(r13, r9, r28); // adc w13, w9, w28 - __ adcsw(r27, r19, r28); // adcs w27, w19, w28 - __ sbcw(r19, r18, r6); // sbc w19, w18, w6 - __ sbcsw(r14, r20, r3); // sbcs w14, w20, w3 - __ adc(r16, r14, r8); // adc x16, x14, x8 - __ adcs(r0, r29, r8); // adcs x0, x29, x8 - __ sbc(r8, r24, r20); // sbc x8, x24, x20 - __ sbcs(r12, r28, r0); // sbcs x12, x28, x0 + __ adcw(r8, r23, r2); // adc w8, w23, w2 + __ adcsw(r24, r3, r19); // adcs w24, w3, w19 + __ sbcw(r22, r24, r29); // sbc w22, w24, w29 + __ sbcsw(r12, r27, r3); // sbcs w12, w27, w3 + __ adc(r11, r23, r1); // adc x11, x23, x1 + __ adcs(r29, r5, r23); // adcs x29, x5, x23 + __ sbc(r9, r25, r12); // sbc x9, x25, x12 + __ sbcs(r12, r0, r22); // sbcs x12, x0, x22 // AddSubExtendedOp - __ addw(r23, r6, r16, ext::uxtb, 4); // add w23, w6, w16, uxtb #4 - __ addsw(r25, r25, r23, ext::sxth, 2); // adds w25, w25, w23, sxth #2 - __ sub(r26, r22, r4, ext::uxtx, 1); // sub x26, x22, x4, uxtx #1 - __ subsw(r17, r29, r19, ext::sxtx, 3); // subs w17, w29, w19, sxtx #3 - __ add(r11, r30, r21, ext::uxtb, 3); // add x11, x30, x21, uxtb #3 - __ adds(r16, r19, r0, ext::sxtb, 2); // adds x16, x19, x0, sxtb #2 - __ sub(r11, r9, r25, ext::sxtx, 1); // sub x11, x9, x25, sxtx #1 - __ subs(r17, r20, r12, ext::sxtb, 4); // subs x17, x20, x12, sxtb #4 + __ addw(r26, r12, r3, ext::uxtw, 1); // add w26, w12, w3, uxtw #1 + __ addsw(r20, r16, r18, ext::sxtb, 2); // adds w20, w16, w18, sxtb #2 + __ sub(r30, r30, r7, ext::uxtw, 2); // sub x30, x30, x7, uxtw #2 + __ subsw(r11, r21, r2, ext::uxth, 3); // subs w11, w21, w2, uxth #3 + __ add(r2, r26, r1, ext::uxtw, 2); // add x2, x26, x1, uxtw #2 + __ adds(r18, r29, r20, ext::sxth, 1); // adds x18, x29, x20, sxth #1 + __ sub(r14, r16, r4, ext::uxtw, 4); // sub x14, x16, x4, uxtw #4 + __ subs(r0, r17, r23, ext::sxtb, 3); // subs x0, x17, x23, sxtb #3 // ConditionalCompareOp - __ ccmnw(r13, r11, 3u, Assembler::LE); // ccmn w13, w11, #3, LE - __ ccmpw(r13, r12, 2u, Assembler::HI); // ccmp w13, w12, #2, HI - __ ccmn(r3, r2, 12u, Assembler::NE); // ccmn x3, x2, #12, NE - __ ccmp(r7, r21, 3u, Assembler::VS); // ccmp x7, x21, #3, VS + __ ccmnw(r20, r22, 3u, Assembler::PL); // ccmn w20, w22, #3, PL + __ ccmpw(r25, r2, 1u, Assembler::EQ); // ccmp w25, w2, #1, EQ + __ ccmn(r18, r24, 7u, Assembler::GT); // ccmn x18, x24, #7, GT + __ ccmp(r8, r13, 6u, Assembler::PL); // ccmp x8, x13, #6, PL // ConditionalCompareImmedOp - __ ccmnw(r2, 14, 4, Assembler::CC); // ccmn w2, #14, #4, CC - __ ccmpw(r17, 17, 6, Assembler::PL); // ccmp w17, #17, #6, PL - __ ccmn(r10, 12, 0, Assembler::CS); // ccmn x10, #12, #0, CS - __ ccmp(r21, 18, 14, Assembler::GE); // ccmp x21, #18, #14, GE + __ ccmnw(r9, 2, 4, Assembler::VS); // ccmn w9, #2, #4, VS + __ ccmpw(r2, 27, 7, Assembler::EQ); // ccmp w2, #27, #7, EQ + __ ccmn(r16, 1, 2, Assembler::CC); // ccmn x16, #1, #2, CC + __ ccmp(r17, 31, 3, Assembler::LT); // ccmp x17, #31, #3, LT // ConditionalSelectOp - __ cselw(r21, r13, r12, Assembler::GT); // csel w21, w13, w12, GT - __ csincw(r10, r27, r15, Assembler::LS); // csinc w10, w27, w15, LS - __ csinvw(r0, r13, r9, Assembler::HI); // csinv w0, w13, w9, HI - __ csnegw(r18, r4, r26, Assembler::VS); // csneg w18, w4, w26, VS - __ csel(r12, r29, r7, Assembler::LS); // csel x12, x29, x7, LS - __ csinc(r6, r7, r20, Assembler::VC); // csinc x6, x7, x20, VC - __ csinv(r22, r21, r3, Assembler::LE); // csinv x22, x21, x3, LE - __ csneg(r19, r12, r27, Assembler::LS); // csneg x19, x12, x27, LS + __ cselw(r23, r27, r23, Assembler::LS); // csel w23, w27, w23, LS + __ csincw(r10, r0, r6, Assembler::VS); // csinc w10, w0, w6, VS + __ csinvw(r11, r0, r9, Assembler::CC); // csinv w11, w0, w9, CC + __ csnegw(r17, r27, r18, Assembler::LO); // csneg w17, w27, w18, LO + __ csel(r12, r16, r11, Assembler::VC); // csel x12, x16, x11, VC + __ csinc(r6, r28, r6, Assembler::HI); // csinc x6, x28, x6, HI + __ csinv(r13, r27, r26, Assembler::VC); // csinv x13, x27, x26, VC + __ csneg(r29, r22, r18, Assembler::PL); // csneg x29, x22, x18, PL // TwoRegOp - __ rbitw(r0, r16); // rbit w0, w16 - __ rev16w(r17, r23); // rev16 w17, w23 - __ revw(r17, r14); // rev w17, w14 - __ clzw(r24, r30); // clz w24, w30 - __ clsw(r24, r22); // cls w24, w22 - __ rbit(r3, r17); // rbit x3, x17 - __ rev16(r12, r13); // rev16 x12, x13 - __ rev32(r9, r22); // rev32 x9, x22 - __ rev(r0, r0); // rev x0, x0 - __ clz(r5, r16); // clz x5, x16 - __ cls(r25, r22); // cls x25, x22 + __ rbitw(r12, r19); // rbit w12, w19 + __ rev16w(r23, r18); // rev16 w23, w18 + __ revw(r9, r28); // rev w9, w28 + __ clzw(r2, r19); // clz w2, w19 + __ clsw(r25, r29); // cls w25, w29 + __ rbit(r4, r23); // rbit x4, x23 + __ rev16(r29, r18); // rev16 x29, x18 + __ rev32(r7, r8); // rev32 x7, x8 + __ rev(r13, r17); // rev x13, x17 + __ clz(r17, r0); // clz x17, x0 + __ cls(r18, r26); // cls x18, x26 // ThreeRegOp - __ udivw(r29, r4, r0); // udiv w29, w4, w0 - __ sdivw(r0, r29, r29); // sdiv w0, w29, w29 - __ lslvw(r5, r17, r21); // lslv w5, w17, w21 - __ lsrvw(r9, r9, r18); // lsrv w9, w9, w18 - __ asrvw(r1, r27, r8); // asrv w1, w27, w8 - __ rorvw(r18, r20, r13); // rorv w18, w20, w13 - __ udiv(r8, r25, r12); // udiv x8, x25, x12 - __ sdiv(r7, r5, r28); // sdiv x7, x5, x28 - __ lslv(r5, r17, r27); // lslv x5, x17, x27 - __ lsrv(r23, r26, r20); // lsrv x23, x26, x20 - __ asrv(r28, r8, r28); // asrv x28, x8, x28 - __ rorv(r3, r29, r4); // rorv x3, x29, x4 + __ udivw(r11, r12, r16); // udiv w11, w12, w16 + __ sdivw(r4, r9, r7); // sdiv w4, w9, w7 + __ lslvw(r12, r7, r16); // lslv w12, w7, w16 + __ lsrvw(r19, r16, r23); // lsrv w19, w16, w23 + __ asrvw(r7, r4, r6); // asrv w7, w4, w6 + __ rorvw(r21, r20, r23); // rorv w21, w20, w23 + __ udiv(r16, r12, r28); // udiv x16, x12, x28 + __ sdiv(r4, r12, r13); // sdiv x4, x12, x13 + __ lslv(r9, r13, r7); // lslv x9, x13, x7 + __ lsrv(r28, r27, r15); // lsrv x28, x27, x15 + __ asrv(r20, r30, r14); // asrv x20, x30, x14 + __ rorv(r14, r18, r30); // rorv x14, x18, x30 + __ umulh(r3, r11, r7); // umulh x3, x11, x7 + __ smulh(r23, r20, r24); // smulh x23, x20, x24 // FourRegMulOp - __ maddw(r17, r14, r26, r21); // madd w17, w14, w26, w21 - __ msubw(r1, r30, r11, r11); // msub w1, w30, w11, w11 - __ madd(r1, r17, r6, r28); // madd x1, x17, x6, x28 - __ msub(r30, r6, r30, r8); // msub x30, x6, x30, x8 - __ smaddl(r21, r6, r14, r8); // smaddl x21, w6, w14, x8 - __ smsubl(r10, r10, r24, r19); // smsubl x10, w10, w24, x19 - __ umaddl(r20, r18, r14, r24); // umaddl x20, w18, w14, x24 - __ umsubl(r18, r2, r5, r5); // umsubl x18, w2, w5, x5 + __ maddw(r2, r5, r21, r9); // madd w2, w5, w21, w9 + __ msubw(r24, r24, r4, r8); // msub w24, w24, w4, w8 + __ madd(r11, r12, r15, r19); // madd x11, x12, x15, x19 + __ msub(r29, r25, r12, r25); // msub x29, x25, x12, x25 + __ smaddl(r17, r11, r12, r22); // smaddl x17, w11, w12, x22 + __ smsubl(r28, r3, r20, r18); // smsubl x28, w3, w20, x18 + __ umaddl(r7, r4, r28, r26); // umaddl x7, w4, w28, x26 + __ umsubl(r22, r10, r17, r5); // umsubl x22, w10, w17, x5 // ThreeRegFloatOp - __ fmuls(v8, v18, v13); // fmul s8, s18, s13 - __ fdivs(v2, v14, v28); // fdiv s2, s14, s28 - __ fadds(v15, v12, v28); // fadd s15, s12, s28 - __ fsubs(v0, v12, v1); // fsub s0, s12, s1 - __ fmuls(v15, v29, v4); // fmul s15, s29, s4 - __ fmuld(v12, v1, v23); // fmul d12, d1, d23 - __ fdivd(v27, v8, v18); // fdiv d27, d8, d18 - __ faddd(v23, v20, v11); // fadd d23, d20, d11 - __ fsubd(v8, v12, v18); // fsub d8, d12, d18 - __ fmuld(v26, v24, v23); // fmul d26, d24, d23 + __ fmuls(v17, v3, v17); // fmul s17, s3, s17 + __ fdivs(v11, v17, v6); // fdiv s11, s17, s6 + __ fadds(v29, v7, v9); // fadd s29, s7, s9 + __ fsubs(v7, v12, v19); // fsub s7, s12, s19 + __ fmuls(v0, v23, v3); // fmul s0, s23, s3 + __ fmuld(v26, v3, v21); // fmul d26, d3, d21 + __ fdivd(v0, v19, v5); // fdiv d0, d19, d5 + __ faddd(v0, v26, v9); // fadd d0, d26, d9 + __ fsubd(v25, v21, v21); // fsub d25, d21, d21 + __ fmuld(v16, v13, v19); // fmul d16, d13, d19 // FourRegFloatOp - __ fmadds(v21, v23, v13, v25); // fmadd s21, s23, s13, s25 - __ fmsubs(v22, v10, v1, v14); // fmsub s22, s10, s1, s14 - __ fnmadds(v14, v20, v2, v30); // fnmadd s14, s20, s2, s30 - __ fnmadds(v7, v29, v22, v22); // fnmadd s7, s29, s22, s22 - __ fmaddd(v13, v5, v15, v5); // fmadd d13, d5, d15, d5 - __ fmsubd(v14, v12, v5, v10); // fmsub d14, d12, d5, d10 - __ fnmaddd(v10, v19, v0, v1); // fnmadd d10, d19, d0, d1 - __ fnmaddd(v20, v2, v2, v0); // fnmadd d20, d2, d2, d0 + __ fmadds(v29, v18, v0, v16); // fmadd s29, s18, s0, s16 + __ fmsubs(v23, v13, v29, v5); // fmsub s23, s13, s29, s5 + __ fnmadds(v9, v7, v10, v14); // fnmadd s9, s7, s10, s14 + __ fnmadds(v25, v28, v15, v23); // fnmadd s25, s28, s15, s23 + __ fmaddd(v6, v13, v21, v17); // fmadd d6, d13, d21, d17 + __ fmsubd(v3, v21, v2, v7); // fmsub d3, d21, d2, d7 + __ fnmaddd(v10, v25, v5, v17); // fnmadd d10, d25, d5, d17 + __ fnmaddd(v14, v14, v20, v18); // fnmadd d14, d14, d20, d18 // TwoRegFloatOp - __ fmovs(v25, v9); // fmov s25, s9 - __ fabss(v20, v4); // fabs s20, s4 - __ fnegs(v3, v27); // fneg s3, s27 - __ fsqrts(v1, v2); // fsqrt s1, s2 - __ fcvts(v30, v0); // fcvt d30, s0 - __ fmovd(v12, v4); // fmov d12, d4 - __ fabsd(v1, v27); // fabs d1, d27 - __ fnegd(v8, v22); // fneg d8, d22 - __ fsqrtd(v11, v11); // fsqrt d11, d11 - __ fcvtd(v22, v28); // fcvt s22, d28 + __ fmovs(v15, v2); // fmov s15, s2 + __ fabss(v18, v7); // fabs s18, s7 + __ fnegs(v3, v6); // fneg s3, s6 + __ fsqrts(v12, v1); // fsqrt s12, s1 + __ fcvts(v9, v0); // fcvt d9, s0 + __ fmovd(v4, v5); // fmov d4, d5 + __ fabsd(v3, v15); // fabs d3, d15 + __ fnegd(v17, v25); // fneg d17, d25 + __ fsqrtd(v12, v24); // fsqrt d12, d24 + __ fcvtd(v21, v5); // fcvt s21, d5 // FloatConvertOp - __ fcvtzsw(r28, v22); // fcvtzs w28, s22 - __ fcvtzs(r20, v27); // fcvtzs x20, s27 - __ fcvtzdw(r14, v0); // fcvtzs w14, d0 - __ fcvtzd(r26, v11); // fcvtzs x26, d11 - __ scvtfws(v28, r22); // scvtf s28, w22 - __ scvtfs(v16, r10); // scvtf s16, x10 - __ scvtfwd(v8, r21); // scvtf d8, w21 - __ scvtfd(v21, r28); // scvtf d21, x28 - __ fmovs(r24, v24); // fmov w24, s24 - __ fmovd(r8, v19); // fmov x8, d19 - __ fmovs(v8, r12); // fmov s8, w12 - __ fmovd(v6, r7); // fmov d6, x7 + __ fcvtzsw(r4, v21); // fcvtzs w4, s21 + __ fcvtzs(r27, v3); // fcvtzs x27, s3 + __ fcvtzdw(r29, v8); // fcvtzs w29, d8 + __ fcvtzd(r9, v21); // fcvtzs x9, d21 + __ scvtfws(v20, r29); // scvtf s20, w29 + __ scvtfs(v7, r8); // scvtf s7, x8 + __ scvtfwd(v12, r21); // scvtf d12, w21 + __ scvtfd(v16, r21); // scvtf d16, x21 + __ fmovs(r18, v5); // fmov w18, s5 + __ fmovd(r25, v8); // fmov x25, d8 + __ fmovs(v18, r26); // fmov s18, w26 + __ fmovd(v0, r11); // fmov d0, x11 // TwoRegFloatOp - __ fcmps(v30, v16); // fcmp s30, s16 - __ fcmpd(v25, v11); // fcmp d25, d11 - __ fcmps(v11, 0.0); // fcmp s11, #0.0 - __ fcmpd(v11, 0.0); // fcmp d11, #0.0 + __ fcmps(v16, v6); // fcmp s16, s6 + __ fcmpd(v16, v29); // fcmp d16, d29 + __ fcmps(v30, 0.0); // fcmp s30, #0.0 + __ fcmpd(v9, 0.0); // fcmp d9, #0.0 + +// LoadStorePairOp + __ stpw(r27, r4, Address(r12, -16)); // stp w27, w4, [x12, #-16] + __ ldpw(r3, r9, Address(r10, 80)); // ldp w3, w9, [x10, #80] + __ ldpsw(r16, r3, Address(r3, 64)); // ldpsw x16, x3, [x3, #64] + __ stp(r10, r28, Address(r19, -192)); // stp x10, x28, [x19, #-192] + __ ldp(r19, r18, Address(r7, -192)); // ldp x19, x18, [x7, #-192] + +// LoadStorePairOp + __ stpw(r10, r16, Address(__ pre(r30, 16))); // stp w10, w16, [x30, #16]! + __ ldpw(r2, r4, Address(__ pre(r18, -240))); // ldp w2, w4, [x18, #-240]! + __ ldpsw(r24, r19, Address(__ pre(r13, 48))); // ldpsw x24, x19, [x13, #48]! + __ stp(r17, r0, Address(__ pre(r24, 0))); // stp x17, x0, [x24, #0]! + __ ldp(r14, r26, Address(__ pre(r3, -192))); // ldp x14, x26, [x3, #-192]! + +// LoadStorePairOp + __ stpw(r22, r1, Address(__ post(r0, 80))); // stp w22, w1, [x0], #80 + __ ldpw(r18, r10, Address(__ post(r0, -16))); // ldp w18, w10, [x0], #-16 + __ ldpsw(r24, r24, Address(__ post(r22, -16))); // ldpsw x24, x24, [x22], #-16 + __ stp(r12, r12, Address(__ post(r4, 80))); // stp x12, x12, [x4], #80 + __ ldp(r4, r9, Address(__ post(r19, -240))); // ldp x4, x9, [x19], #-240 // LoadStorePairOp - __ stpw(r29, r12, Address(r17, 128)); // stp w29, w12, [x17, #128] - __ ldpw(r22, r18, Address(r14, -96)); // ldp w22, w18, [x14, #-96] - __ ldpsw(r11, r16, Address(r1, 64)); // ldpsw x11, x16, [x1, #64] - __ stp(r0, r11, Address(r26, 112)); // stp x0, x11, [x26, #112] - __ ldp(r7, r1, Address(r26, 16)); // ldp x7, x1, [x26, #16] - -// LoadStorePairOp - __ stpw(r10, r7, Address(__ pre(r24, 0))); // stp w10, w7, [x24, #0]! - __ ldpw(r7, r28, Address(__ pre(r24, -256))); // ldp w7, w28, [x24, #-256]! - __ ldpsw(r25, r28, Address(__ pre(r21, -240))); // ldpsw x25, x28, [x21, #-240]! - __ stp(r20, r18, Address(__ pre(r14, -16))); // stp x20, x18, [x14, #-16]! - __ ldp(r8, r10, Address(__ pre(r13, 80))); // ldp x8, x10, [x13, #80]! + __ stnpw(r18, r26, Address(r6, -224)); // stnp w18, w26, [x6, #-224] + __ ldnpw(r21, r20, Address(r1, 112)); // ldnp w21, w20, [x1, #112] + __ stnp(r25, r29, Address(r20, -224)); // stnp x25, x29, [x20, #-224] + __ ldnp(r1, r5, Address(r23, 112)); // ldnp x1, x5, [x23, #112] -// LoadStorePairOp - __ stpw(r26, r24, Address(__ post(r2, -128))); // stp w26, w24, [x2], #-128 - __ ldpw(r2, r25, Address(__ post(r21, -192))); // ldp w2, w25, [x21], #-192 - __ ldpsw(r17, r2, Address(__ post(r21, -144))); // ldpsw x17, x2, [x21], #-144 - __ stp(r12, r10, Address(__ post(r11, 96))); // stp x12, x10, [x11], #96 - __ ldp(r24, r6, Address(__ post(r17, -32))); // ldp x24, x6, [x17], #-32 +// LdStSIMDOp + __ ld1(v4, __ T8B, Address(r20)); // ld1 {v4.8B}, [x20] + __ ld1(v24, v25, __ T16B, Address(__ post(r10, 32))); // ld1 {v24.16B, v25.16B}, [x10], 32 + __ ld1(v24, v25, v26, __ T1D, Address(__ post(r6, r15))); // ld1 {v24.1D, v25.1D, v26.1D}, [x6], x15 + __ ld1(v3, v4, v5, v6, __ T8H, Address(__ post(r4, 64))); // ld1 {v3.8H, v4.8H, v5.8H, v6.8H}, [x4], 64 + __ ld1r(v2, __ T8B, Address(r6)); // ld1r {v2.8B}, [x6] + __ ld1r(v13, __ T4S, Address(__ post(r14, 4))); // ld1r {v13.4S}, [x14], 4 + __ ld1r(v15, __ T1D, Address(__ post(r21, r24))); // ld1r {v15.1D}, [x21], x24 + __ ld2(v9, v10, __ T2D, Address(r21)); // ld2 {v9.2D, v10.2D}, [x21] + __ ld2(v29, v30, __ T4H, Address(__ post(r21, 16))); // ld2 {v29.4H, v30.4H}, [x21], 16 + __ ld2r(v8, v9, __ T16B, Address(r14)); // ld2r {v8.16B, v9.16B}, [x14] + __ ld2r(v7, v8, __ T2S, Address(__ post(r20, 8))); // ld2r {v7.2S, v8.2S}, [x20], 8 + __ ld2r(v28, v29, __ T2D, Address(__ post(r3, r3))); // ld2r {v28.2D, v29.2D}, [x3], x3 + __ ld3(v27, v28, v29, __ T4S, Address(__ post(r11, r29))); // ld3 {v27.4S, v28.4S, v29.4S}, [x11], x29 + __ ld3(v16, v17, v18, __ T2S, Address(r10)); // ld3 {v16.2S, v17.2S, v18.2S}, [x10] + __ ld3r(v21, v22, v23, __ T8H, Address(r12)); // ld3r {v21.8H, v22.8H, v23.8H}, [x12] + __ ld3r(v4, v5, v6, __ T4S, Address(__ post(r29, 12))); // ld3r {v4.4S, v5.4S, v6.4S}, [x29], 12 + __ ld3r(v24, v25, v26, __ T1D, Address(__ post(r9, r19))); // ld3r {v24.1D, v25.1D, v26.1D}, [x9], x19 + __ ld4(v10, v11, v12, v13, __ T8H, Address(__ post(r3, 64))); // ld4 {v10.8H, v11.8H, v12.8H, v13.8H}, [x3], 64 + __ ld4(v27, v28, v29, v30, __ T8B, Address(__ post(r28, r9))); // ld4 {v27.8B, v28.8B, v29.8B, v30.8B}, [x28], x9 + __ ld4r(v21, v22, v23, v24, __ T8B, Address(r30)); // ld4r {v21.8B, v22.8B, v23.8B, v24.8B}, [x30] + __ ld4r(v23, v24, v25, v26, __ T4H, Address(__ post(r14, 8))); // ld4r {v23.4H, v24.4H, v25.4H, v26.4H}, [x14], 8 + __ ld4r(v4, v5, v6, v7, __ T2S, Address(__ post(r13, r20))); // ld4r {v4.2S, v5.2S, v6.2S, v7.2S}, [x13], x20 -// LoadStorePairOp - __ stnpw(r3, r30, Address(r14, -224)); // stnp w3, w30, [x14, #-224] - __ ldnpw(r15, r20, Address(r26, -144)); // ldnp w15, w20, [x26, #-144] - __ stnp(r22, r25, Address(r12, -128)); // stnp x22, x25, [x12, #-128] - __ ldnp(r27, r22, Address(r17, -176)); // ldnp x27, x22, [x17, #-176] +// SpecialCases + __ ccmn(zr, zr, 3u, Assembler::LE); // ccmn xzr, xzr, #3, LE + __ ccmnw(zr, zr, 5u, Assembler::EQ); // ccmn wzr, wzr, #5, EQ + __ ccmp(zr, 1, 4u, Assembler::NE); // ccmp xzr, 1, #4, NE + __ ccmpw(zr, 2, 2, Assembler::GT); // ccmp wzr, 2, #2, GT + __ extr(zr, zr, zr, 0); // extr xzr, xzr, xzr, 0 + __ stlxp(r0, zr, zr, sp); // stlxp w0, xzr, xzr, [sp] + __ stlxpw(r2, zr, zr, r3); // stlxp w2, wzr, wzr, [x3] + __ stxp(r4, zr, zr, r5); // stxp w4, xzr, xzr, [x5] + __ stxpw(r6, zr, zr, sp); // stxp w6, wzr, wzr, [sp] + __ dup(v0, __ T16B, zr); // dup v0.16b, wzr + __ mov(v1, __ T1D, 0, zr); // mov v1.d[0], xzr + __ mov(v1, __ T2S, 1, zr); // mov v1.s[1], wzr + __ mov(v1, __ T4H, 2, zr); // mov v1.h[2], wzr + __ mov(v1, __ T8B, 3, zr); // mov v1.b[3], wzr + __ ld1(v31, v0, __ T2D, Address(__ post(r1, r0))); // ld1 {v31.2d, v0.2d}, [x1], x0 // FloatImmediateOp - __ fmovd(v0, 2.0); // fmov d0, #2.0 - __ fmovd(v0, 2.125); // fmov d0, #2.125 - __ fmovd(v0, 4.0); // fmov d0, #4.0 - __ fmovd(v0, 4.25); // fmov d0, #4.25 - __ fmovd(v0, 8.0); // fmov d0, #8.0 - __ fmovd(v0, 8.5); // fmov d0, #8.5 - __ fmovd(v0, 16.0); // fmov d0, #16.0 - __ fmovd(v0, 17.0); // fmov d0, #17.0 - __ fmovd(v0, 0.125); // fmov d0, #0.125 - __ fmovd(v0, 0.1328125); // fmov d0, #0.1328125 - __ fmovd(v0, 0.25); // fmov d0, #0.25 - __ fmovd(v0, 0.265625); // fmov d0, #0.265625 - __ fmovd(v0, 0.5); // fmov d0, #0.5 - __ fmovd(v0, 0.53125); // fmov d0, #0.53125 - __ fmovd(v0, 1.0); // fmov d0, #1.0 - __ fmovd(v0, 1.0625); // fmov d0, #1.0625 - __ fmovd(v0, -2.0); // fmov d0, #-2.0 - __ fmovd(v0, -2.125); // fmov d0, #-2.125 - __ fmovd(v0, -4.0); // fmov d0, #-4.0 - __ fmovd(v0, -4.25); // fmov d0, #-4.25 - __ fmovd(v0, -8.0); // fmov d0, #-8.0 - __ fmovd(v0, -8.5); // fmov d0, #-8.5 - __ fmovd(v0, -16.0); // fmov d0, #-16.0 - __ fmovd(v0, -17.0); // fmov d0, #-17.0 - __ fmovd(v0, -0.125); // fmov d0, #-0.125 - __ fmovd(v0, -0.1328125); // fmov d0, #-0.1328125 - __ fmovd(v0, -0.25); // fmov d0, #-0.25 - __ fmovd(v0, -0.265625); // fmov d0, #-0.265625 - __ fmovd(v0, -0.5); // fmov d0, #-0.5 - __ fmovd(v0, -0.53125); // fmov d0, #-0.53125 - __ fmovd(v0, -1.0); // fmov d0, #-1.0 - __ fmovd(v0, -1.0625); // fmov d0, #-1.0625 + __ fmovd(v0, 2.0); // fmov d0, #2.0 + __ fmovd(v0, 2.125); // fmov d0, #2.125 + __ fmovd(v0, 4.0); // fmov d0, #4.0 + __ fmovd(v0, 4.25); // fmov d0, #4.25 + __ fmovd(v0, 8.0); // fmov d0, #8.0 + __ fmovd(v0, 8.5); // fmov d0, #8.5 + __ fmovd(v0, 16.0); // fmov d0, #16.0 + __ fmovd(v0, 17.0); // fmov d0, #17.0 + __ fmovd(v0, 0.125); // fmov d0, #0.125 + __ fmovd(v0, 0.1328125); // fmov d0, #0.1328125 + __ fmovd(v0, 0.25); // fmov d0, #0.25 + __ fmovd(v0, 0.265625); // fmov d0, #0.265625 + __ fmovd(v0, 0.5); // fmov d0, #0.5 + __ fmovd(v0, 0.53125); // fmov d0, #0.53125 + __ fmovd(v0, 1.0); // fmov d0, #1.0 + __ fmovd(v0, 1.0625); // fmov d0, #1.0625 + __ fmovd(v0, -2.0); // fmov d0, #-2.0 + __ fmovd(v0, -2.125); // fmov d0, #-2.125 + __ fmovd(v0, -4.0); // fmov d0, #-4.0 + __ fmovd(v0, -4.25); // fmov d0, #-4.25 + __ fmovd(v0, -8.0); // fmov d0, #-8.0 + __ fmovd(v0, -8.5); // fmov d0, #-8.5 + __ fmovd(v0, -16.0); // fmov d0, #-16.0 + __ fmovd(v0, -17.0); // fmov d0, #-17.0 + __ fmovd(v0, -0.125); // fmov d0, #-0.125 + __ fmovd(v0, -0.1328125); // fmov d0, #-0.1328125 + __ fmovd(v0, -0.25); // fmov d0, #-0.25 + __ fmovd(v0, -0.265625); // fmov d0, #-0.265625 + __ fmovd(v0, -0.5); // fmov d0, #-0.5 + __ fmovd(v0, -0.53125); // fmov d0, #-0.53125 + __ fmovd(v0, -1.0); // fmov d0, #-1.0 + __ fmovd(v0, -1.0625); // fmov d0, #-1.0625 + +// LSEOp + __ swp(Assembler::xword, r21, r5, r24); // swp x21, x5, [x24] + __ ldadd(Assembler::xword, r13, r13, r15); // ldadd x13, x13, [x15] + __ ldbic(Assembler::xword, r22, r19, r26); // ldclr x22, x19, [x26] + __ ldeor(Assembler::xword, r25, r10, r26); // ldeor x25, x10, [x26] + __ ldorr(Assembler::xword, r5, r27, r15); // ldset x5, x27, [x15] + __ ldsmin(Assembler::xword, r19, r5, r11); // ldsmin x19, x5, [x11] + __ ldsmax(Assembler::xword, r26, r0, r4); // ldsmax x26, x0, [x4] + __ ldumin(Assembler::xword, r22, r23, r30); // ldumin x22, x23, [x30] + __ ldumax(Assembler::xword, r18, r28, r8); // ldumax x18, x28, [x8] + +// LSEOp + __ swpa(Assembler::xword, r13, r29, r27); // swpa x13, x29, [x27] + __ ldadda(Assembler::xword, r11, r5, r13); // ldadda x11, x5, [x13] + __ ldbica(Assembler::xword, r1, r24, r21); // ldclra x1, x24, [x21] + __ ldeora(Assembler::xword, r27, r17, r24); // ldeora x27, x17, [x24] + __ ldorra(Assembler::xword, r18, r30, r5); // ldseta x18, x30, [x5] + __ ldsmina(Assembler::xword, r7, r22, r25); // ldsmina x7, x22, [x25] + __ ldsmaxa(Assembler::xword, r4, r26, r19); // ldsmaxa x4, x26, [x19] + __ ldumina(Assembler::xword, r6, r30, r3); // ldumina x6, x30, [x3] + __ ldumaxa(Assembler::xword, r24, r23, r5); // ldumaxa x24, x23, [x5] + +// LSEOp + __ swpal(Assembler::xword, r24, r18, r28); // swpal x24, x18, [x28] + __ ldaddal(Assembler::xword, r19, zr, r7); // ldaddal x19, xzr, [x7] + __ ldbical(Assembler::xword, r13, r6, r28); // ldclral x13, x6, [x28] + __ ldeoral(Assembler::xword, r8, r15, r21); // ldeoral x8, x15, [x21] + __ ldorral(Assembler::xword, r2, r13, r1); // ldsetal x2, x13, [x1] + __ ldsminal(Assembler::xword, r17, r29, r25); // ldsminal x17, x29, [x25] + __ ldsmaxal(Assembler::xword, r25, r18, r14); // ldsmaxal x25, x18, [x14] + __ lduminal(Assembler::xword, zr, r6, r27); // lduminal xzr, x6, [x27] + __ ldumaxal(Assembler::xword, r16, r5, r15); // ldumaxal x16, x5, [x15] + +// LSEOp + __ swpl(Assembler::xword, r11, r18, r3); // swpl x11, x18, [x3] + __ ldaddl(Assembler::xword, r26, r20, r2); // ldaddl x26, x20, [x2] + __ ldbicl(Assembler::xword, r11, r4, r11); // ldclrl x11, x4, [x11] + __ ldeorl(Assembler::xword, r30, r19, r23); // ldeorl x30, x19, [x23] + __ ldorrl(Assembler::xword, r3, r15, r14); // ldsetl x3, x15, [x14] + __ ldsminl(Assembler::xword, r30, r22, r20); // ldsminl x30, x22, [x20] + __ ldsmaxl(Assembler::xword, r7, r5, r24); // ldsmaxl x7, x5, [x24] + __ lduminl(Assembler::xword, r23, r16, r15); // lduminl x23, x16, [x15] + __ ldumaxl(Assembler::xword, r11, r19, r0); // ldumaxl x11, x19, [x0] + +// LSEOp + __ swp(Assembler::word, r28, r28, r1); // swp w28, w28, [x1] + __ ldadd(Assembler::word, r11, r21, r12); // ldadd w11, w21, [x12] + __ ldbic(Assembler::word, r29, r0, r18); // ldclr w29, w0, [x18] + __ ldeor(Assembler::word, r5, r0, r25); // ldeor w5, w0, [x25] + __ ldorr(Assembler::word, r14, r0, r26); // ldset w14, w0, [x26] + __ ldsmin(Assembler::word, r28, r18, r29); // ldsmin w28, w18, [x29] + __ ldsmax(Assembler::word, r15, r1, r29); // ldsmax w15, w1, [x29] + __ ldumin(Assembler::word, r8, r26, r28); // ldumin w8, w26, [x28] + __ ldumax(Assembler::word, r17, r14, r4); // ldumax w17, w14, [x4] + +// LSEOp + __ swpa(Assembler::word, r24, r25, r1); // swpa w24, w25, [x1] + __ ldadda(Assembler::word, r10, r17, r17); // ldadda w10, w17, [x17] + __ ldbica(Assembler::word, r29, r20, r21); // ldclra w29, w20, [x21] + __ ldeora(Assembler::word, r29, r9, r12); // ldeora w29, w9, [x12] + __ ldorra(Assembler::word, r11, r6, r5); // ldseta w11, w6, [x5] + __ ldsmina(Assembler::word, r21, r7, r21); // ldsmina w21, w7, [x21] + __ ldsmaxa(Assembler::word, r10, r23, r12); // ldsmaxa w10, w23, [x12] + __ ldumina(Assembler::word, r21, r5, r10); // ldumina w21, w5, [x10] + __ ldumaxa(Assembler::word, r30, r20, r18); // ldumaxa w30, w20, [x18] + +// LSEOp + __ swpal(Assembler::word, r13, r23, r5); // swpal w13, w23, [x5] + __ ldaddal(Assembler::word, r15, r24, r5); // ldaddal w15, w24, [x5] + __ ldbical(Assembler::word, r9, r10, r25); // ldclral w9, w10, [x25] + __ ldeoral(Assembler::word, r20, r17, r17); // ldeoral w20, w17, [x17] + __ ldorral(Assembler::word, r12, r18, r30); // ldsetal w12, w18, [x30] + __ ldsminal(Assembler::word, r3, r3, r25); // ldsminal w3, w3, [x25] + __ ldsmaxal(Assembler::word, r26, r25, r10); // ldsmaxal w26, w25, [x10] + __ lduminal(Assembler::word, r2, r11, sp); // lduminal w2, w11, [sp] + __ ldumaxal(Assembler::word, r7, r2, r5); // ldumaxal w7, w2, [x5] + +// LSEOp + __ swpl(Assembler::word, r0, r7, r20); // swpl w0, w7, [x20] + __ ldaddl(Assembler::word, r5, zr, r2); // ldaddl w5, wzr, [x2] + __ ldbicl(Assembler::word, r27, r25, r27); // ldclrl w27, w25, [x27] + __ ldeorl(Assembler::word, r30, r24, r26); // ldeorl w30, w24, [x26] + __ ldorrl(Assembler::word, r15, r2, r22); // ldsetl w15, w2, [x22] + __ ldsminl(Assembler::word, r0, r3, sp); // ldsminl w0, w3, [sp] + __ ldsmaxl(Assembler::word, r15, r20, r10); // ldsmaxl w15, w20, [x10] + __ lduminl(Assembler::word, r22, r21, r14); // lduminl w22, w21, [x14] + __ ldumaxl(Assembler::word, r6, r30, r2); // ldumaxl w6, w30, [x2] __ bind(forth); @@ -638,542 +769,681 @@ Disassembly of section .text: 0000000000000000 : - 0: 8b0772d3 add x19, x22, x7, lsl #28 - 4: cb4a3570 sub x16, x11, x10, lsr #13 - 8: ab9c09bb adds x27, x13, x28, asr #2 - c: eb9aa794 subs x20, x28, x26, asr #41 - 10: 0b934e68 add w8, w19, w19, asr #19 - 14: 4b0a3924 sub w4, w9, w10, lsl #14 - 18: 2b1e3568 adds w8, w11, w30, lsl #13 - 1c: 6b132720 subs w0, w25, w19, lsl #9 - 20: 8a154c14 and x20, x0, x21, lsl #19 - 24: aa1445d5 orr x21, x14, x20, lsl #17 - 28: ca01cf99 eor x25, x28, x1, lsl #51 - 2c: ea8b3f6a ands x10, x27, x11, asr #15 - 30: 0a8c5cb9 and w25, w5, w12, asr #23 - 34: 2a4a11d2 orr w18, w14, w10, lsr #4 - 38: 4a855aa4 eor w4, w21, w5, asr #22 - 3c: 6a857415 ands w21, w0, w5, asr #29 - 40: 8aa697da bic x26, x30, x6, asr #37 - 44: aa6d7423 orn x3, x1, x13, lsr #29 - 48: ca29bf80 eon x0, x28, x9, lsl #47 - 4c: ea3cb8bd bics x29, x5, x28, lsl #46 - 50: 0a675249 bic w9, w18, w7, lsr #20 - 54: 2ab961ba orn w26, w13, w25, asr #24 - 58: 4a331899 eon w25, w4, w19, lsl #6 - 5c: 6a646345 bics w5, w26, w4, lsr #24 - 60: 11055267 add w7, w19, #0x154 - 64: 31064408 adds w8, w0, #0x191 - 68: 51028e9d sub w29, w20, #0xa3 - 6c: 710bdee8 subs w8, w23, #0x2f7 - 70: 91082d81 add x1, x12, #0x20b - 74: b106a962 adds x2, x11, #0x1aa - 78: d10b33ae sub x14, x29, #0x2cc - 7c: f10918ab subs x11, x5, #0x246 - 80: 121102d7 and w23, w22, #0x8000 - 84: 3204cd44 orr w4, w10, #0xf0f0f0f0 - 88: 5204cf00 eor w0, w24, #0xf0f0f0f0 - 8c: 72099fb3 ands w19, w29, #0x7f807f80 - 90: 92729545 and x5, x10, #0xfffffffffc000 - 94: b20e37cc orr x12, x30, #0xfffc0000fffc0000 - 98: d27c34be eor x30, x5, #0x3fff0 - 9c: f27e4efa ands x26, x23, #0x3ffffc - a0: 14000000 b a0 - a4: 17ffffd7 b 0 - a8: 1400017f b 6a4 - ac: 94000000 bl ac - b0: 97ffffd4 bl 0 - b4: 9400017c bl 6a4 - b8: 3400000c cbz w12, b8 - bc: 34fffa2c cbz w12, 0 - c0: 34002f2c cbz w12, 6a4 - c4: 35000014 cbnz w20, c4 - c8: 35fff9d4 cbnz w20, 0 - cc: 35002ed4 cbnz w20, 6a4 - d0: b400000c cbz x12, d0 - d4: b4fff96c cbz x12, 0 - d8: b4002e6c cbz x12, 6a4 - dc: b5000018 cbnz x24, dc - e0: b5fff918 cbnz x24, 0 - e4: b5002e18 cbnz x24, 6a4 - e8: 10000006 adr x6, e8 - ec: 10fff8a6 adr x6, 0 - f0: 10002da6 adr x6, 6a4 - f4: 90000015 adrp x21, 0 - f8: 36080001 tbz w1, #1, f8 - fc: 360ff821 tbz w1, #1, 0 - 100: 36082d21 tbz w1, #1, 6a4 - 104: 37480008 tbnz w8, #9, 104 - 108: 374ff7c8 tbnz w8, #9, 0 - 10c: 37482cc8 tbnz w8, #9, 6a4 - 110: 128b50ec movn w12, #0x5a87 - 114: 52a9ff8b movz w11, #0x4ffc, lsl #16 - 118: 7281d095 movk w21, #0xe84 - 11c: 92edfebd movn x29, #0x6ff5, lsl #48 - 120: d28361e3 movz x3, #0x1b0f - 124: f2a4cc96 movk x22, #0x2664, lsl #16 - 128: 9346590c sbfx x12, x8, #6, #17 - 12c: 33194f33 bfi w19, w25, #7, #20 - 130: 531d3d89 ubfiz w9, w12, #3, #16 - 134: 9350433c sbfx x28, x25, #16, #1 - 138: b34464ac bfxil x12, x5, #4, #22 - 13c: d3462140 ubfx x0, x10, #6, #3 - 140: 139a61a4 extr w4, w13, w26, #24 - 144: 93d87fd7 extr x23, x30, x24, #31 - 148: 54000000 b.eq 148 - 14c: 54fff5a0 b.eq 0 - 150: 54002aa0 b.eq 6a4 - 154: 54000001 b.ne 154 - 158: 54fff541 b.ne 0 - 15c: 54002a41 b.ne 6a4 - 160: 54000002 b.cs 160 - 164: 54fff4e2 b.cs 0 - 168: 540029e2 b.cs 6a4 - 16c: 54000002 b.cs 16c - 170: 54fff482 b.cs 0 - 174: 54002982 b.cs 6a4 - 178: 54000003 b.cc 178 - 17c: 54fff423 b.cc 0 - 180: 54002923 b.cc 6a4 - 184: 54000003 b.cc 184 - 188: 54fff3c3 b.cc 0 - 18c: 540028c3 b.cc 6a4 - 190: 54000004 b.mi 190 - 194: 54fff364 b.mi 0 - 198: 54002864 b.mi 6a4 - 19c: 54000005 b.pl 19c - 1a0: 54fff305 b.pl 0 - 1a4: 54002805 b.pl 6a4 - 1a8: 54000006 b.vs 1a8 - 1ac: 54fff2a6 b.vs 0 - 1b0: 540027a6 b.vs 6a4 - 1b4: 54000007 b.vc 1b4 - 1b8: 54fff247 b.vc 0 - 1bc: 54002747 b.vc 6a4 - 1c0: 54000008 b.hi 1c0 - 1c4: 54fff1e8 b.hi 0 - 1c8: 540026e8 b.hi 6a4 - 1cc: 54000009 b.ls 1cc - 1d0: 54fff189 b.ls 0 - 1d4: 54002689 b.ls 6a4 - 1d8: 5400000a b.ge 1d8 - 1dc: 54fff12a b.ge 0 - 1e0: 5400262a b.ge 6a4 - 1e4: 5400000b b.lt 1e4 - 1e8: 54fff0cb b.lt 0 - 1ec: 540025cb b.lt 6a4 - 1f0: 5400000c b.gt 1f0 - 1f4: 54fff06c b.gt 0 - 1f8: 5400256c b.gt 6a4 - 1fc: 5400000d b.le 1fc - 200: 54fff00d b.le 0 - 204: 5400250d b.le 6a4 - 208: 5400000e b.al 208 - 20c: 54ffefae b.al 0 - 210: 540024ae b.al 6a4 - 214: 5400000f b.nv 214 - 218: 54ffef4f b.nv 0 - 21c: 5400244f b.nv 6a4 - 220: d4063721 svc #0x31b9 - 224: d4035082 hvc #0x1a84 - 228: d400bfe3 smc #0x5ff - 22c: d4282fc0 brk #0x417e - 230: d444c320 hlt #0x2619 - 234: d503201f nop - 238: d69f03e0 eret - 23c: d6bf03e0 drps - 240: d5033fdf isb - 244: d5033f9f dsb sy - 248: d5033abf dmb ishst - 24c: d61f0040 br x2 - 250: d63f00a0 blr x5 - 254: c8147c55 stxr w20, x21, [x2] - 258: c805fcfd stlxr w5, x29, [x7] - 25c: c85f7e05 ldxr x5, [x16] - 260: c85fffbb ldaxr x27, [x29] - 264: c89fffa0 stlr x0, [x29] - 268: c8dfff95 ldar x21, [x28] - 26c: 88157cf8 stxr w21, w24, [x7] - 270: 8815ff9a stlxr w21, w26, [x28] - 274: 885f7cd5 ldxr w21, [x6] - 278: 885fffcf ldaxr w15, [x30] - 27c: 889ffc73 stlr w19, [x3] - 280: 88dffc56 ldar w22, [x2] - 284: 48127c0f stxrh w18, w15, [x0] - 288: 480bff85 stlxrh w11, w5, [x28] - 28c: 485f7cdd ldxrh w29, [x6] - 290: 485ffcf2 ldaxrh w18, [x7] - 294: 489fff99 stlrh w25, [x28] - 298: 48dffe62 ldarh w2, [x19] - 29c: 080a7c3e stxrb w10, w30, [x1] - 2a0: 0814fed5 stlxrb w20, w21, [x22] - 2a4: 085f7c59 ldxrb w25, [x2] - 2a8: 085ffcb8 ldaxrb w24, [x5] - 2ac: 089ffc70 stlrb w16, [x3] - 2b0: 08dfffb6 ldarb w22, [x29] - 2b4: c87f0a68 ldxp x8, x2, [x19] - 2b8: c87fcdc7 ldaxp x7, x19, [x14] - 2bc: c82870bb stxp w8, x27, x28, [x5] - 2c0: c825b8c8 stlxp w5, x8, x14, [x6] - 2c4: 887f12d9 ldxp w25, w4, [x22] - 2c8: 887fb9ed ldaxp w13, w14, [x15] - 2cc: 8834215a stxp w20, w26, w8, [x10] - 2d0: 8837ca52 stlxp w23, w18, w18, [x18] - 2d4: f806317e str x30, [x11,#99] - 2d8: b81b3337 str w23, [x25,#-77] - 2dc: 39000dc2 strb w2, [x14,#3] - 2e0: 78005149 strh w9, [x10,#5] - 2e4: f84391f4 ldr x20, [x15,#57] - 2e8: b85b220c ldr w12, [x16,#-78] - 2ec: 385fd356 ldrb w22, [x26,#-3] - 2f0: 785d127e ldrh w30, [x19,#-47] - 2f4: 389f4149 ldrsb x9, [x10,#-12] - 2f8: 79801e3c ldrsh x28, [x17,#14] - 2fc: 79c014a3 ldrsh w3, [x5,#10] - 300: b89a5231 ldrsw x17, [x17,#-91] - 304: fc5ef282 ldr d2, [x20,#-17] - 308: bc5f60f6 ldr s22, [x7,#-10] - 30c: fc12125e str d30, [x18,#-223] - 310: bc0152cd str s13, [x22,#21] - 314: f8190e49 str x9, [x18,#-112]! - 318: b800befd str w29, [x23,#11]! - 31c: 381ffd92 strb w18, [x12,#-1]! - 320: 781e9e90 strh w16, [x20,#-23]! - 324: f8409fa3 ldr x3, [x29,#9]! - 328: b8413c79 ldr w25, [x3,#19]! - 32c: 385fffa1 ldrb w1, [x29,#-1]! - 330: 785c7fa8 ldrh w8, [x29,#-57]! - 334: 389f3dc5 ldrsb x5, [x14,#-13]! - 338: 78801f6a ldrsh x10, [x27,#1]! - 33c: 78c19d4b ldrsh w11, [x10,#25]! - 340: b89a4ec4 ldrsw x4, [x22,#-92]! - 344: fc408eeb ldr d11, [x23,#8]! - 348: bc436e79 ldr s25, [x19,#54]! - 34c: fc152ce1 str d1, [x7,#-174]! - 350: bc036f28 str s8, [x25,#54]! - 354: f8025565 str x5, [x11],#37 - 358: b80135f8 str w24, [x15],#19 - 35c: 381ff74f strb w15, [x26],#-1 - 360: 781fa652 strh w18, [x18],#-6 - 364: f851a447 ldr x7, [x2],#-230 - 368: b85e557b ldr w27, [x11],#-27 - 36c: 385e7472 ldrb w18, [x3],#-25 - 370: 785e070a ldrh w10, [x24],#-32 - 374: 38804556 ldrsb x22, [x10],#4 - 378: 78819591 ldrsh x17, [x12],#25 - 37c: 78dc24e8 ldrsh w8, [x7],#-62 - 380: b89cd6d7 ldrsw x23, [x22],#-51 - 384: fc430738 ldr d24, [x25],#48 - 388: bc5f6595 ldr s21, [x12],#-10 - 38c: fc1225b2 str d18, [x13],#-222 - 390: bc1d7430 str s16, [x1],#-41 - 394: f82fcac2 str x2, [x22,w15,sxtw] - 398: b83d6a02 str w2, [x16,x29] - 39c: 382e5a54 strb w20, [x18,w14,uxtw #0] - 3a0: 7834fa66 strh w6, [x19,x20,sxtx #1] - 3a4: f86ecbae ldr x14, [x29,w14,sxtw] - 3a8: b86cda90 ldr w16, [x20,w12,sxtw #2] - 3ac: 3860d989 ldrb w9, [x12,w0,sxtw #0] - 3b0: 78637a2c ldrh w12, [x17,x3,lsl #1] - 3b4: 38a3fa22 ldrsb x2, [x17,x3,sxtx #0] - 3b8: 78b15827 ldrsh x7, [x1,w17,uxtw #1] - 3bc: 78f2d9f9 ldrsh w25, [x15,w18,sxtw #1] - 3c0: b8ac6ab7 ldrsw x23, [x21,x12] - 3c4: fc6879a5 ldr d5, [x13,x8,lsl #3] - 3c8: bc767943 ldr s3, [x10,x22,lsl #2] - 3cc: fc3bc84e str d14, [x2,w27,sxtw] - 3d0: bc3968d4 str s20, [x6,x25] - 3d4: f91fc0fe str x30, [x7,#16256] - 3d8: b91da50f str w15, [x8,#7588] - 3dc: 391d280b strb w11, [x0,#1866] - 3e0: 791d2e23 strh w3, [x17,#3734] - 3e4: f95bc8e2 ldr x2, [x7,#14224] - 3e8: b95ce525 ldr w5, [x9,#7396] - 3ec: 395ae53c ldrb w28, [x9,#1721] - 3f0: 795c9282 ldrh w2, [x20,#3656] - 3f4: 399d7dd6 ldrsb x22, [x14,#1887] - 3f8: 799fe008 ldrsh x8, [x0,#4080] - 3fc: 79de9bc0 ldrsh w0, [x30,#3916] - 400: b99aae78 ldrsw x24, [x19,#6828] - 404: fd597598 ldr d24, [x12,#13032] - 408: bd5d1d08 ldr s8, [x8,#7452] - 40c: fd1f3dea str d10, [x15,#15992] - 410: bd1a227a str s26, [x19,#6688] - 414: 5800148a ldr x10, 6a4 - 418: 18000003 ldr w3, 418 - 41c: f88092e0 prfm pldl1keep, [x23,#9] - 420: d8ffdf00 prfm pldl1keep, 0 - 424: f8a84860 prfm pldl1keep, [x3,w8,uxtw] - 428: f99d7560 prfm pldl1keep, [x11,#15080] - 42c: 1a1c012d adc w13, w9, w28 - 430: 3a1c027b adcs w27, w19, w28 - 434: 5a060253 sbc w19, w18, w6 - 438: 7a03028e sbcs w14, w20, w3 - 43c: 9a0801d0 adc x16, x14, x8 - 440: ba0803a0 adcs x0, x29, x8 - 444: da140308 sbc x8, x24, x20 - 448: fa00038c sbcs x12, x28, x0 - 44c: 0b3010d7 add w23, w6, w16, uxtb #4 - 450: 2b37ab39 adds w25, w25, w23, sxth #2 - 454: cb2466da sub x26, x22, x4, uxtx #1 - 458: 6b33efb1 subs w17, w29, w19, sxtx #3 - 45c: 8b350fcb add x11, x30, w21, uxtb #3 - 460: ab208a70 adds x16, x19, w0, sxtb #2 - 464: cb39e52b sub x11, x9, x25, sxtx #1 - 468: eb2c9291 subs x17, x20, w12, sxtb #4 - 46c: 3a4bd1a3 ccmn w13, w11, #0x3, le - 470: 7a4c81a2 ccmp w13, w12, #0x2, hi - 474: ba42106c ccmn x3, x2, #0xc, ne - 478: fa5560e3 ccmp x7, x21, #0x3, vs - 47c: 3a4e3844 ccmn w2, #0xe, #0x4, cc - 480: 7a515a26 ccmp w17, #0x11, #0x6, pl - 484: ba4c2940 ccmn x10, #0xc, #0x0, cs - 488: fa52aaae ccmp x21, #0x12, #0xe, ge - 48c: 1a8cc1b5 csel w21, w13, w12, gt - 490: 1a8f976a csinc w10, w27, w15, ls - 494: 5a8981a0 csinv w0, w13, w9, hi - 498: 5a9a6492 csneg w18, w4, w26, vs - 49c: 9a8793ac csel x12, x29, x7, ls - 4a0: 9a9474e6 csinc x6, x7, x20, vc - 4a4: da83d2b6 csinv x22, x21, x3, le - 4a8: da9b9593 csneg x19, x12, x27, ls - 4ac: 5ac00200 rbit w0, w16 - 4b0: 5ac006f1 rev16 w17, w23 - 4b4: 5ac009d1 rev w17, w14 - 4b8: 5ac013d8 clz w24, w30 - 4bc: 5ac016d8 cls w24, w22 - 4c0: dac00223 rbit x3, x17 - 4c4: dac005ac rev16 x12, x13 - 4c8: dac00ac9 rev32 x9, x22 - 4cc: dac00c00 rev x0, x0 - 4d0: dac01205 clz x5, x16 - 4d4: dac016d9 cls x25, x22 - 4d8: 1ac0089d udiv w29, w4, w0 - 4dc: 1add0fa0 sdiv w0, w29, w29 - 4e0: 1ad52225 lsl w5, w17, w21 - 4e4: 1ad22529 lsr w9, w9, w18 - 4e8: 1ac82b61 asr w1, w27, w8 - 4ec: 1acd2e92 ror w18, w20, w13 - 4f0: 9acc0b28 udiv x8, x25, x12 - 4f4: 9adc0ca7 sdiv x7, x5, x28 - 4f8: 9adb2225 lsl x5, x17, x27 - 4fc: 9ad42757 lsr x23, x26, x20 - 500: 9adc291c asr x28, x8, x28 - 504: 9ac42fa3 ror x3, x29, x4 - 508: 1b1a55d1 madd w17, w14, w26, w21 - 50c: 1b0bafc1 msub w1, w30, w11, w11 - 510: 9b067221 madd x1, x17, x6, x28 - 514: 9b1ea0de msub x30, x6, x30, x8 - 518: 9b2e20d5 smaddl x21, w6, w14, x8 - 51c: 9b38cd4a smsubl x10, w10, w24, x19 - 520: 9bae6254 umaddl x20, w18, w14, x24 - 524: 9ba59452 umsubl x18, w2, w5, x5 - 528: 1e2d0a48 fmul s8, s18, s13 - 52c: 1e3c19c2 fdiv s2, s14, s28 - 530: 1e3c298f fadd s15, s12, s28 - 534: 1e213980 fsub s0, s12, s1 - 538: 1e240baf fmul s15, s29, s4 - 53c: 1e77082c fmul d12, d1, d23 - 540: 1e72191b fdiv d27, d8, d18 - 544: 1e6b2a97 fadd d23, d20, d11 - 548: 1e723988 fsub d8, d12, d18 - 54c: 1e770b1a fmul d26, d24, d23 - 550: 1f0d66f5 fmadd s21, s23, s13, s25 - 554: 1f01b956 fmsub s22, s10, s1, s14 - 558: 1f227a8e fnmadd s14, s20, s2, s30 - 55c: 1f365ba7 fnmadd s7, s29, s22, s22 - 560: 1f4f14ad fmadd d13, d5, d15, d5 - 564: 1f45a98e fmsub d14, d12, d5, d10 - 568: 1f60066a fnmadd d10, d19, d0, d1 - 56c: 1f620054 fnmadd d20, d2, d2, d0 - 570: 1e204139 fmov s25, s9 - 574: 1e20c094 fabs s20, s4 - 578: 1e214363 fneg s3, s27 - 57c: 1e21c041 fsqrt s1, s2 - 580: 1e22c01e fcvt d30, s0 - 584: 1e60408c fmov d12, d4 - 588: 1e60c361 fabs d1, d27 - 58c: 1e6142c8 fneg d8, d22 - 590: 1e61c16b fsqrt d11, d11 - 594: 1e624396 fcvt s22, d28 - 598: 1e3802dc fcvtzs w28, s22 - 59c: 9e380374 fcvtzs x20, s27 - 5a0: 1e78000e fcvtzs w14, d0 - 5a4: 9e78017a fcvtzs x26, d11 - 5a8: 1e2202dc scvtf s28, w22 - 5ac: 9e220150 scvtf s16, x10 - 5b0: 1e6202a8 scvtf d8, w21 - 5b4: 9e620395 scvtf d21, x28 - 5b8: 1e260318 fmov w24, s24 - 5bc: 9e660268 fmov x8, d19 - 5c0: 1e270188 fmov s8, w12 - 5c4: 9e6700e6 fmov d6, x7 - 5c8: 1e3023c0 fcmp s30, s16 - 5cc: 1e6b2320 fcmp d25, d11 - 5d0: 1e202168 fcmp s11, #0.0 - 5d4: 1e602168 fcmp d11, #0.0 - 5d8: 2910323d stp w29, w12, [x17,#128] - 5dc: 297449d6 ldp w22, w18, [x14,#-96] - 5e0: 6948402b ldpsw x11, x16, [x1,#64] - 5e4: a9072f40 stp x0, x11, [x26,#112] - 5e8: a9410747 ldp x7, x1, [x26,#16] - 5ec: 29801f0a stp w10, w7, [x24,#0]! - 5f0: 29e07307 ldp w7, w28, [x24,#-256]! - 5f4: 69e272b9 ldpsw x25, x28, [x21,#-240]! - 5f8: a9bf49d4 stp x20, x18, [x14,#-16]! - 5fc: a9c529a8 ldp x8, x10, [x13,#80]! - 600: 28b0605a stp w26, w24, [x2],#-128 - 604: 28e866a2 ldp w2, w25, [x21],#-192 - 608: 68ee0ab1 ldpsw x17, x2, [x21],#-144 - 60c: a886296c stp x12, x10, [x11],#96 - 610: a8fe1a38 ldp x24, x6, [x17],#-32 - 614: 282479c3 stnp w3, w30, [x14,#-224] - 618: 286e534f ldnp w15, w20, [x26,#-144] - 61c: a8386596 stnp x22, x25, [x12,#-128] - 620: a8755a3b ldnp x27, x22, [x17,#-176] - 624: 1e601000 fmov d0, #2.000000000000000000e+00 - 628: 1e603000 fmov d0, #2.125000000000000000e+00 - 62c: 1e621000 fmov d0, #4.000000000000000000e+00 - 630: 1e623000 fmov d0, #4.250000000000000000e+00 - 634: 1e641000 fmov d0, #8.000000000000000000e+00 - 638: 1e643000 fmov d0, #8.500000000000000000e+00 - 63c: 1e661000 fmov d0, #1.600000000000000000e+01 - 640: 1e663000 fmov d0, #1.700000000000000000e+01 - 644: 1e681000 fmov d0, #1.250000000000000000e-01 - 648: 1e683000 fmov d0, #1.328125000000000000e-01 - 64c: 1e6a1000 fmov d0, #2.500000000000000000e-01 - 650: 1e6a3000 fmov d0, #2.656250000000000000e-01 - 654: 1e6c1000 fmov d0, #5.000000000000000000e-01 - 658: 1e6c3000 fmov d0, #5.312500000000000000e-01 - 65c: 1e6e1000 fmov d0, #1.000000000000000000e+00 - 660: 1e6e3000 fmov d0, #1.062500000000000000e+00 - 664: 1e701000 fmov d0, #-2.000000000000000000e+00 - 668: 1e703000 fmov d0, #-2.125000000000000000e+00 - 66c: 1e721000 fmov d0, #-4.000000000000000000e+00 - 670: 1e723000 fmov d0, #-4.250000000000000000e+00 - 674: 1e741000 fmov d0, #-8.000000000000000000e+00 - 678: 1e743000 fmov d0, #-8.500000000000000000e+00 - 67c: 1e761000 fmov d0, #-1.600000000000000000e+01 - 680: 1e763000 fmov d0, #-1.700000000000000000e+01 - 684: 1e781000 fmov d0, #-1.250000000000000000e-01 - 688: 1e783000 fmov d0, #-1.328125000000000000e-01 - 68c: 1e7a1000 fmov d0, #-2.500000000000000000e-01 - 690: 1e7a3000 fmov d0, #-2.656250000000000000e-01 - 694: 1e7c1000 fmov d0, #-5.000000000000000000e-01 - 698: 1e7c3000 fmov d0, #-5.312500000000000000e-01 - 69c: 1e7e1000 fmov d0, #-1.000000000000000000e+00 - 6a0: 1e7e3000 fmov d0, #-1.062500000000000000e+00 + 0: 8b50798f add x15, x12, x16, lsr #30 + 4: cb4381e1 sub x1, x15, x3, lsr #32 + 8: ab05372d adds x13, x25, x5, lsl #13 + c: eb864796 subs x22, x28, x6, asr #17 + 10: 0b961920 add w0, w9, w22, asr #6 + 14: 4b195473 sub w19, w3, w25, lsl #21 + 18: 2b0b5264 adds w4, w19, w11, lsl #20 + 1c: 6b9300f8 subs w24, w7, w19, asr #0 + 20: 8a0bc0fe and x30, x7, x11, lsl #48 + 24: aa0f3118 orr x24, x8, x15, lsl #12 + 28: ca170531 eor x17, x9, x23, lsl #1 + 2c: ea44dd6e ands x14, x11, x4, lsr #55 + 30: 0a4c44f3 and w19, w7, w12, lsr #17 + 34: 2a8b7373 orr w19, w27, w11, asr #28 + 38: 4a567c7e eor w30, w3, w22, lsr #31 + 3c: 6a9c0353 ands w19, w26, w28, asr #0 + 40: 8a3accdd bic x29, x6, x26, lsl #51 + 44: aa318f7a orn x26, x27, x17, lsl #35 + 48: ca2e1495 eon x21, x4, x14, lsl #5 + 4c: eaa015e2 bics x2, x15, x0, asr #5 + 50: 0a2274e2 bic w2, w7, w2, lsl #29 + 54: 2a751598 orn w24, w12, w21, lsr #5 + 58: 4a3309fe eon w30, w15, w19, lsl #2 + 5c: 6ab172fe bics w30, w23, w17, asr #28 + 60: 110a5284 add w4, w20, #0x294 + 64: 310b1942 adds w2, w10, #0x2c6 + 68: 5103d353 sub w19, w26, #0xf4 + 6c: 710125bc subs w28, w13, #0x49 + 70: 910d7bc2 add x2, x30, #0x35e + 74: b108fa1b adds x27, x16, #0x23e + 78: d1093536 sub x22, x9, #0x24d + 7c: f10ae824 subs x4, x1, #0x2ba + 80: 120e667c and w28, w19, #0xfffc0fff + 84: 321f6cbb orr w27, w5, #0x1ffffffe + 88: 520f6a9e eor w30, w20, #0xfffe0fff + 8c: 72136f56 ands w22, w26, #0xffffe1ff + 90: 927e4ce5 and x5, x7, #0x3ffffc + 94: b278b4ed orr x13, x7, #0x3fffffffffff00 + 98: d24c6527 eor x7, x9, #0xfff0000000003fff + 9c: f2485803 ands x3, x0, #0xff00000000007fff + a0: 14000000 b a0 + a4: 17ffffd7 b 0 + a8: 140001ee b 860 + ac: 94000000 bl ac + b0: 97ffffd4 bl 0 + b4: 940001eb bl 860 + b8: 34000010 cbz w16, b8 + bc: 34fffa30 cbz w16, 0 + c0: 34003d10 cbz w16, 860 + c4: 35000013 cbnz w19, c4 + c8: 35fff9d3 cbnz w19, 0 + cc: 35003cb3 cbnz w19, 860 + d0: b4000005 cbz x5, d0 + d4: b4fff965 cbz x5, 0 + d8: b4003c45 cbz x5, 860 + dc: b5000004 cbnz x4, dc + e0: b5fff904 cbnz x4, 0 + e4: b5003be4 cbnz x4, 860 + e8: 1000001b adr x27, e8 + ec: 10fff8bb adr x27, 0 + f0: 10003b9b adr x27, 860 + f4: 90000010 adrp x16, 0 + f8: 3640001c tbz w28, #8, f8 + fc: 3647f83c tbz w28, #8, 0 + 100: 36403b1c tbz w28, #8, 860 + 104: 37080001 tbnz w1, #1, 104 + 108: 370ff7c1 tbnz w1, #1, 0 + 10c: 37083aa1 tbnz w1, #1, 860 + 110: 12a437f4 mov w20, #0xde40ffff // #-566165505 + 114: 528c9d67 mov w7, #0x64eb // #25835 + 118: 72838bb1 movk w17, #0x1c5d + 11c: 92c1062e mov x14, #0xfffff7ceffffffff // #-9006546419713 + 120: d287da49 mov x9, #0x3ed2 // #16082 + 124: f2a6d153 movk x19, #0x368a, lsl #16 + 128: 93465ac9 sbfx x9, x22, #6, #17 + 12c: 330b0013 bfi w19, w0, #21, #1 + 130: 530b4e6a ubfx w10, w19, #11, #9 + 134: 934545e4 sbfx x4, x15, #5, #13 + 138: b35370a3 bfxil x3, x5, #19, #10 + 13c: d3510b8c ubfiz x12, x28, #47, #3 + 140: 13960c0f extr w15, w0, w22, #3 + 144: 93ceddc6 ror x6, x14, #55 + 148: 54000000 b.eq 148 // b.none + 14c: 54fff5a0 b.eq 0 // b.none + 150: 54003880 b.eq 860 // b.none + 154: 54000001 b.ne 154 // b.any + 158: 54fff541 b.ne 0 // b.any + 15c: 54003821 b.ne 860 // b.any + 160: 54000002 b.cs 160 // b.hs, b.nlast + 164: 54fff4e2 b.cs 0 // b.hs, b.nlast + 168: 540037c2 b.cs 860 // b.hs, b.nlast + 16c: 54000002 b.cs 16c // b.hs, b.nlast + 170: 54fff482 b.cs 0 // b.hs, b.nlast + 174: 54003762 b.cs 860 // b.hs, b.nlast + 178: 54000003 b.cc 178 // b.lo, b.ul, b.last + 17c: 54fff423 b.cc 0 // b.lo, b.ul, b.last + 180: 54003703 b.cc 860 // b.lo, b.ul, b.last + 184: 54000003 b.cc 184 // b.lo, b.ul, b.last + 188: 54fff3c3 b.cc 0 // b.lo, b.ul, b.last + 18c: 540036a3 b.cc 860 // b.lo, b.ul, b.last + 190: 54000004 b.mi 190 // b.first + 194: 54fff364 b.mi 0 // b.first + 198: 54003644 b.mi 860 // b.first + 19c: 54000005 b.pl 19c // b.nfrst + 1a0: 54fff305 b.pl 0 // b.nfrst + 1a4: 540035e5 b.pl 860 // b.nfrst + 1a8: 54000006 b.vs 1a8 + 1ac: 54fff2a6 b.vs 0 + 1b0: 54003586 b.vs 860 + 1b4: 54000007 b.vc 1b4 + 1b8: 54fff247 b.vc 0 + 1bc: 54003527 b.vc 860 + 1c0: 54000008 b.hi 1c0 // b.pmore + 1c4: 54fff1e8 b.hi 0 // b.pmore + 1c8: 540034c8 b.hi 860 // b.pmore + 1cc: 54000009 b.ls 1cc // b.plast + 1d0: 54fff189 b.ls 0 // b.plast + 1d4: 54003469 b.ls 860 // b.plast + 1d8: 5400000a b.ge 1d8 // b.tcont + 1dc: 54fff12a b.ge 0 // b.tcont + 1e0: 5400340a b.ge 860 // b.tcont + 1e4: 5400000b b.lt 1e4 // b.tstop + 1e8: 54fff0cb b.lt 0 // b.tstop + 1ec: 540033ab b.lt 860 // b.tstop + 1f0: 5400000c b.gt 1f0 + 1f4: 54fff06c b.gt 0 + 1f8: 5400334c b.gt 860 + 1fc: 5400000d b.le 1fc + 200: 54fff00d b.le 0 + 204: 540032ed b.le 860 + 208: 5400000e b.al 208 + 20c: 54ffefae b.al 0 + 210: 5400328e b.al 860 + 214: 5400000f b.nv 214 + 218: 54ffef4f b.nv 0 + 21c: 5400322f b.nv 860 + 220: d40ac601 svc #0x5630 + 224: d40042a2 hvc #0x215 + 228: d404dac3 smc #0x26d6 + 22c: d4224d40 brk #0x126a + 230: d44219c0 hlt #0x10ce + 234: d503201f nop + 238: d69f03e0 eret + 23c: d6bf03e0 drps + 240: d5033fdf isb + 244: d503339f dsb osh + 248: d50335bf dmb nshld + 24c: d61f0280 br x20 + 250: d63f0040 blr x2 + 254: c8127c17 stxr w18, x23, [x0] + 258: c81efec5 stlxr w30, x5, [x22] + 25c: c85f7d05 ldxr x5, [x8] + 260: c85ffe14 ldaxr x20, [x16] + 264: c89ffd66 stlr x6, [x11] + 268: c8dfff66 ldar x6, [x27] + 26c: 880a7cb1 stxr w10, w17, [x5] + 270: 8816fd89 stlxr w22, w9, [x12] + 274: 885f7d1b ldxr w27, [x8] + 278: 885ffc57 ldaxr w23, [x2] + 27c: 889fffba stlr w26, [x29] + 280: 88dffd4d ldar w13, [x10] + 284: 48197f7c stxrh w25, w28, [x27] + 288: 481dfd96 stlxrh w29, w22, [x12] + 28c: 485f7f96 ldxrh w22, [x28] + 290: 485fffc3 ldaxrh w3, [x30] + 294: 489ffdf8 stlrh w24, [x15] + 298: 48dfff5b ldarh w27, [x26] + 29c: 080b7e6a stxrb w11, w10, [x19] + 2a0: 0817fedb stlxrb w23, w27, [x22] + 2a4: 085f7e18 ldxrb w24, [x16] + 2a8: 085ffc38 ldaxrb w24, [x1] + 2ac: 089fffa5 stlrb w5, [x29] + 2b0: 08dffe18 ldarb w24, [x16] + 2b4: c87f6239 ldxp x25, x24, [x17] + 2b8: c87fb276 ldaxp x22, x12, [x19] + 2bc: c820573a stxp w0, x26, x21, [x25] + 2c0: c821aca6 stlxp w1, x6, x11, [x5] + 2c4: 887f388d ldxp w13, w14, [x4] + 2c8: 887f88d1 ldaxp w17, w2, [x6] + 2cc: 882f2643 stxp w15, w3, w9, [x18] + 2d0: 88329131 stlxp w18, w17, w4, [x9] + 2d4: f81cf2b7 stur x23, [x21, #-49] + 2d8: b803f055 stur w21, [x2, #63] + 2dc: 39002f9b strb w27, [x28, #11] + 2e0: 781f31fd sturh w29, [x15, #-13] + 2e4: f85d33ce ldur x14, [x30, #-45] + 2e8: b843539d ldur w29, [x28, #53] + 2ec: 39401f54 ldrb w20, [x26, #7] + 2f0: 785ce059 ldurh w25, [x2, #-50] + 2f4: 389f1143 ldursb x3, [x10, #-15] + 2f8: 788131ee ldursh x14, [x15, #19] + 2fc: 78dfb17d ldursh w29, [x11, #-5] + 300: b89b90af ldursw x15, [x5, #-71] + 304: fc403193 ldur d19, [x12, #3] + 308: bc42a36c ldur s12, [x27, #42] + 30c: fc07d396 stur d22, [x28, #125] + 310: bc1ec1f8 stur s24, [x15, #-20] + 314: f81e8f88 str x8, [x28, #-24]! + 318: b8025de6 str w6, [x15, #37]! + 31c: 38007c27 strb w7, [x1, #7]! + 320: 7801ee20 strh w0, [x17, #30]! + 324: f8454fb9 ldr x25, [x29, #84]! + 328: b85cce9a ldr w26, [x20, #-52]! + 32c: 385e7fba ldrb w26, [x29, #-25]! + 330: 7841af24 ldrh w4, [x25, #26]! + 334: 389ebd1c ldrsb x28, [x8, #-21]! + 338: 789fadd1 ldrsh x17, [x14, #-6]! + 33c: 78c0aefc ldrsh w28, [x23, #10]! + 340: b89c0f7e ldrsw x30, [x27, #-64]! + 344: fc50efd4 ldr d20, [x30, #-242]! + 348: bc414f71 ldr s17, [x27, #20]! + 34c: fc011c67 str d7, [x3, #17]! + 350: bc1f0d6d str s13, [x11, #-16]! + 354: f81c3526 str x6, [x9], #-61 + 358: b81e34b0 str w16, [x5], #-29 + 35c: 3800f7bd strb w29, [x29], #15 + 360: 78012684 strh w4, [x20], #18 + 364: f842e653 ldr x19, [x18], #46 + 368: b8417456 ldr w22, [x2], #23 + 36c: 385e2467 ldrb w7, [x3], #-30 + 370: 785e358b ldrh w11, [x12], #-29 + 374: 389e34c8 ldrsb x8, [x6], #-29 + 378: 788046f8 ldrsh x24, [x23], #4 + 37c: 78c00611 ldrsh w17, [x16], #0 + 380: b89f8680 ldrsw x0, [x20], #-8 + 384: fc582454 ldr d20, [x2], #-126 + 388: bc5987d3 ldr s19, [x30], #-104 + 38c: fc076624 str d4, [x17], #118 + 390: bc190675 str s21, [x19], #-112 + 394: f833785a str x26, [x2, x19, lsl #3] + 398: b82fd809 str w9, [x0, w15, sxtw #2] + 39c: 3821799a strb w26, [x12, x1, lsl #0] + 3a0: 782a7975 strh w21, [x11, x10, lsl #1] + 3a4: f870eaf0 ldr x16, [x23, x16, sxtx] + 3a8: b871d96a ldr w10, [x11, w17, sxtw #2] + 3ac: 386b7aed ldrb w13, [x23, x11, lsl #0] + 3b0: 7875689b ldrh w27, [x4, x21] + 3b4: 38afd91a ldrsb x26, [x8, w15, sxtw #0] + 3b8: 78a2c955 ldrsh x21, [x10, w2, sxtw] + 3bc: 78ee6bc8 ldrsh w8, [x30, x14] + 3c0: b8b4f9dd ldrsw x29, [x14, x20, sxtx #2] + 3c4: fc76eb7e ldr d30, [x27, x22, sxtx] + 3c8: bc76692d ldr s13, [x9, x22] + 3cc: fc31db28 str d8, [x25, w17, sxtw #3] + 3d0: bc255b01 str s1, [x24, w5, uxtw #2] + 3d4: f91c52aa str x10, [x21, #14496] + 3d8: b91c3fb2 str w18, [x29, #7228] + 3dc: 391f8877 strb w23, [x3, #2018] + 3e0: 791ac97c strh w28, [x11, #3428] + 3e4: f95c1758 ldr x24, [x26, #14376] + 3e8: b95b3c55 ldr w21, [x2, #6972] + 3ec: 395ce0a4 ldrb w4, [x5, #1848] + 3f0: 795851ce ldrh w14, [x14, #3112] + 3f4: 399e9f64 ldrsb x4, [x27, #1959] + 3f8: 79993764 ldrsh x4, [x27, #3226] + 3fc: 79d9af8a ldrsh w10, [x28, #3286] + 400: b99eea2a ldrsw x10, [x17, #7912] + 404: fd5a2f8d ldr d13, [x28, #13400] + 408: bd5dac78 ldr s24, [x3, #7596] + 40c: fd1e0182 str d2, [x12, #15360] + 410: bd195c31 str s17, [x1, #6492] + 414: 58000010 ldr x16, 414 + 418: 1800000d ldr w13, 418 + 41c: f8981240 prfum pldl1keep, [x18, #-127] + 420: d8ffdf00 prfm pldl1keep, 0 + 424: f8a27a80 prfm pldl1keep, [x20, x2, lsl #3] + 428: f99af920 prfm pldl1keep, [x9, #13808] + 42c: 1a0202e8 adc w8, w23, w2 + 430: 3a130078 adcs w24, w3, w19 + 434: 5a1d0316 sbc w22, w24, w29 + 438: 7a03036c sbcs w12, w27, w3 + 43c: 9a0102eb adc x11, x23, x1 + 440: ba1700bd adcs x29, x5, x23 + 444: da0c0329 sbc x9, x25, x12 + 448: fa16000c sbcs x12, x0, x22 + 44c: 0b23459a add w26, w12, w3, uxtw #1 + 450: 2b328a14 adds w20, w16, w18, sxtb #2 + 454: cb274bde sub x30, x30, w7, uxtw #2 + 458: 6b222eab subs w11, w21, w2, uxth #3 + 45c: 8b214b42 add x2, x26, w1, uxtw #2 + 460: ab34a7b2 adds x18, x29, w20, sxth #1 + 464: cb24520e sub x14, x16, w4, uxtw #4 + 468: eb378e20 subs x0, x17, w23, sxtb #3 + 46c: 3a565283 ccmn w20, w22, #0x3, pl // pl = nfrst + 470: 7a420321 ccmp w25, w2, #0x1, eq // eq = none + 474: ba58c247 ccmn x18, x24, #0x7, gt + 478: fa4d5106 ccmp x8, x13, #0x6, pl // pl = nfrst + 47c: 3a426924 ccmn w9, #0x2, #0x4, vs + 480: 7a5b0847 ccmp w2, #0x1b, #0x7, eq // eq = none + 484: ba413a02 ccmn x16, #0x1, #0x2, cc // cc = lo, ul, last + 488: fa5fba23 ccmp x17, #0x1f, #0x3, lt // lt = tstop + 48c: 1a979377 csel w23, w27, w23, ls // ls = plast + 490: 1a86640a csinc w10, w0, w6, vs + 494: 5a89300b csinv w11, w0, w9, cc // cc = lo, ul, last + 498: 5a923771 csneg w17, w27, w18, cc // cc = lo, ul, last + 49c: 9a8b720c csel x12, x16, x11, vc + 4a0: 9a868786 csinc x6, x28, x6, hi // hi = pmore + 4a4: da9a736d csinv x13, x27, x26, vc + 4a8: da9256dd csneg x29, x22, x18, pl // pl = nfrst + 4ac: 5ac0026c rbit w12, w19 + 4b0: 5ac00657 rev16 w23, w18 + 4b4: 5ac00b89 rev w9, w28 + 4b8: 5ac01262 clz w2, w19 + 4bc: 5ac017b9 cls w25, w29 + 4c0: dac002e4 rbit x4, x23 + 4c4: dac0065d rev16 x29, x18 + 4c8: dac00907 rev32 x7, x8 + 4cc: dac00e2d rev x13, x17 + 4d0: dac01011 clz x17, x0 + 4d4: dac01752 cls x18, x26 + 4d8: 1ad0098b udiv w11, w12, w16 + 4dc: 1ac70d24 sdiv w4, w9, w7 + 4e0: 1ad020ec lsl w12, w7, w16 + 4e4: 1ad72613 lsr w19, w16, w23 + 4e8: 1ac62887 asr w7, w4, w6 + 4ec: 1ad72e95 ror w21, w20, w23 + 4f0: 9adc0990 udiv x16, x12, x28 + 4f4: 9acd0d84 sdiv x4, x12, x13 + 4f8: 9ac721a9 lsl x9, x13, x7 + 4fc: 9acf277c lsr x28, x27, x15 + 500: 9ace2bd4 asr x20, x30, x14 + 504: 9ade2e4e ror x14, x18, x30 + 508: 9bc77d63 umulh x3, x11, x7 + 50c: 9b587e97 smulh x23, x20, x24 + 510: 1b1524a2 madd w2, w5, w21, w9 + 514: 1b04a318 msub w24, w24, w4, w8 + 518: 9b0f4d8b madd x11, x12, x15, x19 + 51c: 9b0ce73d msub x29, x25, x12, x25 + 520: 9b2c5971 smaddl x17, w11, w12, x22 + 524: 9b34c87c smsubl x28, w3, w20, x18 + 528: 9bbc6887 umaddl x7, w4, w28, x26 + 52c: 9bb19556 umsubl x22, w10, w17, x5 + 530: 1e310871 fmul s17, s3, s17 + 534: 1e261a2b fdiv s11, s17, s6 + 538: 1e2928fd fadd s29, s7, s9 + 53c: 1e333987 fsub s7, s12, s19 + 540: 1e230ae0 fmul s0, s23, s3 + 544: 1e75087a fmul d26, d3, d21 + 548: 1e651a60 fdiv d0, d19, d5 + 54c: 1e692b40 fadd d0, d26, d9 + 550: 1e753ab9 fsub d25, d21, d21 + 554: 1e7309b0 fmul d16, d13, d19 + 558: 1f00425d fmadd s29, s18, s0, s16 + 55c: 1f1d95b7 fmsub s23, s13, s29, s5 + 560: 1f2a38e9 fnmadd s9, s7, s10, s14 + 564: 1f2f5f99 fnmadd s25, s28, s15, s23 + 568: 1f5545a6 fmadd d6, d13, d21, d17 + 56c: 1f429ea3 fmsub d3, d21, d2, d7 + 570: 1f65472a fnmadd d10, d25, d5, d17 + 574: 1f7449ce fnmadd d14, d14, d20, d18 + 578: 1e20404f fmov s15, s2 + 57c: 1e20c0f2 fabs s18, s7 + 580: 1e2140c3 fneg s3, s6 + 584: 1e21c02c fsqrt s12, s1 + 588: 1e22c009 fcvt d9, s0 + 58c: 1e6040a4 fmov d4, d5 + 590: 1e60c1e3 fabs d3, d15 + 594: 1e614331 fneg d17, d25 + 598: 1e61c30c fsqrt d12, d24 + 59c: 1e6240b5 fcvt s21, d5 + 5a0: 1e3802a4 fcvtzs w4, s21 + 5a4: 9e38007b fcvtzs x27, s3 + 5a8: 1e78011d fcvtzs w29, d8 + 5ac: 9e7802a9 fcvtzs x9, d21 + 5b0: 1e2203b4 scvtf s20, w29 + 5b4: 9e220107 scvtf s7, x8 + 5b8: 1e6202ac scvtf d12, w21 + 5bc: 9e6202b0 scvtf d16, x21 + 5c0: 1e2600b2 fmov w18, s5 + 5c4: 9e660119 fmov x25, d8 + 5c8: 1e270352 fmov s18, w26 + 5cc: 9e670160 fmov d0, x11 + 5d0: 1e262200 fcmp s16, s6 + 5d4: 1e7d2200 fcmp d16, d29 + 5d8: 1e2023c8 fcmp s30, #0.0 + 5dc: 1e602128 fcmp d9, #0.0 + 5e0: 293e119b stp w27, w4, [x12, #-16] + 5e4: 294a2543 ldp w3, w9, [x10, #80] + 5e8: 69480c70 ldpsw x16, x3, [x3, #64] + 5ec: a934726a stp x10, x28, [x19, #-192] + 5f0: a97448f3 ldp x19, x18, [x7, #-192] + 5f4: 298243ca stp w10, w16, [x30, #16]! + 5f8: 29e21242 ldp w2, w4, [x18, #-240]! + 5fc: 69c64db8 ldpsw x24, x19, [x13, #48]! + 600: a9800311 stp x17, x0, [x24, #0]! + 604: a9f4686e ldp x14, x26, [x3, #-192]! + 608: 288a0416 stp w22, w1, [x0], #80 + 60c: 28fe2812 ldp w18, w10, [x0], #-16 + 610: 68fe62d8 .inst 0x68fe62d8 ; undefined + 614: a885308c stp x12, x12, [x4], #80 + 618: a8f12664 ldp x4, x9, [x19], #-240 + 61c: 282468d2 stnp w18, w26, [x6, #-224] + 620: 284e5035 ldnp w21, w20, [x1, #112] + 624: a8327699 stnp x25, x29, [x20, #-224] + 628: a84716e1 ldnp x1, x5, [x23, #112] + 62c: 0c407284 ld1 {v4.8b}, [x20] + 630: 4cdfa158 ld1 {v24.16b, v25.16b}, [x10], #32 + 634: 0ccf6cd8 ld1 {v24.1d-v26.1d}, [x6], x15 + 638: 4cdf2483 ld1 {v3.8h-v6.8h}, [x4], #64 + 63c: 0d40c0c2 ld1r {v2.8b}, [x6] + 640: 4ddfc9cd ld1r {v13.4s}, [x14], #4 + 644: 0dd8ceaf ld1r {v15.1d}, [x21], x24 + 648: 4c408ea9 ld2 {v9.2d, v10.2d}, [x21] + 64c: 0cdf86bd ld2 {v29.4h, v30.4h}, [x21], #16 + 650: 4d60c1c8 ld2r {v8.16b, v9.16b}, [x14] + 654: 0dffca87 ld2r {v7.2s, v8.2s}, [x20], #8 + 658: 4de3cc7c ld2r {v28.2d, v29.2d}, [x3], x3 + 65c: 4cdd497b ld3 {v27.4s-v29.4s}, [x11], x29 + 660: 0c404950 ld3 {v16.2s-v18.2s}, [x10] + 664: 4d40e595 ld3r {v21.8h-v23.8h}, [x12] + 668: 4ddfeba4 ld3r {v4.4s-v6.4s}, [x29], #12 + 66c: 0dd3ed38 ld3r {v24.1d-v26.1d}, [x9], x19 + 670: 4cdf046a ld4 {v10.8h-v13.8h}, [x3], #64 + 674: 0cc9039b ld4 {v27.8b-v30.8b}, [x28], x9 + 678: 0d60e3d5 ld4r {v21.8b-v24.8b}, [x30] + 67c: 0dffe5d7 ld4r {v23.4h-v26.4h}, [x14], #8 + 680: 0df4e9a4 ld4r {v4.2s-v7.2s}, [x13], x20 + 684: ba5fd3e3 ccmn xzr, xzr, #0x3, le + 688: 3a5f03e5 ccmn wzr, wzr, #0x5, eq // eq = none + 68c: fa411be4 ccmp xzr, #0x1, #0x4, ne // ne = any + 690: 7a42cbe2 ccmp wzr, #0x2, #0x2, gt + 694: 93df03ff ror xzr, xzr, #0 + 698: c820ffff stlxp w0, xzr, xzr, [sp] + 69c: 8822fc7f stlxp w2, wzr, wzr, [x3] + 6a0: c8247cbf stxp w4, xzr, xzr, [x5] + 6a4: 88267fff stxp w6, wzr, wzr, [sp] + 6a8: 4e010fe0 dup v0.16b, wzr + 6ac: 4e081fe1 mov v1.d[0], xzr + 6b0: 4e0c1fe1 mov v1.s[1], wzr + 6b4: 4e0a1fe1 mov v1.h[2], wzr + 6b8: 4e071fe1 mov v1.b[3], wzr + 6bc: 4cc0ac3f ld1 {v31.2d, v0.2d}, [x1], x0 + 6c0: 1e601000 fmov d0, #2.000000000000000000e+00 + 6c4: 1e603000 fmov d0, #2.125000000000000000e+00 + 6c8: 1e621000 fmov d0, #4.000000000000000000e+00 + 6cc: 1e623000 fmov d0, #4.250000000000000000e+00 + 6d0: 1e641000 fmov d0, #8.000000000000000000e+00 + 6d4: 1e643000 fmov d0, #8.500000000000000000e+00 + 6d8: 1e661000 fmov d0, #1.600000000000000000e+01 + 6dc: 1e663000 fmov d0, #1.700000000000000000e+01 + 6e0: 1e681000 fmov d0, #1.250000000000000000e-01 + 6e4: 1e683000 fmov d0, #1.328125000000000000e-01 + 6e8: 1e6a1000 fmov d0, #2.500000000000000000e-01 + 6ec: 1e6a3000 fmov d0, #2.656250000000000000e-01 + 6f0: 1e6c1000 fmov d0, #5.000000000000000000e-01 + 6f4: 1e6c3000 fmov d0, #5.312500000000000000e-01 + 6f8: 1e6e1000 fmov d0, #1.000000000000000000e+00 + 6fc: 1e6e3000 fmov d0, #1.062500000000000000e+00 + 700: 1e701000 fmov d0, #-2.000000000000000000e+00 + 704: 1e703000 fmov d0, #-2.125000000000000000e+00 + 708: 1e721000 fmov d0, #-4.000000000000000000e+00 + 70c: 1e723000 fmov d0, #-4.250000000000000000e+00 + 710: 1e741000 fmov d0, #-8.000000000000000000e+00 + 714: 1e743000 fmov d0, #-8.500000000000000000e+00 + 718: 1e761000 fmov d0, #-1.600000000000000000e+01 + 71c: 1e763000 fmov d0, #-1.700000000000000000e+01 + 720: 1e781000 fmov d0, #-1.250000000000000000e-01 + 724: 1e783000 fmov d0, #-1.328125000000000000e-01 + 728: 1e7a1000 fmov d0, #-2.500000000000000000e-01 + 72c: 1e7a3000 fmov d0, #-2.656250000000000000e-01 + 730: 1e7c1000 fmov d0, #-5.000000000000000000e-01 + 734: 1e7c3000 fmov d0, #-5.312500000000000000e-01 + 738: 1e7e1000 fmov d0, #-1.000000000000000000e+00 + 73c: 1e7e3000 fmov d0, #-1.062500000000000000e+00 + 740: f8358305 swp x21, x5, [x24] + 744: f82d01ed ldadd x13, x13, [x15] + 748: f8361353 ldclr x22, x19, [x26] + 74c: f839234a ldeor x25, x10, [x26] + 750: f82531fb ldset x5, x27, [x15] + 754: f8335165 ldsmin x19, x5, [x11] + 758: f83a4080 ldsmax x26, x0, [x4] + 75c: f83673d7 ldumin x22, x23, [x30] + 760: f832611c ldumax x18, x28, [x8] + 764: f8ad837d swpa x13, x29, [x27] + 768: f8ab01a5 ldadda x11, x5, [x13] + 76c: f8a112b8 ldclra x1, x24, [x21] + 770: f8bb2311 ldeora x27, x17, [x24] + 774: f8b230be ldseta x18, x30, [x5] + 778: f8a75336 ldsmina x7, x22, [x25] + 77c: f8a4427a ldsmaxa x4, x26, [x19] + 780: f8a6707e ldumina x6, x30, [x3] + 784: f8b860b7 ldumaxa x24, x23, [x5] + 788: f8f88392 swpal x24, x18, [x28] + 78c: f8f300ff ldaddal x19, xzr, [x7] + 790: f8ed1386 ldclral x13, x6, [x28] + 794: f8e822af ldeoral x8, x15, [x21] + 798: f8e2302d ldsetal x2, x13, [x1] + 79c: f8f1533d ldsminal x17, x29, [x25] + 7a0: f8f941d2 ldsmaxal x25, x18, [x14] + 7a4: f8ff7366 lduminal xzr, x6, [x27] + 7a8: f8f061e5 ldumaxal x16, x5, [x15] + 7ac: f86b8072 swpl x11, x18, [x3] + 7b0: f87a0054 ldaddl x26, x20, [x2] + 7b4: f86b1164 ldclrl x11, x4, [x11] + 7b8: f87e22f3 ldeorl x30, x19, [x23] + 7bc: f86331cf ldsetl x3, x15, [x14] + 7c0: f87e5296 ldsminl x30, x22, [x20] + 7c4: f8674305 ldsmaxl x7, x5, [x24] + 7c8: f87771f0 lduminl x23, x16, [x15] + 7cc: f86b6013 ldumaxl x11, x19, [x0] + 7d0: b83c803c swp w28, w28, [x1] + 7d4: b82b0195 ldadd w11, w21, [x12] + 7d8: b83d1240 ldclr w29, w0, [x18] + 7dc: b8252320 ldeor w5, w0, [x25] + 7e0: b82e3340 ldset w14, w0, [x26] + 7e4: b83c53b2 ldsmin w28, w18, [x29] + 7e8: b82f43a1 ldsmax w15, w1, [x29] + 7ec: b828739a ldumin w8, w26, [x28] + 7f0: b831608e ldumax w17, w14, [x4] + 7f4: b8b88039 swpa w24, w25, [x1] + 7f8: b8aa0231 ldadda w10, w17, [x17] + 7fc: b8bd12b4 ldclra w29, w20, [x21] + 800: b8bd2189 ldeora w29, w9, [x12] + 804: b8ab30a6 ldseta w11, w6, [x5] + 808: b8b552a7 ldsmina w21, w7, [x21] + 80c: b8aa4197 ldsmaxa w10, w23, [x12] + 810: b8b57145 ldumina w21, w5, [x10] + 814: b8be6254 ldumaxa w30, w20, [x18] + 818: b8ed80b7 swpal w13, w23, [x5] + 81c: b8ef00b8 ldaddal w15, w24, [x5] + 820: b8e9132a ldclral w9, w10, [x25] + 824: b8f42231 ldeoral w20, w17, [x17] + 828: b8ec33d2 ldsetal w12, w18, [x30] + 82c: b8e35323 ldsminal w3, w3, [x25] + 830: b8fa4159 ldsmaxal w26, w25, [x10] + 834: b8e273eb lduminal w2, w11, [sp] + 838: b8e760a2 ldumaxal w7, w2, [x5] + 83c: b8608287 swpl w0, w7, [x20] + 840: b865005f staddl w5, [x2] + 844: b87b1379 ldclrl w27, w25, [x27] + 848: b87e2358 ldeorl w30, w24, [x26] + 84c: b86f32c2 ldsetl w15, w2, [x22] + 850: b86053e3 ldsminl w0, w3, [sp] + 854: b86f4154 ldsmaxl w15, w20, [x10] + 858: b87671d5 lduminl w22, w21, [x14] + 85c: b866605e ldumaxl w6, w30, [x2] */ static const unsigned int insns[] = { - 0x8b0772d3, 0xcb4a3570, 0xab9c09bb, 0xeb9aa794, - 0x0b934e68, 0x4b0a3924, 0x2b1e3568, 0x6b132720, - 0x8a154c14, 0xaa1445d5, 0xca01cf99, 0xea8b3f6a, - 0x0a8c5cb9, 0x2a4a11d2, 0x4a855aa4, 0x6a857415, - 0x8aa697da, 0xaa6d7423, 0xca29bf80, 0xea3cb8bd, - 0x0a675249, 0x2ab961ba, 0x4a331899, 0x6a646345, - 0x11055267, 0x31064408, 0x51028e9d, 0x710bdee8, - 0x91082d81, 0xb106a962, 0xd10b33ae, 0xf10918ab, - 0x121102d7, 0x3204cd44, 0x5204cf00, 0x72099fb3, - 0x92729545, 0xb20e37cc, 0xd27c34be, 0xf27e4efa, - 0x14000000, 0x17ffffd7, 0x1400017f, 0x94000000, - 0x97ffffd4, 0x9400017c, 0x3400000c, 0x34fffa2c, - 0x34002f2c, 0x35000014, 0x35fff9d4, 0x35002ed4, - 0xb400000c, 0xb4fff96c, 0xb4002e6c, 0xb5000018, - 0xb5fff918, 0xb5002e18, 0x10000006, 0x10fff8a6, - 0x10002da6, 0x90000015, 0x36080001, 0x360ff821, - 0x36082d21, 0x37480008, 0x374ff7c8, 0x37482cc8, - 0x128b50ec, 0x52a9ff8b, 0x7281d095, 0x92edfebd, - 0xd28361e3, 0xf2a4cc96, 0x9346590c, 0x33194f33, - 0x531d3d89, 0x9350433c, 0xb34464ac, 0xd3462140, - 0x139a61a4, 0x93d87fd7, 0x54000000, 0x54fff5a0, - 0x54002aa0, 0x54000001, 0x54fff541, 0x54002a41, - 0x54000002, 0x54fff4e2, 0x540029e2, 0x54000002, - 0x54fff482, 0x54002982, 0x54000003, 0x54fff423, - 0x54002923, 0x54000003, 0x54fff3c3, 0x540028c3, - 0x54000004, 0x54fff364, 0x54002864, 0x54000005, - 0x54fff305, 0x54002805, 0x54000006, 0x54fff2a6, - 0x540027a6, 0x54000007, 0x54fff247, 0x54002747, - 0x54000008, 0x54fff1e8, 0x540026e8, 0x54000009, - 0x54fff189, 0x54002689, 0x5400000a, 0x54fff12a, - 0x5400262a, 0x5400000b, 0x54fff0cb, 0x540025cb, - 0x5400000c, 0x54fff06c, 0x5400256c, 0x5400000d, - 0x54fff00d, 0x5400250d, 0x5400000e, 0x54ffefae, - 0x540024ae, 0x5400000f, 0x54ffef4f, 0x5400244f, - 0xd4063721, 0xd4035082, 0xd400bfe3, 0xd4282fc0, - 0xd444c320, 0xd503201f, 0xd69f03e0, 0xd6bf03e0, - 0xd5033fdf, 0xd5033f9f, 0xd5033abf, 0xd61f0040, - 0xd63f00a0, 0xc8147c55, 0xc805fcfd, 0xc85f7e05, - 0xc85fffbb, 0xc89fffa0, 0xc8dfff95, 0x88157cf8, - 0x8815ff9a, 0x885f7cd5, 0x885fffcf, 0x889ffc73, - 0x88dffc56, 0x48127c0f, 0x480bff85, 0x485f7cdd, - 0x485ffcf2, 0x489fff99, 0x48dffe62, 0x080a7c3e, - 0x0814fed5, 0x085f7c59, 0x085ffcb8, 0x089ffc70, - 0x08dfffb6, 0xc87f0a68, 0xc87fcdc7, 0xc82870bb, - 0xc825b8c8, 0x887f12d9, 0x887fb9ed, 0x8834215a, - 0x8837ca52, 0xf806317e, 0xb81b3337, 0x39000dc2, - 0x78005149, 0xf84391f4, 0xb85b220c, 0x385fd356, - 0x785d127e, 0x389f4149, 0x79801e3c, 0x79c014a3, - 0xb89a5231, 0xfc5ef282, 0xbc5f60f6, 0xfc12125e, - 0xbc0152cd, 0xf8190e49, 0xb800befd, 0x381ffd92, - 0x781e9e90, 0xf8409fa3, 0xb8413c79, 0x385fffa1, - 0x785c7fa8, 0x389f3dc5, 0x78801f6a, 0x78c19d4b, - 0xb89a4ec4, 0xfc408eeb, 0xbc436e79, 0xfc152ce1, - 0xbc036f28, 0xf8025565, 0xb80135f8, 0x381ff74f, - 0x781fa652, 0xf851a447, 0xb85e557b, 0x385e7472, - 0x785e070a, 0x38804556, 0x78819591, 0x78dc24e8, - 0xb89cd6d7, 0xfc430738, 0xbc5f6595, 0xfc1225b2, - 0xbc1d7430, 0xf82fcac2, 0xb83d6a02, 0x382e5a54, - 0x7834fa66, 0xf86ecbae, 0xb86cda90, 0x3860d989, - 0x78637a2c, 0x38a3fa22, 0x78b15827, 0x78f2d9f9, - 0xb8ac6ab7, 0xfc6879a5, 0xbc767943, 0xfc3bc84e, - 0xbc3968d4, 0xf91fc0fe, 0xb91da50f, 0x391d280b, - 0x791d2e23, 0xf95bc8e2, 0xb95ce525, 0x395ae53c, - 0x795c9282, 0x399d7dd6, 0x799fe008, 0x79de9bc0, - 0xb99aae78, 0xfd597598, 0xbd5d1d08, 0xfd1f3dea, - 0xbd1a227a, 0x5800148a, 0x18000003, 0xf88092e0, - 0xd8ffdf00, 0xf8a84860, 0xf99d7560, 0x1a1c012d, - 0x3a1c027b, 0x5a060253, 0x7a03028e, 0x9a0801d0, - 0xba0803a0, 0xda140308, 0xfa00038c, 0x0b3010d7, - 0x2b37ab39, 0xcb2466da, 0x6b33efb1, 0x8b350fcb, - 0xab208a70, 0xcb39e52b, 0xeb2c9291, 0x3a4bd1a3, - 0x7a4c81a2, 0xba42106c, 0xfa5560e3, 0x3a4e3844, - 0x7a515a26, 0xba4c2940, 0xfa52aaae, 0x1a8cc1b5, - 0x1a8f976a, 0x5a8981a0, 0x5a9a6492, 0x9a8793ac, - 0x9a9474e6, 0xda83d2b6, 0xda9b9593, 0x5ac00200, - 0x5ac006f1, 0x5ac009d1, 0x5ac013d8, 0x5ac016d8, - 0xdac00223, 0xdac005ac, 0xdac00ac9, 0xdac00c00, - 0xdac01205, 0xdac016d9, 0x1ac0089d, 0x1add0fa0, - 0x1ad52225, 0x1ad22529, 0x1ac82b61, 0x1acd2e92, - 0x9acc0b28, 0x9adc0ca7, 0x9adb2225, 0x9ad42757, - 0x9adc291c, 0x9ac42fa3, 0x1b1a55d1, 0x1b0bafc1, - 0x9b067221, 0x9b1ea0de, 0x9b2e20d5, 0x9b38cd4a, - 0x9bae6254, 0x9ba59452, 0x1e2d0a48, 0x1e3c19c2, - 0x1e3c298f, 0x1e213980, 0x1e240baf, 0x1e77082c, - 0x1e72191b, 0x1e6b2a97, 0x1e723988, 0x1e770b1a, - 0x1f0d66f5, 0x1f01b956, 0x1f227a8e, 0x1f365ba7, - 0x1f4f14ad, 0x1f45a98e, 0x1f60066a, 0x1f620054, - 0x1e204139, 0x1e20c094, 0x1e214363, 0x1e21c041, - 0x1e22c01e, 0x1e60408c, 0x1e60c361, 0x1e6142c8, - 0x1e61c16b, 0x1e624396, 0x1e3802dc, 0x9e380374, - 0x1e78000e, 0x9e78017a, 0x1e2202dc, 0x9e220150, - 0x1e6202a8, 0x9e620395, 0x1e260318, 0x9e660268, - 0x1e270188, 0x9e6700e6, 0x1e3023c0, 0x1e6b2320, - 0x1e202168, 0x1e602168, 0x2910323d, 0x297449d6, - 0x6948402b, 0xa9072f40, 0xa9410747, 0x29801f0a, - 0x29e07307, 0x69e272b9, 0xa9bf49d4, 0xa9c529a8, - 0x28b0605a, 0x28e866a2, 0x68ee0ab1, 0xa886296c, - 0xa8fe1a38, 0x282479c3, 0x286e534f, 0xa8386596, - 0xa8755a3b, 0x1e601000, 0x1e603000, 0x1e621000, - 0x1e623000, 0x1e641000, 0x1e643000, 0x1e661000, - 0x1e663000, 0x1e681000, 0x1e683000, 0x1e6a1000, - 0x1e6a3000, 0x1e6c1000, 0x1e6c3000, 0x1e6e1000, - 0x1e6e3000, 0x1e701000, 0x1e703000, 0x1e721000, - 0x1e723000, 0x1e741000, 0x1e743000, 0x1e761000, - 0x1e763000, 0x1e781000, 0x1e783000, 0x1e7a1000, - 0x1e7a3000, 0x1e7c1000, 0x1e7c3000, 0x1e7e1000, - 0x1e7e3000, + 0x8b50798f, 0xcb4381e1, 0xab05372d, 0xeb864796, + 0x0b961920, 0x4b195473, 0x2b0b5264, 0x6b9300f8, + 0x8a0bc0fe, 0xaa0f3118, 0xca170531, 0xea44dd6e, + 0x0a4c44f3, 0x2a8b7373, 0x4a567c7e, 0x6a9c0353, + 0x8a3accdd, 0xaa318f7a, 0xca2e1495, 0xeaa015e2, + 0x0a2274e2, 0x2a751598, 0x4a3309fe, 0x6ab172fe, + 0x110a5284, 0x310b1942, 0x5103d353, 0x710125bc, + 0x910d7bc2, 0xb108fa1b, 0xd1093536, 0xf10ae824, + 0x120e667c, 0x321f6cbb, 0x520f6a9e, 0x72136f56, + 0x927e4ce5, 0xb278b4ed, 0xd24c6527, 0xf2485803, + 0x14000000, 0x17ffffd7, 0x140001ee, 0x94000000, + 0x97ffffd4, 0x940001eb, 0x34000010, 0x34fffa30, + 0x34003d10, 0x35000013, 0x35fff9d3, 0x35003cb3, + 0xb4000005, 0xb4fff965, 0xb4003c45, 0xb5000004, + 0xb5fff904, 0xb5003be4, 0x1000001b, 0x10fff8bb, + 0x10003b9b, 0x90000010, 0x3640001c, 0x3647f83c, + 0x36403b1c, 0x37080001, 0x370ff7c1, 0x37083aa1, + 0x12a437f4, 0x528c9d67, 0x72838bb1, 0x92c1062e, + 0xd287da49, 0xf2a6d153, 0x93465ac9, 0x330b0013, + 0x530b4e6a, 0x934545e4, 0xb35370a3, 0xd3510b8c, + 0x13960c0f, 0x93ceddc6, 0x54000000, 0x54fff5a0, + 0x54003880, 0x54000001, 0x54fff541, 0x54003821, + 0x54000002, 0x54fff4e2, 0x540037c2, 0x54000002, + 0x54fff482, 0x54003762, 0x54000003, 0x54fff423, + 0x54003703, 0x54000003, 0x54fff3c3, 0x540036a3, + 0x54000004, 0x54fff364, 0x54003644, 0x54000005, + 0x54fff305, 0x540035e5, 0x54000006, 0x54fff2a6, + 0x54003586, 0x54000007, 0x54fff247, 0x54003527, + 0x54000008, 0x54fff1e8, 0x540034c8, 0x54000009, + 0x54fff189, 0x54003469, 0x5400000a, 0x54fff12a, + 0x5400340a, 0x5400000b, 0x54fff0cb, 0x540033ab, + 0x5400000c, 0x54fff06c, 0x5400334c, 0x5400000d, + 0x54fff00d, 0x540032ed, 0x5400000e, 0x54ffefae, + 0x5400328e, 0x5400000f, 0x54ffef4f, 0x5400322f, + 0xd40ac601, 0xd40042a2, 0xd404dac3, 0xd4224d40, + 0xd44219c0, 0xd503201f, 0xd69f03e0, 0xd6bf03e0, + 0xd5033fdf, 0xd503339f, 0xd50335bf, 0xd61f0280, + 0xd63f0040, 0xc8127c17, 0xc81efec5, 0xc85f7d05, + 0xc85ffe14, 0xc89ffd66, 0xc8dfff66, 0x880a7cb1, + 0x8816fd89, 0x885f7d1b, 0x885ffc57, 0x889fffba, + 0x88dffd4d, 0x48197f7c, 0x481dfd96, 0x485f7f96, + 0x485fffc3, 0x489ffdf8, 0x48dfff5b, 0x080b7e6a, + 0x0817fedb, 0x085f7e18, 0x085ffc38, 0x089fffa5, + 0x08dffe18, 0xc87f6239, 0xc87fb276, 0xc820573a, + 0xc821aca6, 0x887f388d, 0x887f88d1, 0x882f2643, + 0x88329131, 0xf81cf2b7, 0xb803f055, 0x39002f9b, + 0x781f31fd, 0xf85d33ce, 0xb843539d, 0x39401f54, + 0x785ce059, 0x389f1143, 0x788131ee, 0x78dfb17d, + 0xb89b90af, 0xfc403193, 0xbc42a36c, 0xfc07d396, + 0xbc1ec1f8, 0xf81e8f88, 0xb8025de6, 0x38007c27, + 0x7801ee20, 0xf8454fb9, 0xb85cce9a, 0x385e7fba, + 0x7841af24, 0x389ebd1c, 0x789fadd1, 0x78c0aefc, + 0xb89c0f7e, 0xfc50efd4, 0xbc414f71, 0xfc011c67, + 0xbc1f0d6d, 0xf81c3526, 0xb81e34b0, 0x3800f7bd, + 0x78012684, 0xf842e653, 0xb8417456, 0x385e2467, + 0x785e358b, 0x389e34c8, 0x788046f8, 0x78c00611, + 0xb89f8680, 0xfc582454, 0xbc5987d3, 0xfc076624, + 0xbc190675, 0xf833785a, 0xb82fd809, 0x3821799a, + 0x782a7975, 0xf870eaf0, 0xb871d96a, 0x386b7aed, + 0x7875689b, 0x38afd91a, 0x78a2c955, 0x78ee6bc8, + 0xb8b4f9dd, 0xfc76eb7e, 0xbc76692d, 0xfc31db28, + 0xbc255b01, 0xf91c52aa, 0xb91c3fb2, 0x391f8877, + 0x791ac97c, 0xf95c1758, 0xb95b3c55, 0x395ce0a4, + 0x795851ce, 0x399e9f64, 0x79993764, 0x79d9af8a, + 0xb99eea2a, 0xfd5a2f8d, 0xbd5dac78, 0xfd1e0182, + 0xbd195c31, 0x58000010, 0x1800000d, 0xf8981240, + 0xd8ffdf00, 0xf8a27a80, 0xf99af920, 0x1a0202e8, + 0x3a130078, 0x5a1d0316, 0x7a03036c, 0x9a0102eb, + 0xba1700bd, 0xda0c0329, 0xfa16000c, 0x0b23459a, + 0x2b328a14, 0xcb274bde, 0x6b222eab, 0x8b214b42, + 0xab34a7b2, 0xcb24520e, 0xeb378e20, 0x3a565283, + 0x7a420321, 0xba58c247, 0xfa4d5106, 0x3a426924, + 0x7a5b0847, 0xba413a02, 0xfa5fba23, 0x1a979377, + 0x1a86640a, 0x5a89300b, 0x5a923771, 0x9a8b720c, + 0x9a868786, 0xda9a736d, 0xda9256dd, 0x5ac0026c, + 0x5ac00657, 0x5ac00b89, 0x5ac01262, 0x5ac017b9, + 0xdac002e4, 0xdac0065d, 0xdac00907, 0xdac00e2d, + 0xdac01011, 0xdac01752, 0x1ad0098b, 0x1ac70d24, + 0x1ad020ec, 0x1ad72613, 0x1ac62887, 0x1ad72e95, + 0x9adc0990, 0x9acd0d84, 0x9ac721a9, 0x9acf277c, + 0x9ace2bd4, 0x9ade2e4e, 0x9bc77d63, 0x9b587e97, + 0x1b1524a2, 0x1b04a318, 0x9b0f4d8b, 0x9b0ce73d, + 0x9b2c5971, 0x9b34c87c, 0x9bbc6887, 0x9bb19556, + 0x1e310871, 0x1e261a2b, 0x1e2928fd, 0x1e333987, + 0x1e230ae0, 0x1e75087a, 0x1e651a60, 0x1e692b40, + 0x1e753ab9, 0x1e7309b0, 0x1f00425d, 0x1f1d95b7, + 0x1f2a38e9, 0x1f2f5f99, 0x1f5545a6, 0x1f429ea3, + 0x1f65472a, 0x1f7449ce, 0x1e20404f, 0x1e20c0f2, + 0x1e2140c3, 0x1e21c02c, 0x1e22c009, 0x1e6040a4, + 0x1e60c1e3, 0x1e614331, 0x1e61c30c, 0x1e6240b5, + 0x1e3802a4, 0x9e38007b, 0x1e78011d, 0x9e7802a9, + 0x1e2203b4, 0x9e220107, 0x1e6202ac, 0x9e6202b0, + 0x1e2600b2, 0x9e660119, 0x1e270352, 0x9e670160, + 0x1e262200, 0x1e7d2200, 0x1e2023c8, 0x1e602128, + 0x293e119b, 0x294a2543, 0x69480c70, 0xa934726a, + 0xa97448f3, 0x298243ca, 0x29e21242, 0x69c64db8, + 0xa9800311, 0xa9f4686e, 0x288a0416, 0x28fe2812, + 0x68fe62d8, 0xa885308c, 0xa8f12664, 0x282468d2, + 0x284e5035, 0xa8327699, 0xa84716e1, 0x0c407284, + 0x4cdfa158, 0x0ccf6cd8, 0x4cdf2483, 0x0d40c0c2, + 0x4ddfc9cd, 0x0dd8ceaf, 0x4c408ea9, 0x0cdf86bd, + 0x4d60c1c8, 0x0dffca87, 0x4de3cc7c, 0x4cdd497b, + 0x0c404950, 0x4d40e595, 0x4ddfeba4, 0x0dd3ed38, + 0x4cdf046a, 0x0cc9039b, 0x0d60e3d5, 0x0dffe5d7, + 0x0df4e9a4, 0xba5fd3e3, 0x3a5f03e5, 0xfa411be4, + 0x7a42cbe2, 0x93df03ff, 0xc820ffff, 0x8822fc7f, + 0xc8247cbf, 0x88267fff, 0x4e010fe0, 0x4e081fe1, + 0x4e0c1fe1, 0x4e0a1fe1, 0x4e071fe1, 0x4cc0ac3f, + 0x1e601000, 0x1e603000, 0x1e621000, 0x1e623000, + 0x1e641000, 0x1e643000, 0x1e661000, 0x1e663000, + 0x1e681000, 0x1e683000, 0x1e6a1000, 0x1e6a3000, + 0x1e6c1000, 0x1e6c3000, 0x1e6e1000, 0x1e6e3000, + 0x1e701000, 0x1e703000, 0x1e721000, 0x1e723000, + 0x1e741000, 0x1e743000, 0x1e761000, 0x1e763000, + 0x1e781000, 0x1e783000, 0x1e7a1000, 0x1e7a3000, + 0x1e7c1000, 0x1e7c3000, 0x1e7e1000, 0x1e7e3000, + 0xf8358305, 0xf82d01ed, 0xf8361353, 0xf839234a, + 0xf82531fb, 0xf8335165, 0xf83a4080, 0xf83673d7, + 0xf832611c, 0xf8ad837d, 0xf8ab01a5, 0xf8a112b8, + 0xf8bb2311, 0xf8b230be, 0xf8a75336, 0xf8a4427a, + 0xf8a6707e, 0xf8b860b7, 0xf8f88392, 0xf8f300ff, + 0xf8ed1386, 0xf8e822af, 0xf8e2302d, 0xf8f1533d, + 0xf8f941d2, 0xf8ff7366, 0xf8f061e5, 0xf86b8072, + 0xf87a0054, 0xf86b1164, 0xf87e22f3, 0xf86331cf, + 0xf87e5296, 0xf8674305, 0xf87771f0, 0xf86b6013, + 0xb83c803c, 0xb82b0195, 0xb83d1240, 0xb8252320, + 0xb82e3340, 0xb83c53b2, 0xb82f43a1, 0xb828739a, + 0xb831608e, 0xb8b88039, 0xb8aa0231, 0xb8bd12b4, + 0xb8bd2189, 0xb8ab30a6, 0xb8b552a7, 0xb8aa4197, + 0xb8b57145, 0xb8be6254, 0xb8ed80b7, 0xb8ef00b8, + 0xb8e9132a, 0xb8f42231, 0xb8ec33d2, 0xb8e35323, + 0xb8fa4159, 0xb8e273eb, 0xb8e760a2, 0xb8608287, + 0xb865005f, 0xb87b1379, 0xb87e2358, 0xb86f32c2, + 0xb86053e3, 0xb86f4154, 0xb87671d5, 0xb866605e, + }; // END Generated code -- do not edit diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/assembler_aarch64.hpp --- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -276,7 +276,7 @@ unsigned get(int msb = 31, int lsb = 0) { int nbits = msb - lsb + 1; unsigned mask = ((1U << nbits) - 1) << lsb; - assert_cond(bits & mask == mask); + assert_cond((bits & mask) == mask); return (insn & mask) >> lsb; } @@ -306,10 +306,12 @@ }; class Post : public PrePost { Register _idx; + bool _is_postreg; public: - Post(Register reg, int o) : PrePost(reg, o) { _idx = NULL; } - Post(Register reg, Register idx) : PrePost(reg, 0) { _idx = idx; } + Post(Register reg, int o) : PrePost(reg, o) { _idx = NULL; _is_postreg = false; } + Post(Register reg, Register idx) : PrePost(reg, 0) { _idx = idx; _is_postreg = true; } Register idx_reg() { return _idx; } + bool is_postreg() {return _is_postreg; } }; namespace ext @@ -393,7 +395,7 @@ : _base(p.reg()), _offset(p.offset()), _mode(pre) { } Address(Post p) : _base(p.reg()), _index(p.idx_reg()), _offset(p.offset()), - _mode(p.idx_reg() == NULL ? post : post_reg), _target(0) { } + _mode(p.is_postreg() ? post_reg : post), _target(0) { } Address(address target, RelocationHolder const& rspec) : _mode(literal), _rspec(rspec), @@ -807,32 +809,34 @@ #undef INSN // Bitfield -#define INSN(NAME, opcode) \ +#define INSN(NAME, opcode, size) \ void NAME(Register Rd, Register Rn, unsigned immr, unsigned imms) { \ starti; \ + guarantee(size == 1 || (immr < 32 && imms < 32), "incorrect immr/imms");\ f(opcode, 31, 22), f(immr, 21, 16), f(imms, 15, 10); \ zrf(Rn, 5), rf(Rd, 0); \ } - INSN(sbfmw, 0b0001001100); - INSN(bfmw, 0b0011001100); - INSN(ubfmw, 0b0101001100); - INSN(sbfm, 0b1001001101); - INSN(bfm, 0b1011001101); - INSN(ubfm, 0b1101001101); + INSN(sbfmw, 0b0001001100, 0); + INSN(bfmw, 0b0011001100, 0); + INSN(ubfmw, 0b0101001100, 0); + INSN(sbfm, 0b1001001101, 1); + INSN(bfm, 0b1011001101, 1); + INSN(ubfm, 0b1101001101, 1); #undef INSN // Extract -#define INSN(NAME, opcode) \ +#define INSN(NAME, opcode, size) \ void NAME(Register Rd, Register Rn, Register Rm, unsigned imms) { \ starti; \ + guarantee(size == 1 || imms < 32, "incorrect imms"); \ f(opcode, 31, 21), f(imms, 15, 10); \ - rf(Rm, 16), rf(Rn, 5), rf(Rd, 0); \ + zrf(Rm, 16), zrf(Rn, 5), zrf(Rd, 0); \ } - INSN(extrw, 0b00010011100); - INSN(extr, 0b10010011110); + INSN(extrw, 0b00010011100, 0); + INSN(extr, 0b10010011110, 1); #undef INSN @@ -1126,7 +1130,7 @@ Register Rn, enum operand_size sz, int op, bool ordered) { starti; f(sz, 31, 30), f(0b001000, 29, 24), f(op, 23, 21); - rf(Rs, 16), f(ordered, 15), rf(Rt2, 10), srf(Rn, 5), zrf(Rt1, 0); + rf(Rs, 16), f(ordered, 15), zrf(Rt2, 10), srf(Rn, 5), zrf(Rt1, 0); } void load_exclusive(Register dst, Register addr, @@ -1255,7 +1259,7 @@ enum operand_size sz, int op1, int op2, bool a, bool r) { starti; f(sz, 31, 30), f(0b111000, 29, 24), f(a, 23), f(r, 22), f(1, 21); - rf(Rs, 16), f(op1, 15), f(op2, 14, 12), f(0, 11, 10), srf(Rn, 5), zrf(Rt, 0); + zrf(Rs, 16), f(op1, 15), f(op2, 14, 12), f(0, 11, 10), srf(Rn, 5), zrf(Rt, 0); } #define INSN(NAME, NAME_A, NAME_L, NAME_AL, op1, op2) \ @@ -1477,6 +1481,7 @@ void NAME(Register Rd, Register Rn, Register Rm, \ enum shift_kind kind = LSL, unsigned shift = 0) { \ starti; \ + guarantee(size == 1 || shift < 32, "incorrect shift"); \ f(N, 21); \ zrf(Rm, 16), zrf(Rn, 5), zrf(Rd, 0); \ op_shifted_reg(0b01010, kind, shift, size, op); \ @@ -1539,6 +1544,7 @@ starti; \ f(0, 21); \ assert_cond(kind != ROR); \ + guarantee(size == 1 || shift < 32, "incorrect shift");\ zrf(Rd, 0), zrf(Rn, 5), zrf(Rm, 16); \ op_shifted_reg(0b01011, kind, shift, size, op); \ } @@ -1567,7 +1573,7 @@ void add_sub_extended_reg(unsigned op, unsigned decode, Register Rd, Register Rn, Register Rm, unsigned opt, ext::operation option, unsigned imm) { - guarantee(imm <= 4, "shift amount must be < 4"); + guarantee(imm <= 4, "shift amount must be <= 4"); f(op, 31, 29), f(decode, 28, 24), f(opt, 23, 22), f(1, 21); f(option, 15, 13), f(imm, 12, 10); } @@ -1652,7 +1658,7 @@ f(o2, 10); f(o3, 4); f(nzcv, 3, 0); - f(imm5, 20, 16), rf(Rn, 5); + f(imm5, 20, 16), zrf(Rn, 5); } #define INSN(NAME, op) \ @@ -2121,7 +2127,12 @@ } void ld_st(FloatRegister Vt, SIMD_Arrangement T, Register Xn, int imm, int op1, int op2, int regs) { - guarantee(T <= T1Q && imm == SIMD_Size_in_bytes[T] * regs, "bad offset"); + + bool replicate = op2 >> 2 == 3; + // post-index value (imm) is formed differently for replicate/non-replicate ld* instructions + int expectedImmediate = replicate ? regs * (1 << (T >> 1)) : SIMD_Size_in_bytes[T] * regs; + guarantee(T < T1Q , "incorrect arrangement"); + guarantee(imm == expectedImmediate, "bad offset"); starti; f(0,31), f((int)T & 1, 30); f(op1 | 0b100, 29, 21), f(0b11111, 20, 16), f(op2, 15, 12); @@ -2228,42 +2239,47 @@ #undef INSN -#define INSN(NAME, opc, opc2) \ +#define INSN(NAME, opc, opc2, acceptT2D) \ void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, FloatRegister Vm) { \ + guarantee(T != T1Q && T != T1D, "incorrect arrangement"); \ + if (!acceptT2D) guarantee(T != T2D, "incorrect arrangement"); \ starti; \ f(0, 31), f((int)T & 1, 30), f(opc, 29), f(0b01110, 28, 24); \ f((int)T >> 1, 23, 22), f(1, 21), rf(Vm, 16), f(opc2, 15, 10); \ rf(Vn, 5), rf(Vd, 0); \ } - INSN(addv, 0, 0b100001); - INSN(subv, 1, 0b100001); - INSN(mulv, 0, 0b100111); - INSN(mlav, 0, 0b100101); - INSN(mlsv, 1, 0b100101); - INSN(sshl, 0, 0b010001); - INSN(ushl, 1, 0b010001); - INSN(umullv, 1, 0b110000); - INSN(umlalv, 1, 0b100000); + INSN(addv, 0, 0b100001, true); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S, T2D + INSN(subv, 1, 0b100001, true); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S, T2D + INSN(mulv, 0, 0b100111, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S + INSN(mlav, 0, 0b100101, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S + INSN(mlsv, 1, 0b100101, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S + INSN(sshl, 0, 0b010001, true); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S, T2D + INSN(ushl, 1, 0b010001, true); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S, T2D + INSN(umullv, 1, 0b110000, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S + INSN(umlalv, 1, 0b100000, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S #undef INSN -#define INSN(NAME, opc, opc2) \ +#define INSN(NAME, opc, opc2, accepted) \ void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { \ + guarantee(T != T1Q && T != T1D, "incorrect arrangement"); \ + if (accepted < 2) guarantee(T != T2S && T != T2D, "incorrect arrangement"); \ + if (accepted == 0) guarantee(T == T8B || T == T16B, "incorrect arrangement"); \ starti; \ f(0, 31), f((int)T & 1, 30), f(opc, 29), f(0b01110, 28, 24); \ f((int)T >> 1, 23, 22), f(opc2, 21, 10); \ rf(Vn, 5), rf(Vd, 0); \ } - INSN(absr, 0, 0b100000101110); - INSN(negr, 1, 0b100000101110); - INSN(notr, 1, 0b100000010110); - INSN(addv, 0, 0b110001101110); - INSN(cls, 0, 0b100000010010); - INSN(clz, 1, 0b100000010010); - INSN(cnt, 0, 0b100000010110); - INSN(uaddlv, 1, 0b110000001110); + INSN(absr, 0, 0b100000101110, 1); // accepted arrangements: T8B, T16B, T4H, T8H, T4S + INSN(negr, 1, 0b100000101110, 2); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S, T2D + INSN(notr, 1, 0b100000010110, 0); // accepted arrangements: T8B, T16B + INSN(addv, 0, 0b110001101110, 1); // accepted arrangements: T8B, T16B, T4H, T8H, T4S + INSN(cls, 0, 0b100000010010, 1); // accepted arrangements: T8B, T16B, T4H, T8H, T4S + INSN(clz, 1, 0b100000010010, 1); // accepted arrangements: T8B, T16B, T4H, T8H, T4S + INSN(cnt, 0, 0b100000010110, 0); // accepted arrangements: T8B, T16B + INSN(uaddlv, 1, 0b110000001110, 1); // accepted arrangements: T8B, T16B, T4H, T8H, T4S #undef INSN @@ -2287,7 +2303,7 @@ starti; \ assert(lsl == 0 || \ ((T == T4H || T == T8H) && lsl == 8) || \ - ((T == T2S || T == T4S) && ((lsl >> 3) < 4)), "invalid shift"); \ + ((T == T2S || T == T4S) && ((lsl >> 3) < 4) && ((lsl & 7) == 0)), "invalid shift");\ cmode |= lsl >> 2; \ if (T == T4H || T == T8H) cmode |= 0b1000; \ if (!(T == T4H || T == T8H || T == T2S || T == T4S)) { \ @@ -2448,7 +2464,8 @@ #undef INSN - void ushll(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, SIMD_Arrangement Tb, int shift) { +private: + void _ushll(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, SIMD_Arrangement Tb, int shift) { starti; /* The encodings for the immh:immb fields (bits 22:16) are * 0001 xxx 8H, 8B/16b shift = xxx @@ -2461,8 +2478,16 @@ f(0, 31), f(Tb & 1, 30), f(0b1011110, 29, 23), f((1 << ((Tb>>1)+3))|shift, 22, 16); f(0b101001, 15, 10), rf(Vn, 5), rf(Vd, 0); } + +public: + void ushll(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, SIMD_Arrangement Tb, int shift) { + assert(Tb == T8B || Tb == T4H || Tb == T2S, "invalid arrangement"); + _ushll(Vd, Ta, Vn, Tb, shift); + } + void ushll2(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, SIMD_Arrangement Tb, int shift) { - ushll(Vd, Ta, Vn, Tb, shift); + assert(Tb == T16B || Tb == T8H || Tb == T4S, "invalid arrangement"); + _ushll(Vd, Ta, Vn, Tb, shift); } // Move from general purpose register @@ -2470,19 +2495,21 @@ void mov(FloatRegister Vd, SIMD_Arrangement T, int index, Register Xn) { starti; f(0b01001110000, 31, 21), f(((1 << (T >> 1)) | (index << ((T >> 1) + 1))), 20, 16); - f(0b000111, 15, 10), rf(Xn, 5), rf(Vd, 0); + f(0b000111, 15, 10), zrf(Xn, 5), rf(Vd, 0); } // Move to general purpose register // mov Rd, Vn.T[index] void mov(Register Xd, FloatRegister Vn, SIMD_Arrangement T, int index) { + guarantee(T >= T2S && T < T1Q, "only D and S arrangements are supported"); starti; f(0, 31), f((T >= T1D) ? 1:0, 30), f(0b001110000, 29, 21); f(((1 << (T >> 1)) | (index << ((T >> 1) + 1))), 20, 16); f(0b001111, 15, 10), rf(Vn, 5), rf(Xd, 0); } - void pmull(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) { +private: + void _pmull(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) { starti; assert((Ta == T1Q && (Tb == T1D || Tb == T2D)) || (Ta == T8H && (Tb == T8B || Tb == T16B)), "Invalid Size specifier"); @@ -2490,9 +2517,16 @@ f(0, 31), f(Tb & 1, 30), f(0b001110, 29, 24), f(size, 23, 22); f(1, 21), rf(Vm, 16), f(0b111000, 15, 10), rf(Vn, 5), rf(Vd, 0); } + +public: + void pmull(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) { + assert(Tb == T1D || Tb == T8B, "pmull assumes T1D or T8B as the second size specifier"); + _pmull(Vd, Ta, Vn, Vm, Tb); + } + void pmull2(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) { assert(Tb == T2D || Tb == T16B, "pmull2 assumes T2D or T16B as the second size specifier"); - pmull(Vd, Ta, Vn, Vm, Tb); + _pmull(Vd, Ta, Vn, Vm, Tb); } void uqxtn(FloatRegister Vd, SIMD_Arrangement Tb, FloatRegister Vn, SIMD_Arrangement Ta) { @@ -2509,7 +2543,7 @@ starti; assert(T != T1D, "reserved encoding"); f(0,31), f((int)T & 1, 30), f(0b001110000, 29, 21); - f((1 << (T >> 1)), 20, 16), f(0b000011, 15, 10), rf(Xs, 5), rf(Vd, 0); + f((1 << (T >> 1)), 20, 16), f(0b000011, 15, 10), zrf(Xs, 5), rf(Vd, 0); } void dup(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, int index = 0) @@ -2524,6 +2558,7 @@ // AdvSIMD ZIP/UZP/TRN #define INSN(NAME, opcode) \ void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, FloatRegister Vm) { \ + guarantee(T != T1D && T != T1Q, "invalid arrangement"); \ starti; \ f(0, 31), f(0b001110, 29, 24), f(0, 21), f(0, 15); \ f(opcode, 14, 12), f(0b10, 11, 10); \ @@ -2609,7 +2644,7 @@ // RBIT only allows T8B and T16B but encodes them oddly. Argh... void rbit(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { assert((ASSERTION), MSG); - _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn); + _rbit(Vd, SIMD_Arrangement((T & 1) | 0b010), Vn); } #undef ASSERTION diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1015,7 +1015,11 @@ if (UseCompressedOops && !wide) { __ decode_heap_oop(dest->as_register()); } - __ verify_oop(dest->as_register()); + + if (!UseZGC) { + // Load barrier has not yet been applied, so ZGC can't verify the oop here + __ verify_oop(dest->as_register()); + } } else if (type == T_ADDRESS && addr->disp() == oopDesc::klass_offset_in_bytes()) { if (UseCompressedClassPointers) { __ decode_klass_not_null(dest->as_register()); @@ -1074,8 +1078,8 @@ // Assembler::EQ does not permit unordered branches, so we add // another branch here. Likewise, Assembler::NE does not permit // ordered branches. - if (is_unordered && op->cond() == lir_cond_equal - || !is_unordered && op->cond() == lir_cond_notEqual) + if ((is_unordered && op->cond() == lir_cond_equal) + || (!is_unordered && op->cond() == lir_cond_notEqual)) __ br(Assembler::VS, *(op->ublock()->label())); switch(op->cond()) { case lir_cond_equal: acond = Assembler::EQ; break; @@ -1785,18 +1789,22 @@ switch (code) { case lir_add: __ fadds (dest->as_float_reg(), left->as_float_reg(), right->as_float_reg()); break; case lir_sub: __ fsubs (dest->as_float_reg(), left->as_float_reg(), right->as_float_reg()); break; + case lir_mul_strictfp: // fall through case lir_mul: __ fmuls (dest->as_float_reg(), left->as_float_reg(), right->as_float_reg()); break; + case lir_div_strictfp: // fall through case lir_div: __ fdivs (dest->as_float_reg(), left->as_float_reg(), right->as_float_reg()); break; default: ShouldNotReachHere(); } } else if (left->is_double_fpu()) { if (right->is_double_fpu()) { - // cpu register - cpu register + // fpu register - fpu register switch (code) { case lir_add: __ faddd (dest->as_double_reg(), left->as_double_reg(), right->as_double_reg()); break; case lir_sub: __ fsubd (dest->as_double_reg(), left->as_double_reg(), right->as_double_reg()); break; + case lir_mul_strictfp: // fall through case lir_mul: __ fmuld (dest->as_double_reg(), left->as_double_reg(), right->as_double_reg()); break; + case lir_div_strictfp: // fall through case lir_div: __ fdivd (dest->as_double_reg(), left->as_double_reg(), right->as_double_reg()); break; default: ShouldNotReachHere(); @@ -2869,7 +2877,11 @@ void LIR_Assembler::leal(LIR_Opr addr, LIR_Opr dest, LIR_PatchCode patch_code, CodeEmitInfo* info) { - assert(patch_code == lir_patch_none, "Patch code not supported"); + if (patch_code != lir_patch_none) { + deoptimize_trap(info); + return; + } + __ lea(dest->as_register_lo(), as_Address(addr->as_address_ptr())); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp --- a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -426,7 +426,7 @@ tmp = new_register(T_DOUBLE); } - arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), NULL); + arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), x->is_strictfp()); set_result(x, round_item(reg)); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/frame_aarch64.cpp --- a/src/hotspot/cpu/aarch64/frame_aarch64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/frame_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -768,11 +768,13 @@ extern "C" void pf(unsigned long sp, unsigned long fp, unsigned long pc, unsigned long bcx, unsigned long thread) { - RegisterMap map((JavaThread*)thread, false); if (!reg_map) { - reg_map = (RegisterMap*)os::malloc(sizeof map, mtNone); + reg_map = NEW_C_HEAP_OBJ(RegisterMap, mtNone); + ::new (reg_map) RegisterMap((JavaThread*)thread, false); + } else { + *reg_map = RegisterMap((JavaThread*)thread, false); } - memcpy(reg_map, &map, sizeof map); + { CodeBlob *cb = CodeCache::find_blob((address)pc); if (cb && cb->frame_size()) diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,407 @@ +/* + * 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. + */ + +#include "precompiled.hpp" +#include "asm/macroAssembler.inline.hpp" +#include "code/codeBlob.hpp" +#include "gc/z/zBarrier.inline.hpp" +#include "gc/z/zBarrierSet.hpp" +#include "gc/z/zBarrierSetAssembler.hpp" +#include "gc/z/zBarrierSetRuntime.hpp" +#include "memory/resourceArea.hpp" +#ifdef COMPILER1 +#include "c1/c1_LIRAssembler.hpp" +#include "c1/c1_MacroAssembler.hpp" +#include "gc/z/c1/zBarrierSetC1.hpp" +#endif // COMPILER1 + +#include "gc/z/zThreadLocalData.hpp" + +ZBarrierSetAssembler::ZBarrierSetAssembler() : + _load_barrier_slow_stub(), + _load_barrier_weak_slow_stub() {} + +#ifdef PRODUCT +#define BLOCK_COMMENT(str) /* nothing */ +#else +#define BLOCK_COMMENT(str) __ block_comment(str) +#endif + +#undef __ +#define __ masm-> + +void ZBarrierSetAssembler::load_at(MacroAssembler* masm, + DecoratorSet decorators, + BasicType type, + Register dst, + Address src, + Register tmp1, + Register tmp_thread) { + if (!ZBarrierSet::barrier_needed(decorators, type)) { + // Barrier not needed + BarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread); + return; + } + + // rscratch1 can be passed as src or dst, so don't use it. + RegSet savedRegs = RegSet::of(rscratch2, rheapbase); + + Label done; + assert_different_registers(rheapbase, rscratch2, dst); + assert_different_registers(rheapbase, rscratch2, src.base()); + + __ push(savedRegs, sp); + + // Load bad mask into scratch register. + __ ldr(rheapbase, address_bad_mask_from_thread(rthread)); + __ lea(rscratch2, src); + __ ldr(dst, src); + + // Test reference against bad mask. If mask bad, then we need to fix it up. + __ tst(dst, rheapbase); + __ br(Assembler::EQ, done); + + __ enter(); + + __ push(RegSet::range(r0,r28) - RegSet::of(dst), sp); + + if (c_rarg0 != dst) { + __ mov(c_rarg0, dst); + } + __ mov(c_rarg1, rscratch2); + + int step = 4 * wordSize; + __ mov(rscratch1, -step); + __ sub(sp, sp, step); + + for (int i = 28; i >= 4; i -= 4) { + __ st1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2), + as_FloatRegister(i+3), __ T1D, Address(__ post(sp, rscratch1))); + } + + __ call_VM_leaf(ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded_addr(decorators), 2); + + for (int i = 0; i <= 28; i += 4) { + __ ld1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2), + as_FloatRegister(i+3), __ T1D, Address(__ post(sp, step))); + } + + // Make sure dst has the return value. + if (dst != r0) { + __ mov(dst, r0); + } + + __ pop(RegSet::range(r0,r28) - RegSet::of(dst), sp); + __ leave(); + + __ bind(done); + + // Restore tmps + __ pop(savedRegs, sp); +} + +#ifdef ASSERT + +void ZBarrierSetAssembler::store_at(MacroAssembler* masm, + DecoratorSet decorators, + BasicType type, + Address dst, + Register val, + Register tmp1, + Register tmp2) { + // Verify value + if (type == T_OBJECT || type == T_ARRAY) { + // Note that src could be noreg, which means we + // are storing null and can skip verification. + if (val != noreg) { + Label done; + + // tmp1 and tmp2 are often set to noreg. + RegSet savedRegs = RegSet::of(rscratch1); + __ push(savedRegs, sp); + + __ ldr(rscratch1, address_bad_mask_from_thread(rthread)); + __ tst(val, rscratch1); + __ br(Assembler::EQ, done); + __ stop("Verify oop store failed"); + __ should_not_reach_here(); + __ bind(done); + __ pop(savedRegs, sp); + } + } + + // Store value + BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2); +} + +#endif // ASSERT + +void ZBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, + DecoratorSet decorators, + bool is_oop, + Register src, + Register dst, + Register count, + RegSet saved_regs) { + if (!is_oop) { + // Barrier not needed + return; + } + + BLOCK_COMMENT("ZBarrierSetAssembler::arraycopy_prologue {"); + + assert_different_registers(src, count, rscratch1); + + __ pusha(); + + if (count == c_rarg0) { + if (src == c_rarg1) { + // exactly backwards!! + __ mov(rscratch1, c_rarg0); + __ mov(c_rarg0, c_rarg1); + __ mov(c_rarg1, rscratch1); + } else { + __ mov(c_rarg1, count); + __ mov(c_rarg0, src); + } + } else { + __ mov(c_rarg0, src); + __ mov(c_rarg1, count); + } + + __ call_VM_leaf(ZBarrierSetRuntime::load_barrier_on_oop_array_addr(), 2); + + __ popa(); + BLOCK_COMMENT("} ZBarrierSetAssembler::arraycopy_prologue"); +} + +void ZBarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, + Register jni_env, + Register robj, + Register tmp, + Label& slowpath) { + BLOCK_COMMENT("ZBarrierSetAssembler::try_resolve_jobject_in_native {"); + + assert_different_registers(jni_env, robj, tmp); + + // Resolve jobject + BarrierSetAssembler::try_resolve_jobject_in_native(masm, jni_env, robj, tmp, slowpath); + + // The Address offset is too large to direct load - -784. Our range is +127, -128. + __ mov(tmp, (long int)(in_bytes(ZThreadLocalData::address_bad_mask_offset()) - + in_bytes(JavaThread::jni_environment_offset()))); + // Load address bad mask + __ add(tmp, jni_env, tmp); + __ ldr(tmp, Address(tmp)); + + // Check address bad mask + __ tst(robj, tmp); + __ br(Assembler::NE, slowpath); + + BLOCK_COMMENT("} ZBarrierSetAssembler::try_resolve_jobject_in_native"); +} + +#ifdef COMPILER1 + +#undef __ +#define __ ce->masm()-> + +void ZBarrierSetAssembler::generate_c1_load_barrier_test(LIR_Assembler* ce, + LIR_Opr ref) const { + assert_different_registers(rheapbase, rthread, ref->as_register()); + + __ ldr(rheapbase, address_bad_mask_from_thread(rthread)); + __ tst(ref->as_register(), rheapbase); +} + +void ZBarrierSetAssembler::generate_c1_load_barrier_stub(LIR_Assembler* ce, + ZLoadBarrierStubC1* stub) const { + // Stub entry + __ bind(*stub->entry()); + + Register ref = stub->ref()->as_register(); + Register ref_addr = noreg; + Register tmp = noreg; + + if (stub->tmp()->is_valid()) { + // Load address into tmp register + ce->leal(stub->ref_addr(), stub->tmp()); + ref_addr = tmp = stub->tmp()->as_pointer_register(); + } else { + // Address already in register + ref_addr = stub->ref_addr()->as_address_ptr()->base()->as_pointer_register(); + } + + assert_different_registers(ref, ref_addr, noreg); + + // Save r0 unless it is the result or tmp register + // Set up SP to accomodate parameters and maybe r0.. + if (ref != r0 && tmp != r0) { + __ sub(sp, sp, 32); + __ str(r0, Address(sp, 16)); + } else { + __ sub(sp, sp, 16); + } + + // Setup arguments and call runtime stub + ce->store_parameter(ref_addr, 1); + ce->store_parameter(ref, 0); + + __ far_call(stub->runtime_stub()); + + // Verify result + __ verify_oop(r0, "Bad oop"); + + // Move result into place + if (ref != r0) { + __ mov(ref, r0); + } + + // Restore r0 unless it is the result or tmp register + if (ref != r0 && tmp != r0) { + __ ldr(r0, Address(sp, 16)); + __ add(sp, sp, 32); + } else { + __ add(sp, sp, 16); + } + + // Stub exit + __ b(*stub->continuation()); +} + +#undef __ +#define __ sasm-> + +void ZBarrierSetAssembler::generate_c1_load_barrier_runtime_stub(StubAssembler* sasm, + DecoratorSet decorators) const { + __ prologue("zgc_load_barrier stub", false); + + // We don't use push/pop_clobbered_registers() - we need to pull out the result from r0. + for (int i = 0; i < 32; i +=2) { + __ stpd(as_FloatRegister(i), as_FloatRegister(i+1), Address(__ pre(sp,-16))); + } + + RegSet saveRegs = RegSet::range(r0,r28) - RegSet::of(r0); + __ push(saveRegs, sp); + + // Setup arguments + __ load_parameter(0, c_rarg0); + __ load_parameter(1, c_rarg1); + + __ call_VM_leaf(ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded_addr(decorators), 2); + + __ pop(saveRegs, sp); + + for (int i = 30; i >0; i -=2) { + __ ldpd(as_FloatRegister(i), as_FloatRegister(i+1), Address(__ post(sp, 16))); + } + + __ epilogue(); +} +#endif // COMPILER1 + +#undef __ +#define __ cgen->assembler()-> + +// Generates a register specific stub for calling +// ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded() or +// ZBarrierSetRuntime::load_barrier_on_weak_oop_field_preloaded(). +// +// The raddr register serves as both input and output for this stub. When the stub is +// called the raddr register contains the object field address (oop*) where the bad oop +// was loaded from, which caused the slow path to be taken. On return from the stub the +// raddr register contains the good/healed oop returned from +// ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded() or +// ZBarrierSetRuntime::load_barrier_on_weak_oop_field_preloaded(). +static address generate_load_barrier_stub(StubCodeGenerator* cgen, Register raddr, DecoratorSet decorators) { + // Don't generate stub for invalid registers + if (raddr == zr || raddr == r29 || raddr == r30) { + return NULL; + } + + // Create stub name + char name[64]; + const bool weak = (decorators & ON_WEAK_OOP_REF) != 0; + os::snprintf(name, sizeof(name), "zgc_load_barrier%s_stub_%s", weak ? "_weak" : "", raddr->name()); + + __ align(CodeEntryAlignment); + StubCodeMark mark(cgen, "StubRoutines", os::strdup(name, mtCode)); + address start = __ pc(); + + // Save live registers + RegSet savedRegs = RegSet::range(r0,r18) - RegSet::of(raddr); + + __ enter(); + __ push(savedRegs, sp); + + // Setup arguments + if (raddr != c_rarg1) { + __ mov(c_rarg1, raddr); + } + + __ ldr(c_rarg0, Address(raddr)); + + // Call barrier function + __ call_VM_leaf(ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded_addr(decorators), c_rarg0, c_rarg1); + + // Move result returned in r0 to raddr, if needed + if (raddr != r0) { + __ mov(raddr, r0); + } + + __ pop(savedRegs, sp); + __ leave(); + __ ret(lr); + + return start; +} + +#undef __ + +static void barrier_stubs_init_inner(const char* label, const DecoratorSet decorators, address* stub) { + const int nregs = 28; // Exclude FP, XZR, SP from calculation. + const int code_size = nregs * 254; // Rough estimate of code size + + ResourceMark rm; + + CodeBuffer buf(BufferBlob::create(label, code_size)); + StubCodeGenerator cgen(&buf); + + for (int i = 0; i < nregs; i++) { + const Register reg = as_Register(i); + stub[i] = generate_load_barrier_stub(&cgen, reg, decorators); + } +} + +void ZBarrierSetAssembler::barrier_stubs_init() { + barrier_stubs_init_inner("zgc_load_barrier_stubs", ON_STRONG_OOP_REF, _load_barrier_slow_stub); + barrier_stubs_init_inner("zgc_load_barrier_weak_stubs", ON_WEAK_OOP_REF, _load_barrier_weak_slow_stub); +} + +address ZBarrierSetAssembler::load_barrier_slow_stub(Register reg) { + return _load_barrier_slow_stub[reg->encoding()]; +} + +address ZBarrierSetAssembler::load_barrier_weak_slow_stub(Register reg) { + return _load_barrier_weak_slow_stub[reg->encoding()]; +} diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,92 @@ +/* + * 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. + */ + +#ifndef CPU_AARCH64_GC_Z_ZBARRIERSETASSEMBLER_AARCH64_HPP +#define CPU_AARCH64_GC_Z_ZBARRIERSETASSEMBLER_AARCH64_HPP + +#ifdef COMPILER1 +class LIR_Assembler; +class LIR_OprDesc; +typedef LIR_OprDesc* LIR_Opr; +class StubAssembler; +class ZLoadBarrierStubC1; +#endif // COMPILER1 + +class ZBarrierSetAssembler : public ZBarrierSetAssemblerBase { +private: + address _load_barrier_slow_stub[RegisterImpl::number_of_registers]; + address _load_barrier_weak_slow_stub[RegisterImpl::number_of_registers]; + +public: + ZBarrierSetAssembler(); + + virtual void load_at(MacroAssembler* masm, + DecoratorSet decorators, + BasicType type, + Register dst, + Address src, + Register tmp1, + Register tmp_thread); + +#ifdef ASSERT + virtual void store_at(MacroAssembler* masm, + DecoratorSet decorators, + BasicType type, + Address dst, + Register val, + Register tmp1, + Register tmp2); +#endif // ASSERT + + virtual void arraycopy_prologue(MacroAssembler* masm, + DecoratorSet decorators, + bool is_oop, + Register src, + Register dst, + Register count, + RegSet saved_regs); + + virtual void try_resolve_jobject_in_native(MacroAssembler* masm, + Register jni_env, + Register robj, + Register tmp, + Label& slowpath); + +#ifdef COMPILER1 + void generate_c1_load_barrier_test(LIR_Assembler* ce, + LIR_Opr ref) const; + + void generate_c1_load_barrier_stub(LIR_Assembler* ce, + ZLoadBarrierStubC1* stub) const; + + void generate_c1_load_barrier_runtime_stub(StubAssembler* sasm, + DecoratorSet decorators) const; +#endif // COMPILER1 + + virtual void barrier_stubs_init(); + + address load_barrier_slow_stub(Register reg); + address load_barrier_weak_slow_stub(Register reg); +}; + +#endif // CPU_AARCH64_GC_Z_ZBARRIERSETASSEMBLER_AARCH64_HPP diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/gc/z/z_aarch64.ad --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/cpu/aarch64/gc/z/z_aarch64.ad Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,174 @@ +// +// 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. +// + +source_hpp %{ + +#include "gc/z/c2/zBarrierSetC2.hpp" + +%} + +source %{ + +#include "gc/z/zBarrierSetAssembler.hpp" + +static void z_load_barrier_slow_reg(MacroAssembler& _masm, Register dst, + Register base, int index, int scale, + int disp, bool weak) { + const address stub = weak ? ZBarrierSet::assembler()->load_barrier_weak_slow_stub(dst) + : ZBarrierSet::assembler()->load_barrier_slow_stub(dst); + + if (index == -1) { + if (disp != 0) { + __ lea(dst, Address(base, disp)); + } else { + __ mov(dst, base); + } + } else { + Register index_reg = as_Register(index); + if (disp == 0) { + __ lea(dst, Address(base, index_reg, Address::lsl(scale))); + } else { + __ lea(dst, Address(base, disp)); + __ lea(dst, Address(dst, index_reg, Address::lsl(scale))); + } + } + + __ far_call(RuntimeAddress(stub)); +} + +%} + +// +// Execute ZGC load barrier (strong) slow path +// +instruct loadBarrierSlowReg(iRegP dst, memory mem, rFlagsReg cr, + vRegD_V0 v0, vRegD_V1 v1, vRegD_V2 v2, vRegD_V3 v3, vRegD_V4 v4, + vRegD_V5 v5, vRegD_V6 v6, vRegD_V7 v7, vRegD_V8 v8, vRegD_V9 v9, + vRegD_V10 v10, vRegD_V11 v11, vRegD_V12 v12, vRegD_V13 v13, vRegD_V14 v14, + vRegD_V15 v15, vRegD_V16 v16, vRegD_V17 v17, vRegD_V18 v18, vRegD_V19 v19, + vRegD_V20 v20, vRegD_V21 v21, vRegD_V22 v22, vRegD_V23 v23, vRegD_V24 v24, + vRegD_V25 v25, vRegD_V26 v26, vRegD_V27 v27, vRegD_V28 v28, vRegD_V29 v29, + vRegD_V30 v30, vRegD_V31 v31) %{ + match(Set dst (LoadBarrierSlowReg mem)); + predicate(!n->as_LoadBarrierSlowReg()->is_weak()); + + effect(DEF dst, KILL cr, + KILL v0, KILL v1, KILL v2, KILL v3, KILL v4, KILL v5, KILL v6, KILL v7, + KILL v8, KILL v9, KILL v10, KILL v11, KILL v12, KILL v13, KILL v14, + KILL v15, KILL v16, KILL v17, KILL v18, KILL v19, KILL v20, KILL v21, + KILL v22, KILL v23, KILL v24, KILL v25, KILL v26, KILL v27, KILL v28, + KILL v29, KILL v30, KILL v31); + + format %{"LoadBarrierSlowReg $dst, $mem" %} + ins_encode %{ + z_load_barrier_slow_reg(_masm, $dst$$Register, $mem$$base$$Register, + $mem$$index, $mem$$scale, $mem$$disp, false); + %} + ins_pipe(pipe_slow); +%} + +// +// Execute ZGC load barrier (weak) slow path +// +instruct loadBarrierWeakSlowReg(iRegP dst, memory mem, rFlagsReg cr, + vRegD_V0 v0, vRegD_V1 v1, vRegD_V2 v2, vRegD_V3 v3, vRegD_V4 v4, + vRegD_V5 v5, vRegD_V6 v6, vRegD_V7 v7, vRegD_V8 v8, vRegD_V9 v9, + vRegD_V10 v10, vRegD_V11 v11, vRegD_V12 v12, vRegD_V13 v13, vRegD_V14 v14, + vRegD_V15 v15, vRegD_V16 v16, vRegD_V17 v17, vRegD_V18 v18, vRegD_V19 v19, + vRegD_V20 v20, vRegD_V21 v21, vRegD_V22 v22, vRegD_V23 v23, vRegD_V24 v24, + vRegD_V25 v25, vRegD_V26 v26, vRegD_V27 v27, vRegD_V28 v28, vRegD_V29 v29, + vRegD_V30 v30, vRegD_V31 v31) %{ + match(Set dst (LoadBarrierSlowReg mem)); + predicate(n->as_LoadBarrierSlowReg()->is_weak()); + + effect(DEF dst, KILL cr, + KILL v0, KILL v1, KILL v2, KILL v3, KILL v4, KILL v5, KILL v6, KILL v7, + KILL v8, KILL v9, KILL v10, KILL v11, KILL v12, KILL v13, KILL v14, + KILL v15, KILL v16, KILL v17, KILL v18, KILL v19, KILL v20, KILL v21, + KILL v22, KILL v23, KILL v24, KILL v25, KILL v26, KILL v27, KILL v28, + KILL v29, KILL v30, KILL v31); + + format %{"LoadBarrierWeakSlowReg $dst, $mem" %} + ins_encode %{ + z_load_barrier_slow_reg(_masm, $dst$$Register, $mem$$base$$Register, + $mem$$index, $mem$$scale, $mem$$disp, true); + %} + ins_pipe(pipe_slow); +%} + + +// Specialized versions of compareAndExchangeP that adds a keepalive that is consumed +// but doesn't affect output. + +instruct z_compareAndExchangeP(iRegPNoSp res, indirect mem, + iRegP oldval, iRegP newval, iRegP keepalive, + rFlagsReg cr) %{ + match(Set res (ZCompareAndExchangeP (Binary mem keepalive) (Binary oldval newval))); + ins_cost(2 * VOLATILE_REF_COST); + effect(TEMP_DEF res, KILL cr); + format %{ + "cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval" + %} + ins_encode %{ + __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, + Assembler::xword, /*acquire*/ false, /*release*/ true, + /*weak*/ false, $res$$Register); + %} + ins_pipe(pipe_slow); +%} + +instruct z_compareAndSwapP(iRegINoSp res, + indirect mem, + iRegP oldval, iRegP newval, iRegP keepalive, + rFlagsReg cr) %{ + + match(Set res (ZCompareAndSwapP (Binary mem keepalive) (Binary oldval newval))); + match(Set res (ZWeakCompareAndSwapP (Binary mem keepalive) (Binary oldval newval))); + + ins_cost(2 * VOLATILE_REF_COST); + + effect(KILL cr); + + format %{ + "cmpxchg $mem, $oldval, $newval\t# (ptr) if $mem == $oldval then $mem <-- $newval" + "cset $res, EQ\t# $res <-- (EQ ? 1 : 0)" + %} + + ins_encode(aarch64_enc_cmpxchg(mem, oldval, newval), + aarch64_enc_cset_eq(res)); + + ins_pipe(pipe_slow); +%} + + +instruct z_get_and_setP(indirect mem, iRegP newv, iRegPNoSp prev, + iRegP keepalive) %{ + match(Set prev (ZGetAndSetP mem (Binary newv keepalive))); + + ins_cost(2 * VOLATILE_REF_COST); + format %{ "atomic_xchg $prev, $newv, [$mem]" %} + ins_encode %{ + __ atomic_xchg($prev$$Register, $newv$$Register, as_Register($mem$$base)); + %} + ins_pipe(pipe_serial); +%} diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -38,8 +38,6 @@ protected: protected: - using MacroAssembler::call_VM_leaf_base; - // Interpreter specific version of call_VM_base using MacroAssembler::call_VM_leaf_base; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2681,7 +2681,7 @@ if ((offset & (size-1)) && offset >= (1<<8)) { add(tmp, base, offset & ((1<<12)-1)); base = tmp; - offset &= -1<<12; + offset &= -1u<<12; } if (offset >= (1<<12) * size) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -286,7 +286,7 @@ frecpe(vtmp5, vtmp5, S); // vtmp5 ~= 1/vtmp5 lsr(tmp2, rscratch1, 48); movz(tmp4, 0x77f0, 48); - fmovd(vtmp4, 1.0d); + fmovd(vtmp4, 1.0); movz(tmp1, INF_OR_NAN_PREFIX, 48); bfm(tmp4, rscratch1, 0, 51); // tmp4 = 0x77F0 << 48 | mantissa(X) // vtmp1 = AS_DOUBLE_BITS(0x77F0 << 48 | mantissa(X)) == mx @@ -358,7 +358,7 @@ br(GE, DONE); cmp(rscratch1, tmp2); br(NE, CHECKED_CORNER_CASES); - fmovd(v0, 0.0d); + fmovd(v0, 0.0); } bind(DONE); ret(lr); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -381,11 +381,11 @@ } block_comment("nx calculation with unrolled while(tx[nx-1]==zeroA) nx--;"); { - fcmpd(v26, 0.0d); // if NE then jx == 2. else it's 1 or 0 + fcmpd(v26, 0.0); // if NE then jx == 2. else it's 1 or 0 add(iqBase, sp, 480); // base of iq[] fmuld(v3, v26, v10); br(NE, NX_SET); - fcmpd(v7, 0.0d); // v7 == 0 => jx = 0. Else jx = 1 + fcmpd(v7, 0.0); // v7 == 0 => jx = 0. Else jx = 1 csetw(jx, NE); } bind(NX_SET); @@ -696,7 +696,7 @@ cmpw(jv, zr); addw(tmp4, jx, 4); // tmp4 = m = jx + jk = jx + 4. jx is in {0,1,2} so m is in [4,5,6] cselw(jv, jv, zr, GE); - fmovd(v26, 0.0d); + fmovd(v26, 0.0); addw(tmp5, jv, 1); // jv+1 subsw(j, jv, jx); add(qBase, sp, 320); // base of q[] @@ -819,8 +819,8 @@ movw(jz, 4); fmovd(v17, i); // v17 = twon24 fmovd(v30, tmp5); // 2^q0 - fmovd(v21, 0.125d); - fmovd(v20, 8.0d); + fmovd(v21, 0.125); + fmovd(v20, 8.0); fmovd(v22, tmp4); // 2^-q0 block_comment("recompute loop"); { @@ -877,7 +877,7 @@ lsr(ih, tmp2, 23); // ih = iq[z-1] >> 23 b(Q0_ZERO_CMP_DONE); bind(Q0_ZERO_CMP_LT); - fmovd(v4, 0.5d); + fmovd(v4, 0.5); fcmpd(v18, v4); cselw(ih, zr, ih, LT); // if (z<0.5) ih = 0 } @@ -924,7 +924,7 @@ br(NE, IH_HANDLED); block_comment("if(ih==2) {"); { - fmovd(v25, 1.0d); + fmovd(v25, 1.0); fsubd(v18, v25, v18); // z = one - z; cbzw(rscratch2, IH_HANDLED); fsubd(v18, v18, v30); // z -= scalbnA(one,q0); @@ -932,7 +932,7 @@ } bind(IH_HANDLED); // check if recomputation is needed - fcmpd(v18, 0.0d); + fcmpd(v18, 0.0); br(NE, RECOMP_CHECK_DONE_NOT_ZERO); block_comment("if(z==zeroB) {"); { @@ -994,7 +994,7 @@ } bind(RECOMP_CHECK_DONE); // chop off zero terms - fcmpd(v18, 0.0d); + fcmpd(v18, 0.0); br(EQ, Z_IS_ZERO); block_comment("else block of if(z==0.0) {"); { @@ -1053,7 +1053,7 @@ movw(tmp2, zr); // tmp2 will keep jz - i == 0 at start bind(COMP_FOR); // for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; - fmovd(v30, 0.0d); + fmovd(v30, 0.0); add(tmp5, qBase, i, LSL, 3); // address of q[i+k] for k==0 movw(tmp3, 4); movw(tmp4, zr); // used as k @@ -1081,7 +1081,7 @@ // remember prec == 2 block_comment("for (i=jz;i>=0;i--) fw += fq[i];"); { - fmovd(v4, 0.0d); + fmovd(v4, 0.0); mov(i, jz); bind(FW_FOR1); ldrd(v1, Address(rscratch2, i, Address::lsl(3))); @@ -1319,7 +1319,7 @@ ld1(C1, C2, C3, C4, T1D, Address(rscratch2)); // load C1..C3\4 block_comment("calculate r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))))"); { fmaddd(r, z, C6, C5); - fmovd(half, 0.5d); + fmovd(half, 0.5); fmaddd(r, z, r, C4); fmuld(y, x, y); fmaddd(r, z, r, C3); @@ -1329,7 +1329,7 @@ fmaddd(r, z, r, C1); // r = C1+z(C2+z(C4+z(C5+z*C6))) } // need to multiply r by z to have "final" r value - fmovd(one, 1.0d); + fmovd(one, 1.0); cmp(ix, rscratch1); br(GT, IX_IS_LARGE); block_comment("if(ix < 0x3FD33333) return one - (0.5*z - (z*r - x*y))"); { @@ -1352,7 +1352,7 @@ b(QX_SET); bind(SET_QX_CONST); block_comment("if(ix > 0x3fe90000) qx = 0.28125;"); { - fmovd(qx, 0.28125d); + fmovd(qx, 0.28125); } bind(QX_SET); fnmsub(C6, x, r, y); // z*r - xy @@ -1443,7 +1443,7 @@ block_comment("kernel_sin/kernel_cos: if(ix<0x3e400000) {}"); { bind(TINY_X); if (isCos) { - fmovd(v0, 1.0d); + fmovd(v0, 1.0); } ret(lr); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/register_aarch64.hpp --- a/src/hotspot/cpu/aarch64/register_aarch64.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/register_aarch64.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -136,7 +136,7 @@ VMReg as_VMReg(); // derived registers, offsets, and addresses - FloatRegister successor() const { return as_FloatRegister(encoding() + 1); } + FloatRegister successor() const { return as_FloatRegister((encoding() + 1) % 32); } // accessors int encoding() const { assert(is_valid(), "invalid register"); return (intptr_t)this; } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -46,6 +46,9 @@ #ifdef COMPILER2 #include "opto/runtime.hpp" #endif +#if INCLUDE_ZGC +#include "gc/z/zThreadLocalData.hpp" +#endif #ifdef BUILTIN_SIM #include "../../../../../../simulator/simulator.hpp" @@ -580,6 +583,16 @@ // make sure object is 'reasonable' __ cbz(r0, exit); // if obj is NULL it is OK +#if INCLUDE_ZGC + if (UseZGC) { + // Check if mask is good. + // verifies that ZAddressBadMask & r0 == 0 + __ ldr(c_rarg3, Address(rthread, ZThreadLocalData::address_bad_mask_offset())); + __ andr(c_rarg2, r0, c_rarg3); + __ cbnz(c_rarg2, error); + } +#endif + // Check if the oop is in the right area of memory __ mov(c_rarg3, (intptr_t) Universe::verify_oop_mask()); __ andr(c_rarg2, r0, c_rarg3); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/aarch64/vm_version_aarch64.cpp --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -177,7 +177,7 @@ if (FILE *f = fopen("/proc/cpuinfo", "r")) { char buf[128], *p; while (fgets(buf, sizeof (buf), f) != NULL) { - if (p = strchr(buf, ':')) { + if ((p = strchr(buf, ':')) != NULL) { long v = strtol(p+1, NULL, 0); if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) { _cpu = v; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp --- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -80,7 +80,19 @@ } void LIR_Assembler::clinit_barrier(ciMethod* method) { - ShouldNotReachHere(); // not implemented + assert(!method->holder()->is_not_initialized(), "initialization should have been started"); + + Label L_skip_barrier; + Register klass = R20; + + metadata2reg(method->holder()->constant_encoding(), klass); + __ clinit_barrier(klass, R16_thread, &L_skip_barrier /*L_fast_path*/); + + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub(), R0); + __ mtctr(klass); + __ bctr(); + + __ bind(L_skip_barrier); } void LIR_Assembler::osr_entry() { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/ppc/interp_masm_ppc.hpp --- a/src/hotspot/cpu/ppc/interp_masm_ppc.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/ppc/interp_masm_ppc.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -82,6 +82,8 @@ // load cpool->resolved_klass_at(index) void load_resolved_klass_at_offset(Register Rcpool, Register Roffset, Register Rklass); + void load_resolved_method_at_index(int byte_no, Register cache, Register method); + void load_receiver(Register Rparam_count, Register Rrecv_dst); // helpers for expression stack diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -516,6 +516,18 @@ ldx(Rklass, Rklass, Roffset); } +void InterpreterMacroAssembler::load_resolved_method_at_index(int byte_no, + Register cache, + Register method) { + const int method_offset = in_bytes( + ConstantPoolCache::base_offset() + + ((byte_no == TemplateTable::f2_byte) + ? ConstantPoolCacheEntry::f2_offset() + : ConstantPoolCacheEntry::f1_offset())); + + ld(method, method_offset, cache); // get f1 Method* +} + // Generate a subtype check: branch to ok_is_subtype if sub_klass is // a subtype of super_klass. Blows registers Rsub_klass, tmp1, tmp2. void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, Register Rsuper_klass, Register Rtmp1, diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/ppc/macroAssembler_ppc.cpp --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2011,6 +2011,35 @@ bind(L_failure); // Fallthru if not successful. } +void MacroAssembler::clinit_barrier(Register klass, Register thread, Label* L_fast_path, Label* L_slow_path) { + assert(L_fast_path != NULL || L_slow_path != NULL, "at least one is required"); + + Label L_fallthrough; + if (L_fast_path == NULL) { + L_fast_path = &L_fallthrough; + } else if (L_slow_path == NULL) { + L_slow_path = &L_fallthrough; + } + + // Fast path check: class is fully initialized + lbz(R0, in_bytes(InstanceKlass::init_state_offset()), klass); + cmpwi(CCR0, R0, InstanceKlass::fully_initialized); + beq(CCR0, *L_fast_path); + + // Fast path check: current thread is initializer thread + ld(R0, in_bytes(InstanceKlass::init_thread_offset()), klass); + cmpd(CCR0, thread, R0); + if (L_slow_path == &L_fallthrough) { + beq(CCR0, *L_fast_path); + } else if (L_fast_path == &L_fallthrough) { + bne(CCR0, *L_slow_path); + } else { + Unimplemented(); + } + + bind(L_fallthrough); +} + void MacroAssembler::check_method_handle_type(Register mtype_reg, Register mh_reg, Register temp_reg, Label& wrong_method_type) { @@ -3194,6 +3223,12 @@ resolve_oop_handle(mirror); } +void MacroAssembler::load_method_holder(Register holder, Register method) { + ld(holder, in_bytes(Method::const_offset()), method); + ld(holder, in_bytes(ConstMethod::constants_offset()), holder); + ld(holder, ConstantPool::pool_holder_offset_in_bytes(), holder); +} + // Clear Array // For very short arrays. tmp == R0 is allowed. void MacroAssembler::clear_memory_unrolled(Register base_ptr, int cnt_dwords, Register tmp, int offset) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/ppc/macroAssembler_ppc.hpp --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -559,6 +559,11 @@ Register temp2_reg, Label& L_success); + void clinit_barrier(Register klass, + Register thread, + Label* L_fast_path = NULL, + Label* L_slow_path = NULL); + // Method handle support (JSR 292). void check_method_handle_type(Register mtype_reg, Register mh_reg, Register temp_reg, Label& wrong_method_type); @@ -722,6 +727,7 @@ void resolve_oop_handle(Register result); void load_mirror_from_const_method(Register mirror, Register const_method); + void load_method_holder(Register holder, Register method); static int instr_size_for_decode_klass_not_null(); void decode_klass_not_null(Register dst, Register src = noreg); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/ppc/ppc.ad --- a/src/hotspot/cpu/ppc/ppc.ad Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/ppc/ppc.ad Fri Jun 21 14:07:48 2019 +0530 @@ -1,6 +1,6 @@ // -// Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. -// Copyright (c) 2012, 2018 SAP SE. All rights reserved. +// Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2012, 2019 SAP SE. 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 @@ -1400,6 +1400,24 @@ ___(mflr) mflr(return_pc); } + if (C->clinit_barrier_on_entry()) { + assert(!C->method()->holder()->is_not_initialized(), "initialization should have been started"); + + Label L_skip_barrier; + Register klass = toc_temp; + + // Notify OOP recorder (don't need the relocation) + AddressLiteral md = __ constant_metadata_address(C->method()->holder()->constant_encoding()); + __ load_const_optimized(klass, md.value(), R0); + __ clinit_barrier(klass, R16_thread, &L_skip_barrier /*L_fast_path*/); + + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub(), R0); + __ mtctr(klass); + __ bctr(); + + __ bind(L_skip_barrier); + } + // Calls to C2R adapters often do not accept exceptional returns. // We require that their callers must bang for them. But be // careful, because some VM calls (such as call site linkage) can @@ -4631,6 +4649,16 @@ interface(CONST_INTER); %} +// Double Immediate: +0.0d. +operand immD_0() %{ + predicate(jlong_cast(n->getd()) == 0); + match(ConD); + + op_cost(0); + format %{ %} + interface(CONST_INTER); +%} + // Integer Register Operands // Integer Destination Register // See definition of reg_class bits32_reg_rw. @@ -14009,7 +14037,7 @@ instruct repl4S_immI0(iRegLdst dst, immI_0 zero) %{ match(Set dst (ReplicateS zero)); predicate(n->as_Vector()->length() == 4); - format %{ "LI $dst, #0 \t// replicate4C" %} + format %{ "LI $dst, #0 \t// replicate4S" %} size(4); ins_encode %{ // TODO: PPC port $archOpcode(ppc64Opcode_addi); @@ -14021,7 +14049,7 @@ instruct repl4S_immIminus1(iRegLdst dst, immI_minus1 src) %{ match(Set dst (ReplicateS src)); predicate(n->as_Vector()->length() == 4); - format %{ "LI $dst, -1 \t// replicate4C" %} + format %{ "LI $dst, -1 \t// replicate4S" %} size(4); ins_encode %{ // TODO: PPC port $archOpcode(ppc64Opcode_addi); @@ -14062,7 +14090,7 @@ match(Set dst (ReplicateS src)); predicate(n->as_Vector()->length() == 8); - format %{ "XXLEQV $dst, $src \t// replicate16B" %} + format %{ "XXLEQV $dst, $src \t// replicate8S" %} size(4); ins_encode %{ __ xxleqv($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister); @@ -14083,7 +14111,7 @@ instruct repl2I_immI0(iRegLdst dst, immI_0 zero) %{ match(Set dst (ReplicateI zero)); predicate(n->as_Vector()->length() == 2); - format %{ "LI $dst, #0 \t// replicate4C" %} + format %{ "LI $dst, #0 \t// replicate2I" %} size(4); ins_encode %{ // TODO: PPC port $archOpcode(ppc64Opcode_addi); @@ -14095,7 +14123,7 @@ instruct repl2I_immIminus1(iRegLdst dst, immI_minus1 src) %{ match(Set dst (ReplicateI src)); predicate(n->as_Vector()->length() == 2); - format %{ "LI $dst, -1 \t// replicate4C" %} + format %{ "LI $dst, -1 \t// replicate2I" %} size(4); ins_encode %{ // TODO: PPC port $archOpcode(ppc64Opcode_addi); @@ -14669,7 +14697,7 @@ ins_pipe(pipe_class_default); %} -instruct repl2D_immI0(vecX dst, immI_0 zero) %{ +instruct repl2D_immD0(vecX dst, immD_0 zero) %{ match(Set dst (ReplicateD zero)); predicate(n->as_Vector()->length() == 2); @@ -14681,18 +14709,6 @@ ins_pipe(pipe_class_default); %} -instruct repl2D_immIminus1(vecX dst, immI_minus1 src) %{ - match(Set dst (ReplicateD src)); - predicate(n->as_Vector()->length() == 2); - - format %{ "XXLEQV $dst, $src \t// replicate16B" %} - size(4); - ins_encode %{ - __ xxleqv($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister); - %} - ins_pipe(pipe_class_default); -%} - instruct mtvsrd(vecX dst, iRegLsrc src) %{ predicate(false); effect(DEF dst, USE src); @@ -14754,7 +14770,7 @@ match(Set dst (ReplicateL src)); predicate(n->as_Vector()->length() == 2); - format %{ "XXLEQV $dst, $src \t// replicate16B" %} + format %{ "XXLEQV $dst, $src \t// replicate2L" %} size(4); ins_encode %{ __ xxleqv($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1274,7 +1274,30 @@ // entry: c2i - c2i_entry = gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, call_interpreter, ientry); + c2i_entry = __ pc(); + + // Class initialization barrier for static methods + if (VM_Version::supports_fast_class_init_checks()) { + Label L_skip_barrier; + + { // Bypass the barrier for non-static methods + __ lwz(R0, in_bytes(Method::access_flags_offset()), R19_method); + __ andi_(R0, R0, JVM_ACC_STATIC); + __ beq(CCR0, L_skip_barrier); // non-static + } + + Register klass = R11_scratch1; + __ load_method_holder(klass, R19_method); + __ clinit_barrier(klass, R16_thread, &L_skip_barrier /*L_fast_path*/); + + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub(), R0); + __ mtctr(klass); + __ bctr(); + + __ bind(L_skip_barrier); + } + + gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, call_interpreter, ientry); return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry); } @@ -2106,6 +2129,21 @@ __ tabort_(); } + if (VM_Version::supports_fast_class_init_checks() && method->needs_clinit_barrier()) { + Label L_skip_barrier; + Register klass = r_temp_1; + // Notify OOP recorder (don't need the relocation) + AddressLiteral md = __ constant_metadata_address(method->method_holder()); + __ load_const_optimized(klass, md.value(), R0); + __ clinit_barrier(klass, R16_thread, &L_skip_barrier /*L_fast_path*/); + + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub(), R0); + __ mtctr(klass); + __ bctr(); + + __ bind(L_skip_barrier); + } + __ save_LR_CR(r_temp_1); __ generate_stack_overflow_check(frame_size_in_bytes); // Check before creating frame. __ mr(r_callers_sp, R1_SP); // Remember frame pointer. diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/ppc/templateTable_ppc_64.cpp --- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2232,7 +2232,7 @@ void TemplateTable::resolve_cache_and_index(int byte_no, Register Rcache, Register Rscratch, size_t index_size) { __ get_cache_and_index_at_bcp(Rcache, 1, index_size); - Label Lresolved, Ldone; + Label Lresolved, Ldone, L_clinit_barrier_slow; Bytecodes::Code code = bytecode(); switch (code) { @@ -2253,6 +2253,9 @@ __ cmpdi(CCR0, Rscratch, (int)code); __ beq(CCR0, Lresolved); + // Class initialization barrier slow path lands here as well. + __ bind(L_clinit_barrier_slow); + address entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_from_cache); __ li(R4_ARG2, code); __ call_VM(noreg, entry, R4_ARG2, true); @@ -2263,6 +2266,17 @@ __ bind(Lresolved); __ isync(); // Order load wrt. succeeding loads. + + // Class initialization barrier for static methods + if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) { + const Register method = Rscratch; + const Register klass = Rscratch; + + __ load_resolved_method_at_index(byte_no, Rcache, method); + __ load_method_holder(klass, method); + __ clinit_barrier(klass, R16_thread, NULL /*L_fast_path*/, &L_clinit_barrier_slow); + } + __ bind(Ldone); } @@ -2329,7 +2343,7 @@ // Already resolved. __ get_cache_and_index_at_bcp(Rcache, 1); } else { - resolve_cache_and_index(byte_no, Rcache, R0, is_invokedynamic ? sizeof(u4) : sizeof(u2)); + resolve_cache_and_index(byte_no, Rcache, /* temp */ Rmethod, is_invokedynamic ? sizeof(u4) : sizeof(u2)); } __ ld(Rmethod, method_offset, Rcache); @@ -3634,9 +3648,7 @@ // Find entry point to call. // Get declaring interface class from method - __ ld(Rinterface_klass, in_bytes(Method::const_offset()), Rmethod); - __ ld(Rinterface_klass, in_bytes(ConstMethod::constants_offset()), Rinterface_klass); - __ ld(Rinterface_klass, ConstantPool::pool_holder_offset_in_bytes(), Rinterface_klass); + __ load_method_holder(Rinterface_klass, Rmethod); // Get itable index from method __ lwa(Rindex, in_bytes(Method::itable_index_offset()), Rmethod); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/ppc/vm_version_ppc.hpp --- a/src/hotspot/cpu/ppc/vm_version_ppc.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/ppc/vm_version_ppc.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -95,6 +95,9 @@ // Override Abstract_VM_Version implementation static bool use_biased_locking(); + // PPC64 supports fast class initialization checks for static methods. + static bool supports_fast_class_init_checks() { return true; } + static bool is_determine_features_test_running() { return _is_determine_features_test_running; } // CPU instruction support static bool has_fsqrt() { return (_features & fsqrt_m) != 0; } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp --- a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -82,7 +82,18 @@ } void LIR_Assembler::clinit_barrier(ciMethod* method) { - ShouldNotReachHere(); // not implemented + assert(!method->holder()->is_not_initialized(), "initialization should have been started"); + + Label L_skip_barrier; + Register klass = Z_R1_scratch; + + metadata2reg(method->holder()->constant_encoding(), klass); + __ clinit_barrier(klass, Z_thread, &L_skip_barrier /*L_fast_path*/); + + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub()); + __ z_br(klass); + + __ bind(L_skip_barrier); } void LIR_Assembler::osr_entry() { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/interp_masm_s390.cpp --- a/src/hotspot/cpu/s390/interp_masm_s390.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/interp_masm_s390.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016, 2018 SAP SE. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019 SAP SE. 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 @@ -414,6 +414,19 @@ BLOCK_COMMENT("}"); } +void InterpreterMacroAssembler::load_resolved_method_at_index(int byte_no, + Register cache, + Register cpe_offset, + Register method) { + const int method_offset = in_bytes( + ConstantPoolCache::base_offset() + + ((byte_no == TemplateTable::f2_byte) + ? ConstantPoolCacheEntry::f2_offset() + : ConstantPoolCacheEntry::f1_offset())); + + z_lg(method, Address(cache, cpe_offset, method_offset)); // get f1 Method* +} + // Generate a subtype check: branch to ok_is_subtype if sub_klass is // a subtype of super_klass. Blows registers Rsuper_klass, Rsub_klass, tmp1, tmp2. void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, @@ -2175,7 +2188,7 @@ Register R_f1_sender_sp = tmp1; Register R_f2_sp = tmp2; - // Tirst check the for the interpreter frame's magic. + // First check for the interpreter frame's magic. asm_assert_ijava_state_magic(R_f2_sp/*tmp*/); z_lg(R_f2_sp, _z_parent_ijava_frame_abi(callers_sp), Z_fp); z_lg(R_f1_sender_sp, _z_ijava_state_neg(sender_sp), Z_fp); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/interp_masm_s390.hpp --- a/src/hotspot/cpu/s390/interp_masm_s390.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/interp_masm_s390.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -120,6 +120,8 @@ // load cpool->resolved_klass_at(index) void load_resolved_klass_at_offset(Register cpool, Register offset, Register iklass); + void load_resolved_method_at_index(int byte_no, Register cache, Register cpe_offset, Register method); + // Pop topmost element from stack. It just disappears. Useful if // consumed previously by access via stackTop(). void popx(int len); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/macroAssembler_s390.cpp --- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016, 2018, SAP SE. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, SAP SE. 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 @@ -3130,6 +3130,33 @@ BLOCK_COMMENT("} check_klass_subtype"); } +void MacroAssembler::clinit_barrier(Register klass, Register thread, Label* L_fast_path, Label* L_slow_path) { + assert(L_fast_path != NULL || L_slow_path != NULL, "at least one is required"); + + Label L_fallthrough; + if (L_fast_path == NULL) { + L_fast_path = &L_fallthrough; + } else if (L_slow_path == NULL) { + L_slow_path = &L_fallthrough; + } + + // Fast path check: class is fully initialized + z_cli(Address(klass, InstanceKlass::init_state_offset()), InstanceKlass::fully_initialized); + z_bre(*L_fast_path); + + // Fast path check: current thread is initializer thread + z_cg(thread, Address(klass, InstanceKlass::init_thread_offset())); + if (L_slow_path == &L_fallthrough) { + z_bre(*L_fast_path); + } else if (L_fast_path == &L_fallthrough) { + z_brne(*L_slow_path); + } else { + Unimplemented(); + } + + bind(L_fallthrough); +} + // Increment a counter at counter_address when the eq condition code is // set. Kills registers tmp1_reg and tmp2_reg and preserves the condition code. void MacroAssembler::increment_counter_eq(address counter_address, Register tmp1_reg, Register tmp2_reg) { @@ -4339,14 +4366,19 @@ z_lg(result, 0, result); } -void MacroAssembler::load_mirror(Register mirror, Register method) { - mem2reg_opt(mirror, Address(method, Method::const_offset())); - mem2reg_opt(mirror, Address(mirror, ConstMethod::constants_offset())); +void MacroAssembler::load_mirror_from_const_method(Register mirror, Register const_method) { + mem2reg_opt(mirror, Address(const_method, ConstMethod::constants_offset())); mem2reg_opt(mirror, Address(mirror, ConstantPool::pool_holder_offset_in_bytes())); mem2reg_opt(mirror, Address(mirror, Klass::java_mirror_offset())); resolve_oop_handle(mirror); } +void MacroAssembler::load_method_holder(Register holder, Register method) { + mem2reg_opt(holder, Address(method, Method::const_offset())); + mem2reg_opt(holder, Address(holder, ConstMethod::constants_offset())); + mem2reg_opt(holder, Address(holder, ConstantPool::pool_holder_offset_in_bytes())); +} + //--------------------------------------------------------------- //--- Operations on arrays. //--------------------------------------------------------------- diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/macroAssembler_s390.hpp --- a/src/hotspot/cpu/s390/macroAssembler_s390.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/macroAssembler_s390.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016, 2018, SAP SE. All rights reserved. + * Copyright (c) 2016, 2019, SAP SE. 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 @@ -713,6 +713,11 @@ Register temp2_reg, Label& L_success); + void clinit_barrier(Register klass, + Register thread, + Label* L_fast_path = NULL, + Label* L_slow_path = NULL); + // Increment a counter at counter_address when the eq condition code is set. // Kills registers tmp1_reg and tmp2_reg and preserves the condition code. void increment_counter_eq(address counter_address, Register tmp1_reg, Register tmp2_reg); @@ -823,7 +828,8 @@ Register Rbase = Z_R1, int pow2_offset = -1); void resolve_oop_handle(Register result); - void load_mirror(Register mirror, Register method); + void load_mirror_from_const_method(Register mirror, Register const_method); + void load_method_holder(Register holder, Register method); //-------------------------- //--- Operations on arrays. diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/s390.ad --- a/src/hotspot/cpu/s390/s390.ad Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/s390.ad Fri Jun 21 14:07:48 2019 +0530 @@ -867,6 +867,23 @@ assert(framesize % wordSize == 0, "must preserve wordSize alignment"); + if (C->clinit_barrier_on_entry()) { + assert(!C->method()->holder()->is_not_initialized(), "initialization should have been started"); + + Label L_skip_barrier; + Register klass = Z_R1_scratch; + + // Notify OOP recorder (don't need the relocation) + AddressLiteral md = __ constant_metadata_address(C->method()->holder()->constant_encoding()); + __ load_const_optimized(klass, md.value()); + __ clinit_barrier(klass, Z_thread, &L_skip_barrier /*L_fast_path*/); + + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub()); + __ z_br(klass); + + __ bind(L_skip_barrier); + } + // Calls to C2R adapters often do not accept exceptional returns. // We require that their callers must bang for them. But be // careful, because some VM calls (such as call site linkage) can diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/sharedRuntime_s390.cpp --- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1832,6 +1832,20 @@ //--------------------------------------------------------------------- wrapper_VEPStart = __ offset(); + if (VM_Version::supports_fast_class_init_checks() && method->needs_clinit_barrier()) { + Label L_skip_barrier; + Register klass = Z_R1_scratch; + // Notify OOP recorder (don't need the relocation) + AddressLiteral md = __ constant_metadata_address(method->method_holder()); + __ load_const_optimized(klass, md.value()); + __ clinit_barrier(klass, Z_thread, &L_skip_barrier /*L_fast_path*/); + + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub()); + __ z_br(klass); + + __ bind(L_skip_barrier); + } + __ save_return_pc(); __ generate_stack_overflow_check(frame_size_in_bytes); // Check before creating frame. #ifndef USE_RESIZE_FRAME @@ -2696,8 +2710,28 @@ // Fallthru to VEP. Duplicate LTG, but saved taken branch. } - address c2i_entry; - c2i_entry = gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup); + address c2i_entry = __ pc(); + + // Class initialization barrier for static methods + if (VM_Version::supports_fast_class_init_checks()) { + Label L_skip_barrier; + + { // Bypass the barrier for non-static methods + __ testbit(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT); + __ z_bfalse(L_skip_barrier); // non-static + } + + Register klass = Z_R11; + __ load_method_holder(klass, Z_method); + __ clinit_barrier(klass, Z_thread, &L_skip_barrier /*L_fast_path*/); + + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub()); + __ z_br(klass); + + __ bind(L_skip_barrier); + } + + gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup); return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp --- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016, 2018, SAP SE. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, SAP SE. 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 @@ -821,7 +821,7 @@ const int page_size = os::vm_page_size(); NearLabel after_frame_check; - BLOCK_COMMENT("counter_overflow {"); + BLOCK_COMMENT("stack_overflow_check {"); assert_different_registers(frame_size, tmp1); @@ -883,7 +883,7 @@ // If you get to here, then there is enough stack space. __ bind(after_frame_check); - BLOCK_COMMENT("} counter_overflow"); + BLOCK_COMMENT("} stack_overflow_check"); } // Allocate monitor and lock method (asm interpreter). @@ -927,7 +927,9 @@ __ bind(static_method); // Lock the java mirror. - __ load_mirror(object, method); + // Load mirror from interpreter frame. + __ z_lg(object, _z_ijava_state_neg(mirror), Z_fp); + #ifdef ASSERT { NearLabel L; @@ -991,20 +993,20 @@ // Allocate space for locals other than the parameters, the // interpreter state, monitors, and the expression stack. - const Register local_count = Z_ARG5; - const Register fp = Z_tmp_2; + const Register local_count = Z_ARG5; + const Register fp = Z_tmp_2; + const Register const_method = Z_ARG1; BLOCK_COMMENT("generate_fixed_frame {"); - { // local registers const Register top_frame_size = Z_ARG2; const Register sp_after_resize = Z_ARG3; const Register max_stack = Z_ARG4; - // local_count = method->constMethod->max_locals(); - __ z_lg(Z_R1_scratch, Address(Z_method, Method::const_offset())); - __ z_llgh(local_count, Address(Z_R1_scratch, ConstMethod::size_of_locals_offset())); + __ z_lg(const_method, Address(Z_method, Method::const_offset())); + __ z_llgh(max_stack, Address(const_method, ConstMethod::size_of_parameters_offset())); + __ z_sllg(Z_locals /*parameter_count bytes*/, max_stack /*parameter_count*/, LogBytesPerWord); if (native_call) { // If we're calling a native method, we replace max_stack (which is @@ -1024,9 +1026,6 @@ // area, so we need to allocate at least that much even though we're // going to throw it away. // - - __ z_lg(Z_R1_scratch, Address(Z_method, Method::const_offset())); - __ z_llgh(max_stack, Address(Z_R1_scratch, ConstMethod::size_of_parameters_offset())); __ add2reg(max_stack, 2); NearLabel passing_args_on_stack; @@ -1042,14 +1041,14 @@ __ bind(passing_args_on_stack); } else { // !native_call - __ z_lg(max_stack, method_(const)); + // local_count = method->constMethod->max_locals(); + __ z_llgh(local_count, Address(const_method, ConstMethod::size_of_locals_offset())); // Calculate number of non-parameter locals (in slots): - __ z_lg(Z_R1_scratch, Address(Z_method, Method::const_offset())); - __ z_sh(local_count, Address(Z_R1_scratch, ConstMethod::size_of_parameters_offset())); + __ z_sgr(local_count, max_stack); // max_stack = method->max_stack(); - __ z_llgh(max_stack, Address(max_stack, ConstMethod::max_stack_offset())); + __ z_llgh(max_stack, Address(const_method, ConstMethod::max_stack_offset())); // max_stack in bytes __ z_sllg(max_stack, max_stack, LogBytesPerWord); } @@ -1089,14 +1088,15 @@ // delta = PARENT_IJAVA_FRAME_ABI + (locals_count - params_count) __ add2reg(sp_after_resize, (Interpreter::stackElementSize) - (frame::z_parent_ijava_frame_abi_size), Z_esp); - __ z_sllg(Z_R0_scratch, local_count, LogBytesPerWord); // Params have already been subtracted from local_count. - __ z_slgr(sp_after_resize, Z_R0_scratch); + if (!native_call) { + __ z_sllg(Z_R0_scratch, local_count, LogBytesPerWord); // Params have already been subtracted from local_count. + __ z_slgr(sp_after_resize, Z_R0_scratch); + } // top_frame_size = TOP_IJAVA_FRAME_ABI + max_stack + size of interpreter state __ add2reg(top_frame_size, frame::z_top_ijava_frame_abi_size + - frame::z_ijava_state_size + - frame::interpreter_frame_monitor_size() * wordSize, + frame::z_ijava_state_size, max_stack); if (!native_call) { @@ -1104,7 +1104,7 @@ // Native calls don't need the stack size check since they have no // expression stack and the arguments are already on the stack and // we only add a handful of words to the stack. - Register frame_size = max_stack; // Reuse the regiser for max_stack. + Register frame_size = max_stack; // Reuse the register for max_stack. __ z_lgr(frame_size, Z_SP); __ z_sgr(frame_size, sp_after_resize); __ z_agr(frame_size, top_frame_size); @@ -1136,13 +1136,12 @@ #endif // Save sender SP from F1 (i.e. before it was potentially modified by an - // adapter) into F0's interpreter state. We us it as well to revert + // adapter) into F0's interpreter state. We use it as well to revert // resizing the frame above. __ z_stg(Z_R10, _z_ijava_state_neg(sender_sp), fp); - // Load cp cache and save it at the and of this block. - __ z_lg(Z_R1_scratch, Address(Z_method, Method::const_offset())); - __ z_lg(Z_R1_scratch, Address(Z_R1_scratch, ConstMethod::constants_offset())); + // Load cp cache and save it at the end of this block. + __ z_lg(Z_R1_scratch, Address(const_method, ConstMethod::constants_offset())); __ z_lg(Z_R1_scratch, Address(Z_R1_scratch, ConstantPool::cache_offset_in_bytes())); // z_ijava_state->method = method; @@ -1152,10 +1151,6 @@ // parameters on top of caller's expression stack. // Tos points past last Java argument. - __ z_lg(Z_locals, Address(Z_method, Method::const_offset())); - __ z_llgh(Z_locals /*parameter_count words*/, - Address(Z_locals, ConstMethod::size_of_parameters_offset())); - __ z_sllg(Z_locals /*parameter_count bytes*/, Z_locals /*parameter_count*/, LogBytesPerWord); __ z_agr(Z_locals, Z_esp); // z_ijava_state->locals - i*BytesPerWord points to i-th Java local (i starts at 0) // z_ijava_state->locals = Z_esp + parameter_count bytes @@ -1183,8 +1178,7 @@ if (native_call) { __ clear_reg(Z_bcp); // Must initialize. Will get written into frame where GC reads it. } else { - __ z_lg(Z_bcp, method_(const)); - __ add2reg(Z_bcp, in_bytes(ConstMethod::codes_offset())); + __ add2reg(Z_bcp, in_bytes(ConstMethod::codes_offset()), const_method); } __ z_stg(Z_bcp, _z_ijava_state_neg(bcp), fp); @@ -1202,62 +1196,21 @@ __ z_stg(Z_R1_scratch, _z_ijava_state_neg(cpoolCache), fp); // Get mirror and store it in the frame as GC root for this Method*. - __ load_mirror(Z_R1_scratch, Z_method); + __ load_mirror_from_const_method(Z_R1_scratch, const_method); __ z_stg(Z_R1_scratch, _z_ijava_state_neg(mirror), fp); BLOCK_COMMENT("} generate_fixed_frame: initialize interpreter state"); //============================================================================= if (!native_call) { - // Fill locals with 0x0s. - NearLabel locals_zeroed; - NearLabel doXC; - // Local_count is already num_locals_slots - num_param_slots. - __ compare64_and_branch(local_count, (intptr_t)0L, Assembler::bcondNotHigh, locals_zeroed); - - // Advance local_addr to point behind locals (creates positive incr. in loop). - __ z_lg(Z_R1_scratch, Address(Z_method, Method::const_offset())); - __ z_llgh(Z_R0_scratch, Address(Z_R1_scratch, ConstMethod::size_of_locals_offset())); - __ add2reg(Z_R0_scratch, -1); - - __ z_lgr(local_addr/*locals*/, Z_locals); + // Start of locals: local_addr = Z_locals - locals size + 1 slot + __ z_llgh(Z_R0_scratch, Address(const_method, ConstMethod::size_of_locals_offset())); + __ add2reg(local_addr, BytesPerWord, Z_locals); __ z_sllg(Z_R0_scratch, Z_R0_scratch, LogBytesPerWord); - __ z_sllg(local_count, local_count, LogBytesPerWord); // Local_count are non param locals. __ z_sgr(local_addr, Z_R0_scratch); - if (VM_Version::has_Prefetch()) { - __ z_pfd(0x02, 0, Z_R0, local_addr); - __ z_pfd(0x02, 256, Z_R0, local_addr); - } - - // Can't optimise for Z10 using "compare and branch" (immediate value is too big). - __ z_cghi(local_count, 256); - __ z_brnh(doXC); - - // MVCLE: Initialize if quite a lot locals. - // __ bind(doMVCLE); - __ z_lgr(Z_R0_scratch, local_addr); - __ z_lgr(Z_R1_scratch, local_count); - __ clear_reg(Z_ARG2); // Src len of MVCLE is zero. - - __ MacroAssembler::move_long_ext(Z_R0_scratch, Z_ARG1, 0); - __ z_bru(locals_zeroed); - - Label XC_template; - __ bind(XC_template); - __ z_xc(0, 0, local_addr, 0, local_addr); - - __ bind(doXC); - __ z_bctgr(local_count, Z_R0); // Get #bytes-1 for EXECUTE. - if (VM_Version::has_ExecuteExtensions()) { - __ z_exrl(local_count, XC_template); // Execute XC with variable length. - } else { - __ z_larl(Z_R1_scratch, XC_template); - __ z_ex(local_count, 0, Z_R0, Z_R1_scratch); // Execute XC with variable length. - } - - __ bind(locals_zeroed); + __ Clear_Array(local_count, local_addr, Z_ARG2); } } @@ -1530,8 +1483,8 @@ Label method_is_not_static; __ testbit(method2_(Rmethod, access_flags), JVM_ACC_STATIC_BIT); __ z_bfalse(method_is_not_static); - // Get mirror. - __ load_mirror(Z_R1, Rmethod); + // Load mirror from interpreter frame. + __ z_lg(Z_R1, _z_ijava_state_neg(mirror), Z_fp); // z_ijava_state.oop_temp = pool_holder->klass_part()->java_mirror(); __ z_stg(Z_R1, oop_tmp_offset, Z_fp); // Pass handle to mirror as 2nd argument to JNI method. diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/templateTable_s390.cpp --- a/src/hotspot/cpu/s390/templateTable_s390.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/templateTable_s390.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2404,14 +2404,14 @@ // NOTE: Cpe_offset is already computed as byte offset, so we must not // shift it afterwards! void TemplateTable::resolve_cache_and_index(int byte_no, - Register Rcache, + Register cache, Register cpe_offset, size_t index_size) { BLOCK_COMMENT("resolve_cache_and_index {"); - NearLabel resolved; + NearLabel resolved, clinit_barrier_slow; const Register bytecode_in_cpcache = Z_R1_scratch; const int total_f1_offset = in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::f1_offset()); - assert_different_registers(Rcache, cpe_offset, bytecode_in_cpcache); + assert_different_registers(cache, cpe_offset, bytecode_in_cpcache); Bytecodes::Code code = bytecode(); switch (code) { @@ -2423,19 +2423,32 @@ { assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range"); - __ get_cache_and_index_and_bytecode_at_bcp(Rcache, cpe_offset, bytecode_in_cpcache, byte_no, 1, index_size); + __ get_cache_and_index_and_bytecode_at_bcp(cache, cpe_offset, bytecode_in_cpcache, byte_no, 1, index_size); // Have we resolved this bytecode? __ compare32_and_branch(bytecode_in_cpcache, (int)code, Assembler::bcondEqual, resolved); } // Resolve first time through. + // Class initialization barrier slow path lands here as well. + __ bind(clinit_barrier_slow); address entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_from_cache); __ load_const_optimized(Z_ARG2, (int) code); __ call_VM(noreg, entry, Z_ARG2); // Update registers with resolved info. - __ get_cache_and_index_at_bcp(Rcache, cpe_offset, 1, index_size); + __ get_cache_and_index_at_bcp(cache, cpe_offset, 1, index_size); __ bind(resolved); + + // Class initialization barrier for static methods + if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) { + const Register method = Z_R1_scratch; + const Register klass = Z_R1_scratch; + + __ load_resolved_method_at_index(byte_no, cache, cpe_offset, method); + __ load_method_holder(klass, method); + __ clinit_barrier(klass, Z_thread, NULL /*L_fast_path*/, &clinit_barrier_slow); + } + BLOCK_COMMENT("} resolve_cache_and_index"); } @@ -3664,9 +3677,7 @@ // Find entry point to call. // Get declaring interface class from method - __ z_lg(interface, Address(method, Method::const_offset())); - __ z_lg(interface, Address(interface, ConstMethod::constants_offset())); - __ z_lg(interface, Address(interface, ConstantPool::pool_holder_offset_in_bytes())); + __ load_method_holder(interface, method); // Get itable index from method Register index = receiver, diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/cpu/s390/vm_version_s390.hpp --- a/src/hotspot/cpu/s390/vm_version_s390.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/cpu/s390/vm_version_s390.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -349,6 +349,9 @@ // Override Abstract_VM_Version implementation static void print_platform_virtualization_info(outputStream*); + // s390 supports fast class initialization checks for static methods. + static bool supports_fast_class_init_checks() { return true; } + // CPU feature query functions static const char* get_model_string() { return _model_string; } static bool has_StoreFacilityListExtended() { return (_features[0] & StoreFacilityListExtendedMask) == StoreFacilityListExtendedMask; } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os/bsd/os_bsd.cpp --- a/src/hotspot/os/bsd/os_bsd.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/os/bsd/os_bsd.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2189,11 +2189,6 @@ // available (and not reserved for something else). char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) { - const int max_tries = 10; - char* base[max_tries]; - size_t size[max_tries]; - const size_t gap = 0x000000; - // Assert only that the size is a multiple of the page size, since // that's all that mmap requires, and since that's all we really know // about at this low abstraction level. If we need higher alignment, @@ -2216,50 +2211,7 @@ anon_munmap(addr, bytes); } - int i; - for (i = 0; i < max_tries; ++i) { - base[i] = reserve_memory(bytes); - - if (base[i] != NULL) { - // Is this the block we wanted? - if (base[i] == requested_addr) { - size[i] = bytes; - break; - } - - // Does this overlap the block we wanted? Give back the overlapped - // parts and try again. - - size_t top_overlap = requested_addr + (bytes + gap) - base[i]; - if (top_overlap >= 0 && top_overlap < bytes) { - unmap_memory(base[i], top_overlap); - base[i] += top_overlap; - size[i] = bytes - top_overlap; - } else { - size_t bottom_overlap = base[i] + bytes - requested_addr; - if (bottom_overlap >= 0 && bottom_overlap < bytes) { - unmap_memory(requested_addr, bottom_overlap); - size[i] = bytes - bottom_overlap; - } else { - size[i] = bytes; - } - } - } - } - - // Give back the unused reserved pieces. - - for (int j = 0; j < i; ++j) { - if (base[j] != NULL) { - unmap_memory(base[j], size[j]); - } - } - - if (i < max_tries) { - return requested_addr; - } else { - return NULL; - } + return NULL; } // Sleep forever; naked call to OS-specific sleep; use with CAUTION diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os/linux/os_linux.cpp --- a/src/hotspot/os/linux/os_linux.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/os/linux/os_linux.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -4105,11 +4105,6 @@ // available (and not reserved for something else). char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) { - const int max_tries = 10; - char* base[max_tries]; - size_t size[max_tries]; - const size_t gap = 0x000000; - // Assert only that the size is a multiple of the page size, since // that's all that mmap requires, and since that's all we really know // about at this low abstraction level. If we need higher alignment, @@ -4132,50 +4127,7 @@ anon_munmap(addr, bytes); } - int i; - for (i = 0; i < max_tries; ++i) { - base[i] = reserve_memory(bytes); - - if (base[i] != NULL) { - // Is this the block we wanted? - if (base[i] == requested_addr) { - size[i] = bytes; - break; - } - - // Does this overlap the block we wanted? Give back the overlapped - // parts and try again. - - ptrdiff_t top_overlap = requested_addr + (bytes + gap) - base[i]; - if (top_overlap >= 0 && (size_t)top_overlap < bytes) { - unmap_memory(base[i], top_overlap); - base[i] += top_overlap; - size[i] = bytes - top_overlap; - } else { - ptrdiff_t bottom_overlap = base[i] + bytes - requested_addr; - if (bottom_overlap >= 0 && (size_t)bottom_overlap < bytes) { - unmap_memory(requested_addr, bottom_overlap); - size[i] = bytes - bottom_overlap; - } else { - size[i] = bytes; - } - } - } - } - - // Give back the unused reserved pieces. - - for (int j = 0; j < i; ++j) { - if (base[j] != NULL) { - unmap_memory(base[j], size[j]); - } - } - - if (i < max_tries) { - return requested_addr; - } else { - return NULL; - } + return NULL; } // Sleep forever; naked call to OS-specific sleep; use with CAUTION diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os/linux/perfMemory_linux.cpp --- a/src/hotspot/os/linux/perfMemory_linux.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/os/linux/perfMemory_linux.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -661,7 +661,7 @@ if (fp) { int pid, nspid; int ret; - while (!feof(fp)) { + while (!feof(fp) && !ferror(fp)) { ret = fscanf(fp, "NSpid: %d %d", &pid, &nspid); if (ret == 1) { break; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os/solaris/os_solaris.cpp --- a/src/hotspot/os/solaris/os_solaris.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/os/solaris/os_solaris.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2553,17 +2553,6 @@ // available (and not reserved for something else). char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) { - const int max_tries = 10; - char* base[max_tries]; - size_t size[max_tries]; - - // Solaris adds a gap between mmap'ed regions. The size of the gap - // is dependent on the requested size and the MMU. Our initial gap - // value here is just a guess and will be corrected later. - bool had_top_overlap = false; - bool have_adjusted_gap = false; - size_t gap = 0x400000; - // Assert only that the size is a multiple of the page size, since // that's all that mmap requires, and since that's all we really know // about at this low abstraction level. If we need higher alignment, @@ -2572,105 +2561,18 @@ assert(bytes % os::vm_page_size() == 0, "reserving unexpected size block"); // Since snv_84, Solaris attempts to honor the address hint - see 5003415. - // Give it a try, if the kernel honors the hint we can return immediately. char* addr = Solaris::anon_mmap(requested_addr, bytes, 0, false); volatile int err = errno; if (addr == requested_addr) { return addr; - } else if (addr != NULL) { + } + + if (addr != NULL) { pd_unmap_memory(addr, bytes); } - if (log_is_enabled(Warning, os)) { - char buf[256]; - buf[0] = '\0'; - if (addr == NULL) { - jio_snprintf(buf, sizeof(buf), ": %s", os::strerror(err)); - } - log_info(os)("attempt_reserve_memory_at: couldn't reserve " SIZE_FORMAT " bytes at " - PTR_FORMAT ": reserve_memory_helper returned " PTR_FORMAT - "%s", bytes, requested_addr, addr, buf); - } - - // Address hint method didn't work. Fall back to the old method. - // In theory, once SNV becomes our oldest supported platform, this - // code will no longer be needed. - // - // Repeatedly allocate blocks until the block is allocated at the - // right spot. Give up after max_tries. - int i; - for (i = 0; i < max_tries; ++i) { - base[i] = reserve_memory(bytes); - - if (base[i] != NULL) { - // Is this the block we wanted? - if (base[i] == requested_addr) { - size[i] = bytes; - break; - } - - // check that the gap value is right - if (had_top_overlap && !have_adjusted_gap) { - size_t actual_gap = base[i-1] - base[i] - bytes; - if (gap != actual_gap) { - // adjust the gap value and retry the last 2 allocations - assert(i > 0, "gap adjustment code problem"); - have_adjusted_gap = true; // adjust the gap only once, just in case - gap = actual_gap; - log_info(os)("attempt_reserve_memory_at: adjusted gap to 0x%lx", gap); - unmap_memory(base[i], bytes); - unmap_memory(base[i-1], size[i-1]); - i-=2; - continue; - } - } - - // Does this overlap the block we wanted? Give back the overlapped - // parts and try again. - // - // There is still a bug in this code: if top_overlap == bytes, - // the overlap is offset from requested region by the value of gap. - // In this case giving back the overlapped part will not work, - // because we'll give back the entire block at base[i] and - // therefore the subsequent allocation will not generate a new gap. - // This could be fixed with a new algorithm that used larger - // or variable size chunks to find the requested region - - // but such a change would introduce additional complications. - // It's rare enough that the planets align for this bug, - // so we'll just wait for a fix for 6204603/5003415 which - // will provide a mmap flag to allow us to avoid this business. - - size_t top_overlap = requested_addr + (bytes + gap) - base[i]; - if (top_overlap >= 0 && top_overlap < bytes) { - had_top_overlap = true; - unmap_memory(base[i], top_overlap); - base[i] += top_overlap; - size[i] = bytes - top_overlap; - } else { - size_t bottom_overlap = base[i] + bytes - requested_addr; - if (bottom_overlap >= 0 && bottom_overlap < bytes) { - if (bottom_overlap == 0) { - log_info(os)("attempt_reserve_memory_at: possible alignment bug"); - } - unmap_memory(requested_addr, bottom_overlap); - size[i] = bytes - bottom_overlap; - } else { - size[i] = bytes; - } - } - } - } - - // Give back the unused reserved pieces. - - for (int j = 0; j < i; ++j) { - if (base[j] != NULL) { - unmap_memory(base[j], size[j]); - } - } - - return (i < max_tries) ? requested_addr : NULL; + return NULL; } bool os::pd_release_memory(char* addr, size_t bytes) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp --- a/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -40,7 +40,9 @@ { template D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const { - return __sync_add_and_fetch(dest, add_value); + D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELEASE); + FULL_MEM_BARRIER; + return res; } }; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.s --- a/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.s Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.s Fri Jun 21 14:07:48 2019 +0530 @@ -159,7 +159,7 @@ blo bwd_copy_drain bwd_copy_again: - prfm pldl1keep, [s, #-256] + prfum pldl1keep, [s, #-256] stp t0, t1, [d, #-16] ldp t0, t1, [s, #-16] stp t2, t3, [d, #-32] diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/gc/z/zArguments_linux_aarch64.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/os_cpu/linux_aarch64/gc/z/zArguments_linux_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018, 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. + */ + +#include "precompiled.hpp" +#include "gc/z/zArguments.hpp" +#include "runtime/globals.hpp" +#include "runtime/globals_extension.hpp" +#include "utilities/debug.hpp" + +void ZArguments::initialize_platform() { + // Disable class unloading - we don't support concurrent class unloading yet. + FLAG_SET_DEFAULT(ClassUnloading, false); + FLAG_SET_DEFAULT(ClassUnloadingWithConcurrentMark, false); +} diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/gc/z/zBackingFile_linux_aarch64.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/os_cpu/linux_aarch64/gc/z/zBackingFile_linux_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,590 @@ +/* + * Copyright (c) 2015, 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. + */ + +#include "precompiled.hpp" +#include "gc/z/zArray.inline.hpp" +#include "gc/z/zBackingFile_linux_aarch64.hpp" +#include "gc/z/zBackingPath_linux_aarch64.hpp" +#include "gc/z/zErrno.hpp" +#include "gc/z/zGlobals.hpp" +#include "gc/z/zLargePages.inline.hpp" +#include "logging/log.hpp" +#include "runtime/init.hpp" +#include "runtime/os.hpp" +#include "utilities/align.hpp" +#include "utilities/debug.hpp" + +#include +#include +#include +#include +#include +#include +#include + +// +// Support for building on older Linux systems +// + +// System calls +#ifndef SYS_fallocate +#define SYS_fallocate 47 +#endif +#ifndef SYS_memfd_create +#define SYS_memfd_create 279 +#endif + +// memfd_create(2) flags +#ifndef MFD_CLOEXEC +#define MFD_CLOEXEC 0x0001U +#endif +#ifndef MFD_HUGETLB +#define MFD_HUGETLB 0x0004U +#endif + +// open(2) flags +#ifndef O_CLOEXEC +#define O_CLOEXEC 02000000 +#endif +#ifndef O_TMPFILE +#define O_TMPFILE (020000000 | O_DIRECTORY) +#endif + +// fallocate(2) flags +#ifndef FALLOC_FL_KEEP_SIZE +#define FALLOC_FL_KEEP_SIZE 0x01 +#endif +#ifndef FALLOC_FL_PUNCH_HOLE +#define FALLOC_FL_PUNCH_HOLE 0x02 +#endif + +// Filesystem types, see statfs(2) +#ifndef TMPFS_MAGIC +#define TMPFS_MAGIC 0x01021994 +#endif +#ifndef HUGETLBFS_MAGIC +#define HUGETLBFS_MAGIC 0x958458f6 +#endif + +// Filesystem names +#define ZFILESYSTEM_TMPFS "tmpfs" +#define ZFILESYSTEM_HUGETLBFS "hugetlbfs" + +// Sysfs file for transparent huge page on tmpfs +#define ZFILENAME_SHMEM_ENABLED "/sys/kernel/mm/transparent_hugepage/shmem_enabled" + +// Java heap filename +#define ZFILENAME_HEAP "java_heap" + +// Preferred tmpfs mount points, ordered by priority +static const char* z_preferred_tmpfs_mountpoints[] = { + "/dev/shm", + "/run/shm", + NULL +}; + +// Preferred hugetlbfs mount points, ordered by priority +static const char* z_preferred_hugetlbfs_mountpoints[] = { + "/dev/hugepages", + "/hugepages", + NULL +}; + +static int z_fallocate_hugetlbfs_attempts = 3; +static bool z_fallocate_supported = true; + +static int z_fallocate(int fd, int mode, size_t offset, size_t length) { + return syscall(SYS_fallocate, fd, mode, offset, length); +} + +static int z_memfd_create(const char *name, unsigned int flags) { + return syscall(SYS_memfd_create, name, flags); +} + +ZBackingFile::ZBackingFile() : + _fd(-1), + _size(0), + _filesystem(0), + _block_size(0), + _available(0), + _initialized(false) { + + // Create backing file + _fd = create_fd(ZFILENAME_HEAP); + if (_fd == -1) { + return; + } + + // Get filesystem statistics + struct statfs buf; + if (fstatfs(_fd, &buf) == -1) { + ZErrno err; + log_error(gc)("Failed to determine filesystem type for backing file (%s)", err.to_string()); + return; + } + + _filesystem = buf.f_type; + _block_size = buf.f_bsize; + _available = buf.f_bavail * _block_size; + + // Make sure we're on a supported filesystem + if (!is_tmpfs() && !is_hugetlbfs()) { + log_error(gc)("Backing file must be located on a %s or a %s filesystem", + ZFILESYSTEM_TMPFS, ZFILESYSTEM_HUGETLBFS); + return; + } + + // Make sure the filesystem type matches requested large page type + if (ZLargePages::is_transparent() && !is_tmpfs()) { + log_error(gc)("-XX:+UseTransparentHugePages can only be enable when using a %s filesystem", + ZFILESYSTEM_TMPFS); + return; + } + + if (ZLargePages::is_transparent() && !tmpfs_supports_transparent_huge_pages()) { + log_error(gc)("-XX:+UseTransparentHugePages on a %s filesystem not supported by kernel", + ZFILESYSTEM_TMPFS); + return; + } + + if (ZLargePages::is_explicit() && !is_hugetlbfs()) { + log_error(gc)("-XX:+UseLargePages (without -XX:+UseTransparentHugePages) can only be enabled " + "when using a %s filesystem", ZFILESYSTEM_HUGETLBFS); + return; + } + + if (!ZLargePages::is_explicit() && is_hugetlbfs()) { + log_error(gc)("-XX:+UseLargePages must be enabled when using a %s filesystem", + ZFILESYSTEM_HUGETLBFS); + return; + } + + const size_t expected_block_size = is_tmpfs() ? os::vm_page_size() : os::large_page_size(); + if (expected_block_size != _block_size) { + log_error(gc)("%s filesystem has unexpected block size " SIZE_FORMAT " (expected " SIZE_FORMAT ")", + is_tmpfs() ? ZFILESYSTEM_TMPFS : ZFILESYSTEM_HUGETLBFS, _block_size, expected_block_size); + return; + } + + // Successfully initialized + _initialized = true; +} + +int ZBackingFile::create_mem_fd(const char* name) const { + // Create file name + char filename[PATH_MAX]; + snprintf(filename, sizeof(filename), "%s%s", name, ZLargePages::is_explicit() ? ".hugetlb" : ""); + + // Create file + const int extra_flags = ZLargePages::is_explicit() ? MFD_HUGETLB : 0; + const int fd = z_memfd_create(filename, MFD_CLOEXEC | extra_flags); + if (fd == -1) { + ZErrno err; + log_debug(gc, init)("Failed to create memfd file (%s)", + ((ZLargePages::is_explicit() && err == EINVAL) ? "Hugepages not supported" : err.to_string())); + return -1; + } + + log_info(gc, init)("Heap backed by file: /memfd:%s", filename); + + return fd; +} + +int ZBackingFile::create_file_fd(const char* name) const { + const char* const filesystem = ZLargePages::is_explicit() + ? ZFILESYSTEM_HUGETLBFS + : ZFILESYSTEM_TMPFS; + const char** const preferred_mountpoints = ZLargePages::is_explicit() + ? z_preferred_hugetlbfs_mountpoints + : z_preferred_tmpfs_mountpoints; + + // Find mountpoint + ZBackingPath path(filesystem, preferred_mountpoints); + if (path.get() == NULL) { + log_error(gc)("Use -XX:ZPath to specify the path to a %s filesystem", filesystem); + return -1; + } + + // Try to create an anonymous file using the O_TMPFILE flag. Note that this + // flag requires kernel >= 3.11. If this fails we fall back to open/unlink. + const int fd_anon = os::open(path.get(), O_TMPFILE|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); + if (fd_anon == -1) { + ZErrno err; + log_debug(gc, init)("Failed to create anonymous file in %s (%s)", path.get(), + (err == EINVAL ? "Not supported" : err.to_string())); + } else { + // Get inode number for anonymous file + struct stat stat_buf; + if (fstat(fd_anon, &stat_buf) == -1) { + ZErrno err; + log_error(gc)("Failed to determine inode number for anonymous file (%s)", err.to_string()); + return -1; + } + + log_info(gc, init)("Heap backed by file: %s/#" UINT64_FORMAT, path.get(), (uint64_t)stat_buf.st_ino); + + return fd_anon; + } + + log_debug(gc, init)("Falling back to open/unlink"); + + // Create file name + char filename[PATH_MAX]; + snprintf(filename, sizeof(filename), "%s/%s.%d", path.get(), name, os::current_process_id()); + + // Create file + const int fd = os::open(filename, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); + if (fd == -1) { + ZErrno err; + log_error(gc)("Failed to create file %s (%s)", filename, err.to_string()); + return -1; + } + + // Unlink file + if (unlink(filename) == -1) { + ZErrno err; + log_error(gc)("Failed to unlink file %s (%s)", filename, err.to_string()); + return -1; + } + + log_info(gc, init)("Heap backed by file: %s", filename); + + return fd; +} + +int ZBackingFile::create_fd(const char* name) const { + if (ZPath == NULL) { + // If the path is not explicitly specified, then we first try to create a memfd file + // instead of looking for a tmpfd/hugetlbfs mount point. Note that memfd_create() might + // not be supported at all (requires kernel >= 3.17), or it might not support large + // pages (requires kernel >= 4.14). If memfd_create() fails, then we try to create a + // file on an accessible tmpfs or hugetlbfs mount point. + const int fd = create_mem_fd(name); + if (fd != -1) { + return fd; + } + + log_debug(gc, init)("Falling back to searching for an accessible mount point"); + } + + return create_file_fd(name); +} + +bool ZBackingFile::is_initialized() const { + return _initialized; +} + +int ZBackingFile::fd() const { + return _fd; +} + +size_t ZBackingFile::size() const { + return _size; +} + +size_t ZBackingFile::available() const { + return _available; +} + +bool ZBackingFile::is_tmpfs() const { + return _filesystem == TMPFS_MAGIC; +} + +bool ZBackingFile::is_hugetlbfs() const { + return _filesystem == HUGETLBFS_MAGIC; +} + +bool ZBackingFile::tmpfs_supports_transparent_huge_pages() const { + // If the shmem_enabled file exists and is readable then we + // know the kernel supports transparent huge pages for tmpfs. + return access(ZFILENAME_SHMEM_ENABLED, R_OK) == 0; +} + +ZErrno ZBackingFile::fallocate_compat_ftruncate(size_t size) const { + while (ftruncate(_fd, size) == -1) { + if (errno != EINTR) { + // Failed + return errno; + } + } + + // Success + return 0; +} + +ZErrno ZBackingFile::fallocate_compat_mmap(size_t offset, size_t length, bool touch) const { + // On hugetlbfs, mapping a file segment will fail immediately, without + // the need to touch the mapped pages first, if there aren't enough huge + // pages available to back the mapping. + void* const addr = mmap(0, length, PROT_READ|PROT_WRITE, MAP_SHARED, _fd, offset); + if (addr == MAP_FAILED) { + // Failed + return errno; + } + + // Once mapped, the huge pages are only reserved. We need to touch them + // to associate them with the file segment. Note that we can not punch + // hole in file segments which only have reserved pages. + if (touch) { + char* const start = (char*)addr; + char* const end = start + length; + os::pretouch_memory(start, end, _block_size); + } + + // Unmap again. From now on, the huge pages that were mapped are allocated + // to this file. There's no risk in getting SIGBUS when touching them. + if (munmap(addr, length) == -1) { + // Failed + return errno; + } + + // Success + return 0; +} + +ZErrno ZBackingFile::fallocate_compat_pwrite(size_t offset, size_t length) const { + uint8_t data = 0; + + // Allocate backing memory by writing to each block + for (size_t pos = offset; pos < offset + length; pos += _block_size) { + if (pwrite(_fd, &data, sizeof(data), pos) == -1) { + // Failed + return errno; + } + } + + // Success + return 0; +} + +ZErrno ZBackingFile::fallocate_fill_hole_compat(size_t offset, size_t length) { + // fallocate(2) is only supported by tmpfs since Linux 3.5, and by hugetlbfs + // since Linux 4.3. When fallocate(2) is not supported we emulate it using + // ftruncate/pwrite (for tmpfs) or ftruncate/mmap/munmap (for hugetlbfs). + + const size_t end = offset + length; + if (end > _size) { + // Increase file size + const ZErrno err = fallocate_compat_ftruncate(end); + if (err) { + // Failed + return err; + } + } + + // Allocate backing memory + const ZErrno err = is_hugetlbfs() ? fallocate_compat_mmap(offset, length, false /* touch */) + : fallocate_compat_pwrite(offset, length); + if (err) { + if (end > _size) { + // Restore file size + fallocate_compat_ftruncate(_size); + } + + // Failed + return err; + } + + if (end > _size) { + // Record new file size + _size = end; + } + + // Success + return 0; +} + +ZErrno ZBackingFile::fallocate_fill_hole_syscall(size_t offset, size_t length) { + const int mode = 0; // Allocate + const int res = z_fallocate(_fd, mode, offset, length); + if (res == -1) { + // Failed + return errno; + } + + const size_t end = offset + length; + if (end > _size) { + // Record new file size + _size = end; + } + + // Success + return 0; +} + +ZErrno ZBackingFile::fallocate_fill_hole(size_t offset, size_t length) { + // Using compat mode is more efficient when allocating space on hugetlbfs. + // Note that allocating huge pages this way will only reserve them, and not + // associate them with segments of the file. We must guarantee that we at + // some point touch these segments, otherwise we can not punch hole in them. + if (z_fallocate_supported && !is_hugetlbfs()) { + const ZErrno err = fallocate_fill_hole_syscall(offset, length); + if (!err) { + // Success + return 0; + } + + if (err != ENOSYS && err != EOPNOTSUPP) { + // Failed + return err; + } + + // Not supported + log_debug(gc)("Falling back to fallocate() compatibility mode"); + z_fallocate_supported = false; + } + + return fallocate_fill_hole_compat(offset, length); +} + +ZErrno ZBackingFile::fallocate_punch_hole(size_t offset, size_t length) { + if (is_hugetlbfs()) { + // We can only punch hole in pages that have been touched. Non-touched + // pages are only reserved, and not associated with any specific file + // segment. We don't know which pages have been previously touched, so + // we always touch them here to guarantee that we can punch hole. + const ZErrno err = fallocate_compat_mmap(offset, length, true /* touch */); + if (err) { + // Failed + return err; + } + } + + const int mode = FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE; + if (z_fallocate(_fd, mode, offset, length) == -1) { + // Failed + return errno; + } + + // Success + return 0; +} + +ZErrno ZBackingFile::split_and_fallocate(bool punch_hole, size_t offset, size_t length) { + // Try first half + const size_t offset0 = offset; + const size_t length0 = align_up(length / 2, _block_size); + const ZErrno err0 = fallocate(punch_hole, offset0, length0); + if (err0) { + return err0; + } + + // Try second half + const size_t offset1 = offset0 + length0; + const size_t length1 = length - length0; + const ZErrno err1 = fallocate(punch_hole, offset1, length1); + if (err1) { + return err1; + } + + // Success + return 0; +} + +ZErrno ZBackingFile::fallocate(bool punch_hole, size_t offset, size_t length) { + assert(is_aligned(offset, _block_size), "Invalid offset"); + assert(is_aligned(length, _block_size), "Invalid length"); + + const ZErrno err = punch_hole ? fallocate_punch_hole(offset, length) : fallocate_fill_hole(offset, length); + if (err == EINTR && length > _block_size) { + // Calling fallocate(2) with a large length can take a long time to + // complete. When running profilers, such as VTune, this syscall will + // be constantly interrupted by signals. Expanding the file in smaller + // steps avoids this problem. + return split_and_fallocate(punch_hole, offset, length); + } + + return err; +} + +bool ZBackingFile::commit_inner(size_t offset, size_t length) { + log_trace(gc, heap)("Committing memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + offset / M, (offset + length) / M, length / M); + +retry: + const ZErrno err = fallocate(false /* punch_hole */, offset, length); + if (err) { + if (err == ENOSPC && !is_init_completed() && is_hugetlbfs() && z_fallocate_hugetlbfs_attempts-- > 0) { + // If we fail to allocate during initialization, due to lack of space on + // the hugetlbfs filesystem, then we wait and retry a few times before + // giving up. Otherwise there is a risk that running JVMs back-to-back + // will fail, since there is a delay between process termination and the + // huge pages owned by that process being returned to the huge page pool + // and made available for new allocations. + log_debug(gc, init)("Failed to commit memory (%s), retrying", err.to_string()); + + // Wait and retry in one second, in the hope that huge pages will be + // available by then. + sleep(1); + goto retry; + } + + // Failed + log_error(gc)("Failed to commit memory (%s)", err.to_string()); + return false; + } + + // Success + return true; +} + +size_t ZBackingFile::commit(size_t offset, size_t length) { + // Try to commit the whole region + if (commit_inner(offset, length)) { + // Success + return length; + } + + // Failed, try to commit as much as possible + size_t start = offset; + size_t end = offset + length; + + for (;;) { + length = align_down((end - start) / 2, ZGranuleSize); + if (length < ZGranuleSize) { + // Done, don't commit more + return start - offset; + } + + if (commit_inner(start, length)) { + // Success, try commit more + start += length; + } else { + // Failed, try commit less + end -= length; + } + } +} + +size_t ZBackingFile::uncommit(size_t offset, size_t length) { + log_trace(gc, heap)("Uncommitting memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + offset / M, (offset + length) / M, length / M); + + const ZErrno err = fallocate(true /* punch_hole */, offset, length); + if (err) { + log_error(gc)("Failed to uncommit memory (%s)", err.to_string()); + return 0; + } + + return length; +} diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/gc/z/zBackingFile_linux_aarch64.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/os_cpu/linux_aarch64/gc/z/zBackingFile_linux_aarch64.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2015, 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. + */ + +#ifndef OS_CPU_LINUX_AARCH64_GC_Z_ZBACKINGFILE_LINUX_AARCH64_HPP +#define OS_CPU_LINUX_AARCH64_GC_Z_ZBACKINGFILE_LINUX_AARCH64_HPP + +#include "memory/allocation.hpp" + +class ZErrno; + +class ZBackingFile { +private: + int _fd; + size_t _size; + uint64_t _filesystem; + size_t _block_size; + size_t _available; + bool _initialized; + + int create_mem_fd(const char* name) const; + int create_file_fd(const char* name) const; + int create_fd(const char* name) const; + + bool is_tmpfs() const; + bool is_hugetlbfs() const; + bool tmpfs_supports_transparent_huge_pages() const; + + ZErrno fallocate_compat_ftruncate(size_t size) const; + ZErrno fallocate_compat_mmap(size_t offset, size_t length, bool reserve_only) const; + ZErrno fallocate_compat_pwrite(size_t offset, size_t length) const; + ZErrno fallocate_fill_hole_compat(size_t offset, size_t length); + ZErrno fallocate_fill_hole_syscall(size_t offset, size_t length); + ZErrno fallocate_fill_hole(size_t offset, size_t length); + ZErrno fallocate_punch_hole(size_t offset, size_t length); + ZErrno split_and_fallocate(bool punch_hole, size_t offset, size_t length); + ZErrno fallocate(bool punch_hole, size_t offset, size_t length); + + bool commit_inner(size_t offset, size_t length); + +public: + ZBackingFile(); + + bool is_initialized() const; + + int fd() const; + size_t size() const; + size_t available() const; + + size_t commit(size_t offset, size_t length); + size_t uncommit(size_t offset, size_t length); +}; + +#endif // OS_CPU_LINUX_AARCH64_GC_Z_ZBACKINGFILE_LINUX_AARCH64_HPP diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/gc/z/zBackingPath_linux_aarch64.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/os_cpu/linux_aarch64/gc/z/zBackingPath_linux_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,149 @@ +/* + * 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 + * 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. + */ + +#include "precompiled.hpp" +#include "gc/z/zArray.inline.hpp" +#include "zBackingPath_linux_aarch64.hpp" +#include "gc/z/zErrno.hpp" +#include "logging/log.hpp" + +#include +#include + +// Mount information, see proc(5) for more details. +#define PROC_SELF_MOUNTINFO "/proc/self/mountinfo" + +ZBackingPath::ZBackingPath(const char* filesystem, const char** preferred_mountpoints) { + if (ZPath != NULL) { + // Use specified path + _path = strdup(ZPath); + } else { + // Find suitable path + _path = find_mountpoint(filesystem, preferred_mountpoints); + } +} + +ZBackingPath::~ZBackingPath() { + free(_path); + _path = NULL; +} + +char* ZBackingPath::get_mountpoint(const char* line, const char* filesystem) const { + char* line_mountpoint = NULL; + char* line_filesystem = NULL; + + // Parse line and return a newly allocated string containing the mount point if + // the line contains a matching filesystem and the mount point is accessible by + // the current user. + if (sscanf(line, "%*u %*u %*u:%*u %*s %ms %*[^-]- %ms", &line_mountpoint, &line_filesystem) != 2 || + strcmp(line_filesystem, filesystem) != 0 || + access(line_mountpoint, R_OK|W_OK|X_OK) != 0) { + // Not a matching or accessible filesystem + free(line_mountpoint); + line_mountpoint = NULL; + } + + free(line_filesystem); + + return line_mountpoint; +} + +void ZBackingPath::get_mountpoints(const char* filesystem, ZArray* mountpoints) const { + FILE* fd = fopen(PROC_SELF_MOUNTINFO, "r"); + if (fd == NULL) { + ZErrno err; + log_error(gc)("Failed to open %s: %s", PROC_SELF_MOUNTINFO, err.to_string()); + return; + } + + char* line = NULL; + size_t length = 0; + + while (getline(&line, &length, fd) != -1) { + char* const mountpoint = get_mountpoint(line, filesystem); + if (mountpoint != NULL) { + mountpoints->add(mountpoint); + } + } + + free(line); + fclose(fd); +} + +void ZBackingPath::free_mountpoints(ZArray* mountpoints) const { + ZArrayIterator iter(mountpoints); + for (char* mountpoint; iter.next(&mountpoint);) { + free(mountpoint); + } + mountpoints->clear(); +} + +char* ZBackingPath::find_preferred_mountpoint(const char* filesystem, + ZArray* mountpoints, + const char** preferred_mountpoints) const { + // Find preferred mount point + ZArrayIterator iter1(mountpoints); + for (char* mountpoint; iter1.next(&mountpoint);) { + for (const char** preferred = preferred_mountpoints; *preferred != NULL; preferred++) { + if (!strcmp(mountpoint, *preferred)) { + // Preferred mount point found + return strdup(mountpoint); + } + } + } + + // Preferred mount point not found + log_error(gc)("More than one %s filesystem found:", filesystem); + ZArrayIterator iter2(mountpoints); + for (char* mountpoint; iter2.next(&mountpoint);) { + log_error(gc)(" %s", mountpoint); + } + + return NULL; +} + +char* ZBackingPath::find_mountpoint(const char* filesystem, const char** preferred_mountpoints) const { + char* path = NULL; + ZArray mountpoints; + + get_mountpoints(filesystem, &mountpoints); + + if (mountpoints.size() == 0) { + // No mount point found + log_error(gc)("Failed to find an accessible %s filesystem", filesystem); + } else if (mountpoints.size() == 1) { + // One mount point found + path = strdup(mountpoints.at(0)); + } else { + // More than one mount point found + path = find_preferred_mountpoint(filesystem, &mountpoints, preferred_mountpoints); + } + + free_mountpoints(&mountpoints); + + return path; +} + +const char* ZBackingPath::get() const { + return _path; +} diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/gc/z/zBackingPath_linux_aarch64.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/os_cpu/linux_aarch64/gc/z/zBackingPath_linux_aarch64.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,52 @@ +/* + * 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 + * 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. + */ + +#ifndef OS_CPU_LINUX_AARCH64_GC_Z_ZBACKINGPATH_LINUX_AARCH64_HPP +#define OS_CPU_LINUX_AARCH64_GC_Z_ZBACKINGPATH_LINUX_AARCH64_HPP + +#include "gc/z/zArray.hpp" +#include "memory/allocation.hpp" + +class ZBackingPath : public StackObj { +private: + char* _path; + + char* get_mountpoint(const char* line, + const char* filesystem) const; + void get_mountpoints(const char* filesystem, + ZArray* mountpoints) const; + void free_mountpoints(ZArray* mountpoints) const; + char* find_preferred_mountpoint(const char* filesystem, + ZArray* mountpoints, + const char** preferred_mountpoints) const; + char* find_mountpoint(const char* filesystem, + const char** preferred_mountpoints) const; + +public: + ZBackingPath(const char* filesystem, const char** preferred_mountpoints); + ~ZBackingPath(); + + const char* get() const; +}; + +#endif // OS_CPU_LINUX_AARCH64_GC_Z_ZBACKINGPATH_LINUX_AARCH64_HPP diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/gc/z/zGlobals_linux_aarch64.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/os_cpu/linux_aarch64/gc/z/zGlobals_linux_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2017, 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. + */ + +#include "precompiled.hpp" +#include "gc/z/zGlobals.hpp" +#include "gc/z/zUtils.inline.hpp" +#include "runtime/globals.hpp" +#include "utilities/globalDefinitions.hpp" + +// +// The heap can have three different layouts, depending on the max heap size. +// +// Address Space & Pointer Layout 1 +// -------------------------------- +// +// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB) +// . . +// . . +// . . +// +--------------------------------+ 0x0000014000000000 (20TB) +// | Remapped View | +// +--------------------------------+ 0x0000010000000000 (16TB) +// | (Reserved, but unused) | +// +--------------------------------+ 0x00000c0000000000 (12TB) +// | Marked1 View | +// +--------------------------------+ 0x0000080000000000 (8TB) +// | Marked0 View | +// +--------------------------------+ 0x0000040000000000 (4TB) +// . . +// +--------------------------------+ 0x0000000000000000 +// +// 6 4 4 4 4 +// 3 6 5 2 1 0 +// +--------------------+----+-----------------------------------------------+ +// |00000000 00000000 00|1111|11 11111111 11111111 11111111 11111111 11111111| +// +--------------------+----+-----------------------------------------------+ +// | | | +// | | * 41-0 Object Offset (42-bits, 4TB address space) +// | | +// | * 45-42 Metadata Bits (4-bits) 0001 = Marked0 (Address view 4-8TB) +// | 0010 = Marked1 (Address view 8-12TB) +// | 0100 = Remapped (Address view 16-20TB) +// | 1000 = Finalizable (Address view N/A) +// | +// * 63-46 Fixed (18-bits, always zero) +// +// +// Address Space & Pointer Layout 2 +// -------------------------------- +// +// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB) +// . . +// . . +// . . +// +--------------------------------+ 0x0000280000000000 (40TB) +// | Remapped View | +// +--------------------------------+ 0x0000200000000000 (32TB) +// | (Reserved, but unused) | +// +--------------------------------+ 0x0000180000000000 (24TB) +// | Marked1 View | +// +--------------------------------+ 0x0000100000000000 (16TB) +// | Marked0 View | +// +--------------------------------+ 0x0000080000000000 (8TB) +// . . +// +--------------------------------+ 0x0000000000000000 +// +// 6 4 4 4 4 +// 3 7 6 3 2 0 +// +------------------+-----+------------------------------------------------+ +// |00000000 00000000 0|1111|111 11111111 11111111 11111111 11111111 11111111| +// +-------------------+----+------------------------------------------------+ +// | | | +// | | * 42-0 Object Offset (43-bits, 8TB address space) +// | | +// | * 46-43 Metadata Bits (4-bits) 0001 = Marked0 (Address view 8-16TB) +// | 0010 = Marked1 (Address view 16-24TB) +// | 0100 = Remapped (Address view 32-40TB) +// | 1000 = Finalizable (Address view N/A) +// | +// * 63-47 Fixed (17-bits, always zero) +// +// +// Address Space & Pointer Layout 3 +// -------------------------------- +// +// +--------------------------------+ 0x00007FFFFFFFFFFF (127TB) +// . . +// . . +// . . +// +--------------------------------+ 0x0000500000000000 (80TB) +// | Remapped View | +// +--------------------------------+ 0x0000400000000000 (64TB) +// | (Reserved, but unused) | +// +--------------------------------+ 0x0000300000000000 (48TB) +// | Marked1 View | +// +--------------------------------+ 0x0000200000000000 (32TB) +// | Marked0 View | +// +--------------------------------+ 0x0000100000000000 (16TB) +// . . +// +--------------------------------+ 0x0000000000000000 +// +// 6 4 4 4 4 +// 3 8 7 4 3 0 +// +------------------+----+-------------------------------------------------+ +// |00000000 00000000 |1111|1111 11111111 11111111 11111111 11111111 11111111| +// +------------------+----+-------------------------------------------------+ +// | | | +// | | * 43-0 Object Offset (44-bits, 16TB address space) +// | | +// | * 47-44 Metadata Bits (4-bits) 0001 = Marked0 (Address view 16-32TB) +// | 0010 = Marked1 (Address view 32-48TB) +// | 0100 = Remapped (Address view 64-80TB) +// | 1000 = Finalizable (Address view N/A) +// | +// * 63-48 Fixed (16-bits, always zero) +// + +uintptr_t ZPlatformAddressSpaceStart() { + const uintptr_t first_heap_view_address = (uintptr_t)1 << (ZPlatformAddressMetadataShift() + 0); + const size_t min_address_offset = 0; + return first_heap_view_address + min_address_offset; +} + +uintptr_t ZPlatformAddressSpaceEnd() { + const uintptr_t last_heap_view_address = (uintptr_t)1 << (ZPlatformAddressMetadataShift() + 2); + const size_t max_address_offset = (size_t)1 << ZPlatformAddressOffsetBits(); + return last_heap_view_address + max_address_offset; +} + +uintptr_t ZPlatformAddressReservedStart() { + return ZPlatformAddressSpaceStart(); +} + +uintptr_t ZPlatformAddressReservedEnd() { + return ZPlatformAddressSpaceEnd(); +} + +uintptr_t ZPlatformAddressBase() { + return 0; +} + +size_t ZPlatformAddressOffsetBits() { + const size_t min_address_offset_bits = 42; // 4TB + const size_t max_address_offset_bits = 44; // 16TB + const size_t virtual_to_physical_ratio = 7; // 7:1 + const size_t address_offset = ZUtils::round_up_power_of_2(MaxHeapSize * virtual_to_physical_ratio); + const size_t address_offset_bits = log2_intptr(address_offset); + return MIN2(MAX2(address_offset_bits, min_address_offset_bits), max_address_offset_bits); +} + +size_t ZPlatformAddressMetadataShift() { + return ZPlatformAddressOffsetBits(); +} diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/gc/z/zGlobals_linux_aarch64.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/os_cpu/linux_aarch64/gc/z/zGlobals_linux_aarch64.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2015, 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. + */ + +#ifndef OS_CPU_LINUX_AARCH64_GC_Z_ZGLOBALS_LINUX_AARCH64_HPP +#define OS_CPU_LINUX_AARCH64_GC_Z_ZGLOBALS_LINUX_AARCH64_HPP + +// +// Page Allocation Tiers +// --------------------- +// +// Page Type Page Size Object Size Limit Object Alignment +// ------------------------------------------------------------------ +// Small 2M <= 265K +// Medium 32M <= 4M 4K +// Large X*M > 4M 2M +// ------------------------------------------------------------------ +// +const size_t ZPlatformGranuleSizeShift = 21; // 2MB +const size_t ZPlatformMaxHeapSizeShift = 46; // 16TB +const size_t ZPlatformNMethodDisarmedOffset = 4; +const size_t ZPlatformCacheLineSize = 64; + +uintptr_t ZPlatformAddressSpaceStart(); +uintptr_t ZPlatformAddressSpaceEnd(); +uintptr_t ZPlatformAddressReservedStart(); +uintptr_t ZPlatformAddressReservedEnd(); +uintptr_t ZPlatformAddressBase(); +size_t ZPlatformAddressOffsetBits(); +size_t ZPlatformAddressMetadataShift(); + +#endif // OS_CPU_LINUX_AARCH64_GC_Z_ZGLOBALS_LINUX_AARCH64_HPP diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/gc/z/zPhysicalMemoryBacking_linux_aarch64.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/os_cpu/linux_aarch64/gc/z/zPhysicalMemoryBacking_linux_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,333 @@ +/* + * Copyright (c) 2015, 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. + */ + +#include "precompiled.hpp" +#include "gc/z/zAddress.inline.hpp" +#include "gc/z/zBackingFile_linux_aarch64.hpp" +#include "gc/z/zErrno.hpp" +#include "gc/z/zGlobals.hpp" +#include "gc/z/zLargePages.inline.hpp" +#include "gc/z/zMemory.hpp" +#include "gc/z/zNUMA.hpp" +#include "gc/z/zPhysicalMemory.inline.hpp" +#include "gc/z/zPhysicalMemoryBacking_linux_aarch64.hpp" +#include "logging/log.hpp" +#include "runtime/init.hpp" +#include "runtime/os.hpp" +#include "utilities/align.hpp" +#include "utilities/debug.hpp" + +#include +#include +#include + +// +// Support for building on older Linux systems +// + +// madvise(2) flags +#ifndef MADV_HUGEPAGE +#define MADV_HUGEPAGE 14 +#endif + +// Proc file entry for max map mount +#define ZFILENAME_PROC_MAX_MAP_COUNT "/proc/sys/vm/max_map_count" + +bool ZPhysicalMemoryBacking::is_initialized() const { + return _file.is_initialized(); +} + +void ZPhysicalMemoryBacking::warn_available_space(size_t max) const { + // Note that the available space on a tmpfs or a hugetlbfs filesystem + // will be zero if no size limit was specified when it was mounted. + const size_t available = _file.available(); + if (available == 0) { + // No size limit set, skip check + log_info(gc, init)("Available space on backing filesystem: N/A"); + return; + } + + log_info(gc, init)("Available space on backing filesystem: " SIZE_FORMAT "M", available / M); + + // Warn if the filesystem doesn't currently have enough space available to hold + // the max heap size. The max heap size will be capped if we later hit this limit + // when trying to expand the heap. + if (available < max) { + log_warning(gc)("***** WARNING! INCORRECT SYSTEM CONFIGURATION DETECTED! *****"); + log_warning(gc)("Not enough space available on the backing filesystem to hold the current max Java heap"); + log_warning(gc)("size (" SIZE_FORMAT "M). Please adjust the size of the backing filesystem accordingly " + "(available", max / M); + log_warning(gc)("space is currently " SIZE_FORMAT "M). Continuing execution with the current filesystem " + "size could", available / M); + log_warning(gc)("lead to a premature OutOfMemoryError being thrown, due to failure to map memory."); + } +} + +void ZPhysicalMemoryBacking::warn_max_map_count(size_t max) const { + const char* const filename = ZFILENAME_PROC_MAX_MAP_COUNT; + FILE* const file = fopen(filename, "r"); + if (file == NULL) { + // Failed to open file, skip check + log_debug(gc, init)("Failed to open %s", filename); + return; + } + + size_t actual_max_map_count = 0; + const int result = fscanf(file, SIZE_FORMAT, &actual_max_map_count); + fclose(file); + if (result != 1) { + // Failed to read file, skip check + log_debug(gc, init)("Failed to read %s", filename); + return; + } + + // The required max map count is impossible to calculate exactly since subsystems + // other than ZGC are also creating memory mappings, and we have no control over that. + // However, ZGC tends to create the most mappings and dominate the total count. + // In the worst cases, ZGC will map each granule three times, i.e. once per heap view. + // We speculate that we need another 20% to allow for non-ZGC subsystems to map memory. + const size_t required_max_map_count = (max / ZGranuleSize) * 3 * 1.2; + if (actual_max_map_count < required_max_map_count) { + log_warning(gc)("***** WARNING! INCORRECT SYSTEM CONFIGURATION DETECTED! *****"); + log_warning(gc)("The system limit on number of memory mappings per process might be too low for the given"); + log_warning(gc)("max Java heap size (" SIZE_FORMAT "M). Please adjust %s to allow for at", + max / M, filename); + log_warning(gc)("least " SIZE_FORMAT " mappings (current limit is " SIZE_FORMAT "). Continuing execution " + "with the current", required_max_map_count, actual_max_map_count); + log_warning(gc)("limit could lead to a fatal error, due to failure to map memory."); + } +} + +void ZPhysicalMemoryBacking::warn_commit_limits(size_t max) const { + // Warn if available space is too low + warn_available_space(max); + + // Warn if max map count is too low + warn_max_map_count(max); +} + +bool ZPhysicalMemoryBacking::supports_uncommit() { + assert(!is_init_completed(), "Invalid state"); + assert(_file.size() >= ZGranuleSize, "Invalid size"); + + // Test if uncommit is supported by uncommitting and then re-committing a granule + return commit(uncommit(ZGranuleSize)) == ZGranuleSize; +} + +size_t ZPhysicalMemoryBacking::commit(size_t size) { + size_t committed = 0; + + // Fill holes in the backing file + while (committed < size) { + size_t allocated = 0; + const size_t remaining = size - committed; + const uintptr_t start = _uncommitted.alloc_from_front_at_most(remaining, &allocated); + if (start == UINTPTR_MAX) { + // No holes to commit + break; + } + + // Try commit hole + const size_t filled = _file.commit(start, allocated); + if (filled > 0) { + // Successful or partialy successful + _committed.free(start, filled); + committed += filled; + } + if (filled < allocated) { + // Failed or partialy failed + _uncommitted.free(start + filled, allocated - filled); + return committed; + } + } + + // Expand backing file + if (committed < size) { + const size_t remaining = size - committed; + const uintptr_t start = _file.size(); + const size_t expanded = _file.commit(start, remaining); + if (expanded > 0) { + // Successful or partialy successful + _committed.free(start, expanded); + committed += expanded; + } + } + + return committed; +} + +size_t ZPhysicalMemoryBacking::uncommit(size_t size) { + size_t uncommitted = 0; + + // Punch holes in backing file + while (uncommitted < size) { + size_t allocated = 0; + const size_t remaining = size - uncommitted; + const uintptr_t start = _committed.alloc_from_back_at_most(remaining, &allocated); + assert(start != UINTPTR_MAX, "Allocation should never fail"); + + // Try punch hole + const size_t punched = _file.uncommit(start, allocated); + if (punched > 0) { + // Successful or partialy successful + _uncommitted.free(start, punched); + uncommitted += punched; + } + if (punched < allocated) { + // Failed or partialy failed + _committed.free(start + punched, allocated - punched); + return uncommitted; + } + } + + return uncommitted; +} + +ZPhysicalMemory ZPhysicalMemoryBacking::alloc(size_t size) { + assert(is_aligned(size, ZGranuleSize), "Invalid size"); + + ZPhysicalMemory pmem; + + // Allocate segments + for (size_t allocated = 0; allocated < size; allocated += ZGranuleSize) { + const uintptr_t start = _committed.alloc_from_front(ZGranuleSize); + assert(start != UINTPTR_MAX, "Allocation should never fail"); + pmem.add_segment(ZPhysicalMemorySegment(start, ZGranuleSize)); + } + + return pmem; +} + +void ZPhysicalMemoryBacking::free(const ZPhysicalMemory& pmem) { + const size_t nsegments = pmem.nsegments(); + + // Free segments + for (size_t i = 0; i < nsegments; i++) { + const ZPhysicalMemorySegment& segment = pmem.segment(i); + _committed.free(segment.start(), segment.size()); + } +} + +void ZPhysicalMemoryBacking::map_failed(ZErrno err) const { + if (err == ENOMEM) { + fatal("Failed to map memory. Please check the system limit on number of " + "memory mappings allowed per process (see %s)", ZFILENAME_PROC_MAX_MAP_COUNT); + } else { + fatal("Failed to map memory (%s)", err.to_string()); + } +} + +void ZPhysicalMemoryBacking::advise_view(uintptr_t addr, size_t size, int advice) const { + if (madvise((void*)addr, size, advice) == -1) { + ZErrno err; + log_error(gc)("Failed to advise on memory (advice %d, %s)", advice, err.to_string()); + } +} + +void ZPhysicalMemoryBacking::pretouch_view(uintptr_t addr, size_t size) const { + const size_t page_size = ZLargePages::is_explicit() ? os::large_page_size() : os::vm_page_size(); + os::pretouch_memory((void*)addr, (void*)(addr + size), page_size); +} + +void ZPhysicalMemoryBacking::map_view(const ZPhysicalMemory& pmem, uintptr_t addr, bool pretouch) const { + const size_t nsegments = pmem.nsegments(); + size_t size = 0; + + // Map segments + for (size_t i = 0; i < nsegments; i++) { + const ZPhysicalMemorySegment& segment = pmem.segment(i); + const uintptr_t segment_addr = addr + size; + const void* const res = mmap((void*)segment_addr, segment.size(), PROT_READ|PROT_WRITE, MAP_FIXED|MAP_SHARED, _file.fd(), segment.start()); + if (res == MAP_FAILED) { + ZErrno err; + map_failed(err); + } + + size += segment.size(); + } + + // Advise on use of transparent huge pages before touching it + if (ZLargePages::is_transparent()) { + advise_view(addr, size, MADV_HUGEPAGE); + } + + // NUMA interleave memory before touching it + ZNUMA::memory_interleave(addr, size); + + // Pre-touch memory + if (pretouch) { + pretouch_view(addr, size); + } +} + +void ZPhysicalMemoryBacking::unmap_view(const ZPhysicalMemory& pmem, uintptr_t addr) const { + // Note that we must keep the address space reservation intact and just detach + // the backing memory. For this reason we map a new anonymous, non-accessible + // and non-reserved page over the mapping instead of actually unmapping. + const void* const res = mmap((void*)addr, pmem.size(), PROT_NONE, MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0); + if (res == MAP_FAILED) { + ZErrno err; + map_failed(err); + } +} + +uintptr_t ZPhysicalMemoryBacking::nmt_address(uintptr_t offset) const { + // From an NMT point of view we treat the first heap view (marked0) as committed + return ZAddress::marked0(offset); +} + +void ZPhysicalMemoryBacking::map(const ZPhysicalMemory& pmem, uintptr_t offset) const { + if (ZVerifyViews) { + // Map good view + map_view(pmem, ZAddress::good(offset), AlwaysPreTouch); + } else { + // Map all views + map_view(pmem, ZAddress::marked0(offset), AlwaysPreTouch); + map_view(pmem, ZAddress::marked1(offset), AlwaysPreTouch); + map_view(pmem, ZAddress::remapped(offset), AlwaysPreTouch); + } +} + +void ZPhysicalMemoryBacking::unmap(const ZPhysicalMemory& pmem, uintptr_t offset) const { + if (ZVerifyViews) { + // Unmap good view + unmap_view(pmem, ZAddress::good(offset)); + } else { + // Unmap all views + unmap_view(pmem, ZAddress::marked0(offset)); + unmap_view(pmem, ZAddress::marked1(offset)); + unmap_view(pmem, ZAddress::remapped(offset)); + } +} + +void ZPhysicalMemoryBacking::debug_map(const ZPhysicalMemory& pmem, uintptr_t offset) const { + // Map good view + assert(ZVerifyViews, "Should be enabled"); + map_view(pmem, ZAddress::good(offset), false /* pretouch */); +} + +void ZPhysicalMemoryBacking::debug_unmap(const ZPhysicalMemory& pmem, uintptr_t offset) const { + // Unmap good view + assert(ZVerifyViews, "Should be enabled"); + unmap_view(pmem, ZAddress::good(offset)); +} diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/gc/z/zPhysicalMemoryBacking_linux_aarch64.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/os_cpu/linux_aarch64/gc/z/zPhysicalMemoryBacking_linux_aarch64.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2015, 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. + */ + +#ifndef OS_CPU_LINUX_AARCH64_GC_Z_ZPHYSICALMEMORYBACKING_LINUX_AARCH64_HPP +#define OS_CPU_LINUX_AARCH64_GC_Z_ZPHYSICALMEMORYBACKING_LINUX_AARCH64_HPP + +#include "gc/z/zBackingFile_linux_aarch64.hpp" +#include "gc/z/zMemory.hpp" + +class ZErrno; +class ZPhysicalMemory; + +class ZPhysicalMemoryBacking { +private: + ZBackingFile _file; + ZMemoryManager _committed; + ZMemoryManager _uncommitted; + + void warn_available_space(size_t max) const; + void warn_max_map_count(size_t max) const; + + void map_failed(ZErrno err) const; + + void advise_view(uintptr_t addr, size_t size, int advice) const; + void pretouch_view(uintptr_t addr, size_t size) const; + void map_view(const ZPhysicalMemory& pmem, uintptr_t addr, bool pretouch) const; + void unmap_view(const ZPhysicalMemory& pmem, uintptr_t addr) const; + +public: + bool is_initialized() const; + + void warn_commit_limits(size_t max) const; + bool supports_uncommit(); + + size_t commit(size_t size); + size_t uncommit(size_t size); + + ZPhysicalMemory alloc(size_t size); + void free(const ZPhysicalMemory& pmem); + + uintptr_t nmt_address(uintptr_t offset) const; + + void map(const ZPhysicalMemory& pmem, uintptr_t offset) const; + void unmap(const ZPhysicalMemory& pmem, uintptr_t offset) const; + + void debug_map(const ZPhysicalMemory& pmem, uintptr_t offset) const; + void debug_unmap(const ZPhysicalMemory& pmem, uintptr_t offset) const; +}; + +#endif // OS_CPU_LINUX_AARCH64_GC_Z_ZPHYSICALMEMORYBACKING_LINUX_AARCH64_HPP diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp --- a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -83,19 +83,13 @@ #define REG_SP REG_RSP #define REG_PC REG_RIP #define REG_FP REG_RBP -#define SPELL_REG_SP "rsp" -#define SPELL_REG_FP "rbp" #else #define REG_FP 29 #define REG_LR 30 - -#define SPELL_REG_SP "sp" -#define SPELL_REG_FP "x29" #endif -address os::current_stack_pointer() { - register void *esp __asm__ (SPELL_REG_SP); - return (address) esp; +NOINLINE address os::current_stack_pointer() { + return (address)__builtin_frame_address(0); } char* os::non_memory_address_word() { @@ -230,23 +224,8 @@ #endif } -intptr_t* _get_previous_fp() { - register intptr_t **fp __asm__ (SPELL_REG_FP); - - // fp is for this frame (_get_previous_fp). We want the fp for the - // caller of os::current_frame*(), so go up two frames. However, for - // optimized builds, _get_previous_fp() will be inlined, so only go - // up 1 frame in that case. - #ifdef _NMT_NOINLINE_ - return **(intptr_t***)fp; - #else - return *fp; - #endif -} - - -frame os::current_frame() { - intptr_t* fp = _get_previous_fp(); +NOINLINE frame os::current_frame() { + intptr_t *fp = *(intptr_t **)__builtin_frame_address(0); frame myframe((intptr_t*)os::current_stack_pointer(), (intptr_t*)fp, CAST_FROM_FN_PTR(address, os::current_frame)); @@ -259,12 +238,6 @@ } // Utility functions - -// From IA32 System Programming Guide -enum { - trap_page_fault = 0xE -}; - #ifdef BUILTIN_SIM extern "C" void Fetch32PFI () ; extern "C" void Fetch32Resume () ; @@ -667,42 +640,42 @@ return 0; } - void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { + void _Copy_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) { if (from > to) { - jshort *end = from + count; + const jshort *end = from + count; while (from < end) *(to++) = *(from++); } else if (from < to) { - jshort *end = from; + const jshort *end = from; from += count - 1; to += count - 1; while (from >= end) *(to--) = *(from--); } } - void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) { + void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { if (from > to) { - jint *end = from + count; + const jint *end = from + count; while (from < end) *(to++) = *(from++); } else if (from < to) { - jint *end = from; + const jint *end = from; from += count - 1; to += count - 1; while (from >= end) *(to--) = *(from--); } } - void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { + void _Copy_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { if (from > to) { - jlong *end = from + count; + const jlong *end = from + count; while (from < end) os::atomic_copy64(from++, to++); } else if (from < to) { - jlong *end = from; + const jlong *end = from; from += count - 1; to += count - 1; while (from >= end) @@ -710,22 +683,22 @@ } } - void _Copy_arrayof_conjoint_bytes(HeapWord* from, + void _Copy_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count); } - void _Copy_arrayof_conjoint_jshorts(HeapWord* from, + void _Copy_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 2); } - void _Copy_arrayof_conjoint_jints(HeapWord* from, + void _Copy_arrayof_conjoint_jints(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 4); } - void _Copy_arrayof_conjoint_jlongs(HeapWord* from, + void _Copy_arrayof_conjoint_jlongs(const HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 8); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/asm/assembler.cpp --- a/src/hotspot/share/asm/assembler.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/asm/assembler.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -313,25 +313,22 @@ bool MacroAssembler::uses_implicit_null_check(void* address) { // Exception handler checks the nmethod's implicit null checks table // only when this method returns false. - intptr_t int_address = reinterpret_cast(address); - intptr_t cell_header_size = Universe::heap()->cell_header_size(); - size_t region_size = os::vm_page_size() + cell_header_size; + uintptr_t addr = reinterpret_cast(address); + uintptr_t page_size = (uintptr_t)os::vm_page_size(); #ifdef _LP64 if (UseCompressedOops && CompressedOops::base() != NULL) { // A SEGV can legitimately happen in C2 code at address // (heap_base + offset) if Matcher::narrow_oop_use_complex_address // is configured to allow narrow oops field loads to be implicitly // null checked - intptr_t start = ((intptr_t)CompressedOops::base()) - cell_header_size; - intptr_t end = start + region_size; - if (int_address >= start && int_address < end) { + uintptr_t start = (uintptr_t)CompressedOops::base(); + uintptr_t end = start + page_size; + if (addr >= start && addr < end) { return true; } } #endif - intptr_t start = -cell_header_size; - intptr_t end = start + region_size; - return int_address >= start && int_address < end; + return addr < page_size; } bool MacroAssembler::needs_explicit_null_check(intptr_t offset) { @@ -341,12 +338,8 @@ // with -1. Another example is GraphBuilder::access_field(...) which uses -1 as placeholder // for offsets to be patched in later. The -1 there means the offset is not yet known // and may lie outside of the zero-trapping page, and thus we need to ensure we're forcing - // an explicit null check for -1, even if it may otherwise be in the range - // [-cell_header_size, os::vm_page_size). - // TODO: Find and replace all relevant uses of -1 with a reasonably named constant. - if (offset == -1) return true; + // an explicit null check for -1. - // Check if offset is outside of [-cell_header_size, os::vm_page_size) - return offset < -Universe::heap()->cell_header_size() || - offset >= os::vm_page_size(); + // Check if offset is outside of [0, os::vm_page_size()] + return offset < 0 || offset >= os::vm_page_size(); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/asm/codeBuffer.hpp --- a/src/hotspot/share/asm/codeBuffer.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/asm/codeBuffer.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -413,6 +413,7 @@ || PrintMethodHandleStubs || PrintInterpreter || PrintSignatureHandlers + || UnlockDiagnosticVMOptions ); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/classfile/classFileParser.cpp --- a/src/hotspot/share/classfile/classFileParser.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/classfile/classFileParser.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -125,6 +125,8 @@ #define JAVA_13_VERSION 57 +#define JAVA_14_VERSION 58 + void ClassFileParser::set_class_bad_constant_seen(short bad_constant) { assert((bad_constant == JVM_CONSTANT_Module || bad_constant == JVM_CONSTANT_Package) && _major_version >= JAVA_9_VERSION, @@ -4754,60 +4756,62 @@ // A legal major_version.minor_version must be one of the following: // -// Major_version = 45, any minor_version. -// Major_version >= 46 and major_version <= current_major_version and minor_version = 0. -// Major_version = current_major_version and minor_version = 65535 and --enable-preview is present. +// Major_version >= 45 and major_version < 56, any minor_version. +// Major_version >= 56 and major_version <= JVM_CLASSFILE_MAJOR_VERSION and minor_version = 0. +// Major_version = JVM_CLASSFILE_MAJOR_VERSION and minor_version = 65535 and --enable-preview is present. // static void verify_class_version(u2 major, u2 minor, Symbol* class_name, TRAPS){ + ResourceMark rm(THREAD); const u2 max_version = JVM_CLASSFILE_MAJOR_VERSION; - if (major != JAVA_MIN_SUPPORTED_VERSION) { // All 45.* are ok including 45.65535 - if (minor == JAVA_PREVIEW_MINOR_VERSION) { - if (major != max_version) { - ResourceMark rm(THREAD); - Exceptions::fthrow( - THREAD_AND_LOCATION, - vmSymbols::java_lang_UnsupportedClassVersionError(), - "%s (class file version %u.%u) was compiled with preview features that are unsupported. " - "This version of the Java Runtime only recognizes preview features for class file version %u.%u", - class_name->as_C_string(), major, minor, JVM_CLASSFILE_MAJOR_VERSION, JAVA_PREVIEW_MINOR_VERSION); - return; - } - - if (!Arguments::enable_preview()) { - ResourceMark rm(THREAD); - Exceptions::fthrow( - THREAD_AND_LOCATION, - vmSymbols::java_lang_UnsupportedClassVersionError(), - "Preview features are not enabled for %s (class file version %u.%u). Try running with '--enable-preview'", - class_name->as_C_string(), major, minor); - return; - } - - } else { // minor != JAVA_PREVIEW_MINOR_VERSION - if (major > max_version) { - ResourceMark rm(THREAD); - Exceptions::fthrow( - THREAD_AND_LOCATION, - vmSymbols::java_lang_UnsupportedClassVersionError(), - "%s has been compiled by a more recent version of the Java Runtime (class file version %u.%u), " - "this version of the Java Runtime only recognizes class file versions up to %u.0", - class_name->as_C_string(), major, minor, JVM_CLASSFILE_MAJOR_VERSION); - } else if (major < JAVA_MIN_SUPPORTED_VERSION) { - ResourceMark rm(THREAD); - Exceptions::fthrow( - THREAD_AND_LOCATION, - vmSymbols::java_lang_UnsupportedClassVersionError(), - "%s (class file version %u.%u) was compiled with an invalid major version", - class_name->as_C_string(), major, minor); - } else if (minor != 0) { - ResourceMark rm(THREAD); - Exceptions::fthrow( - THREAD_AND_LOCATION, - vmSymbols::java_lang_UnsupportedClassVersionError(), - "%s (class file version %u.%u) was compiled with an invalid non-zero minor version", - class_name->as_C_string(), major, minor); - } + if (major < JAVA_MIN_SUPPORTED_VERSION) { + Exceptions::fthrow( + THREAD_AND_LOCATION, + vmSymbols::java_lang_UnsupportedClassVersionError(), + "%s (class file version %u.%u) was compiled with an invalid major version", + class_name->as_C_string(), major, minor); + return; + } + + if (major > max_version) { + Exceptions::fthrow( + THREAD_AND_LOCATION, + vmSymbols::java_lang_UnsupportedClassVersionError(), + "%s has been compiled by a more recent version of the Java Runtime (class file version %u.%u), " + "this version of the Java Runtime only recognizes class file versions up to %u.0", + class_name->as_C_string(), major, minor, JVM_CLASSFILE_MAJOR_VERSION); + return; + } + + if (major < JAVA_12_VERSION || minor == 0) { + return; + } + + if (minor == JAVA_PREVIEW_MINOR_VERSION) { + if (major != max_version) { + Exceptions::fthrow( + THREAD_AND_LOCATION, + vmSymbols::java_lang_UnsupportedClassVersionError(), + "%s (class file version %u.%u) was compiled with preview features that are unsupported. " + "This version of the Java Runtime only recognizes preview features for class file version %u.%u", + class_name->as_C_string(), major, minor, JVM_CLASSFILE_MAJOR_VERSION, JAVA_PREVIEW_MINOR_VERSION); + return; } + + if (!Arguments::enable_preview()) { + Exceptions::fthrow( + THREAD_AND_LOCATION, + vmSymbols::java_lang_UnsupportedClassVersionError(), + "Preview features are not enabled for %s (class file version %u.%u). Try running with '--enable-preview'", + class_name->as_C_string(), major, minor); + return; + } + + } else { // minor != JAVA_PREVIEW_MINOR_VERSION + Exceptions::fthrow( + THREAD_AND_LOCATION, + vmSymbols::java_lang_UnsupportedClassVersionError(), + "%s (class file version %u.%u) was compiled with an invalid non-zero minor version", + class_name->as_C_string(), major, minor); } } @@ -4954,6 +4958,7 @@ bool ClassFileParser::verify_unqualified_name(const char* name, unsigned int length, int type) { + if (length == 0) return false; // Must have at least one char. for (const char* p = name; p != name + length; p++) { switch(*p) { case '.': @@ -5103,7 +5108,7 @@ int newlen = c - (char*) signature; bool legal = verify_unqualified_name(signature, newlen, LegalClass); if (!legal) { - classfile_parse_error("Class name contains illegal character " + classfile_parse_error("Class name is empty or contains illegal character " "in descriptor in class file %s", CHECK_0); return NULL; @@ -5641,11 +5646,11 @@ } if (ik->minor_version() == JAVA_PREVIEW_MINOR_VERSION && - ik->major_version() != JAVA_MIN_SUPPORTED_VERSION && + ik->major_version() == JVM_CLASSFILE_MAJOR_VERSION && log_is_enabled(Info, class, preview)) { ResourceMark rm; log_info(class, preview)("Loading class %s that depends on preview features (class file version %d.65535)", - ik->external_name(), ik->major_version()); + ik->external_name(), JVM_CLASSFILE_MAJOR_VERSION); } if (log_is_enabled(Debug, class, resolve)) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/classfile/stringTable.cpp --- a/src/hotspot/share/classfile/stringTable.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/classfile/stringTable.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -58,8 +58,8 @@ const double PREF_AVG_LIST_LEN = 2.0; // 2^24 is max size const size_t END_SIZE = 24; -// If a chain gets to 32 something might be wrong -const size_t REHASH_LEN = 32; +// If a chain gets to 100 something might be wrong +const size_t REHASH_LEN = 100; // If we have as many dead items as 50% of the number of bucket const double CLEAN_DEAD_HIGH_WATER_MARK = 0.5; @@ -496,8 +496,9 @@ return false; } - // We use max size - StringTableHash* new_table = new StringTableHash(END_SIZE, END_SIZE, REHASH_LEN); + // We use current size, not max size. + size_t new_size = _local_table->get_size_log2(Thread::current()); + StringTableHash* new_table = new StringTableHash(new_size, END_SIZE, REHASH_LEN); // Use alt hash from now on _alt_hash = true; if (!_local_table->try_move_nodes_to(Thread::current(), new_table)) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/classfile/symbolTable.cpp --- a/src/hotspot/share/classfile/symbolTable.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/classfile/symbolTable.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -267,7 +267,7 @@ // all symbols from the dynamic table SymbolsDo sd(cl); if (!_local_table->try_scan(Thread::current(), sd)) { - log_info(stringtable)("symbols_do unavailable at this moment"); + log_info(symboltable)("symbols_do unavailable at this moment"); } } @@ -557,7 +557,7 @@ Thread* thr = Thread::current(); VerifySymbols vs; if (!_local_table->try_scan(thr, vs)) { - log_info(stringtable)("verify unavailable at this moment"); + log_info(symboltable)("verify unavailable at this moment"); } } @@ -763,8 +763,9 @@ return false; } - // We use max size - SymbolTableHash* new_table = new SymbolTableHash(END_SIZE, END_SIZE, REHASH_LEN); + // We use current size + size_t new_size = _local_table->get_size_log2(Thread::current()); + SymbolTableHash* new_table = new SymbolTableHash(new_size, END_SIZE, REHASH_LEN); // Use alt hash from now on _alt_hash = true; if (!_local_table->try_move_nodes_to(Thread::current(), new_table)) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/classfile/systemDictionary.cpp --- a/src/hotspot/share/classfile/systemDictionary.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/classfile/systemDictionary.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2861,14 +2861,17 @@ } TableStatistics SystemDictionary::placeholders_statistics() { + MutexLocker ml(SystemDictionary_lock); return placeholders()->statistics_calculate(); } TableStatistics SystemDictionary::loader_constraints_statistics() { + MutexLocker ml(SystemDictionary_lock); return constraints()->statistics_calculate(); } TableStatistics SystemDictionary::protection_domain_cache_statistics() { + MutexLocker ml(SystemDictionary_lock); return pd_cache_table()->statistics_calculate(); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/classfile/verifier.cpp --- a/src/hotspot/share/classfile/verifier.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/classfile/verifier.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -165,22 +165,28 @@ PerfClassTraceTime::CLASS_VERIFY); // If the class should be verified, first see if we can use the split - // verifier. If not, or if verification fails and FailOverToOldVerifier - // is set, then call the inference verifier. + // verifier. If not, or if verification fails and can failover, then + // call the inference verifier. Symbol* exception_name = NULL; const size_t message_buffer_len = klass->name()->utf8_length() + 1024; char* message_buffer = NULL; char* exception_message = NULL; - bool can_failover = FailOverToOldVerifier && - klass->major_version() < NOFAILOVER_MAJOR_VERSION; - log_info(class, init)("Start class verification for: %s", klass->external_name()); if (klass->major_version() >= STACKMAP_ATTRIBUTE_MAJOR_VERSION) { ClassVerifier split_verifier(klass, THREAD); split_verifier.verify_class(THREAD); exception_name = split_verifier.result(); - if (can_failover && !HAS_PENDING_EXCEPTION && + + // If DumpSharedSpaces is set then don't fall back to the old verifier on + // verification failure. If a class fails verification with the split verifier, + // it might fail the CDS runtime verifier constraint check. In that case, we + // don't want to share the class. We only archive classes that pass the split + // verifier. + bool can_failover = !DumpSharedSpaces && + klass->major_version() < NOFAILOVER_MAJOR_VERSION; + + if (can_failover && !HAS_PENDING_EXCEPTION && // Split verifier doesn't set PENDING_EXCEPTION for failure (exception_name == vmSymbols::java_lang_VerifyError() || exception_name == vmSymbols::java_lang_ClassFormatError())) { log_info(verification)("Fail over class verification to old verifier for: %s", klass->external_name()); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/code/nmethod.cpp --- a/src/hotspot/share/code/nmethod.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/code/nmethod.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1473,6 +1473,13 @@ return NativeAccess::oop_load(oop_addr_at(index)); } +oop nmethod::oop_at_phantom(int index) const { + if (index == 0) { + return NULL; + } + return NativeAccess::oop_load(oop_addr_at(index)); +} + // // Notify all classes this nmethod is dependent on that it is no // longer dependent. This should only be called in two situations. diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/code/nmethod.hpp --- a/src/hotspot/share/code/nmethod.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/code/nmethod.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -392,6 +392,7 @@ // Support for oops in scopes and relocs: // Note: index 0 is reserved for null. oop oop_at(int index) const; + oop oop_at_phantom(int index) const; // phantom reference oop* oop_addr_at(int index) const { // for GC // relocation indexes are biased by 1 (because 0 is reserved) assert(index > 0 && index <= oops_count(), "must be a valid non-zero index"); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/compiler/abstractDisassembler.cpp --- a/src/hotspot/share/compiler/abstractDisassembler.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/compiler/abstractDisassembler.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -38,12 +38,12 @@ bool AbstractDisassembler::_show_data_hex = true; bool AbstractDisassembler::_show_data_int = false; bool AbstractDisassembler::_show_data_float = false; -bool AbstractDisassembler::_align_instr = false; +bool AbstractDisassembler::_align_instr = true; bool AbstractDisassembler::_show_pc = true; bool AbstractDisassembler::_show_offset = false; -bool AbstractDisassembler::_show_structs = false; -bool AbstractDisassembler::_show_comment = false; -bool AbstractDisassembler::_show_block_comment = false; +bool AbstractDisassembler::_show_structs = true; +bool AbstractDisassembler::_show_comment = true; +bool AbstractDisassembler::_show_block_comment = true; // set "true" to see what's in memory bit by bit // might prove cumbersome on platforms where instr_len is hard to find out diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/compiler/disassembler.cpp --- a/src/hotspot/share/compiler/disassembler.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/compiler/disassembler.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -147,7 +147,10 @@ if (AbstractDisassembler::show_comment()) { if ((_nm != NULL) && _nm->has_code_comment(pc0, pc)) { - _nm->print_code_comment_on(st, _post_decode_alignment, pc0, pc); + _nm->print_code_comment_on + (st, + _post_decode_alignment ? _post_decode_alignment : COMMENT_COLUMN, + pc0, pc); // this calls reloc_string_for which calls oop::print_value_on } print_hook_comments(pc0, _nm != NULL); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/compiler/oopMap.cpp --- a/src/hotspot/share/compiler/oopMap.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/compiler/oopMap.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -379,12 +379,8 @@ continue; } #ifdef ASSERT - // We can not verify the oop here if we are using ZGC, the oop - // will be bad in case we had a safepoint between a load and a - // load barrier. - if (!UseZGC && - ((((uintptr_t)loc & (sizeof(*loc)-1)) != 0) || - !Universe::heap()->is_in_or_null(*loc))) { + if ((((uintptr_t)loc & (sizeof(*loc)-1)) != 0) || + !Universe::heap()->is_in_or_null(*loc)) { tty->print_cr("# Found non oop pointer. Dumping state at failure"); // try to dump out some helpful debugging information trace_codeblob_maps(fr, reg_map); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -391,8 +391,6 @@ #endif // !PRODUCT HeapWord* G1BlockOffsetTablePart::initialize_threshold_raw() { - assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array), - "just checking"); _next_offset_index = _bot->index_for_raw(_space->bottom()); _next_offset_index++; _next_offset_threshold = @@ -401,8 +399,6 @@ } void G1BlockOffsetTablePart::zero_bottom_entry_raw() { - assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array), - "just checking"); size_t bottom_index = _bot->index_for_raw(_space->bottom()); assert(_bot->address_for_index_raw(bottom_index) == _space->bottom(), "Precondition of call"); @@ -410,8 +406,6 @@ } HeapWord* G1BlockOffsetTablePart::initialize_threshold() { - assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array), - "just checking"); _next_offset_index = _bot->index_for(_space->bottom()); _next_offset_index++; _next_offset_threshold = diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -52,7 +52,7 @@ // Array for keeping offsets for retrieving object start fast given an // address. - u_char* _offset_array; // byte array keeping backwards offsets + volatile u_char* _offset_array; // byte array keeping backwards offsets void check_offset(size_t offset, const char* msg) const { assert(offset <= BOTConstants::N_words, @@ -64,10 +64,7 @@ // For performance these have to devolve to array accesses in product builds. inline u_char offset_array(size_t index) const; - void set_offset_array_raw(size_t index, u_char offset) { - _offset_array[index] = offset; - } - + inline void set_offset_array_raw(size_t index, u_char offset); inline void set_offset_array(size_t index, u_char offset); inline void set_offset_array(size_t index, HeapWord* high, HeapWord* low); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -29,6 +29,7 @@ #include "gc/g1/heapRegion.hpp" #include "gc/shared/memset_with_concurrent_readers.hpp" #include "gc/shared/space.hpp" +#include "runtime/atomic.hpp" inline HeapWord* G1BlockOffsetTablePart::block_start(const void* addr) { if (addr >= _space->bottom() && addr < _space->end()) { @@ -51,7 +52,11 @@ u_char G1BlockOffsetTable::offset_array(size_t index) const { check_index(index, "index out of range"); - return _offset_array[index]; + return Atomic::load(&_offset_array[index]); +} + +void G1BlockOffsetTable::set_offset_array_raw(size_t index, u_char offset) { + Atomic::store(offset, &_offset_array[index]); } void G1BlockOffsetTable::set_offset_array(size_t index, u_char offset) { @@ -71,7 +76,8 @@ check_index(right, "right index out of range"); assert(left <= right, "indexes out of order"); size_t num_cards = right - left + 1; - memset_with_concurrent_readers(&_offset_array[left], offset, num_cards); + memset_with_concurrent_readers + (const_cast (&_offset_array[left]), offset, num_cards); } // Variant of index_for that does not check the index for validity. diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/g1/g1CollectedHeap.cpp --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2780,6 +2780,23 @@ cl.flush_rem_set_entries(); } +#ifndef PRODUCT +void G1CollectedHeap::verify_region_attr_remset_update() { + class VerifyRegionAttrRemSet : public HeapRegionClosure { + public: + virtual bool do_heap_region(HeapRegion* r) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + bool const needs_remset_update = g1h->region_attr(r->bottom()).needs_remset_update(); + assert(r->rem_set()->is_tracked() == needs_remset_update, + "Region %u remset tracking status (%s) different to region attribute (%s)", + r->hrm_index(), BOOL_TO_STR(r->rem_set()->is_tracked()), BOOL_TO_STR(needs_remset_update)); + return false; + } + } cl; + heap_region_iterate(&cl); +} +#endif + class VerifyRegionRemSetClosure : public HeapRegionClosure { public: bool do_heap_region(HeapRegion* hr) { @@ -3059,6 +3076,7 @@ // Actually do the work... evacuate_initial_collection_set(&per_thread_states); + if (_collection_set.optional_region_length() != 0) { evacuate_optional_collection_set(&per_thread_states); } @@ -4640,7 +4658,7 @@ bool const during_im = collector_state()->in_initial_mark_gc(); if (during_im && allocated_bytes > 0) { - _cm->root_regions()->add(alloc_region); + _cm->root_regions()->add(alloc_region->next_top_at_mark_start(), alloc_region->top()); } _hr_printer.retire(alloc_region); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/g1/g1CollectedHeap.hpp --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -593,6 +593,10 @@ _region_attr.clear(); } + // Verify that the G1RegionAttr remset tracking corresponds to actual remset tracking + // for all regions. + void verify_region_attr_remset_update() PRODUCT_RETURN; + bool is_user_requested_concurrent_full_gc(GCCause::Cause cause); // This is called at the start of either a concurrent cycle or a Full diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/g1/g1CollectionSet.cpp --- a/src/hotspot/share/gc/g1/g1CollectionSet.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/g1/g1CollectionSet.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -519,6 +519,9 @@ _num_optional_regions -= num_selected_regions; stop_incremental_building(); + + _g1h->verify_region_attr_remset_update(); + return num_selected_regions > 0; } @@ -526,10 +529,15 @@ for (uint i = 0; i < _num_optional_regions; i++) { HeapRegion* r = candidates()->at(candidates()->cur_idx() + i); pss->record_unused_optional_region(r); + // Clear collection set marker and make sure that the remembered set information + // is correct as we still need it later. _g1h->clear_region_attr(r); + _g1h->register_region_with_region_attr(r); r->clear_index_in_opt_cset(); } free_optional_regions(); + + _g1h->verify_region_attr_remset_update(); } #ifdef ASSERT diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/g1/g1ConcurrentMark.cpp --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -257,30 +257,38 @@ _free_list = NULL; } -G1CMRootRegions::G1CMRootRegions(uint const max_regions) : - _root_regions(NEW_C_HEAP_ARRAY(HeapRegion*, max_regions, mtGC)), - _max_regions(max_regions), - _num_root_regions(0), - _claimed_root_regions(0), - _scan_in_progress(false), - _should_abort(false) { } - -G1CMRootRegions::~G1CMRootRegions() { - FREE_C_HEAP_ARRAY(HeapRegion*, _max_regions); +G1CMRootMemRegions::G1CMRootMemRegions(uint const max_regions) : + _root_regions(NULL), + _max_regions(max_regions), + _num_root_regions(0), + _claimed_root_regions(0), + _scan_in_progress(false), + _should_abort(false) { + _root_regions = new MemRegion[_max_regions]; + if (_root_regions == NULL) { + vm_exit_during_initialization("Could not allocate root MemRegion set."); + } } -void G1CMRootRegions::reset() { +G1CMRootMemRegions::~G1CMRootMemRegions() { + delete[] _root_regions; +} + +void G1CMRootMemRegions::reset() { _num_root_regions = 0; } -void G1CMRootRegions::add(HeapRegion* hr) { +void G1CMRootMemRegions::add(HeapWord* start, HeapWord* end) { assert_at_safepoint(); size_t idx = Atomic::add((size_t)1, &_num_root_regions) - 1; - assert(idx < _max_regions, "Trying to add more root regions than there is space " SIZE_FORMAT, _max_regions); - _root_regions[idx] = hr; + assert(idx < _max_regions, "Trying to add more root MemRegions than there is space " SIZE_FORMAT, _max_regions); + assert(start != NULL && end != NULL && start <= end, "Start (" PTR_FORMAT ") should be less or equal to " + "end (" PTR_FORMAT ")", p2i(start), p2i(end)); + _root_regions[idx].set_start(start); + _root_regions[idx].set_end(end); } -void G1CMRootRegions::prepare_for_scan() { +void G1CMRootMemRegions::prepare_for_scan() { assert(!scan_in_progress(), "pre-condition"); _scan_in_progress = _num_root_regions > 0; @@ -289,7 +297,7 @@ _should_abort = false; } -HeapRegion* G1CMRootRegions::claim_next() { +const MemRegion* G1CMRootMemRegions::claim_next() { if (_should_abort) { // If someone has set the should_abort flag, we return NULL to // force the caller to bail out of their loop. @@ -302,26 +310,26 @@ size_t claimed_index = Atomic::add((size_t)1, &_claimed_root_regions) - 1; if (claimed_index < _num_root_regions) { - return _root_regions[claimed_index]; + return &_root_regions[claimed_index]; } return NULL; } -uint G1CMRootRegions::num_root_regions() const { +uint G1CMRootMemRegions::num_root_regions() const { return (uint)_num_root_regions; } -void G1CMRootRegions::notify_scan_done() { +void G1CMRootMemRegions::notify_scan_done() { MutexLocker x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag); _scan_in_progress = false; RootRegionScan_lock->notify_all(); } -void G1CMRootRegions::cancel_scan() { +void G1CMRootMemRegions::cancel_scan() { notify_scan_done(); } -void G1CMRootRegions::scan_finished() { +void G1CMRootMemRegions::scan_finished() { assert(scan_in_progress(), "pre-condition"); if (!_should_abort) { @@ -333,7 +341,7 @@ notify_scan_done(); } -bool G1CMRootRegions::wait_until_scan_finished() { +bool G1CMRootMemRegions::wait_until_scan_finished() { if (!scan_in_progress()) { return false; } @@ -875,14 +883,21 @@ return result; } -void G1ConcurrentMark::scan_root_region(HeapRegion* hr, uint worker_id) { - assert(hr->is_old() || (hr->is_survivor() && hr->next_top_at_mark_start() == hr->bottom()), - "Root regions must be old or survivor but region %u is %s", hr->hrm_index(), hr->get_type_str()); +void G1ConcurrentMark::scan_root_region(const MemRegion* region, uint worker_id) { +#ifdef ASSERT + HeapWord* last = region->last(); + HeapRegion* hr = _g1h->heap_region_containing(last); + assert(hr->is_old() || hr->next_top_at_mark_start() == hr->bottom(), + "Root regions must be old or survivor/eden but region %u is %s", hr->hrm_index(), hr->get_type_str()); + assert(hr->next_top_at_mark_start() == region->start(), + "MemRegion start should be equal to nTAMS"); +#endif + G1RootRegionScanClosure cl(_g1h, this, worker_id); const uintx interval = PrefetchScanIntervalInBytes; - HeapWord* curr = hr->next_top_at_mark_start(); - const HeapWord* end = hr->top(); + HeapWord* curr = region->start(); + const HeapWord* end = region->end(); while (curr < end) { Prefetch::read(curr, interval); oop obj = oop(curr); @@ -902,11 +917,11 @@ assert(Thread::current()->is_ConcurrentGC_thread(), "this should only be done by a conc GC thread"); - G1CMRootRegions* root_regions = _cm->root_regions(); - HeapRegion* hr = root_regions->claim_next(); - while (hr != NULL) { - _cm->scan_root_region(hr, worker_id); - hr = root_regions->claim_next(); + G1CMRootMemRegions* root_regions = _cm->root_regions(); + const MemRegion* region = root_regions->claim_next(); + while (region != NULL) { + _cm->scan_root_region(region, worker_id); + region = root_regions->claim_next(); } } }; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/g1/g1ConcurrentMark.hpp --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -222,18 +222,20 @@ template void iterate(Fn fn) const PRODUCT_RETURN; }; -// Root Regions are regions that contain objects from nTAMS to top. These are roots -// for marking, i.e. their referenced objects must be kept alive to maintain the +// Root MemRegions are memory areas that contain objects which references are +// roots wrt to the marking. They must be scanned before marking to maintain the // SATB invariant. -// We could scan and mark them through during the initial-mark pause, but for +// Typically they contain the areas from nTAMS to top of the regions. +// We could scan and mark through these objects during the initial-mark pause, but for // pause time reasons we move this work to the concurrent phase. // We need to complete this procedure before the next GC because it might determine // that some of these "root objects" are dead, potentially dropping some required // references. -// Root regions comprise of the complete contents of survivor regions, and any -// objects copied into old gen during GC. -class G1CMRootRegions { - HeapRegion** _root_regions; +// Root MemRegions comprise of the contents of survivor regions at the end +// of the GC, and any objects copied into the old gen during GC. +class G1CMRootMemRegions { + // The set of root MemRegions. + MemRegion* _root_regions; size_t const _max_regions; volatile size_t _num_root_regions; // Actual number of root regions. @@ -246,13 +248,13 @@ void notify_scan_done(); public: - G1CMRootRegions(uint const max_regions); - ~G1CMRootRegions(); + G1CMRootMemRegions(uint const max_regions); + ~G1CMRootMemRegions(); // Reset the data structure to allow addition of new root regions. void reset(); - void add(HeapRegion* hr); + void add(HeapWord* start, HeapWord* end); // Reset the claiming / scanning of the root regions. void prepare_for_scan(); @@ -264,9 +266,9 @@ // false otherwise. bool scan_in_progress() { return _scan_in_progress; } - // Claim the next root region to scan atomically, or return NULL if + // Claim the next root MemRegion to scan atomically, or return NULL if // all have been claimed. - HeapRegion* claim_next(); + const MemRegion* claim_next(); // The number of root regions to scan. uint num_root_regions() const; @@ -310,7 +312,7 @@ MemRegion const _heap; // Root region tracking and claiming - G1CMRootRegions _root_regions; + G1CMRootMemRegions _root_regions; // For grey objects G1CMMarkStack _global_mark_stack; // Grey objects behind global finger @@ -501,7 +503,7 @@ size_t partial_mark_stack_size_target() const { return _global_mark_stack.capacity() / 3; } bool mark_stack_empty() const { return _global_mark_stack.is_empty(); } - G1CMRootRegions* root_regions() { return &_root_regions; } + G1CMRootMemRegions* root_regions() { return &_root_regions; } void concurrent_cycle_start(); // Abandon current marking iteration due to a Full GC. @@ -554,8 +556,8 @@ // them. void scan_root_regions(); - // Scan a single root region from nTAMS to top and mark everything reachable from it. - void scan_root_region(HeapRegion* hr, uint worker_id); + // Scan a single root MemRegion to mark everything reachable from it. + void scan_root_region(const MemRegion* region, uint worker_id); // Do concurrent phase of marking, to a tentative transitive closure. void mark_from_roots(); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shared/c2/barrierSetC2.hpp --- a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -308,7 +308,6 @@ virtual bool escape_add_to_con_graph(ConnectionGraph* conn_graph, PhaseGVN* gvn, Unique_Node_List* delayed_worklist, Node* n, uint opcode) const { return false; } virtual bool escape_add_final_edges(ConnectionGraph* conn_graph, PhaseGVN* gvn, Node* n, uint opcode) const { return false; } virtual bool escape_has_out_with_unsafe_object(Node* n) const { return false; } - virtual bool escape_is_barrier_node(Node* n) const { return false; } virtual bool matcher_find_shared_visit(Matcher* matcher, Matcher::MStack& mstack, Node* n, uint opcode, bool& mem_op, int& mem_addr_idx) const { return false; }; virtual bool matcher_find_shared_post_visit(Matcher* matcher, Node* n, uint opcode) const { return false; }; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shared/collectedHeap.hpp --- a/src/hotspot/share/gc/shared/collectedHeap.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -534,11 +534,6 @@ virtual size_t obj_size(oop obj) const; - // Cells are memory slices allocated by the allocator. Objects are initialized - // in cells. The cell itself may have a header, found at a negative offset of - // oops. Usually, the size of the cell header is 0, but it may be larger. - virtual ptrdiff_t cell_header_size() const { return 0; } - // Non product verification and debugging. #ifndef PRODUCT // Support for PromotionFailureALot. Return true if it's time to cause a diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shared/gcArguments.cpp --- a/src/hotspot/share/gc/shared/gcArguments.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shared/gcArguments.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -33,8 +33,6 @@ #include "utilities/defaultStream.hpp" #include "utilities/macros.hpp" -size_t MinHeapSize = 0; - size_t HeapAlignment = 0; size_t SpaceAlignment = 0; @@ -122,7 +120,7 @@ assert(MaxHeapSize >= MinHeapSize, "Ergonomics decided on incompatible minimum and maximum heap sizes"); assert(InitialHeapSize >= MinHeapSize, "Ergonomics decided on incompatible initial and minimum heap sizes"); assert(MaxHeapSize >= InitialHeapSize, "Ergonomics decided on incompatible initial and maximum heap sizes"); - assert(MaxHeapSize % HeapAlignment == 0, "MinHeapSize alignment"); + assert(MinHeapSize % HeapAlignment == 0, "MinHeapSize alignment"); assert(InitialHeapSize % HeapAlignment == 0, "InitialHeapSize alignment"); assert(MaxHeapSize % HeapAlignment == 0, "MaxHeapSize alignment"); } @@ -149,7 +147,7 @@ if (FLAG_IS_CMDLINE(InitialHeapSize) && InitialHeapSize > MaxHeapSize) { vm_exit_during_initialization("Initial heap size set to a larger value than the maximum heap size"); } - if (MinHeapSize != 0 && MaxHeapSize < MinHeapSize) { + if (FLAG_IS_CMDLINE(MinHeapSize) && MaxHeapSize < MinHeapSize) { vm_exit_during_initialization("Incompatible minimum and maximum heap sizes specified"); } } @@ -166,28 +164,28 @@ } // User inputs from -Xmx and -Xms must be aligned - MinHeapSize = align_up(MinHeapSize, HeapAlignment); - size_t aligned_initial_heap_size = align_up(InitialHeapSize, HeapAlignment); - size_t aligned_max_heap_size = align_up(MaxHeapSize, HeapAlignment); - // Write back to flags if the values changed - if (aligned_initial_heap_size != InitialHeapSize) { - FLAG_SET_ERGO(InitialHeapSize, aligned_initial_heap_size); + if (!is_aligned(MinHeapSize, HeapAlignment)) { + FLAG_SET_ERGO(MinHeapSize, align_up(MinHeapSize, HeapAlignment)); } - if (aligned_max_heap_size != MaxHeapSize) { - FLAG_SET_ERGO(MaxHeapSize, aligned_max_heap_size); + if (!is_aligned(InitialHeapSize, HeapAlignment)) { + FLAG_SET_ERGO(InitialHeapSize, align_up(InitialHeapSize, HeapAlignment)); + } + if (!is_aligned(MaxHeapSize, HeapAlignment)) { + FLAG_SET_ERGO(MaxHeapSize, align_up(MaxHeapSize, HeapAlignment)); } - if (FLAG_IS_CMDLINE(InitialHeapSize) && MinHeapSize != 0 && + if (FLAG_IS_CMDLINE(InitialHeapSize) && FLAG_IS_CMDLINE(MinHeapSize) && InitialHeapSize < MinHeapSize) { vm_exit_during_initialization("Incompatible minimum and initial heap sizes specified"); } + if (!FLAG_IS_DEFAULT(InitialHeapSize) && InitialHeapSize > MaxHeapSize) { FLAG_SET_ERGO(MaxHeapSize, InitialHeapSize); } else if (!FLAG_IS_DEFAULT(MaxHeapSize) && InitialHeapSize > MaxHeapSize) { FLAG_SET_ERGO(InitialHeapSize, MaxHeapSize); if (InitialHeapSize < MinHeapSize) { - MinHeapSize = InitialHeapSize; + FLAG_SET_ERGO(MinHeapSize, InitialHeapSize); } } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shared/gcArguments.hpp --- a/src/hotspot/share/gc/shared/gcArguments.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shared/gcArguments.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -30,8 +30,6 @@ class CollectedHeap; -extern size_t MinHeapSize; - extern size_t HeapAlignment; extern size_t SpaceAlignment; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shared/gcLocker.inline.hpp --- a/src/hotspot/share/gc/shared/gcLocker.inline.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shared/gcLocker.inline.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -26,7 +26,7 @@ #define SHARE_GC_SHARED_GCLOCKER_INLINE_HPP #include "gc/shared/gcLocker.hpp" -#include "runtime/thread.hpp" +#include "runtime/thread.inline.hpp" void GCLocker::lock_critical(JavaThread* thread) { if (!thread->in_critical()) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shared/gc_globals.hpp --- a/src/hotspot/share/gc/shared/gc_globals.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shared/gc_globals.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -713,6 +713,10 @@ "to move") \ \ /* gc parameters */ \ + product(size_t, MinHeapSize, 0, \ + "Minimum heap size (in bytes); zero means use ergonomics") \ + constraint(MinHeapSizeConstraintFunc,AfterErgo) \ + \ product(size_t, InitialHeapSize, 0, \ "Initial heap size (in bytes); zero means use ergonomics") \ constraint(InitialHeapSizeConstraintFunc,AfterErgo) \ diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shared/genArguments.cpp --- a/src/hotspot/share/gc/shared/genArguments.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shared/genArguments.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -90,7 +90,7 @@ } // If needed, synchronize MinHeapSize size and InitialHeapSize if (MinHeapSize < smallest_heap_size) { - MinHeapSize = smallest_heap_size; + FLAG_SET_ERGO(MinHeapSize, smallest_heap_size); if (InitialHeapSize < MinHeapSize) { FLAG_SET_ERGO(InitialHeapSize, smallest_heap_size); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp --- a/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -319,6 +319,10 @@ return MaxSizeForAlignment(name, value, heap_alignment, verbose); } +JVMFlag::Error MinHeapSizeConstraintFunc(size_t value, bool verbose) { + return MaxSizeForHeapAlignment("MinHeapSize", value, verbose); +} + JVMFlag::Error InitialHeapSizeConstraintFunc(size_t value, bool verbose) { return MaxSizeForHeapAlignment("InitialHeapSize", value, verbose); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shared/jvmFlagConstraintsGC.hpp --- a/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -59,6 +59,7 @@ JVMFlag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose); JVMFlag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose); JVMFlag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose); +JVMFlag::Error MinHeapSizeConstraintFunc(size_t value, bool verbose); JVMFlag::Error InitialHeapSizeConstraintFunc(size_t value, bool verbose); JVMFlag::Error MaxHeapSizeConstraintFunc(size_t value, bool verbose); JVMFlag::Error SoftMaxHeapSizeConstraintFunc(size_t value, bool verbose); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1194,10 +1194,6 @@ } -bool ShenandoahBarrierSetC2::escape_is_barrier_node(Node* n) const { - return n->Opcode() == Op_ShenandoahLoadReferenceBarrier; -} - bool ShenandoahBarrierSetC2::matcher_find_shared_post_visit(Matcher* matcher, Node* n, uint opcode) const { switch (opcode) { case Op_ShenandoahCompareAndExchangeP: diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -144,7 +144,6 @@ virtual bool escape_add_to_con_graph(ConnectionGraph* conn_graph, PhaseGVN* gvn, Unique_Node_List* delayed_worklist, Node* n, uint opcode) const; virtual bool escape_add_final_edges(ConnectionGraph* conn_graph, PhaseGVN* gvn, Node* n, uint opcode) const; virtual bool escape_has_out_with_unsafe_object(Node* n) const; - virtual bool escape_is_barrier_node(Node* n) const; virtual bool matcher_find_shared_post_visit(Matcher* matcher, Node* n, uint opcode) const; virtual bool matcher_is_store_load_barrier(Node* x, uint xop) const; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -122,7 +122,7 @@ void possibly_parallel_blobs_do(CodeBlobClosure* f); }; -class ShenandoahCodeRoots : public CHeapObj { +class ShenandoahCodeRoots : public AllStatic { friend class ShenandoahHeap; friend class ShenandoahCodeRootsIterator; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahConcurrentRoots.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentRoots.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. All rights reserved. + * + * 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. + * + */ + +#include "precompiled.hpp" + +#include "gc/shenandoah/shenandoahConcurrentRoots.hpp" +#include "gc/shenandoah/shenandoahHeap.inline.hpp" + +bool ShenandoahConcurrentRoots::can_do_concurrent_roots() { + // Don't support traversal GC at this moment + return !ShenandoahHeap::heap()->is_concurrent_traversal_in_progress(); +} + +bool ShenandoahConcurrentRoots::should_do_concurrent_roots() { + ShenandoahHeap* const heap = ShenandoahHeap::heap(); + bool stw_gc_in_progress = heap->is_full_gc_in_progress() || + heap->is_degenerated_gc_in_progress(); + return can_do_concurrent_roots() && + !stw_gc_in_progress; +} diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahConcurrentRoots.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentRoots.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. All rights reserved. + * + * 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. + * + */ + +#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTROOTS_HPP +#define SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTROOTS_HPP + +#include "memory/allocation.hpp" + +class ShenandoahConcurrentRoots : public AllStatic { +public: + // Can GC settings allow concurrent root processing + static bool can_do_concurrent_roots(); + // If current GC cycle can process roots concurrently + static bool should_do_concurrent_roots(); +}; + + +#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTROOTS_HPP diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -377,6 +377,9 @@ // Complete marking under STW, and start evacuation heap->vmop_entry_final_mark(); + // Evacuate concurrent roots + heap->entry_roots(); + // Final mark might have reclaimed some immediate garbage, kick cleanup to reclaim // the space. This would be the last action if there is nothing to evacuate. heap->entry_cleanup(); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -38,6 +38,7 @@ #include "gc/shenandoah/shenandoahCollectionSet.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc/shenandoah/shenandoahConcurrentMark.inline.hpp" +#include "gc/shenandoah/shenandoahConcurrentRoots.hpp" #include "gc/shenandoah/shenandoahControlThread.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" #include "gc/shenandoah/shenandoahPhaseTimings.hpp" @@ -1071,9 +1072,11 @@ DerivedPointerTable::clear(); #endif assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only iterate roots while world is stopped"); - { - ShenandoahRootEvacuator rp(workers()->active_workers(), ShenandoahPhaseTimings::init_evac); + // Include concurrent roots if current cycle can not process those roots concurrently + ShenandoahRootEvacuator rp(workers()->active_workers(), + ShenandoahPhaseTimings::init_evac, + !ShenandoahConcurrentRoots::should_do_concurrent_roots()); ShenandoahEvacuateUpdateRootsTask roots_task(&rp); workers()->run_task(&roots_task); } @@ -1276,10 +1279,15 @@ Stack oop_stack; - // First, we process all GC roots. This populates the work stack with initial objects. - ShenandoahAllRootScanner rp(1, ShenandoahPhaseTimings::_num_phases); + // First, we process GC roots according to current GC cycle. This populates the work stack with initial objects. + ShenandoahHeapIterationRootScanner rp; ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack); - rp.roots_do_unchecked(&oops); + + if (unload_classes()) { + rp.strong_roots_do(&oops); + } else { + rp.roots_do(&oops); + } // Work through the oop stack to traverse heap. while (! oop_stack.is_empty()) { @@ -1512,7 +1520,11 @@ } if (ShenandoahVerify) { - verifier()->verify_roots_no_forwarded(); + if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) { + verifier()->verify_roots_no_forwarded_except(ShenandoahRootVerifier::JNIHandleRoots); + } else { + verifier()->verify_roots_no_forwarded(); + } verifier()->verify_during_evacuation(); } } else { @@ -1573,6 +1585,30 @@ free_set()->recycle_trash(); } +class ShenandoahConcurrentRootsEvacUpdateTask : public AbstractGangTask { +private: + ShenandoahJNIHandleRoots _jni_roots; + +public: + ShenandoahConcurrentRootsEvacUpdateTask() : + AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") { + } + + void work(uint worker_id) { + ShenandoahEvacOOMScope oom; + ShenandoahEvacuateUpdateRootsClosure cl; + _jni_roots.oops_do(&cl); + } +}; + +void ShenandoahHeap::op_roots() { + if (is_evacuation_in_progress() && + ShenandoahConcurrentRoots::should_do_concurrent_roots()) { + ShenandoahConcurrentRootsEvacUpdateTask task; + workers()->run_task(&task); + } +} + void ShenandoahHeap::op_reset() { reset_mark_bitmap(); } @@ -1694,7 +1730,28 @@ // it would be a simple check, which is supposed to be fast. This is also // safe to do even without degeneration, as CSet iterator is at beginning // in preparation for evacuation anyway. - collection_set()->clear_current_index(); + // + // Before doing that, we need to make sure we never had any cset-pinned + // regions. This may happen if allocation failure happened when evacuating + // the about-to-be-pinned object, oom-evac protocol left the object in + // the collection set, and then the pin reached the cset region. If we continue + // the cycle here, we would trash the cset and alive objects in it. To avoid + // it, we fail degeneration right away and slide into Full GC to recover. + + { + collection_set()->clear_current_index(); + + ShenandoahHeapRegion* r; + while ((r = collection_set()->next()) != NULL) { + if (r->is_pinned()) { + cancel_gc(GCCause::_shenandoah_upgrade_to_full_gc); + op_degenerated_fail(); + return; + } + } + + collection_set()->clear_current_index(); + } op_stw_evac(); if (cancelled_gc()) { @@ -2152,6 +2209,11 @@ concurrent_mark()->update_thread_roots(ShenandoahPhaseTimings::final_update_refs_roots); } + // Has to be done before cset is clear + if (ShenandoahVerify) { + verifier()->verify_roots_in_to_space(); + } + ShenandoahGCPhase final_update_refs(ShenandoahPhaseTimings::final_update_refs_recycle); trash_cset_regions(); @@ -2159,7 +2221,6 @@ set_update_refs_in_progress(false); if (ShenandoahVerify) { - verifier()->verify_roots_no_forwarded(); verifier()->verify_after_updaterefs(); } @@ -2529,6 +2590,22 @@ try_inject_alloc_failure(); op_updaterefs(); } + +void ShenandoahHeap::entry_roots() { + ShenandoahGCPhase phase(ShenandoahPhaseTimings::conc_roots); + + static const char* msg = "Concurrent roots processing"; + GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); + EventMark em("%s", msg); + + ShenandoahWorkerScope scope(workers(), + ShenandoahWorkerPolicy::calc_workers_for_conc_root_processing(), + "concurrent root processing"); + + try_inject_alloc_failure(); + op_roots(); +} + void ShenandoahHeap::entry_cleanup() { ShenandoahGCPhase phase(ShenandoahPhaseTimings::conc_cleanup); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -391,6 +391,7 @@ void entry_reset(); void entry_mark(); void entry_preclean(); + void entry_roots(); void entry_cleanup(); void entry_evac(); void entry_updaterefs(); @@ -414,6 +415,7 @@ void op_reset(); void op_mark(); void op_preclean(); + void op_roots(); void op_cleanup(); void op_conc_evac(); void op_stw_evac(); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -306,6 +306,7 @@ f(conc_mark, "Concurrent Marking") \ f(conc_termination, " Termination") \ f(conc_preclean, "Concurrent Precleaning") \ + f(conc_roots, "Concurrent Roots") \ f(conc_evac, "Concurrent Evacuation") \ f(conc_update_refs, "Concurrent Update Refs") \ f(conc_cleanup, "Concurrent Cleanup") \ diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -60,8 +60,7 @@ _object_synchronizer_root(&ObjectSynchronizer::oops_do, ShenandoahPhaseTimings::ObjectSynchronizerRoots), _management_root(&Management::oops_do, ShenandoahPhaseTimings::ManagementRoots), _system_dictionary_root(&SystemDictionary::oops_do, ShenandoahPhaseTimings::SystemDictionaryRoots), - _jvmti_root(&JvmtiExport::oops_do, ShenandoahPhaseTimings::JVMTIRoots), - _jni_handle_root(&JNIHandles::oops_do, ShenandoahPhaseTimings::JNIRoots) { + _jvmti_root(&JvmtiExport::oops_do, ShenandoahPhaseTimings::JVMTIRoots) { } void ShenandoahSerialRoots::oops_do(OopClosure* cl, uint worker_id) { @@ -70,7 +69,6 @@ _management_root.oops_do(cl, worker_id); _system_dictionary_root.oops_do(cl, worker_id); _jvmti_root.oops_do(cl, worker_id); - _jni_handle_root.oops_do(cl, worker_id); } ShenandoahThreadRoots::ShenandoahThreadRoots(bool is_par) : _is_par(is_par) { @@ -124,16 +122,6 @@ } } -ShenandoahClassLoaderDataRoots::ShenandoahClassLoaderDataRoots() { - ClassLoaderDataGraph::clear_claimed_marks(); -} - -void ShenandoahClassLoaderDataRoots::clds_do(CLDClosure* strong_clds, CLDClosure* weak_clds, uint worker_id) { - ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); - ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id); - ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds); -} - ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) : _heap(ShenandoahHeap::heap()), _phase(phase) { @@ -146,23 +134,25 @@ _heap->phase_timings()->record_workers_end(_phase); } -ShenandoahRootEvacuator::ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase) : +ShenandoahRootEvacuator::ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots) : ShenandoahRootProcessor(phase), _thread_roots(n_workers > 1), - _weak_roots(n_workers) { + _weak_roots(n_workers), + _include_concurrent_roots(include_concurrent_roots) { } void ShenandoahRootEvacuator::roots_do(uint worker_id, OopClosure* oops) { MarkingCodeBlobClosure blobsCl(oops, CodeBlobToOopClosure::FixRelocations); CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong); - CLDToOopClosure* weak_clds = ShenandoahHeap::heap()->unload_classes() ? NULL : &clds; - AlwaysTrueClosure always_true; _serial_roots.oops_do(oops, worker_id); + if (_include_concurrent_roots) { + _jni_roots.oops_do(oops, worker_id); + } _thread_roots.oops_do(oops, NULL, worker_id); - _cld_roots.clds_do(&clds, &clds, worker_id); + _cld_roots.cld_do(&clds, worker_id); _code_roots.code_blobs_do(&blobsCl, worker_id); _weak_roots.oops_do(&always_true, oops, worker_id); @@ -189,11 +179,46 @@ AlwaysTrueClosure always_true; _serial_roots.oops_do(oops, worker_id); + _jni_roots.oops_do(oops, worker_id); _thread_roots.oops_do(oops, NULL, worker_id); - _cld_roots.clds_do(&adjust_cld_closure, NULL, worker_id); + _cld_roots.cld_do(&adjust_cld_closure, worker_id); _code_roots.code_blobs_do(&adjust_code_closure, worker_id); _weak_roots.oops_do(&always_true, oops, worker_id); _dedup_roots.oops_do(&always_true, oops, worker_id); } + + ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner() : + ShenandoahRootProcessor(ShenandoahPhaseTimings::_num_phases), + _thread_roots(false /*is par*/) { + } + + void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) { + assert(Thread::current()->is_VM_thread(), "Only by VM thread"); + // Must use _claim_none to avoid interfering with concurrent CLDG iteration + CLDToOopClosure clds(oops, ClassLoaderData::_claim_none); + MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations); + ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL); + ResourceMark rm; + + _serial_roots.oops_do(oops, 0); + _jni_roots.oops_do(oops, 0); + _cld_roots.cld_do(&clds, 0); + _thread_roots.threads_do(&tc_cl, 0); + _code_roots.code_blobs_do(&code, 0); + } + + void ShenandoahHeapIterationRootScanner::strong_roots_do(OopClosure* oops) { + assert(Thread::current()->is_VM_thread(), "Only by VM thread"); + // Must use _claim_none to avoid interfering with concurrent CLDG iteration + CLDToOopClosure clds(oops, ClassLoaderData::_claim_none); + MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations); + ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL); + ResourceMark rm; + + _serial_roots.oops_do(oops, 0); + _jni_roots.oops_do(oops, 0); + _cld_roots.always_strong_cld_do(&clds, 0); + _thread_roots.threads_do(&tc_cl, 0); + } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -56,12 +56,22 @@ ShenandoahSerialRoot _management_root; ShenandoahSerialRoot _system_dictionary_root; ShenandoahSerialRoot _jvmti_root; - ShenandoahSerialRoot _jni_handle_root; public: ShenandoahSerialRoots(); void oops_do(OopClosure* cl, uint worker_id); }; +template +class ShenandoahJNIHandleRoots { +private: + OopStorage::ParState _itr; +public: + ShenandoahJNIHandleRoots(); + + template + void oops_do(T* cl, uint worker_id = 0); +}; + class ShenandoahThreadRoots { private: const bool _is_par; @@ -104,11 +114,13 @@ void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id); }; +template class ShenandoahClassLoaderDataRoots { public: ShenandoahClassLoaderDataRoots(); - void clds_do(CLDClosure* strong_clds, CLDClosure* weak_clds, uint worker_id); + void always_strong_cld_do(CLDClosure* clds, uint worker_id); + void cld_do(CLDClosure* clds, uint worker_id); }; class ShenandoahRootProcessor : public StackObj { @@ -125,10 +137,11 @@ template class ShenandoahRootScanner : public ShenandoahRootProcessor { private: - ShenandoahSerialRoots _serial_roots; - ShenandoahClassLoaderDataRoots _cld_roots; - ShenandoahThreadRoots _thread_roots; - ShenandoahCodeCacheRoots _code_roots; + ShenandoahSerialRoots _serial_roots; + ShenandoahThreadRoots _thread_roots; + ShenandoahCodeCacheRoots _code_roots; + ShenandoahJNIHandleRoots _jni_roots; + ShenandoahClassLoaderDataRoots _cld_roots; public: ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase); @@ -141,25 +154,42 @@ // roots when class unloading is disabled during this cycle void roots_do(uint worker_id, OopClosure* cl); void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL); - // For heap object iteration - void roots_do_unchecked(OopClosure* cl); }; typedef ShenandoahRootScanner ShenandoahAllRootScanner; typedef ShenandoahRootScanner ShenandoahCSetRootScanner; +// This scanner is only for SH::object_iteration() and only supports single-threaded +// root scanning +class ShenandoahHeapIterationRootScanner : public ShenandoahRootProcessor { +private: + ShenandoahSerialRoots _serial_roots; + ShenandoahThreadRoots _thread_roots; + ShenandoahJNIHandleRoots _jni_roots; + ShenandoahClassLoaderDataRoots _cld_roots; + ShenandoahCodeCacheRoots _code_roots; + +public: + ShenandoahHeapIterationRootScanner(); + + void roots_do(OopClosure* cl); + void strong_roots_do(OopClosure* cl); +}; + // Evacuate all roots at a safepoint class ShenandoahRootEvacuator : public ShenandoahRootProcessor { private: - ShenandoahSerialRoots _serial_roots; - ShenandoahClassLoaderDataRoots _cld_roots; - ShenandoahThreadRoots _thread_roots; - ShenandoahWeakRoots _weak_roots; - ShenandoahStringDedupRoots _dedup_roots; + ShenandoahSerialRoots _serial_roots; + ShenandoahJNIHandleRoots _jni_roots; + ShenandoahClassLoaderDataRoots _cld_roots; + ShenandoahThreadRoots _thread_roots; + ShenandoahWeakRoots _weak_roots; + ShenandoahStringDedupRoots _dedup_roots; ShenandoahCodeCacheRoots _code_roots; + bool _include_concurrent_roots; public: - ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase); + ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots); void roots_do(uint worker_id, OopClosure* oops); }; @@ -167,13 +197,14 @@ // Update all roots at a safepoint class ShenandoahRootUpdater : public ShenandoahRootProcessor { private: - ShenandoahSerialRoots _serial_roots; - ShenandoahClassLoaderDataRoots _cld_roots; - ShenandoahThreadRoots _thread_roots; - ShenandoahWeakRoots _weak_roots; - ShenandoahStringDedupRoots _dedup_roots; + ShenandoahSerialRoots _serial_roots; + ShenandoahJNIHandleRoots _jni_roots; + ShenandoahClassLoaderDataRoots _cld_roots; + ShenandoahThreadRoots _thread_roots; + ShenandoahWeakRoots _weak_roots; + ShenandoahStringDedupRoots _dedup_roots; ShenandoahCodeCacheRoots _code_roots; - const bool _update_code_cache; + const bool _update_code_cache; public: ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache); @@ -185,12 +216,13 @@ // Adjuster all roots at a safepoint during full gc class ShenandoahRootAdjuster : public ShenandoahRootProcessor { private: - ShenandoahSerialRoots _serial_roots; - ShenandoahClassLoaderDataRoots _cld_roots; - ShenandoahThreadRoots _thread_roots; - ShenandoahWeakRoots _weak_roots; - ShenandoahStringDedupRoots _dedup_roots; - ShenandoahCodeCacheRoots _code_roots; + ShenandoahSerialRoots _serial_roots; + ShenandoahJNIHandleRoots _jni_roots; + ShenandoahClassLoaderDataRoots _cld_roots; + ShenandoahThreadRoots _thread_roots; + ShenandoahWeakRoots _weak_roots; + ShenandoahStringDedupRoots _dedup_roots; + ShenandoahCodeCacheRoots _code_roots; public: ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -24,17 +24,70 @@ #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP +#include "classfile/classLoaderDataGraph.hpp" +#include "gc/shared/oopStorageParState.inline.hpp" #include "gc/shenandoah/shenandoahHeuristics.hpp" #include "gc/shenandoah/shenandoahRootProcessor.hpp" #include "gc/shenandoah/shenandoahTimingTracker.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" #include "memory/resourceArea.hpp" +#include "runtime/safepoint.hpp" + +template +ShenandoahJNIHandleRoots::ShenandoahJNIHandleRoots() : + _itr(JNIHandles::global_handles()) { +} + +template +template +void ShenandoahJNIHandleRoots::oops_do(T* cl, uint worker_id) { + if (CONCURRENT) { + _itr.oops_do(cl); + } else { + ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); + ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::JNIRoots, worker_id); + _itr.oops_do(cl); + } +} template void ShenandoahWeakRoots::oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) { _task.work(worker_id, is_alive, keep_alive); } +template +ShenandoahClassLoaderDataRoots::ShenandoahClassLoaderDataRoots() { + if (!SINGLE_THREADED) { + ClassLoaderDataGraph::clear_claimed_marks(); + } +} + +template +void ShenandoahClassLoaderDataRoots::always_strong_cld_do(CLDClosure* clds, uint worker_id) { + if (SINGLE_THREADED) { + assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint"); + assert(Thread::current()->is_VM_thread(), "Single threaded CLDG iteration can only be done by VM thread"); + ClassLoaderDataGraph::always_strong_cld_do(clds); + } else { + ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); + ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id); + ClassLoaderDataGraph::always_strong_cld_do(clds); + } +} + +template +void ShenandoahClassLoaderDataRoots::cld_do(CLDClosure* clds, uint worker_id) { + if (SINGLE_THREADED) { + assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint"); + assert(Thread::current()->is_VM_thread(), "Single threaded CLDG iteration can only be done by VM thread"); + ClassLoaderDataGraph::cld_do(clds); + } else { + ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); + ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id); + ClassLoaderDataGraph::cld_do(clds); + } +} + template ShenandoahCodeCacheRoots::ShenandoahCodeCacheRoots() { nmethod::oops_do_marking_prologue(); @@ -99,7 +152,14 @@ ResourceMark rm; _serial_roots.oops_do(oops, worker_id); - _cld_roots.clds_do(clds, clds, worker_id); + _jni_roots.oops_do(oops, worker_id); + + if (clds != NULL) { + _cld_roots.cld_do(clds, worker_id); + } else { + assert(ShenandoahHeap::heap()->is_concurrent_traversal_in_progress(), "Only possible with traversal GC"); + } + _thread_roots.threads_do(&tc_cl, worker_id); // With ShenandoahConcurrentScanCodeRoots, we avoid scanning the entire code cache here, @@ -111,26 +171,14 @@ } template -void ShenandoahRootScanner::roots_do_unchecked(OopClosure* oops) { - CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong); - MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations); - ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL); - ResourceMark rm; - - _serial_roots.oops_do(oops, 0); - _cld_roots.clds_do(&clds, &clds, 0); - _thread_roots.threads_do(&tc_cl, 0); - _code_roots.code_blobs_do(&code, 0); -} - -template void ShenandoahRootScanner::strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc) { assert(ShenandoahHeap::heap()->unload_classes(), "Should be used during class unloading"); ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc); ResourceMark rm; _serial_roots.oops_do(oops, worker_id); - _cld_roots.clds_do(clds, NULL, worker_id); + _jni_roots.oops_do(oops, worker_id); + _cld_roots.always_strong_cld_do(clds, worker_id); _thread_roots.threads_do(&tc_cl, worker_id); } @@ -138,12 +186,12 @@ void ShenandoahRootUpdater::roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive) { CodeBlobToOopClosure update_blobs(keep_alive, CodeBlobToOopClosure::FixRelocations); CLDToOopClosure clds(keep_alive, ClassLoaderData::_claim_strong); - CLDToOopClosure* weak_clds = ShenandoahHeap::heap()->unload_classes() ? NULL : &clds; _serial_roots.oops_do(keep_alive, worker_id); + _jni_roots.oops_do(keep_alive, worker_id); _thread_roots.oops_do(keep_alive, NULL, worker_id); - _cld_roots.clds_do(&clds, weak_clds, worker_id); + _cld_roots.cld_do(&clds, worker_id); if(_update_code_cache) { _code_roots.code_blobs_do(&update_blobs, worker_id); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -69,15 +69,18 @@ if (verify(SerialRoots)) { shenandoah_assert_safepoint(); - Universe::oops_do(oops); Management::oops_do(oops); JvmtiExport::oops_do(oops); - JNIHandles::oops_do(oops); ObjectSynchronizer::oops_do(oops); SystemDictionary::oops_do(oops); } + if (verify(JNIHandleRoots)) { + shenandoah_assert_safepoint(); + JNIHandles::oops_do(oops); + } + if (verify(WeakRoots)) { shenandoah_assert_safepoint(); AlwaysTrueClosure always_true; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -36,7 +36,8 @@ CLDGRoots = 1 << 3, WeakRoots = 1 << 4, StringDedupRoots = 1 << 5, - AllRoots = (SerialRoots | ThreadRoots | CodeRoots | CLDGRoots | WeakRoots | StringDedupRoots) + JNIHandleRoots = 1 << 6, + AllRoots = (SerialRoots | ThreadRoots | CodeRoots | CLDGRoots | WeakRoots | StringDedupRoots | JNIHandleRoots) }; private: diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -964,6 +964,44 @@ void do_oop(oop* p) { do_oop_work(p); } }; +class ShenandoahVerifyInToSpaceClosure : public OopClosure { +private: + template + void do_oop_work(T* p) { + T o = RawAccess<>::oop_load(p); + if (!CompressedOops::is_null(o)) { + oop obj = CompressedOops::decode_not_null(o); + ShenandoahHeap* heap = ShenandoahHeap::heap_no_check(); + + if (!heap->marking_context()->is_marked(obj)) { + ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL, + "Verify Roots In To-Space", "Should be marked", __FILE__, __LINE__); + } + + if (heap->in_collection_set(obj)) { + ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL, + "Verify Roots In To-Space", "Should not be in collection set", __FILE__, __LINE__); + } + + oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj); + if (!oopDesc::equals_raw(obj, fwd)) { + ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL, + "Verify Roots In To-Space", "Should not be forwarded", __FILE__, __LINE__); + } + } + } + +public: + void do_oop(narrowOop* p) { do_oop_work(p); } + void do_oop(oop* p) { do_oop_work(p); } +}; + +void ShenandoahVerifier::verify_roots_in_to_space() { + ShenandoahRootVerifier verifier; + ShenandoahVerifyInToSpaceClosure cl; + verifier.oops_do(&cl); +} + void ShenandoahVerifier::verify_roots_no_forwarded() { ShenandoahRootVerifier verifier; ShenandoahVerifyNoForwared cl; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -189,6 +189,7 @@ void verify_generic(VerifyOption option); // Roots should only contain to-space oops + void verify_roots_in_to_space(); void verify_roots_no_forwarded(); void verify_roots_no_forwarded_except(ShenandoahRootVerifier::RootTypes types); }; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -30,6 +30,7 @@ uint ShenandoahWorkerPolicy::_prev_par_marking = 0; uint ShenandoahWorkerPolicy::_prev_conc_marking = 0; uint ShenandoahWorkerPolicy::_prev_conc_evac = 0; +uint ShenandoahWorkerPolicy::_prev_conc_root_proc = 0; uint ShenandoahWorkerPolicy::_prev_fullgc = 0; uint ShenandoahWorkerPolicy::_prev_degengc = 0; uint ShenandoahWorkerPolicy::_prev_stw_traversal = 0; @@ -63,6 +64,16 @@ return _prev_par_marking; } +// Calculate workers for concurrent root processing +uint ShenandoahWorkerPolicy::calc_workers_for_conc_root_processing() { + uint active_workers = (_prev_conc_root_proc == 0) ? ConcGCThreads : _prev_conc_root_proc; + _prev_conc_root_proc = + WorkerPolicy::calc_active_conc_workers(ConcGCThreads, + active_workers, + Threads::number_of_non_daemon_threads()); + return _prev_conc_root_proc; +} + // Calculate workers for concurrent evacuation (concurrent GC) uint ShenandoahWorkerPolicy::calc_workers_for_conc_evac() { uint active_workers = (_prev_conc_evac == 0) ? ConcGCThreads : _prev_conc_evac; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -30,6 +30,7 @@ private: static uint _prev_par_marking; static uint _prev_conc_marking; + static uint _prev_conc_root_proc; static uint _prev_conc_evac; static uint _prev_fullgc; static uint _prev_degengc; @@ -50,6 +51,9 @@ // Calculate the number of workers for final marking static uint calc_workers_for_final_marking(); + // Calculate workers for concurrent root processing + static uint calc_workers_for_conc_root_processing(); + // Calculate workers for concurrent evacuation (concurrent GC) static uint calc_workers_for_conc_evac(); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp --- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -866,7 +866,6 @@ // In some very rare cases a load that doesn't need a barrier will end up here // Treat it as a LoadP and the insertion of phis will be done correctly. if (node->is_Load()) { - assert(node->as_Load()->barrier_data() == 0, "Sanity"); call_catch_cleanup_one(phase, node->as_Load(), phase->get_ctrl(node)); } else { for (DUIterator_Fast jmax, i = node->fast_outs(jmax); i < jmax; i++) { @@ -1356,6 +1355,14 @@ while(nodeStack.length() > 0) { Node *n = nodeStack.pop(); + for (uint i = 0; i < n->len(); i++) { + if (n->in(i)) { + if (!visited.test_set(n->in(i)->_idx)) { + nodeStack.push(n->in(i)); + } + } + } + bool is_old_node = (n->_idx < new_ids); // don't process nodes that were created during cleanup if (n->is_Load() && is_old_node) { LoadNode* load = n->isa_Load(); @@ -1364,14 +1371,6 @@ process_catch_cleanup_candidate(phase, load); } } - - for (uint i = 0; i < n->len(); i++) { - if (n->in(i)) { - if (!visited.test_set(n->in(i)->_idx)) { - nodeStack.push(n->in(i)); - } - } - } } C->print_method(PHASE_CALL_CATCH_CLEANUP, 2); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/z/zHeap.cpp --- a/src/hotspot/share/gc/z/zHeap.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/z/zHeap.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -471,8 +471,8 @@ void ZHeap::object_iterate(ObjectClosure* cl, bool visit_referents) { assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint"); - ZHeapIterator iter(visit_referents); - iter.objects_do(cl); + ZHeapIterator iter; + iter.objects_do(cl, visit_referents); } void ZHeap::serviceability_initialize() { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/z/zHeapIterator.cpp --- a/src/hotspot/share/gc/z/zHeapIterator.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/z/zHeapIterator.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -51,18 +51,29 @@ } }; +template class ZHeapIteratorRootOopClosure : public ZRootsIteratorClosure { private: ZHeapIterator* const _iter; + oop load_oop(oop* p) { + if (Weak) { + return NativeAccess::oop_load(p); + } + + if (Concurrent) { + return NativeAccess::oop_load(p); + } + + return RawAccess<>::oop_load(p); + } + public: ZHeapIteratorRootOopClosure(ZHeapIterator* iter) : _iter(iter) {} virtual void do_oop(oop* p) { - // Load barrier needed here, even on non-concurrent strong roots, - // for the same reason we need fixup_partial_loads() in ZHeap::mark_end(). - const oop obj = NativeAccess::oop_load(p); + const oop obj = load_oop(p); _iter->push(obj); } @@ -71,28 +82,27 @@ } }; +template class ZHeapIteratorOopClosure : public BasicOopIterateClosure { private: ZHeapIterator* const _iter; const oop _base; - const bool _visit_referents; - oop load_oop(oop* p) const { - if (_visit_referents) { - return HeapAccess::oop_load_at(_base, _base->field_offset(p)); - } else { - return HeapAccess::oop_load(p); + oop load_oop(oop* p) { + if (VisitReferents) { + return HeapAccess::oop_load_at(_base, _base->field_offset(p)); } + + return HeapAccess::oop_load(p); } public: - ZHeapIteratorOopClosure(ZHeapIterator* iter, oop base, bool visit_referents) : + ZHeapIteratorOopClosure(ZHeapIterator* iter, oop base) : _iter(iter), - _base(base), - _visit_referents(visit_referents) {} + _base(base) {} virtual ReferenceIterationMode reference_iteration_mode() { - return _visit_referents ? DO_FIELDS : DO_FIELDS_EXCEPT_REFERENT; + return VisitReferents ? DO_FIELDS : DO_FIELDS_EXCEPT_REFERENT; } virtual void do_oop(oop* p) { @@ -111,10 +121,9 @@ #endif }; -ZHeapIterator::ZHeapIterator(bool visit_referents) : +ZHeapIterator::ZHeapIterator() : _visit_stack(), - _visit_map(), - _visit_referents(visit_referents) {} + _visit_map() {} ZHeapIterator::~ZHeapIterator() { ZVisitMapIterator iter(&_visit_map); @@ -162,49 +171,45 @@ _visit_stack.push(obj); } -void ZHeapIterator::objects_do(ObjectClosure* cl) { - // Note that the heap iterator visits all reachable objects, including - // objects that might be unreachable from the application, such as a - // not yet cleared JNIWeakGloablRef. However, also note that visiting - // the JVMTI tag map is a requirement to make sure we visit all tagged - // objects, even those that might now have become phantom reachable. - // If we didn't do this the application would have expected to see - // ObjectFree events for phantom reachable objects in the tag map. - - ZStatTimerDisable disable; - ZHeapIteratorRootOopClosure root_cl(this); +template +void ZHeapIterator::push_roots() { + ZHeapIteratorRootOopClosure cl(this); + RootsIterator roots; + roots.oops_do(&cl); +} - // Push strong roots onto stack - { - ZRootsIterator roots; - roots.oops_do(&root_cl); - } - - { - ZConcurrentRootsIterator roots; - roots.oops_do(&root_cl); - } +template +void ZHeapIterator::push_fields(oop obj) { + ZHeapIteratorOopClosure cl(this, obj); + obj->oop_iterate(&cl); +} - // Push weak roots onto stack - { - ZWeakRootsIterator roots; - roots.oops_do(&root_cl); - } +template +void ZHeapIterator::objects_do(ObjectClosure* cl) { + ZStatTimerDisable disable; - { - ZConcurrentWeakRootsIterator roots; - roots.oops_do(&root_cl); - } + // Push roots to visit + push_roots(); + push_roots(); + push_roots(); + push_roots(); // Drain stack while (!_visit_stack.is_empty()) { const oop obj = _visit_stack.pop(); - // Visit + // Visit object cl->do_object(obj); - // Push members to visit - ZHeapIteratorOopClosure push_cl(this, obj, _visit_referents); - obj->oop_iterate(&push_cl); + // Push fields to visit + push_fields(obj); } } + +void ZHeapIterator::objects_do(ObjectClosure* cl, bool visit_referents) { + if (visit_referents) { + objects_do(cl); + } else { + objects_do(cl); + } +} diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/gc/z/zHeapIterator.hpp --- a/src/hotspot/share/gc/z/zHeapIterator.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/gc/z/zHeapIterator.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -32,8 +32,8 @@ class ZHeapIteratorBitMap; class ZHeapIterator : public StackObj { - friend class ZHeapIteratorRootOopClosure; - friend class ZHeapIteratorOopClosure; + template friend class ZHeapIteratorRootOopClosure; + template friend class ZHeapIteratorOopClosure; private: typedef ZGranuleMap ZVisitMap; @@ -42,16 +42,19 @@ ZVisitStack _visit_stack; ZVisitMap _visit_map; - const bool _visit_referents; ZHeapIteratorBitMap* object_map(oop obj); void push(oop obj); + template void push_roots(); + template void push_fields(oop obj); + template void objects_do(ObjectClosure* cl); + public: - ZHeapIterator(bool visit_referents); + ZHeapIterator(); ~ZHeapIterator(); - void objects_do(ObjectClosure* cl); + void objects_do(ObjectClosure* cl, bool visit_referents); }; #endif // SHARE_GC_Z_ZHEAPITERATOR_HPP diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/jvmci/jvmciCompilerToVM.cpp --- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2416,7 +2416,7 @@ if (peerEnv->is_hotspot()) { // Only the mirror in the HotSpot heap is accessible // through JVMCINMethodData - oop nmethod_mirror = data->get_nmethod_mirror(nm); + oop nmethod_mirror = data->get_nmethod_mirror(nm, /* phantom_ref */ true); if (nmethod_mirror != NULL) { result = HotSpotJVMCI::wrap(nmethod_mirror); } @@ -2443,7 +2443,7 @@ if (data == NULL) { JVMCI_THROW_MSG_0(IllegalArgumentException, "Cannot set HotSpotNmethod mirror for default nmethod"); } - if (data->get_nmethod_mirror(nm) != NULL) { + if (data->get_nmethod_mirror(nm, /* phantom_ref */ false) != NULL) { JVMCI_THROW_MSG_0(IllegalArgumentException, "Cannot overwrite existing HotSpotNmethod mirror for nmethod"); } oop nmethod_mirror = HotSpotJVMCI::resolve(result); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp --- a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -308,7 +308,8 @@ BOXED_BOOLEAN(box, *(jbyte*) vmField.address); assert(box.is_non_null(), "must have a box"); } else if (strcmp(vmField.typeString, "int") == 0 || - strcmp(vmField.typeString, "jint") == 0) { + strcmp(vmField.typeString, "jint") == 0 || + strcmp(vmField.typeString, "uint32_t") == 0) { BOXED_LONG(box, *(jint*) vmField.address); assert(box.is_non_null(), "must have a box"); } else if (strcmp(vmField.typeString, "uint64_t") == 0) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/jvmci/jvmciEnv.cpp --- a/src/hotspot/share/jvmci/jvmciEnv.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/jvmci/jvmciEnv.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1111,13 +1111,6 @@ if (klass.is_null()) { return type; } -#ifdef INCLUDE_ALL_GCS - if (UseG1GC) { - // The klass might have come from a weak location so enqueue - // the Class to make sure it's noticed by G1 - G1SATBCardTableModRefBS::enqueue(klass()->java_mirror()); - } -#endif // Klass* don't require tracking as Metadata* jlong pointer = (jlong) klass(); JavaThread* THREAD = JavaThread::current(); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/jvmci/jvmciRuntime.cpp --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -700,11 +700,15 @@ FailedSpeculation::add_failed_speculation(nm, _failed_speculations, data, length); } -oop JVMCINMethodData::get_nmethod_mirror(nmethod* nm) { +oop JVMCINMethodData::get_nmethod_mirror(nmethod* nm, bool phantom_ref) { if (_nmethod_mirror_index == -1) { return NULL; } - return nm->oop_at(_nmethod_mirror_index); + if (phantom_ref) { + return nm->oop_at_phantom(_nmethod_mirror_index); + } else { + return nm->oop_at(_nmethod_mirror_index); + } } void JVMCINMethodData::set_nmethod_mirror(nmethod* nm, oop new_mirror) { @@ -728,7 +732,7 @@ } void JVMCINMethodData::invalidate_nmethod_mirror(nmethod* nm) { - oop nmethod_mirror = get_nmethod_mirror(nm); + oop nmethod_mirror = get_nmethod_mirror(nm, /* phantom_ref */ true); if (nmethod_mirror == NULL) { return; } @@ -1339,6 +1343,18 @@ return JVMCI::dependencies_invalid; } +// Reports a pending exception and exits the VM. +static void fatal_exception_in_compile(JVMCIEnv* JVMCIENV, JavaThread* thread, const char* msg) { + // Only report a fatal JVMCI compilation exception once + static volatile int report_init_failure = 0; + if (!report_init_failure && Atomic::cmpxchg(1, &report_init_failure, 0) == 0) { + tty->print_cr("%s:", msg); + JVMCIENV->describe_pending_exception(true); + } + JVMCIENV->clear_pending_exception(); + before_exit(thread); + vm_exit(-1); +} void JVMCIRuntime::compile_method(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, const methodHandle& method, int entry_bci) { JVMCI_EXCEPTION_CONTEXT @@ -1360,9 +1376,7 @@ HandleMark hm; JVMCIObject receiver = get_HotSpotJVMCIRuntime(JVMCIENV); if (JVMCIENV->has_pending_exception()) { - JVMCIENV->describe_pending_exception(true); - compile_state->set_failure(false, "exception getting HotSpotJVMCIRuntime object"); - return; + fatal_exception_in_compile(JVMCIENV, thread, "Exception during HotSpotJVMCIRuntime initialization"); } JVMCIObject jvmci_method = JVMCIENV->get_jvmci_method(method, JVMCIENV); if (JVMCIENV->has_pending_exception()) { @@ -1397,16 +1411,7 @@ } else { // An uncaught exception here implies failure during compiler initialization. // The only sensible thing to do here is to exit the VM. - - // Only report initialization failure once - static volatile int report_init_failure = 0; - if (!report_init_failure && Atomic::cmpxchg(1, &report_init_failure, 0) == 0) { - tty->print_cr("Exception during JVMCI compiler initialization:"); - JVMCIENV->describe_pending_exception(true); - } - JVMCIENV->clear_pending_exception(); - before_exit((JavaThread*) THREAD); - vm_exit(-1); + fatal_exception_in_compile(JVMCIENV, thread, "Exception during JVMCI compiler initialization"); } if (compiler->is_bootstrapping()) { compiler->set_bootstrap_compilation_request_handled(); @@ -1529,7 +1534,7 @@ JVMCINMethodData* data = nm->jvmci_nmethod_data(); assert(data != NULL, "must be"); if (install_default) { - assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm) == NULL, "must be"); + assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == NULL, "must be"); if (entry_bci == InvocationEntryBci) { if (TieredCompilation) { // If there is an old version we're done with it @@ -1564,7 +1569,7 @@ InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm); } } else { - assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm) == HotSpotJVMCI::resolve(nmethod_mirror), "must be"); + assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == HotSpotJVMCI::resolve(nmethod_mirror), "must be"); } nm->make_in_use(); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/jvmci/jvmciRuntime.hpp --- a/src/hotspot/share/jvmci/jvmciRuntime.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/jvmci/jvmciRuntime.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -74,7 +74,7 @@ void invalidate_nmethod_mirror(nmethod* nm); // Gets the mirror from nm's oops table. - oop get_nmethod_mirror(nmethod* nm); + oop get_nmethod_mirror(nmethod* nm, bool phantom_ref); // Sets the mirror in nm's oops table. void set_nmethod_mirror(nmethod* nm, oop mirror); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/jvmci/vmStructs_jvmci.cpp --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -691,10 +691,10 @@ #endif -// AARCH64 is defined in closed port, too. TARGET_ARCH_aarch64 is not. -#ifdef TARGET_ARCH_aarch64 +#ifdef AARCH64 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ + static_field(VM_Version, _psr_info.dczid_el0, uint32_t) \ volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) #define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \ diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/memory/memRegion.hpp --- a/src/hotspot/share/memory/memRegion.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/memory/memRegion.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -32,13 +32,13 @@ // A very simple data structure representing a contigous region // region of address space. -// Note that MemRegions are passed by value, not by reference. +// Note that MemRegions are typically passed by value, not by reference. // The intent is that they remain very small and contain no // objects. The copy constructor and destructor must be trivial, // to support optimization for pass-by-value. -// These should never be allocated in heap but we do -// create MemRegions (in CardTableBarrierSet) in heap so operator -// new and operator new [] added for this special case. +// These should almost never be allocated in heap but we do +// create MemRegions (in CardTable and G1CMRootMemRegions) on the heap so operator +// new and operator new [] were added for these special cases. class MemRegion { friend class VMStructs; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/memory/metaspace.cpp --- a/src/hotspot/share/memory/metaspace.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/memory/metaspace.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1221,7 +1221,7 @@ } if (DynamicDumpSharedSpaces && !UseSharedSpaces) { - vm_exit_during_initialization("DynamicDumpSharedSpaces not supported when base CDS archive is not loaded", NULL); + vm_exit_during_initialization("DynamicDumpSharedSpaces is unsupported when base CDS archive is not loaded", NULL); } if (!DumpSharedSpaces && !UseSharedSpaces) diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/opto/escape.cpp --- a/src/hotspot/share/opto/escape.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/opto/escape.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2346,8 +2346,7 @@ assert(opcode == Op_ConP || opcode == Op_ThreadLocal || opcode == Op_CastX2P || uncast_base->is_DecodeNarrowPtr() || (uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_rawptr() != NULL)) || - (uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()) || - BarrierSet::barrier_set()->barrier_set_c2()->escape_is_barrier_node(uncast_base), "sanity"); + (uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()), "sanity"); } } return base; @@ -3085,7 +3084,6 @@ n->is_CheckCastPP() || n->is_EncodeP() || n->is_DecodeN() || - BarrierSet::barrier_set()->barrier_set_c2()->escape_is_barrier_node(n) || (n->is_ConstraintCast() && n->Opcode() == Op_CastPP)) { if (visited.test_set(n->_idx)) { assert(n->is_Phi(), "loops only through Phi's"); @@ -3156,7 +3154,6 @@ use->is_CheckCastPP() || use->is_EncodeNarrowPtr() || use->is_DecodeNarrowPtr() || - BarrierSet::barrier_set()->barrier_set_c2()->escape_is_barrier_node(use) || (use->is_ConstraintCast() && use->Opcode() == Op_CastPP)) { alloc_worklist.append_if_missing(use); #ifdef ASSERT diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/opto/graphKit.hpp --- a/src/hotspot/share/opto/graphKit.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/opto/graphKit.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -565,7 +565,7 @@ return store_to_memory(ctl, adr, val, bt, C->get_alias_index(adr_type), mo, require_atomic_access, - unaligned, mismatched); + unaligned, mismatched, unsafe); } // This is the base version which is given alias index // Return the new StoreXNode diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/opto/library_call.cpp --- a/src/hotspot/share/opto/library_call.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/opto/library_call.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2439,7 +2439,10 @@ val = is_store ? argument(4) : NULL; - const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); + const TypePtr* adr_type = _gvn.type(adr)->isa_ptr(); + if (adr_type == TypePtr::NULL_PTR) { + return false; // off-heap access with zero address + } // Try to categorize the address. Compile::AliasType* alias_type = C->alias_type(adr_type); @@ -4498,8 +4501,8 @@ ciMethod* trap_method = alloc->jvms()->method(); int trap_bci = alloc->jvms()->bci(); - if (!C->too_many_traps(trap_method, trap_bci, Deoptimization::Reason_intrinsic) & - !C->too_many_traps(trap_method, trap_bci, Deoptimization::Reason_null_check)) { + if (!C->too_many_traps(trap_method, trap_bci, Deoptimization::Reason_intrinsic) && + !C->too_many_traps(trap_method, trap_bci, Deoptimization::Reason_null_check)) { // Make sure there's no store between the allocation and the // arraycopy otherwise visible side effects could be rexecuted // in case of deoptimization and cause incorrect execution. diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/opto/memnode.cpp --- a/src/hotspot/share/opto/memnode.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/opto/memnode.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -44,6 +44,7 @@ #include "opto/narrowptrnode.hpp" #include "opto/phaseX.hpp" #include "opto/regmask.hpp" +#include "opto/rootnode.hpp" #include "utilities/align.hpp" #include "utilities/copy.hpp" #include "utilities/macros.hpp" @@ -328,6 +329,24 @@ const Type *t_adr = phase->type(address); if (t_adr == Type::TOP) return NodeSentinel; // caller will return NULL + if (can_reshape && is_unsafe_access() && (t_adr == TypePtr::NULL_PTR)) { + // Unsafe off-heap access with zero address. Remove access and other control users + // to not confuse optimizations and add a HaltNode to fail if this is ever executed. + assert(ctl != NULL, "unsafe accesses should be control dependent"); + for (DUIterator_Fast imax, i = ctl->fast_outs(imax); i < imax; i++) { + Node* u = ctl->fast_out(i); + if (u != ctl) { + igvn->rehash_node_delayed(u); + int nb = u->replace_edge(ctl, phase->C->top()); + --i, imax -= nb; + } + } + Node* frame = igvn->transform(new ParmNode(phase->C->start(), TypeFunc::FramePtr)); + Node* halt = igvn->transform(new HaltNode(ctl, frame)); + phase->C->root()->add_req(halt); + return this; + } + if (can_reshape && igvn != NULL && (igvn->_worklist.member(address) || (igvn->_worklist.size() > 0 && t_adr != adr_type())) ) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/opto/output.cpp --- a/src/hotspot/share/opto/output.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/opto/output.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2412,12 +2412,9 @@ } assert(!last->is_Mach() || last->as_Mach()->ideal_Opcode() != Op_Con, ""); if( last->is_Catch() || - // Exclude unreachable path case when Halt node is in a separate block. - (_bb_end > 1 && last->is_Mach() && last->as_Mach()->ideal_Opcode() == Op_Halt) ) { - // There must be a prior call. Skip it. - while( !bb->get_node(--_bb_end)->is_MachCall() ) { - assert( bb->get_node(_bb_end)->is_MachProj(), "skipping projections after expected call" ); - } + (last->is_Mach() && last->as_Mach()->ideal_Opcode() == Op_Halt) ) { + // There might be a prior call. Skip it. + while (_bb_start < _bb_end && bb->get_node(--_bb_end)->is_MachProj()); } else if( last->is_MachNullCheck() ) { // Backup so the last null-checked memory instruction is // outside the schedulable range. Skip over the nullcheck, diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/opto/type.cpp --- a/src/hotspot/share/opto/type.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/opto/type.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -2109,7 +2109,7 @@ const TypeAry *a = t->is_ary(); return TypeAry::make(_elem->meet_speculative(a->_elem), _size->xmeet(a->_size)->is_int(), - _stable & a->_stable); + _stable && a->_stable); } case Top: break; @@ -3879,7 +3879,7 @@ bool subtype_exact = false; if( tinst_klass->equals(this_klass) ) { subtype = this_klass; - subtype_exact = below_centerline(ptr) ? (this_xk & tinst_xk) : (this_xk | tinst_xk); + subtype_exact = below_centerline(ptr) ? (this_xk && tinst_xk) : (this_xk || tinst_xk); } else if( !tinst_xk && this_klass->is_subtype_of( tinst_klass ) ) { subtype = this_klass; // Pick subtyping class subtype_exact = this_xk; @@ -4361,7 +4361,7 @@ if (below_centerline(this->_ptr)) { xk = this->_klass_is_exact; } else { - xk = (tap->_klass_is_exact | this->_klass_is_exact); + xk = (tap->_klass_is_exact || this->_klass_is_exact); } return make(ptr, const_oop(), tary, lazy_klass, xk, off, instance_id, speculative, depth); case Constant: { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/prims/jvmtiEnvBase.cpp --- a/src/hotspot/share/prims/jvmtiEnvBase.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/prims/jvmtiEnvBase.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -1083,7 +1083,7 @@ // If the monitor has no owner, then a non-suspended contending // thread could potentially change the state of the monitor by // entering it. The JVM/TI spec doesn't allow this. - if (owning_thread == NULL && !at_safepoint & + if (owning_thread == NULL && !at_safepoint && !pending_thread->is_thread_fully_suspended(true, &debug_bits)) { if (ret.owner != NULL) { destroy_jni_reference(calling_thread, ret.owner); diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/runtime/arguments.cpp --- a/src/hotspot/share/runtime/arguments.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/runtime/arguments.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -533,7 +533,6 @@ { "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, { "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() }, { "CompilationPolicyChoice", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() }, - { "FailOverToOldVerifier", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() }, { "AllowJNIEnvProxy", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) }, { "ThreadLocalHandshakes", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) }, { "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() }, @@ -563,6 +562,7 @@ { "ProfilerNumberOfRuntimeStubNodes", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) }, { "UseImplicitStableValues", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) }, { "NeedsDeoptSuspend", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) }, + { "FailOverToOldVerifier", JDK_Version::undefined(), JDK_Version::jdk(14), JDK_Version::jdk(15) }, #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS // These entries will generate build errors. Their purpose is to test the macros. @@ -1630,8 +1630,8 @@ #ifdef _LP64 // MaxHeapSize is not set up properly at this point, but // the only value that can override MaxHeapSize if we are - // to use UseCompressedOops is InitialHeapSize. - size_t max_heap_size = MAX2(MaxHeapSize, InitialHeapSize); + // to use UseCompressedOops are InitialHeapSize and MinHeapSize. + size_t max_heap_size = MAX3(MaxHeapSize, InitialHeapSize, MinHeapSize); if (max_heap_size <= max_heap_for_compressed_oops()) { #if !defined(COMPILER1) || defined(TIERED) @@ -1832,6 +1832,8 @@ // after call to limit_by_allocatable_memory because that // method might reduce the allocation size. reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize); + } else if (!FLAG_IS_DEFAULT(MinHeapSize)) { + reasonable_max = MAX2(reasonable_max, (julong)MinHeapSize); } log_trace(gc, heap)(" Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max); @@ -1855,13 +1857,13 @@ reasonable_initial = limit_by_allocatable_memory(reasonable_initial); - log_trace(gc, heap)(" Initial heap size " SIZE_FORMAT, (size_t)reasonable_initial); FLAG_SET_ERGO(InitialHeapSize, (size_t)reasonable_initial); + log_trace(gc, heap)(" Initial heap size " SIZE_FORMAT, InitialHeapSize); } - // If the minimum heap size has not been set (via -Xms), + // If the minimum heap size has not been set (via -Xms or -XX:MinHeapSize), // synchronize with InitialHeapSize to avoid errors with the default value. if (MinHeapSize == 0) { - MinHeapSize = MIN2((size_t)reasonable_minimum, InitialHeapSize); + FLAG_SET_ERGO(MinHeapSize, MIN2((size_t)reasonable_minimum, InitialHeapSize)); log_trace(gc, heap)(" Minimum heap size " SIZE_FORMAT, MinHeapSize); } } @@ -1903,8 +1905,9 @@ if (FLAG_SET_CMDLINE(InitialHeapSize, initHeapSize) != JVMFlag::SUCCESS) { return JNI_EINVAL; } - // Currently the minimum size and the initial heap sizes are the same. - MinHeapSize = initHeapSize; + if (FLAG_SET_CMDLINE(MinHeapSize, initHeapSize) != JVMFlag::SUCCESS) { + return JNI_EINVAL; + } } if (FLAG_IS_DEFAULT(NewSize)) { // Make the young generation 3/8ths of the total heap. @@ -2595,19 +2598,19 @@ } // -Xms } else if (match_option(option, "-Xms", &tail)) { - julong long_initial_heap_size = 0; + julong size = 0; // an initial heap size of 0 means automatically determine - ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0); + ArgsRange errcode = parse_memory_size(tail, &size, 0); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), "Invalid initial heap size: %s\n", option->optionString); describe_range_error(errcode); return JNI_EINVAL; } - MinHeapSize = (size_t)long_initial_heap_size; - // Currently the minimum size and the initial heap sizes are the same. - // Can be overridden with -XX:InitialHeapSize. - if (FLAG_SET_CMDLINE(InitialHeapSize, (size_t)long_initial_heap_size) != JVMFlag::SUCCESS) { + if (FLAG_SET_CMDLINE(MinHeapSize, (size_t)size) != JVMFlag::SUCCESS) { + return JNI_EINVAL; + } + if (FLAG_SET_CMDLINE(InitialHeapSize, (size_t)size) != JVMFlag::SUCCESS) { return JNI_EINVAL; } // -Xmx @@ -3462,14 +3465,6 @@ void Arguments::set_shared_spaces_flags() { if (DumpSharedSpaces) { - if (FailOverToOldVerifier) { - // Don't fall back to the old verifier on verification failure. If a - // class fails verification with the split verifier, it might fail the - // CDS runtime verifier constraint check. In that case, we don't want - // to share the class. We only archive classes that pass the split verifier. - FLAG_SET_DEFAULT(FailOverToOldVerifier, false); - } - if (RequireSharedSpaces) { warning("Cannot dump shared archive while using shared archive"); } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/runtime/globals.hpp --- a/src/hotspot/share/runtime/globals.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/runtime/globals.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -405,9 +405,6 @@ notproduct(bool, VerifyLastFrame, false, \ "Verify oops on last frame on entry to VM") \ \ - product(bool, FailOverToOldVerifier, true, \ - "Fail over to old verifier when split verifier fails") \ - \ product(bool, SafepointTimeout, false, \ "Time out and warn or fail after SafepointTimeoutDelay " \ "milliseconds if failed to reach safepoint") \ diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/runtime/objectMonitor.cpp --- a/src/hotspot/share/runtime/objectMonitor.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/runtime/objectMonitor.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -245,9 +245,7 @@ void * cur = Atomic::cmpxchg(Self, &_owner, (void*)NULL); if (cur == NULL) { - // Either ASSERT _recursions == 0 or explicitly set _recursions = 0. assert(_recursions == 0, "invariant"); - assert(_owner == Self, "invariant"); return; } @@ -405,9 +403,7 @@ void * own = _owner; if (own != NULL) return 0; if (Atomic::replace_if_null(Self, &_owner)) { - // Either guarantee _recursions == 0 or set _recursions = 0. assert(_recursions == 0, "invariant"); - assert(_owner == Self, "invariant"); return 1; } // The lock had been free momentarily, but we lost the race to the lock. @@ -417,6 +413,15 @@ return -1; } +// Convert the fields used by is_busy() to a string that can be +// used for diagnostic output. +const char* ObjectMonitor::is_busy_to_string(stringStream* ss) { + ss->print("is_busy: contentions=%d, waiters=%d, owner=" INTPTR_FORMAT + ", cxq=" INTPTR_FORMAT ", EntryList=" INTPTR_FORMAT, _contentions, + _waiters, p2i(_owner), p2i(_cxq), p2i(_EntryList)); + return ss->base(); +} + #define MAX_RECHECK_INTERVAL 1000 void ObjectMonitor::EnterI(TRAPS) { diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/runtime/objectMonitor.hpp --- a/src/hotspot/share/runtime/objectMonitor.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/runtime/objectMonitor.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -235,6 +235,7 @@ // TODO-FIXME: assert _owner == null implies _recursions = 0 return _contentions|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList); } + const char* is_busy_to_string(stringStream* ss); intptr_t is_entered(Thread* current) const; @@ -268,7 +269,9 @@ // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0 // _contentions == 0 EntryList == NULL // _recursions == 0 _WaitSet == NULL - assert(((is_busy()|_recursions) == 0), "freeing inuse monitor"); + DEBUG_ONLY(stringStream ss;) + assert((is_busy() | _recursions) == 0, "freeing in-use monitor: %s, " + "recursions=" INTPTR_FORMAT, is_busy_to_string(&ss), _recursions); _succ = NULL; _EntryList = NULL; _cxq = NULL; diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/runtime/objectMonitor.inline.hpp --- a/src/hotspot/share/runtime/objectMonitor.inline.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/runtime/objectMonitor.inline.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -95,12 +95,8 @@ return _contentions; } -// Do NOT set _contentions = 0. There is a race such that _contentions could -// be set while inflating prior to setting _owner -// Just use Atomic::inc/dec and assert 0 when monitor put on free list inline void ObjectMonitor::set_owner(void* owner) { _owner = owner; - _recursions = 0; } #endif // SHARE_RUNTIME_OBJECTMONITOR_INLINE_HPP diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/runtime/synchronizer.cpp --- a/src/hotspot/share/runtime/synchronizer.cpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/runtime/synchronizer.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -242,7 +242,6 @@ if (owner == NULL && Atomic::replace_if_null(Self, &(m->_owner))) { assert(m->_recursions == 0, "invariant"); - assert(m->_owner == Self, "invariant"); return true; } } @@ -1030,6 +1029,7 @@ // scavenge costs. As usual, we lean toward time in space-time // tradeoffs. const int MAXPRIVATE = 1024; + stringStream ss; for (;;) { ObjectMonitor * m; @@ -1065,7 +1065,6 @@ ObjectMonitor * take = gFreeList; gFreeList = take->FreeNext; guarantee(take->object() == NULL, "invariant"); - guarantee(!take->is_busy(), "invariant"); take->Recycle(); omRelease(Self, take, false); } @@ -1167,7 +1166,10 @@ bool fromPerThreadAlloc) { guarantee(m->header() == NULL, "invariant"); guarantee(m->object() == NULL, "invariant"); - guarantee(((m->is_busy()|m->_recursions) == 0), "freeing in-use monitor"); + stringStream ss; + guarantee((m->is_busy() | m->_recursions) == 0, "freeing in-use monitor: " + "%s, recursions=" INTPTR_FORMAT, m->is_busy_to_string(&ss), + m->_recursions); // Remove from omInUseList if (fromPerThreadAlloc) { ObjectMonitor* cur_mid_in_use = NULL; @@ -1220,16 +1222,14 @@ int tally = 0; if (list != NULL) { ObjectMonitor * s; - // The thread is going away, the per-thread free monitors - // are freed via set_owner(NULL) - // Link them to tail, which will be linked into the global free list - // gFreeList below, under the gListLock + // The thread is going away. Set 'tail' to the last per-thread free + // monitor which will be linked to gFreeList below under the gListLock. + stringStream ss; for (s = list; s != NULL; s = s->FreeNext) { tally++; tail = s; guarantee(s->object() == NULL, "invariant"); - guarantee(!s->is_busy(), "invariant"); - s->set_owner(NULL); // redundant but good hygiene + guarantee(!s->is_busy(), "must be !is_busy: %s", s->is_busy_to_string(&ss)); } guarantee(tail != NULL, "invariant"); assert(Self->omFreeCount == tally, "free-count off"); @@ -1379,7 +1379,6 @@ // in which INFLATING appears in the mark. m->Recycle(); m->_Responsible = NULL; - m->_recursions = 0; m->_SpinDuration = ObjectMonitor::Knob_SpinLimit; // Consider: maintain by type/class markOop cmp = object->cas_set_mark(markOopDesc::INFLATING(), mark); @@ -1472,9 +1471,7 @@ // prepare m for installation - set monitor to initial state m->Recycle(); m->set_header(mark); - m->set_owner(NULL); m->set_object(object); - m->_recursions = 0; m->_Responsible = NULL; m->_SpinDuration = ObjectMonitor::Knob_SpinLimit; // consider: keep metastats by type/class @@ -1925,14 +1922,15 @@ // Check a free monitor entry; log any errors. void ObjectSynchronizer::chk_free_entry(JavaThread * jt, ObjectMonitor * n, outputStream * out, int *error_cnt_p) { + stringStream ss; if (n->is_busy()) { if (jt != NULL) { out->print_cr("ERROR: jt=" INTPTR_FORMAT ", monitor=" INTPTR_FORMAT - ": free per-thread monitor must not be busy.", p2i(jt), - p2i(n)); + ": free per-thread monitor must not be busy: %s", p2i(jt), + p2i(n), n->is_busy_to_string(&ss)); } else { out->print_cr("ERROR: monitor=" INTPTR_FORMAT ": free global monitor " - "must not be busy.", p2i(n)); + "must not be busy: %s", p2i(n), n->is_busy_to_string(&ss)); } *error_cnt_p = *error_cnt_p + 1; } @@ -2111,6 +2109,7 @@ Thread::muxAcquire(&gListLock, "log_in_use_monitor_details"); } + stringStream ss; if (gOmInUseCount > 0) { out->print_cr("In-use global monitor info:"); out->print_cr("(B -> is_busy, H -> has hash code, L -> lock status)"); @@ -2121,9 +2120,14 @@ const oop obj = (oop) n->object(); const markOop mark = n->header(); ResourceMark rm; - out->print_cr(INTPTR_FORMAT " %d%d%d " INTPTR_FORMAT " %s", p2i(n), - n->is_busy() != 0, mark->hash() != 0, n->owner() != NULL, - p2i(obj), obj->klass()->external_name()); + out->print(INTPTR_FORMAT " %d%d%d " INTPTR_FORMAT " %s", p2i(n), + n->is_busy() != 0, mark->hash() != 0, n->owner() != NULL, + p2i(obj), obj->klass()->external_name()); + if (n->is_busy() != 0) { + out->print(" (%s)", n->is_busy_to_string(&ss)); + ss.reset(); + } + out->cr(); } } @@ -2141,10 +2145,15 @@ const oop obj = (oop) n->object(); const markOop mark = n->header(); ResourceMark rm; - out->print_cr(INTPTR_FORMAT " " INTPTR_FORMAT " %d%d%d " INTPTR_FORMAT - " %s", p2i(jt), p2i(n), n->is_busy() != 0, - mark->hash() != 0, n->owner() != NULL, p2i(obj), - obj->klass()->external_name()); + out->print(INTPTR_FORMAT " " INTPTR_FORMAT " %d%d%d " INTPTR_FORMAT + " %s", p2i(jt), p2i(n), n->is_busy() != 0, + mark->hash() != 0, n->owner() != NULL, p2i(obj), + obj->klass()->external_name()); + if (n->is_busy() != 0) { + out->print(" (%s)", n->is_busy_to_string(&ss)); + ss.reset(); + } + out->cr(); } } diff -r 28582d575a98 -r fd4ec73925c3 src/hotspot/share/runtime/vframe.inline.hpp --- a/src/hotspot/share/runtime/vframe.inline.hpp Fri Jun 21 12:42:10 2019 +0530 +++ b/src/hotspot/share/runtime/vframe.inline.hpp Fri Jun 21 14:07:48 2019 +0530 @@ -26,6 +26,7 @@ #define SHARE_RUNTIME_VFRAME_INLINE_HPP #include "runtime/frame.inline.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" inline vframeStreamCommon::vframeStreamCommon(JavaThread* thread) : _reg_map(thread, false) { diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -51,6 +51,7 @@ 1.11 to 1.11.X 55,0 1.12 to 1.12.X 56,0 1.13 to 1.13.X 57,0 + 1.14 to 1.14.X 58,0 */ public static final Package.Version JAVA_MIN_CLASS_VERSION = @@ -83,6 +84,9 @@ public static final Package.Version JAVA13_MAX_CLASS_VERSION = Package.Version.of(57, 00); + public static final Package.Version JAVA14_MAX_CLASS_VERSION = + Package.Version.of(58, 00); + public static final int JAVA_PACKAGE_MAGIC = 0xCAFED00D; public static final Package.Version JAVA5_PACKAGE_VERSION = diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/lang/Class.java --- a/src/java.base/share/classes/java/lang/Class.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/lang/Class.java Fri Jun 21 14:07:48 2019 +0530 @@ -917,7 +917,7 @@ * *

If the superclass is a parameterized type, the {@code Type} * object returned must accurately reflect the actual type - * parameters used in the source code. The parameterized type + * arguments used in the source code. The parameterized type * representing the superclass is created if it had not been * created before. See the declaration of {@link * java.lang.reflect.ParameterizedType ParameterizedType} for the @@ -1097,7 +1097,7 @@ * *

If a superinterface is a parameterized type, the * {@code Type} object returned for it must accurately reflect - * the actual type parameters used in the source code. The + * the actual type arguments used in the source code. The * parameterized type representing each superinterface is created * if it had not been created before. See the declaration of * {@link java.lang.reflect.ParameterizedType ParameterizedType} diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/lang/Integer.java --- a/src/java.base/share/classes/java/lang/Integer.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/lang/Integer.java Fri Jun 21 14:07:48 2019 +0530 @@ -347,59 +347,53 @@ int chars = Math.max(((mag + (shift - 1)) / shift), 1); if (COMPACT_STRINGS) { byte[] buf = new byte[chars]; - formatUnsignedInt(val, shift, buf, 0, chars); + formatUnsignedInt(val, shift, buf, chars); return new String(buf, LATIN1); } else { byte[] buf = new byte[chars * 2]; - formatUnsignedIntUTF16(val, shift, buf, 0, chars); + formatUnsignedIntUTF16(val, shift, buf, chars); return new String(buf, UTF16); } } /** - * Format an {@code int} (treated as unsigned) into a character buffer. If + * Format an {@code int} (treated as unsigned) into a byte buffer (LATIN1 version). If * {@code len} exceeds the formatted ASCII representation of {@code val}, * {@code buf} will be padded with leading zeroes. * * @param val the unsigned int to format * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary) - * @param buf the character buffer to write to - * @param offset the offset in the destination buffer to start at + * @param buf the byte buffer to write to * @param len the number of characters to write */ - static void formatUnsignedInt(int val, int shift, char[] buf, int offset, int len) { - // assert shift > 0 && shift <=5 : "Illegal shift value"; - // assert offset >= 0 && offset < buf.length : "illegal offset"; - // assert len > 0 && (offset + len) <= buf.length : "illegal length"; - int charPos = offset + len; - int radix = 1 << shift; - int mask = radix - 1; - do { - buf[--charPos] = Integer.digits[val & mask]; - val >>>= shift; - } while (charPos > offset); - } - - /** byte[]/LATIN1 version */ - static void formatUnsignedInt(int val, int shift, byte[] buf, int offset, int len) { - int charPos = offset + len; + private static void formatUnsignedInt(int val, int shift, byte[] buf, int len) { + int charPos = len; int radix = 1 << shift; int mask = radix - 1; do { buf[--charPos] = (byte)Integer.digits[val & mask]; val >>>= shift; - } while (charPos > offset); + } while (charPos > 0); } - /** byte[]/UTF16 version */ - private static void formatUnsignedIntUTF16(int val, int shift, byte[] buf, int offset, int len) { - int charPos = offset + len; + /** + * Format an {@code int} (treated as unsigned) into a byte buffer (UTF16 version). If + * {@code len} exceeds the formatted ASCII representation of {@code val}, + * {@code buf} will be padded with leading zeroes. + * + * @param val the unsigned int to format + * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary) + * @param buf the byte buffer to write to + * @param len the number of characters to write + */ + private static void formatUnsignedIntUTF16(int val, int shift, byte[] buf, int len) { + int charPos = len; int radix = 1 << shift; int mask = radix - 1; do { StringUTF16.putChar(buf, --charPos, Integer.digits[val & mask]); val >>>= shift; - } while (charPos > offset); + } while (charPos > 0); } static final byte[] DigitTens = { @@ -698,7 +692,7 @@ */ public static int parseInt(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException { - s = Objects.requireNonNull(s); + Objects.requireNonNull(s); if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) { throw new IndexOutOfBoundsException(); @@ -881,7 +875,7 @@ */ public static int parseUnsignedInt(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException { - s = Objects.requireNonNull(s); + Objects.requireNonNull(s); if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) { throw new IndexOutOfBoundsException(); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/lang/Long.java --- a/src/java.base/share/classes/java/lang/Long.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/lang/Long.java Fri Jun 21 14:07:48 2019 +0530 @@ -398,19 +398,17 @@ } /** - * Format a long (treated as unsigned) into a character buffer. If + * Format a long (treated as unsigned) into a byte buffer (LATIN1 version). If * {@code len} exceeds the formatted ASCII representation of {@code val}, * {@code buf} will be padded with leading zeroes. * * @param val the unsigned long to format * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary) - * @param buf the character buffer to write to + * @param buf the byte buffer to write to * @param offset the offset in the destination buffer to start at * @param len the number of characters to write */ - - /** byte[]/LATIN1 version */ - static void formatUnsignedLong0(long val, int shift, byte[] buf, int offset, int len) { + private static void formatUnsignedLong0(long val, int shift, byte[] buf, int offset, int len) { int charPos = offset + len; int radix = 1 << shift; int mask = radix - 1; @@ -420,7 +418,17 @@ } while (charPos > offset); } - /** byte[]/UTF16 version */ + /** + * Format a long (treated as unsigned) into a byte buffer (UTF16 version). If + * {@code len} exceeds the formatted ASCII representation of {@code val}, + * {@code buf} will be padded with leading zeroes. + * + * @param val the unsigned long to format + * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary) + * @param buf the byte buffer to write to + * @param offset the offset in the destination buffer to start at + * @param len the number of characters to write + */ private static void formatUnsignedLong0UTF16(long val, int shift, byte[] buf, int offset, int len) { int charPos = offset + len; int radix = 1 << shift; @@ -739,7 +747,7 @@ */ public static long parseLong(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException { - s = Objects.requireNonNull(s); + Objects.requireNonNull(s); if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) { throw new IndexOutOfBoundsException(); @@ -985,7 +993,7 @@ */ public static long parseUnsignedLong(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException { - s = Objects.requireNonNull(s); + Objects.requireNonNull(s); if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) { throw new IndexOutOfBoundsException(); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/lang/Runtime.java --- a/src/java.base/share/classes/java/lang/Runtime.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/lang/Runtime.java Fri Jun 21 14:07:48 2019 +0530 @@ -684,32 +684,6 @@ } /** - * Not implemented, does nothing. - * - * @deprecated - * This method was intended to control instruction tracing. - * It has been superseded by JVM-specific tracing mechanisms. - * This method is subject to removal in a future version of Java SE. - * - * @param on ignored - */ - @Deprecated(since="9", forRemoval=true) - public void traceInstructions(boolean on) { } - - /** - * Not implemented, does nothing. - * - * @deprecated - * This method was intended to control method call tracing. - * It has been superseded by JVM-specific tracing mechanisms. - * This method is subject to removal in a future version of Java SE. - * - * @param on ignored - */ - @Deprecated(since="9", forRemoval=true) - public void traceMethodCalls(boolean on) { } - - /** * Loads the native library specified by the filename argument. The filename * argument must be an absolute path name. * (for example diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/lang/ref/Reference.java --- a/src/java.base/share/classes/java/lang/ref/Reference.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/lang/ref/Reference.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -418,10 +418,10 @@ * {@code synchronized} blocks or methods, or using other synchronization * facilities are not possible or do not provide the desired control. This * method is applicable only when reclamation may have visible effects, - * which is possible for objects with finalizers (See - * - * Section 12.6 17 of The Java™ Language Specification) - * that are implemented in ways that rely on ordering control for correctness. + * which is possible for objects with finalizers (See Section 12.6 + * of The Java™ Language Specification) that + * are implemented in ways that rely on ordering control for + * correctness. * * @apiNote * Finalization may occur whenever the virtual machine detects that no @@ -508,6 +508,7 @@ * * @param ref the reference. If {@code null}, this method has no effect. * @since 9 + * @jls 12.6 Finalization of Class Instances */ @ForceInline public static void reachabilityFence(Object ref) { diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/lang/reflect/Executable.java --- a/src/java.base/share/classes/java/lang/reflect/Executable.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/lang/reflect/Executable.java Fri Jun 21 14:07:48 2019 +0530 @@ -266,7 +266,7 @@ * *

If a formal parameter type is a parameterized type, * the {@code Type} object returned for it must accurately reflect - * the actual type parameters used in the source code. + * the actual type arguments used in the source code. * *

If a formal parameter type is a type variable or a parameterized * type, it is created. Otherwise, it is resolved. diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/lang/reflect/Field.java --- a/src/java.base/share/classes/java/lang/reflect/Field.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/lang/reflect/Field.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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,9 +243,9 @@ * Returns a {@code Type} object that represents the declared type for * the field represented by this {@code Field} object. * - *

If the {@code Type} is a parameterized type, the - * {@code Type} object returned must accurately reflect the - * actual type parameters used in the source code. + *

If the declared type of the field is a parameterized type, + * the {@code Type} object returned must accurately reflect the + * actual type arguments used in the source code. * *

If the type of the underlying field is a type variable or a * parameterized type, it is created. Otherwise, it is resolved. diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/lang/reflect/Method.java --- a/src/java.base/share/classes/java/lang/reflect/Method.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/lang/reflect/Method.java Fri Jun 21 14:07:48 2019 +0530 @@ -269,7 +269,7 @@ * *

If the return type is a parameterized type, * the {@code Type} object returned must accurately reflect - * the actual type parameters used in the source code. + * the actual type arguments used in the source code. * *

If the return type is a type variable or a parameterized type, it * is created. Otherwise, it is resolved. diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/lang/reflect/TypeVariable.java --- a/src/java.base/share/classes/java/lang/reflect/TypeVariable.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/lang/reflect/TypeVariable.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -72,7 +72,7 @@ /** * Returns the {@code GenericDeclaration} object representing the - * generic declaration declared this type variable. + * generic declaration declared for this type variable. * * @return the generic declaration declared for this type variable. * diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java --- a/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -33,6 +33,7 @@ import sun.net.ResourceManager; import sun.net.ext.ExtendedSocketOptions; +import sun.net.util.IPAddressUtil; import sun.security.action.GetPropertyAction; /** @@ -110,6 +111,9 @@ */ protected synchronized void bind(int lport, InetAddress laddr) throws SocketException { + if (laddr.isLinkLocalAddress()) { + laddr = IPAddressUtil.toScopedAddress(laddr); + } bind0(lport, laddr); } @@ -121,7 +125,19 @@ * destination address to send the packet to. * @param p the packet to be sent. */ - protected abstract void send(DatagramPacket p) throws IOException; + protected void send(DatagramPacket p) throws IOException { + InetAddress orig = p.getAddress(); + if (orig.isLinkLocalAddress()) { + InetAddress scoped = IPAddressUtil.toScopedAddress(orig); + if (orig != scoped) { + p = new DatagramPacket(p.getData(), p.getOffset(), + p.getLength(), scoped, p.getPort()); + } + } + send0(p); + } + + protected abstract void send0(DatagramPacket p) throws IOException; /** * Connects a datagram socket to a remote destination. This associates the remote @@ -131,6 +147,9 @@ * @param port the remote port number */ protected void connect(InetAddress address, int port) throws SocketException { + if (address.isLinkLocalAddress()) { + address = IPAddressUtil.toScopedAddress(address); + } connect0(address, port); connectedAddress = address; connectedPort = port; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java --- a/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -43,6 +43,7 @@ import sun.net.PlatformSocketImpl; import sun.net.ResourceManager; import sun.net.ext.ExtendedSocketOptions; +import sun.net.util.IPAddressUtil; import sun.net.util.SocketExceptions; /** @@ -157,8 +158,12 @@ boolean connected = false; try { InetAddress address = InetAddress.getByName(host); + // recording this.address as supplied by caller before calling connect + this.address = address; this.port = port; - this.address = address; + if (address.isLinkLocalAddress()) { + address = IPAddressUtil.toScopedAddress(address); + } connectToAddress(address, port, timeout); connected = true; @@ -182,8 +187,12 @@ * @param port the specified port */ protected void connect(InetAddress address, int port) throws IOException { + // recording this.address as supplied by caller before calling connect + this.address = address; this.port = port; - this.address = address; + if (address.isLinkLocalAddress()) { + address = IPAddressUtil.toScopedAddress(address); + } try { connectToAddress(address, port, timeout); @@ -215,10 +224,14 @@ InetSocketAddress addr = (InetSocketAddress) address; if (addr.isUnresolved()) throw new UnknownHostException(addr.getHostName()); + // recording this.address as supplied by caller before calling connect + InetAddress ia = addr.getAddress(); + this.address = ia; this.port = addr.getPort(); - this.address = addr.getAddress(); - - connectToAddress(this.address, port, timeout); + if (ia.isLinkLocalAddress()) { + ia = IPAddressUtil.toScopedAddress(ia); + } + connectToAddress(ia, port, timeout); connected = true; } finally { if (!connected) { @@ -546,6 +559,9 @@ NetHooks.beforeTcpBind(fd, address, lport); } } + if (address.isLinkLocalAddress()) { + address = IPAddressUtil.toScopedAddress(address); + } socketBind(address, lport); isBound = true; } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/net/Inet6Address.java --- a/src/java.base/share/classes/java/net/Inet6Address.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/net/Inet6Address.java Fri Jun 21 14:07:48 2019 +0530 @@ -176,11 +176,6 @@ class Inet6Address extends InetAddress { static final int INADDRSZ = 16; - /* - * cached scope_id - for link-local address use only. - */ - private transient int cached_scope_id; // 0 - private class Inet6AddressHolder { private Inet6AddressHolder() { diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/net/ServerSocket.java --- a/src/java.base/share/classes/java/net/ServerSocket.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/net/ServerSocket.java Fri Jun 21 14:07:48 2019 +0530 @@ -106,9 +106,10 @@ * request to connect) is set to {@code 50}. If a connection * indication arrives when the queue is full, the connection is refused. *

- * If the application has specified a server socket factory, that - * factory's {@code createSocketImpl} method is called to create - * the actual socket implementation. Otherwise a "plain" socket is created. + * If the application has specified a server socket implementation + * factory, that factory's {@code createSocketImpl} method is called to + * create the actual socket implementation. Otherwise a system-default + * socket implementation is created. *

* If there is a security manager, * its {@code checkListen} method is called @@ -150,9 +151,10 @@ * a connection indication arrives when the queue is full, the * connection is refused. *

- * If the application has specified a server socket factory, that - * factory's {@code createSocketImpl} method is called to create - * the actual socket implementation. Otherwise a "plain" socket is created. + * If the application has specified a server socket implementation + * factory, that factory's {@code createSocketImpl} method is called to + * create the actual socket implementation. Otherwise a system-default + * socket implementation is created. *

* If there is a security manager, * its {@code checkListen} method is called diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/net/Socket.java --- a/src/java.base/share/classes/java/net/Socket.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/net/Socket.java Fri Jun 21 14:07:48 2019 +0530 @@ -89,8 +89,12 @@ } /** - * Creates an unconnected socket, with the - * system-default type of SocketImpl. + * Creates an unconnected Socket. + *

+ * If the application has specified a client socket implementation + * factory, that factory's {@code createSocketImpl} method is called to + * create the actual socket implementation. Otherwise a system-default + * socket implementation is created. * * @since 1.1 * @revised 1.4 @@ -194,9 +198,10 @@ * In other words, it is equivalent to specifying an address of the * loopback interface.

*

- * If the application has specified a server socket factory, that - * factory's {@code createSocketImpl} method is called to create - * the actual socket implementation. Otherwise a "plain" socket is created. + * If the application has specified a client socket implementation + * factory, that factory's {@code createSocketImpl} method is called to + * create the actual socket implementation. Otherwise a system-default + * socket implementation is created. *

* If there is a security manager, its * {@code checkConnect} method is called @@ -232,9 +237,10 @@ * Creates a stream socket and connects it to the specified port * number at the specified IP address. *

- * If the application has specified a socket factory, that factory's - * {@code createSocketImpl} method is called to create the - * actual socket implementation. Otherwise a "plain" socket is created. + * If the application has specified a client socket implementation + * factory, that factory's {@code createSocketImpl} method is called to + * create the actual socket implementation. Otherwise a system-default + * socket implementation is created. *

* If there is a security manager, its * {@code checkConnect} method is called @@ -358,9 +364,10 @@ * stream socket. If the stream argument is {@code false}, it * creates a datagram socket. *

- * If the application has specified a server socket factory, that - * factory's {@code createSocketImpl} method is called to create - * the actual socket implementation. Otherwise a "plain" socket is created. + * If the application has specified a client socket implementation + * factory, that factory's {@code createSocketImpl} method is called to + * create the actual socket implementation. Otherwise a system-default + * socket implementation is created. *

* If there is a security manager, its * {@code checkConnect} method is called @@ -400,9 +407,10 @@ * stream socket. If the stream argument is {@code false}, it * creates a datagram socket. *

- * If the application has specified a server socket factory, that - * factory's {@code createSocketImpl} method is called to create - * the actual socket implementation. Otherwise a "plain" socket is created. + * If the application has specified a client socket implementation + * factory, that factory's {@code createSocketImpl} method is called to + * create the actual socket implementation. Otherwise a system-default + * socket implementation is created. * *

If there is a security manager, its * {@code checkConnect} method is called diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/net/SocketImpl.java --- a/src/java.base/share/classes/java/net/SocketImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/net/SocketImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -396,7 +396,7 @@ * * @implSpec * The default implementation of this method first checks that the given - * socket option {code name} is not null, then throws {@code + * socket option {@code name} is not null, then throws {@code * UnsupportedOperationException}. Subclasses should override this method * with an appropriate implementation. * @@ -424,7 +424,7 @@ * * @implSpec * The default implementation of this method first checks that the given - * socket option {code name} is not null, then throws {@code + * socket option {@code name} is not null, then throws {@code * UnsupportedOperationException}. Subclasses should override this method * with an appropriate implementation. * diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/security/cert/X509CertSelector.java --- a/src/java.base/share/classes/java/security/cert/X509CertSelector.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/security/cert/X509CertSelector.java Fri Jun 21 14:07:48 2019 +0530 @@ -2115,8 +2115,11 @@ if (certSubjectKeyID == null || !Arrays.equals(subjectKeyID, certSubjectKeyID)) { if (debug != null) { - debug.println("X509CertSelector.match: " - + "subject key IDs don't match"); + debug.println("X509CertSelector.match: subject key IDs " + + "don't match\nX509CertSelector.match: subjectKeyID: " + + Arrays.toString(subjectKeyID) + + "\nX509CertSelector.match: certSubjectKeyID: " + + Arrays.toString(certSubjectKeyID)); } return false; } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/time/format/DateTimeFormatter.java --- a/src/java.base/share/classes/java/time/format/DateTimeFormatter.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/time/format/DateTimeFormatter.java Fri Jun 21 14:07:48 2019 +0530 @@ -396,15 +396,16 @@ * 'Z' when the offset to be output would be zero, whereas pattern letter 'x' * (lower case) will output '+00', '+0000', or '+00:00'. *

- * Offset O: This formats the localized offset based on the number of - * pattern letters. One letter outputs the {@linkplain TextStyle#SHORT short} - * form of the localized offset, which is localized offset text, such as 'GMT', - * with hour without leading zero, optional 2-digit minute and second if - * non-zero, and colon, for example 'GMT+8'. Four letters outputs the - * {@linkplain TextStyle#FULL full} form, which is localized offset text, - * such as 'GMT, with 2-digit hour and minute field, optional second field - * if non-zero, and colon, for example 'GMT+08:00'. Any other count of letters - * throws {@code IllegalArgumentException}. + * Offset O: With a non-zero offset, this formats the localized offset + * based on the number of pattern letters. One letter outputs the + * {@linkplain TextStyle#SHORT short} form of the localized offset, which is + * localized offset text, such as 'GMT', with hour without leading zero, optional + * 2-digit minute and second if non-zero, and colon, for example 'GMT+8'. Four + * letters outputs the {@linkplain TextStyle#FULL full} form, which is localized + * offset text, such as 'GMT, with 2-digit hour and minute field, optional second + * field if non-zero, and colon, for example 'GMT+08:00'. If the offset is zero, + * only localized text is output. Any other count of letters throws + * {@code IllegalArgumentException}. *

* Offset Z: This formats the offset based on the number of pattern * letters. One, two or three letters outputs the hour and minute, without a diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/util/HashMap.java --- a/src/java.base/share/classes/java/util/HashMap.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/util/HashMap.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -911,6 +911,74 @@ return ks; } + /** + * Prepares the array for {@link Collection#toArray(Object[])} implementation. + * If supplied array is smaller than this map size, a new array is allocated. + * If supplied array is bigger than this map size, a null is written at size index. + * + * @param a an original array passed to {@code toArray()} method + * @param type of array elements + * @return an array ready to be filled and returned from {@code toArray()} method. + */ + @SuppressWarnings("unchecked") + final T[] prepareArray(T[] a) { + int size = this.size; + if (a.length < size) { + return (T[]) java.lang.reflect.Array + .newInstance(a.getClass().getComponentType(), size); + } + if (a.length > size) { + a[size] = null; + } + return a; + } + + /** + * Fills an array with this map keys and returns it. This method assumes + * that input array is big enough to fit all the keys. Use + * {@link #prepareArray(Object[])} to ensure this. + * + * @param a an array to fill + * @param type of array elements + * @return supplied array + */ + T[] keysToArray(T[] a) { + Object[] r = a; + Node[] tab; + int idx = 0; + if (size > 0 && (tab = table) != null) { + for (Node e : tab) { + for (; e != null; e = e.next) { + r[idx++] = e.key; + } + } + } + return a; + } + + /** + * Fills an array with this map values and returns it. This method assumes + * that input array is big enough to fit all the values. Use + * {@link #prepareArray(Object[])} to ensure this. + * + * @param a an array to fill + * @param type of array elements + * @return supplied array + */ + T[] valuesToArray(T[] a) { + Object[] r = a; + Node[] tab; + int idx = 0; + if (size > 0 && (tab = table) != null) { + for (Node e : tab) { + for (; e != null; e = e.next) { + r[idx++] = e.value; + } + } + } + return a; + } + final class KeySet extends AbstractSet { public final int size() { return size; } public final void clear() { HashMap.this.clear(); } @@ -922,6 +990,15 @@ public final Spliterator spliterator() { return new KeySpliterator<>(HashMap.this, 0, -1, 0, 0); } + + public Object[] toArray() { + return keysToArray(new Object[size]); + } + + public T[] toArray(T[] a) { + return keysToArray(prepareArray(a)); + } + public final void forEach(Consumer action) { Node[] tab; if (action == null) @@ -970,6 +1047,15 @@ public final Spliterator spliterator() { return new ValueSpliterator<>(HashMap.this, 0, -1, 0, 0); } + + public Object[] toArray() { + return valuesToArray(new Object[size]); + } + + public T[] toArray(T[] a) { + return valuesToArray(prepareArray(a)); + } + public final void forEach(Consumer action) { Node[] tab; if (action == null) diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/util/HashSet.java --- a/src/java.base/share/classes/java/util/HashSet.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/util/HashSet.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -358,4 +358,14 @@ public Spliterator spliterator() { return new HashMap.KeySpliterator<>(map, 0, -1, 0, 0); } + + @Override + public Object[] toArray() { + return map.keysToArray(new Object[map.size()]); + } + + @Override + public T[] toArray(T[] a) { + return map.keysToArray(map.prepareArray(a)); + } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/java/util/LinkedHashMap.java --- a/src/java.base/share/classes/java/util/LinkedHashMap.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/java/util/LinkedHashMap.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -536,6 +536,26 @@ return ks; } + @Override + final T[] keysToArray(T[] a) { + Object[] r = a; + int idx = 0; + for (LinkedHashMap.Entry e = head; e != null; e = e.after) { + r[idx++] = e.key; + } + return a; + } + + @Override + final T[] valuesToArray(T[] a) { + Object[] r = a; + int idx = 0; + for (LinkedHashMap.Entry e = head; e != null; e = e.after) { + r[idx++] = e.value; + } + return a; + } + final class LinkedKeySet extends AbstractSet { public final int size() { return size; } public final void clear() { LinkedHashMap.this.clear(); } @@ -551,6 +571,15 @@ Spliterator.ORDERED | Spliterator.DISTINCT); } + + public Object[] toArray() { + return keysToArray(new Object[size]); + } + + public T[] toArray(T[] a) { + return keysToArray(prepareArray(a)); + } + public final void forEach(Consumer action) { if (action == null) throw new NullPointerException(); @@ -600,6 +629,15 @@ return Spliterators.spliterator(this, Spliterator.SIZED | Spliterator.ORDERED); } + + public Object[] toArray() { + return valuesToArray(new Object[size]); + } + + public T[] toArray(T[] a) { + return valuesToArray(prepareArray(a)); + } + public final void forEach(Consumer action) { if (action == null) throw new NullPointerException(); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/jdk/internal/module/ModuleInfo.java --- a/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -63,7 +63,7 @@ public final class ModuleInfo { private final int JAVA_MIN_SUPPORTED_VERSION = 53; - private final int JAVA_MAX_SUPPORTED_VERSION = 57; + private final int JAVA_MAX_SUPPORTED_VERSION = 58; private static final JavaLangModuleAccess JLMA = SharedSecrets.getJavaLangModuleAccess(); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java --- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java Fri Jun 21 14:07:48 2019 +0530 @@ -210,7 +210,7 @@ b = classFileBuffer; // Check the class' major_version. This field is after the magic and minor_version fields, which // use 4 and 2 bytes respectively. - if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V13) { + if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V14) { throw new IllegalArgumentException( "Unsupported class file major version " + readShort(classFileOffset + 6)); } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java --- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java Fri Jun 21 14:07:48 2019 +0530 @@ -96,6 +96,7 @@ int V11 = 0 << 16 | 55; int V12 = 0 << 16 | 56; int V13 = 0 << 16 | 57; + int V14 = 0 << 16 | 58; /** * Version flag indicating that the class is using 'preview' features. diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/net/util/IPAddressUtil.java --- a/src/java.base/share/classes/sun/net/util/IPAddressUtil.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/net/util/IPAddressUtil.java Fri Jun 21 14:07:48 2019 +0530 @@ -25,6 +25,20 @@ package sun.net.util; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + public class IPAddressUtil { private static final int INADDR4SZ = 4; private static final int INADDR16SZ = 16; @@ -287,4 +301,75 @@ } return false; } + /** + * Mapping from unscoped local Inet(6)Address to the same address + * including the correct scope-id, determined from NetworkInterface. + */ + private final static ConcurrentHashMap + cache = new ConcurrentHashMap<>(); + + /** + * Returns a scoped version of the supplied local, link-local ipv6 address + * if that scope-id can be determined from local NetworkInterfaces. + * If the address already has a scope-id or if the address is not local, ipv6 + * or link local, then the original address is returned. + * + * @param addr + * @exception SocketException if the given ipv6 link local address is found + * on more than one local interface + * @return + */ + public static InetAddress toScopedAddress(InetAddress address) + throws SocketException { + + if (address instanceof Inet6Address && address.isLinkLocalAddress() + && ((Inet6Address) address).getScopeId() == 0) { + + InetAddress cached = null; + try { + cached = cache.computeIfAbsent(address, k -> findScopedAddress(k)); + } catch (UncheckedIOException e) { + throw (SocketException)e.getCause(); + } + return cached != null ? cached : address; + } else { + return address; + } + } + + /** + * Same as above for InetSocketAddress + */ + public static InetSocketAddress toScopedAddress(InetSocketAddress address) + throws SocketException { + InetAddress addr; + InetAddress orig = address.getAddress(); + if ((addr = toScopedAddress(orig)) == orig) { + return address; + } else { + return new InetSocketAddress(addr, address.getPort()); + } + } + + private static InetAddress findScopedAddress(InetAddress address) { + PrivilegedExceptionAction> pa = () -> NetworkInterface.networkInterfaces() + .flatMap(NetworkInterface::inetAddresses) + .filter(a -> (a instanceof Inet6Address) + && address.equals(a) + && ((Inet6Address) a).getScopeId() != 0) + .collect(Collectors.toList()); + List result; + try { + result = AccessController.doPrivileged(pa); + var sz = result.size(); + if (sz == 0) + return null; + if (sz > 1) + throw new UncheckedIOException(new SocketException( + "Duplicate link local addresses: must specify scope-id")); + return result.get(0); + } catch (PrivilegedActionException pae) { + return null; + } + } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java --- a/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -57,6 +57,7 @@ import sun.net.ResourceManager; import sun.net.ext.ExtendedSocketOptions; +import sun.net.util.IPAddressUtil; /** * An implementation of DatagramChannels. @@ -527,14 +528,16 @@ } else { // not connected SecurityManager sm = System.getSecurityManager(); + InetAddress ia = isa.getAddress(); if (sm != null) { - InetAddress ia = isa.getAddress(); if (ia.isMulticastAddress()) { sm.checkMulticast(ia); } else { sm.checkConnect(ia.getHostAddress(), isa.getPort()); } } + if (ia.isLinkLocalAddress()) + isa = IPAddressUtil.toScopedAddress(isa); n = send(fd, src, isa); if (blocking) { while (IOStatus.okayToRetry(n) && isOpen()) { diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/nio/ch/Net.java --- a/src/java.base/share/classes/sun/nio/ch/Net.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/nio/ch/Net.java Fri Jun 21 14:07:48 2019 +0530 @@ -50,6 +50,7 @@ import java.util.Enumeration; import sun.net.ext.ExtendedSocketOptions; +import sun.net.util.IPAddressUtil; import sun.security.action.GetPropertyAction; public class Net { @@ -462,6 +463,9 @@ { boolean preferIPv6 = isIPv6Available() && (family != StandardProtocolFamily.INET); + if (addr.isLinkLocalAddress()) { + addr = IPAddressUtil.toScopedAddress(addr); + } bind0(fd, preferIPv6, exclusiveBind, addr, port); } @@ -481,6 +485,9 @@ static int connect(ProtocolFamily family, FileDescriptor fd, InetAddress remote, int remotePort) throws IOException { + if (remote.isLinkLocalAddress()) { + remote = IPAddressUtil.toScopedAddress(remote); + } boolean preferIPv6 = isIPv6Available() && (family != StandardProtocolFamily.INET); return connect0(preferIPv6, fd, remote, remotePort); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java --- a/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -145,14 +145,20 @@ result.append(type.getName()); result.append('('); boolean firstMember = true; - for (Map.Entry e : memberValues.entrySet()) { + Set> entries = memberValues.entrySet(); + boolean loneValue = entries.size() == 1; + for (Map.Entry e : entries) { if (firstMember) firstMember = false; else result.append(", "); - result.append(e.getKey()); - result.append('='); + String key = e.getKey(); + if (!loneValue || !"value".equals(key)) { + result.append(key); + result.append('='); + } + loneValue = false; result.append(memberValueToString(e.getValue())); } result.append(')'); @@ -178,6 +184,8 @@ return toSourceString((float) value); else if (type == Long.class) return toSourceString((long) value); + else if (type == Byte.class) + return toSourceString((byte) value); else return value.toString(); } else { @@ -221,14 +229,14 @@ */ private static String toSourceString(Class clazz) { Class finalComponent = clazz; - StringBuilder arrayBackets = new StringBuilder(); + StringBuilder arrayBrackets = new StringBuilder(); while(finalComponent.isArray()) { finalComponent = finalComponent.getComponentType(); - arrayBackets.append("[]"); + arrayBrackets.append("[]"); } - return finalComponent.getName() + arrayBackets.toString() + ".class" ; + return finalComponent.getName() + arrayBrackets.toString() + ".class"; } private static String toSourceString(float f) { @@ -256,18 +264,44 @@ private static String toSourceString(char c) { StringBuilder sb = new StringBuilder(4); sb.append('\''); - if (c == '\'') - sb.append("\\'"); - else - sb.append(c); - return sb.append('\'') - .toString(); + sb.append(quote(c)); + return sb.append('\'') .toString(); + } + + /** + * Escapes a character if it has an escape sequence or is + * non-printable ASCII. Leaves non-ASCII characters alone. + */ + private static String quote(char ch) { + switch (ch) { + case '\b': return "\\b"; + case '\f': return "\\f"; + case '\n': return "\\n"; + case '\r': return "\\r"; + case '\t': return "\\t"; + case '\'': return "\\'"; + case '\"': return "\\\""; + case '\\': return "\\\\"; + default: + return (isPrintableAscii(ch)) + ? String.valueOf(ch) + : String.format("\\u%04x", (int) ch); + } + } + + /** + * Is a character printable ASCII? + */ + private static boolean isPrintableAscii(char ch) { + return ch >= ' ' && ch <= '~'; + } + + private static String toSourceString(byte b) { + return String.format("(byte)0x%02x", b); } private static String toSourceString(long ell) { - String str = String.valueOf(ell); - return (ell < Integer.MIN_VALUE || ell > Integer.MAX_VALUE) - ? (str + 'L') : str; + return String.valueOf(ell) + "L"; } /** @@ -277,9 +311,9 @@ private static String toSourceString(String s) { StringBuilder sb = new StringBuilder(); sb.append('"'); - // Escape embedded quote characters, if present, but don't do - // anything more heroic. - sb.append(s.replace("\"", "\\\"")); + for (int i = 0; i < s.length(); i++) { + sb.append(quote(s.charAt(i))); + } sb.append('"'); return sb.toString(); } @@ -287,7 +321,7 @@ private static Stream convert(byte[] values) { List list = new ArrayList<>(values.length); for (byte b : values) - list.add(Byte.toString(b)); + list.add(toSourceString(b)); return list.stream(); } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/CipherSuite.java --- a/src/java.base/share/classes/sun/security/ssl/CipherSuite.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/CipherSuite.java Fri Jun 21 14:07:48 2019 +0530 @@ -35,8 +35,8 @@ import static sun.security.ssl.CipherSuite.KeyExchange.*; import static sun.security.ssl.CipherSuite.MacAlg.*; import static sun.security.ssl.SSLCipher.*; -import sun.security.ssl.SupportedGroupsExtension.NamedGroupType; -import static sun.security.ssl.SupportedGroupsExtension.NamedGroupType.*; +import sun.security.ssl.NamedGroup.NamedGroupType; +import static sun.security.ssl.NamedGroup.NamedGroupType.*; /** * Enum for SSL/(D)TLS cipher suites. @@ -184,7 +184,7 @@ K_DHE_DSS, B_AES_128, M_SHA256, H_SHA256), // - // not forward screcy cipher suites. + // not forward secret cipher suites. // // AES_256(GCM) @@ -1106,11 +1106,18 @@ K_DH_ANON ("DH_anon", true, true, NAMED_GROUP_FFDHE), K_DH_ANON_EXPORT("DH_anon_EXPORT", true, true, NAMED_GROUP_NONE), - K_ECDH_ECDSA ("ECDH_ECDSA", true, false, NAMED_GROUP_ECDHE), - K_ECDH_RSA ("ECDH_RSA", true, false, NAMED_GROUP_ECDHE), - K_ECDHE_ECDSA ("ECDHE_ECDSA", true, false, NAMED_GROUP_ECDHE), - K_ECDHE_RSA ("ECDHE_RSA", true, false, NAMED_GROUP_ECDHE), - K_ECDH_ANON ("ECDH_anon", true, true, NAMED_GROUP_ECDHE), + // These KeyExchanges can use either ECDHE/XDH, so we'll use a + // varargs here. + K_ECDH_ECDSA ("ECDH_ECDSA", JsseJce.ALLOW_ECC, false, + NAMED_GROUP_ECDHE, NAMED_GROUP_XDH), + K_ECDH_RSA ("ECDH_RSA", JsseJce.ALLOW_ECC, false, + NAMED_GROUP_ECDHE, NAMED_GROUP_XDH), + K_ECDHE_ECDSA ("ECDHE_ECDSA", JsseJce.ALLOW_ECC, false, + NAMED_GROUP_ECDHE, NAMED_GROUP_XDH), + K_ECDHE_RSA ("ECDHE_RSA", JsseJce.ALLOW_ECC, false, + NAMED_GROUP_ECDHE, NAMED_GROUP_XDH), + K_ECDH_ANON ("ECDH_anon", JsseJce.ALLOW_ECC, true, + NAMED_GROUP_ECDHE, NAMED_GROUP_XDH), // renegotiation protection request signaling cipher suite K_SCSV ("SCSV", true, true, NAMED_GROUP_NONE); @@ -1118,19 +1125,16 @@ // name of the key exchange algorithm, e.g. DHE_DSS final String name; final boolean allowed; - final NamedGroupType groupType; + final NamedGroupType[] groupTypes; private final boolean alwaysAvailable; private final boolean isAnonymous; KeyExchange(String name, boolean allowed, - boolean isAnonymous, NamedGroupType groupType) { + boolean isAnonymous, NamedGroupType... groupTypes) { this.name = name; - if (groupType == NAMED_GROUP_ECDHE) { - this.allowed = JsseJce.ALLOW_ECC; - } else { - this.allowed = allowed; - } - this.groupType = groupType; + this.groupTypes = groupTypes; + this.allowed = allowed; + this.alwaysAvailable = allowed && (!name.startsWith("EC")); this.isAnonymous = isAnonymous; } @@ -1140,7 +1144,8 @@ return true; } - if (groupType == NAMED_GROUP_ECDHE) { + if (NamedGroupType.arrayContains( + groupTypes, NamedGroupType.NAMED_GROUP_ECDHE)) { return (allowed && JsseJce.isEcAvailable()); } else { return allowed; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/ClientHello.java --- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java Fri Jun 21 14:07:48 2019 +0530 @@ -35,7 +35,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Locale; -import java.util.Objects; import javax.net.ssl.SSLException; import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLPeerUnverifiedException; @@ -969,11 +968,24 @@ } } - // Is it an abbreviated handshake? - if (clientHello.sessionId.length() != 0) { - SSLSessionImpl previous = ((SSLSessionContextImpl)shc.sslContext - .engineGetServerSessionContext()) - .get(clientHello.sessionId.getId()); + // Consume a Session Ticket Extension if it exists + SSLExtension[] ext = new SSLExtension[]{ + SSLExtension.CH_SESSION_TICKET + }; + clientHello.extensions.consumeOnLoad(shc, ext); + + // Does the client want to resume a session? + if (clientHello.sessionId.length() != 0 || shc.statelessResumption) { + SSLSessionContextImpl cache = (SSLSessionContextImpl)shc.sslContext + .engineGetServerSessionContext(); + + SSLSessionImpl previous; + // Use the stateless session ticket if provided + if (shc.statelessResumption) { + previous = shc.resumingSession; + } else { + previous = cache.get(clientHello.sessionId.getId()); + } boolean resumingSession = (previous != null) && previous.isRejoinable(); @@ -1051,14 +1063,20 @@ // the resuming options later. shc.isResumption = resumingSession; shc.resumingSession = resumingSession ? previous : null; + + if (!resumingSession && SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("Session not resumed."); + } } // cache the client random number for further using shc.clientHelloRandom = clientHello.clientRandom; // Check and launch ClientHello extensions. - SSLExtension[] extTypes = shc.sslConfig.getEnabledExtensions( - SSLHandshake.CLIENT_HELLO); + SSLExtension[] extTypes = shc.sslConfig.getExclusiveExtensions( + SSLHandshake.CLIENT_HELLO, + Arrays.asList(SSLExtension.CH_SESSION_TICKET)); clientHello.extensions.consumeOnLoad(shc, extTypes); // @@ -1276,11 +1294,25 @@ } } - // Is it an abbreviated handshake? + + // Does the client want to resume a session? if (clientHello.sessionId.length() != 0) { - SSLSessionImpl previous = ((SSLSessionContextImpl)shc.sslContext - .engineGetServerSessionContext()) - .get(clientHello.sessionId.getId()); + SSLSessionContextImpl cache = (SSLSessionContextImpl)shc.sslContext + .engineGetServerSessionContext(); + + // Consume a Session Ticket Extension if it exists + SSLExtension[] ext = new SSLExtension[]{ + SSLExtension.CH_SESSION_TICKET + }; + clientHello.extensions.consumeOnLoad(shc, ext); + + SSLSessionImpl previous; + // Use stateless session ticket if provided. + if (shc.statelessResumption) { + previous = shc.resumingSession; + } else { + previous = cache.get(clientHello.sessionId.getId()); + } boolean resumingSession = (previous != null) && previous.isRejoinable(); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java --- a/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java Fri Jun 21 14:07:48 2019 +0530 @@ -42,7 +42,6 @@ import sun.security.ssl.DHKeyExchange.DHECredentials; import sun.security.ssl.DHKeyExchange.DHEPossession; import sun.security.ssl.SSLHandshake.HandshakeMessage; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; import sun.security.util.HexDumpEncoder; /** diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java --- a/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java Fri Jun 21 14:07:48 2019 +0530 @@ -36,19 +36,12 @@ import java.security.PrivateKey; import java.security.PublicKey; import java.security.SecureRandom; -import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidKeySpecException; -import javax.crypto.KeyAgreement; -import javax.crypto.SecretKey; import javax.crypto.interfaces.DHPublicKey; import javax.crypto.spec.DHParameterSpec; import javax.crypto.spec.DHPublicKeySpec; -import javax.crypto.spec.SecretKeySpec; -import javax.net.ssl.SSLHandshakeException; import sun.security.action.GetPropertyAction; -import sun.security.ssl.CipherSuite.HashAlg; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; -import sun.security.ssl.SupportedGroupsExtension.NamedGroupType; +import sun.security.ssl.NamedGroup.NamedGroupType; import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; import sun.security.ssl.X509Authentication.X509Possession; import sun.security.util.KeyUtil; @@ -61,7 +54,7 @@ static final SSLKeyAgreementGenerator kaGenerator = new DHEKAGenerator(); - static final class DHECredentials implements SSLCredentials { + static final class DHECredentials implements NamedGroupCredentials { final DHPublicKey popPublicKey; final NamedGroup namedGroup; @@ -70,6 +63,16 @@ this.namedGroup = namedGroup; } + @Override + public PublicKey getPublicKey() { + return popPublicKey; + } + + @Override + public NamedGroup getNamedGroup() { + return namedGroup; + } + static DHECredentials valueOf(NamedGroup ng, byte[] encodedPublic) throws IOException, GeneralSecurityException { @@ -98,7 +101,7 @@ } } - static final class DHEPossession implements SSLPossession { + static final class DHEPossession implements NamedGroupPossession { final PrivateKey privateKey; final DHPublicKey publicKey; final NamedGroup namedGroup; @@ -174,13 +177,13 @@ // Generate and validate DHPublicKeySpec private KeyPair generateDHKeyPair( KeyPairGenerator kpg) throws GeneralSecurityException { - boolean doExtraValiadtion = + boolean doExtraValidation = (!KeyUtil.isOracleJCEProvider(kpg.getProvider().getName())); boolean isRecovering = false; for (int i = 0; i <= 2; i++) { // Try to recover from failure. KeyPair kp = kpg.generateKeyPair(); // validate the Diffie-Hellman public key - if (doExtraValiadtion) { + if (doExtraValidation) { DHPublicKeySpec spec = getDHPublicKeySpec(kp.getPublic()); try { KeyUtil.validate(spec); @@ -231,6 +234,21 @@ return encoded; } + + @Override + public PublicKey getPublicKey() { + return publicKey; + } + + @Override + public NamedGroup getNamedGroup() { + return namedGroup; + } + + @Override + public PrivateKey getPrivateKey() { + return privateKey; + } } private static final class @@ -298,7 +316,7 @@ // Used for ServerKeyExchange, TLS 1.2 and prior versions. @Override public SSLPossession createPossession(HandshakeContext context) { - NamedGroup preferableNamedGroup = null; + NamedGroup preferableNamedGroup; if (!useLegacyEphemeralDHKeys && (context.clientRequestedNamedGroups != null) && (!context.clientRequestedNamedGroups.isEmpty())) { @@ -306,7 +324,8 @@ SupportedGroups.getPreferredGroup( context.negotiatedProtocol, context.algorithmConstraints, - NamedGroupType.NAMED_GROUP_FFDHE, + new NamedGroupType [] { + NamedGroupType.NAMED_GROUP_FFDHE }, context.clientRequestedNamedGroups); if (preferableNamedGroup != null) { return new DHEPossession(preferableNamedGroup, @@ -392,7 +411,7 @@ private static final class DHEKAGenerator implements SSLKeyAgreementGenerator { - static private DHEKAGenerator instance = new DHEKAGenerator(); + private static final DHEKAGenerator instance = new DHEKAGenerator(); // Prevent instantiation of this class. private DHEKAGenerator() { @@ -442,93 +461,8 @@ "No sufficient DHE key agreement parameters negotiated"); } - return new DHEKAKeyDerivation(context, + return new KAKeyDerivation("DiffieHellman", context, dhePossession.privateKey, dheCredentials.popPublicKey); } - - private static final - class DHEKAKeyDerivation implements SSLKeyDerivation { - private final HandshakeContext context; - private final PrivateKey localPrivateKey; - private final PublicKey peerPublicKey; - - DHEKAKeyDerivation(HandshakeContext context, - PrivateKey localPrivateKey, - PublicKey peerPublicKey) { - this.context = context; - this.localPrivateKey = localPrivateKey; - this.peerPublicKey = peerPublicKey; - } - - @Override - public SecretKey deriveKey(String algorithm, - AlgorithmParameterSpec params) throws IOException { - if (!context.negotiatedProtocol.useTLS13PlusSpec()) { - return t12DeriveKey(algorithm, params); - } else { - return t13DeriveKey(algorithm, params); - } - } - - private SecretKey t12DeriveKey(String algorithm, - AlgorithmParameterSpec params) throws IOException { - try { - KeyAgreement ka = KeyAgreement.getInstance("DiffieHellman"); - ka.init(localPrivateKey); - ka.doPhase(peerPublicKey, true); - SecretKey preMasterSecret = - ka.generateSecret("TlsPremasterSecret"); - SSLMasterKeyDerivation mskd = - SSLMasterKeyDerivation.valueOf( - context.negotiatedProtocol); - if (mskd == null) { - // unlikely - throw new SSLHandshakeException( - "No expected master key derivation for protocol: " + - context.negotiatedProtocol.name); - } - SSLKeyDerivation kd = mskd.createKeyDerivation( - context, preMasterSecret); - return kd.deriveKey("MasterSecret", params); - } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(gse); - } - } - - private SecretKey t13DeriveKey(String algorithm, - AlgorithmParameterSpec params) throws IOException { - try { - KeyAgreement ka = KeyAgreement.getInstance("DiffieHellman"); - ka.init(localPrivateKey); - ka.doPhase(peerPublicKey, true); - SecretKey sharedSecret = - ka.generateSecret("TlsPremasterSecret"); - - HashAlg hashAlg = context.negotiatedCipherSuite.hashAlg; - SSLKeyDerivation kd = context.handshakeKeyDerivation; - HKDF hkdf = new HKDF(hashAlg.name); - if (kd == null) { // No PSK is in use. - // If PSK is not in use Early Secret will still be - // HKDF-Extract(0, 0). - byte[] zeros = new byte[hashAlg.hashLength]; - SecretKeySpec ikm = - new SecretKeySpec(zeros, "TlsPreSharedSecret"); - SecretKey earlySecret = - hkdf.extract(zeros, ikm, "TlsEarlySecret"); - kd = new SSLSecretDerivation(context, earlySecret); - } - - // derive salt secret - SecretKey saltSecret = kd.deriveKey("TlsSaltSecret", null); - - // derive handshake secret - return hkdf.extract(saltSecret, sharedSecret, algorithm); - } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(gse); - } - } - } } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java --- a/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java Fri Jun 21 14:07:48 2019 +0530 @@ -48,7 +48,6 @@ import sun.security.ssl.DHKeyExchange.DHECredentials; import sun.security.ssl.DHKeyExchange.DHEPossession; import sun.security.ssl.SSLHandshake.HandshakeMessage; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; import sun.security.ssl.X509Authentication.X509Credentials; import sun.security.ssl.X509Authentication.X509Possession; import sun.security.util.HexDumpEncoder; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java --- a/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java Fri Jun 21 14:07:48 2019 +0530 @@ -27,31 +27,28 @@ import java.io.IOException; import java.nio.ByteBuffer; -import java.security.AlgorithmConstraints; -import java.security.CryptoPrimitive; import java.security.GeneralSecurityException; -import java.security.KeyFactory; import java.security.PublicKey; import java.security.interfaces.ECPublicKey; +import java.security.interfaces.XECPublicKey; +import java.security.spec.AlgorithmParameterSpec; import java.security.spec.ECParameterSpec; -import java.security.spec.ECPoint; -import java.security.spec.ECPublicKeySpec; +import java.security.spec.NamedParameterSpec; import java.text.MessageFormat; -import java.util.EnumSet; import java.util.Locale; import javax.crypto.SecretKey; -import javax.net.ssl.SSLHandshakeException; -import sun.security.ssl.ECDHKeyExchange.ECDHECredentials; -import sun.security.ssl.ECDHKeyExchange.ECDHEPossession; import sun.security.ssl.SSLHandshake.HandshakeMessage; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; import sun.security.ssl.X509Authentication.X509Credentials; import sun.security.ssl.X509Authentication.X509Possession; -import sun.security.util.ECUtil; import sun.security.util.HexDumpEncoder; /** * Pack of the "ClientKeyExchange" handshake message. + * + * This file is used by both the ECDH/ECDHE/XDH code since much of the + * code is the same between the EC named groups (i.e. + * x25519/x448/secp*r1), even though the APIs are very different (i.e. + * ECPublicKey/XECPublicKey, KeyExchange.getInstance("EC"/"XDH"), etc.). */ final class ECDHClientKeyExchange { static final SSLConsumer ecdhHandshakeConsumer = @@ -65,19 +62,17 @@ new ECDHEClientKeyExchangeProducer(); /** - * The ECDH/ECDHE ClientKeyExchange handshake message. + * The ECDH/ECDHE/XDH ClientKeyExchange handshake message. */ private static final class ECDHClientKeyExchangeMessage extends HandshakeMessage { private final byte[] encodedPoint; ECDHClientKeyExchangeMessage(HandshakeContext handshakeContext, - ECPublicKey publicKey) { + byte[] encodedPublicKey) { super(handshakeContext); - ECPoint point = publicKey.getW(); - ECParameterSpec params = publicKey.getParams(); - encodedPoint = ECUtil.encodePoint(point, params.getCurve()); + this.encodedPoint = encodedPublicKey; } ECDHClientKeyExchangeMessage(HandshakeContext handshakeContext, @@ -90,34 +85,6 @@ } } - // Check constraints of the specified EC public key. - static void checkConstraints(AlgorithmConstraints constraints, - ECPublicKey publicKey, - byte[] encodedPoint) throws SSLHandshakeException { - - try { - ECParameterSpec params = publicKey.getParams(); - ECPoint point = - ECUtil.decodePoint(encodedPoint, params.getCurve()); - ECPublicKeySpec spec = new ECPublicKeySpec(point, params); - - KeyFactory kf = KeyFactory.getInstance("EC"); - ECPublicKey peerPublicKey = - (ECPublicKey)kf.generatePublic(spec); - - // check constraints of ECPublicKey - if (!constraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - peerPublicKey)) { - throw new SSLHandshakeException( - "ECPublicKey does not comply to algorithm constraints"); - } - } catch (GeneralSecurityException | java.io.IOException e) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate ECPublicKey").initCause(e); - } - } - @Override public SSLHandshake handshakeType() { return SSLHandshake.CLIENT_KEY_EXCHANGE; @@ -194,24 +161,41 @@ } PublicKey publicKey = x509Credentials.popPublicKey; - if (!publicKey.getAlgorithm().equals("EC")) { + + NamedGroup namedGroup = null; + String algorithm = publicKey.getAlgorithm(); + + // Determine which NamedGroup we'll be using, then use + // the creator functions. + if (algorithm.equals("EC")) { + ECParameterSpec params = ((ECPublicKey)publicKey).getParams(); + namedGroup = NamedGroup.valueOf(params); + } else if (algorithm.equals("XDH")) { + AlgorithmParameterSpec params = + ((XECPublicKey)publicKey).getParams(); + if (params instanceof NamedParameterSpec) { + String name = ((NamedParameterSpec)params).getName(); + namedGroup = NamedGroup.nameOf(name); + } + } else { throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - "Not EC server certificate for ECDH client key exchange"); + "Not EC/XDH server certificate for " + + "ECDH client key exchange"); } - ECParameterSpec params = ((ECPublicKey)publicKey).getParams(); - NamedGroup namedGroup = NamedGroup.valueOf(params); if (namedGroup == null) { throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - "Unsupported EC server cert for ECDH client key exchange"); + "Unsupported EC/XDH server cert for " + + "ECDH client key exchange"); } - ECDHEPossession ecdhePossession = new ECDHEPossession( - namedGroup, chc.sslContext.getSecureRandom()); - chc.handshakePossessions.add(ecdhePossession); + SSLPossession sslPossession = namedGroup.createPossession( + chc.sslContext.getSecureRandom()); + + chc.handshakePossessions.add(sslPossession); ECDHClientKeyExchangeMessage cke = new ECDHClientKeyExchangeMessage( - chc, ecdhePossession.publicKey); + chc, sslPossession.encode()); if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { SSLLogger.fine( "Produced ECDH ClientKeyExchange handshake message", cke); @@ -283,18 +267,35 @@ "No expected EC server cert for ECDH client key exchange"); } - ECParameterSpec params = x509Possession.getECParameterSpec(); - if (params == null) { + // Determine which NamedGroup we'll be using, then use + // the creator functions. + NamedGroup namedGroup = null; + + // Iteratively determine the X509Possession type's ParameterSpec. + ECParameterSpec ecParams = x509Possession.getECParameterSpec(); + NamedParameterSpec namedParams = null; + if (ecParams != null) { + namedGroup = NamedGroup.valueOf(ecParams); + } + + // Wasn't EC, try XEC. + if (ecParams == null) { + namedParams = x509Possession.getXECParameterSpec(); + namedGroup = NamedGroup.nameOf(namedParams.getName()); + } + + // Can't figure this out, bail. + if ((ecParams == null) && (namedParams == null)) { // unlikely, have been checked during cipher suite negotiation. throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - "Not EC server cert for ECDH client key exchange"); + "Not EC/XDH server cert for ECDH client key exchange"); } - NamedGroup namedGroup = NamedGroup.valueOf(params); + // unlikely, have been checked during cipher suite negotiation. if (namedGroup == null) { - // unlikely, have been checked during cipher suite negotiation. throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - "Unsupported EC server cert for ECDH client key exchange"); + "Unknown named group in server cert for " + + "ECDH client key exchange"); } SSLKeyExchange ke = SSLKeyExchange.valueOf( @@ -306,7 +307,7 @@ "Not supported key exchange type"); } - // parse the handshake message + // parse either handshake message containing either EC/XEC. ECDHClientKeyExchangeMessage cke = new ECDHClientKeyExchangeMessage(shc, message); if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { @@ -316,27 +317,17 @@ // create the credentials try { - ECPoint point = - ECUtil.decodePoint(cke.encodedPoint, params.getCurve()); - ECPublicKeySpec spec = new ECPublicKeySpec(point, params); - - KeyFactory kf = KeyFactory.getInstance("EC"); - ECPublicKey peerPublicKey = - (ECPublicKey)kf.generatePublic(spec); + NamedGroup ng = namedGroup; // "effectively final" the lambda + // AlgorithmConstraints are checked internally. + SSLCredentials sslCredentials = namedGroup.decodeCredentials( + cke.encodedPoint, shc.algorithmConstraints, + s -> shc.conContext.fatal(Alert.INSUFFICIENT_SECURITY, + "ClientKeyExchange " + ng + ": " + s)); - // check constraints of peer ECPublicKey - if (!shc.algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - peerPublicKey)) { - throw new SSLHandshakeException( - "ECPublicKey does not comply to algorithm constraints"); - } - - shc.handshakeCredentials.add(new ECDHECredentials( - peerPublicKey, namedGroup)); - } catch (GeneralSecurityException | java.io.IOException e) { - throw (SSLHandshakeException)(new SSLHandshakeException( - "Could not generate ECPublicKey").initCause(e)); + shc.handshakeCredentials.add(sslCredentials); + } catch (GeneralSecurityException e) { + throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, + "Cannot decode ECDH PublicKey: " + namedGroup); } // update the states @@ -374,25 +365,37 @@ // The producing happens in client side only. ClientHandshakeContext chc = (ClientHandshakeContext)context; - ECDHECredentials ecdheCredentials = null; + SSLCredentials sslCredentials = null; + NamedGroup ng = null; + PublicKey publicKey = null; + + // Find a good EC/XEC credential to use, determine the + // NamedGroup to use for creating Possessions/Credentials/Keys. for (SSLCredentials cd : chc.handshakeCredentials) { - if (cd instanceof ECDHECredentials) { - ecdheCredentials = (ECDHECredentials)cd; + if (cd instanceof NamedGroupCredentials) { + NamedGroupCredentials creds = (NamedGroupCredentials)cd; + ng = creds.getNamedGroup(); + publicKey = creds.getPublicKey(); + sslCredentials = cd; break; } } - if (ecdheCredentials == null) { + if (sslCredentials == null) { throw chc.conContext.fatal(Alert.INTERNAL_ERROR, "No ECDHE credentials negotiated for client key exchange"); } - ECDHEPossession ecdhePossession = new ECDHEPossession( - ecdheCredentials, chc.sslContext.getSecureRandom()); - chc.handshakePossessions.add(ecdhePossession); + SSLPossession sslPossession = ng.createPossession( + chc.sslContext.getSecureRandom()); + + chc.handshakePossessions.add(sslPossession); + + // Write the EC/XEC message. ECDHClientKeyExchangeMessage cke = new ECDHClientKeyExchangeMessage( - chc, ecdhePossession.publicKey); + chc, sslPossession.encode()); + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { SSLLogger.fine( "Produced ECDHE ClientKeyExchange handshake message", cke); @@ -450,23 +453,29 @@ // The consuming happens in server side only. ServerHandshakeContext shc = (ServerHandshakeContext)context; - ECDHEPossession ecdhePossession = null; + SSLPossession sslPossession = null; + NamedGroup namedGroup = null; + + // Find a good EC/XEC credential to use, determine the + // NamedGroup to use for creating Possessions/Credentials/Keys. for (SSLPossession possession : shc.handshakePossessions) { - if (possession instanceof ECDHEPossession) { - ecdhePossession = (ECDHEPossession)possession; + if (possession instanceof NamedGroupPossession) { + NamedGroupPossession poss = + (NamedGroupPossession)possession; + namedGroup = poss.getNamedGroup(); + sslPossession = poss; break; } } - if (ecdhePossession == null) { + + if (sslPossession == null) { // unlikely throw shc.conContext.fatal(Alert.INTERNAL_ERROR, "No expected ECDHE possessions for client key exchange"); } - ECParameterSpec params = ecdhePossession.publicKey.getParams(); - NamedGroup namedGroup = NamedGroup.valueOf(params); if (namedGroup == null) { - // unlikely, have been checked during cipher suite negotiation. + // unlikely, have been checked during cipher suite negotiation throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER, "Unsupported EC server cert for ECDHE client key exchange"); } @@ -480,7 +489,7 @@ "Not supported key exchange type"); } - // parse the handshake message + // parse the EC/XEC handshake message ECDHClientKeyExchangeMessage cke = new ECDHClientKeyExchangeMessage(shc, message); if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { @@ -490,27 +499,17 @@ // create the credentials try { - ECPoint point = - ECUtil.decodePoint(cke.encodedPoint, params.getCurve()); - ECPublicKeySpec spec = new ECPublicKeySpec(point, params); - - KeyFactory kf = KeyFactory.getInstance("EC"); - ECPublicKey peerPublicKey = - (ECPublicKey)kf.generatePublic(spec); + NamedGroup ng = namedGroup; // "effectively final" the lambda + // AlgorithmConstraints are checked internally. + SSLCredentials sslCredentials = namedGroup.decodeCredentials( + cke.encodedPoint, shc.algorithmConstraints, + s -> shc.conContext.fatal(Alert.INSUFFICIENT_SECURITY, + "ClientKeyExchange " + ng + ": " + s)); - // check constraints of peer ECPublicKey - if (!shc.algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - peerPublicKey)) { - throw new SSLHandshakeException( - "ECPublicKey does not comply to algorithm constraints"); - } - - shc.handshakeCredentials.add(new ECDHECredentials( - peerPublicKey, namedGroup)); - } catch (GeneralSecurityException | java.io.IOException e) { - throw (SSLHandshakeException)(new SSLHandshakeException( - "Could not generate ECPublicKey").initCause(e)); + shc.handshakeCredentials.add(sslCredentials); + } catch (GeneralSecurityException e) { + throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, + "Cannot decode named group: " + namedGroup); } // update the states diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java --- a/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java Fri Jun 21 14:07:48 2019 +0530 @@ -36,7 +36,6 @@ import java.security.PublicKey; import java.security.SecureRandom; import java.security.interfaces.ECPublicKey; -import java.security.spec.AlgorithmParameterSpec; import java.security.spec.ECGenParameterSpec; import java.security.spec.ECParameterSpec; import java.security.spec.ECPoint; @@ -44,25 +43,30 @@ import java.util.EnumSet; import javax.crypto.KeyAgreement; import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; import javax.net.ssl.SSLHandshakeException; -import sun.security.ssl.CipherSuite.HashAlg; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; -import sun.security.ssl.SupportedGroupsExtension.NamedGroupType; +import sun.security.ssl.NamedGroup.NamedGroupType; import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; import sun.security.ssl.X509Authentication.X509Credentials; import sun.security.ssl.X509Authentication.X509Possession; +import sun.security.ssl.XDHKeyExchange.XDHECredentials; +import sun.security.ssl.XDHKeyExchange.XDHEPossession; import sun.security.util.ECUtil; final class ECDHKeyExchange { static final SSLPossessionGenerator poGenerator = new ECDHEPossessionGenerator(); - static final SSLKeyAgreementGenerator ecdheKAGenerator = - new ECDHEKAGenerator(); static final SSLKeyAgreementGenerator ecdhKAGenerator = new ECDHKAGenerator(); - static final class ECDHECredentials implements SSLCredentials { + // TLSv1.3 + static final SSLKeyAgreementGenerator ecdheKAGenerator = + new ECDHEKAGenerator(); + + // TLSv1-1.2, the KA gets more difficult with EC/XEC keys + static final SSLKeyAgreementGenerator ecdheXdhKAGenerator = + new ECDHEXDHKAGenerator(); + + static final class ECDHECredentials implements NamedGroupCredentials { final ECPublicKey popPublicKey; final NamedGroup namedGroup; @@ -71,6 +75,16 @@ this.namedGroup = namedGroup; } + @Override + public PublicKey getPublicKey() { + return popPublicKey; + } + + @Override + public NamedGroup getNamedGroup() { + return namedGroup; + } + static ECDHECredentials valueOf(NamedGroup namedGroup, byte[] encodedPoint) throws IOException, GeneralSecurityException { @@ -98,7 +112,7 @@ } } - static final class ECDHEPossession implements SSLPossession { + static final class ECDHEPossession implements NamedGroupPossession { final PrivateKey privateKey; final ECPublicKey publicKey; final NamedGroup namedGroup; @@ -199,6 +213,21 @@ "Could not generate ECPublicKey").initCause(e); } } + + @Override + public PublicKey getPublicKey() { + return publicKey; + } + + @Override + public NamedGroup getNamedGroup() { + return namedGroup; + } + + @Override + public PrivateKey getPrivateKey() { + return privateKey; + } } private static final @@ -210,24 +239,31 @@ @Override public SSLPossession createPossession(HandshakeContext context) { - NamedGroup preferableNamedGroup = null; + + NamedGroup preferableNamedGroup; + + // Find most preferred EC or XEC groups if ((context.clientRequestedNamedGroups != null) && (!context.clientRequestedNamedGroups.isEmpty())) { preferableNamedGroup = SupportedGroups.getPreferredGroup( context.negotiatedProtocol, context.algorithmConstraints, - NamedGroupType.NAMED_GROUP_ECDHE, + new NamedGroupType[] { + NamedGroupType.NAMED_GROUP_ECDHE, + NamedGroupType.NAMED_GROUP_XDH }, context.clientRequestedNamedGroups); } else { preferableNamedGroup = SupportedGroups.getPreferredGroup( context.negotiatedProtocol, context.algorithmConstraints, - NamedGroupType.NAMED_GROUP_ECDHE); + new NamedGroupType[] { + NamedGroupType.NAMED_GROUP_ECDHE, + NamedGroupType.NAMED_GROUP_XDH }); } if (preferableNamedGroup != null) { - return new ECDHEPossession(preferableNamedGroup, - context.sslContext.getSecureRandom()); + return preferableNamedGroup.createPossession( + context.sslContext.getSecureRandom()); } // no match found, cannot use this cipher suite. @@ -298,7 +334,7 @@ "No sufficient ECDHE key agreement parameters negotiated"); } - return new ECDHEKAKeyDerivation(shc, + return new KAKeyDerivation("ECDH", shc, x509Possession.popPrivateKey, ecdheCredentials.popPublicKey); } @@ -347,7 +383,7 @@ "No sufficient ECDH key agreement parameters negotiated"); } - return new ECDHEKAKeyDerivation(chc, + return new KAKeyDerivation("ECDH", chc, ecdhePossession.privateKey, x509Credentials.popPublicKey); } } @@ -391,94 +427,73 @@ "No sufficient ECDHE key agreement parameters negotiated"); } - return new ECDHEKAKeyDerivation(context, + return new KAKeyDerivation("ECDH", context, ecdhePossession.privateKey, ecdheCredentials.popPublicKey); } } + /* + * A Generator for TLSv1-1.2 to create a ECDHE or a XDH KeyDerivation + * object depending on the negotiated group. + */ private static final - class ECDHEKAKeyDerivation implements SSLKeyDerivation { - private final HandshakeContext context; - private final PrivateKey localPrivateKey; - private final PublicKey peerPublicKey; - - ECDHEKAKeyDerivation(HandshakeContext context, - PrivateKey localPrivateKey, - PublicKey peerPublicKey) { - this.context = context; - this.localPrivateKey = localPrivateKey; - this.peerPublicKey = peerPublicKey; + class ECDHEXDHKAGenerator implements SSLKeyAgreementGenerator { + // Prevent instantiation of this class. + private ECDHEXDHKAGenerator() { + // blank } @Override - public SecretKey deriveKey(String algorithm, - AlgorithmParameterSpec params) throws IOException { - if (!context.negotiatedProtocol.useTLS13PlusSpec()) { - return t12DeriveKey(algorithm, params); - } else { - return t13DeriveKey(algorithm, params); - } - } + public SSLKeyDerivation createKeyDerivation( + HandshakeContext context) throws IOException { + + NamedGroupPossession namedGroupPossession = null; + NamedGroupCredentials namedGroupCredentials = null; + NamedGroup namedGroup = null; - private SecretKey t12DeriveKey(String algorithm, - AlgorithmParameterSpec params) throws IOException { - try { - KeyAgreement ka = KeyAgreement.getInstance("ECDH"); - ka.init(localPrivateKey); - ka.doPhase(peerPublicKey, true); - SecretKey preMasterSecret = - ka.generateSecret("TlsPremasterSecret"); - - SSLMasterKeyDerivation mskd = - SSLMasterKeyDerivation.valueOf( - context.negotiatedProtocol); - if (mskd == null) { - // unlikely - throw new SSLHandshakeException( - "No expected master key derivation for protocol: " + - context.negotiatedProtocol.name); + // Find a possession/credential combo using the same named group + search: + for (SSLPossession poss : context.handshakePossessions) { + for (SSLCredentials cred : context.handshakeCredentials) { + if (((poss instanceof ECDHEPossession) && + (cred instanceof ECDHECredentials)) || + (((poss instanceof XDHEPossession) && + (cred instanceof XDHECredentials)))) { + NamedGroupPossession p = (NamedGroupPossession)poss; + NamedGroupCredentials c = (NamedGroupCredentials)cred; + if (p.getNamedGroup() != c.getNamedGroup()) { + continue; + } else { + namedGroup = p.getNamedGroup(); + } + namedGroupPossession = p; + namedGroupCredentials = c; + break search; + } } - SSLKeyDerivation kd = mskd.createKeyDerivation( - context, preMasterSecret); - return kd.deriveKey("MasterSecret", params); - } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(gse); } - } - private SecretKey t13DeriveKey(String algorithm, - AlgorithmParameterSpec params) throws IOException { - try { - KeyAgreement ka = KeyAgreement.getInstance("ECDH"); - ka.init(localPrivateKey); - ka.doPhase(peerPublicKey, true); - SecretKey sharedSecret = - ka.generateSecret("TlsPremasterSecret"); + if (namedGroupPossession == null || namedGroupCredentials == null) { + throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE, + "No sufficient ECDHE/XDH key agreement " + + "parameters negotiated"); + } - HashAlg hashAlg = context.negotiatedCipherSuite.hashAlg; - SSLKeyDerivation kd = context.handshakeKeyDerivation; - HKDF hkdf = new HKDF(hashAlg.name); - if (kd == null) { // No PSK is in use. - // If PSK is not in use Early Secret will still be - // HKDF-Extract(0, 0). - byte[] zeros = new byte[hashAlg.hashLength]; - SecretKeySpec ikm = - new SecretKeySpec(zeros, "TlsPreSharedSecret"); - SecretKey earlySecret = - hkdf.extract(zeros, ikm, "TlsEarlySecret"); - kd = new SSLSecretDerivation(context, earlySecret); - } + String alg; + switch (namedGroup.type) { + case NAMED_GROUP_ECDHE: + alg = "ECDH"; + break; + case NAMED_GROUP_XDH: + alg = "XDH"; + break; + default: + throw new RuntimeException("Unexpected named group type"); + } - // derive salt secret - SecretKey saltSecret = kd.deriveKey("TlsSaltSecret", null); - - // derive handshake secret - return hkdf.extract(saltSecret, sharedSecret, algorithm); - } catch (GeneralSecurityException gse) { - throw (SSLHandshakeException) new SSLHandshakeException( - "Could not generate secret").initCause(gse); - } + return new KAKeyDerivation(alg, context, + namedGroupPossession.getPrivateKey(), + namedGroupCredentials.getPublicKey()); } } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java --- a/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java Fri Jun 21 14:07:48 2019 +0530 @@ -27,32 +27,21 @@ import java.io.IOException; import java.nio.ByteBuffer; -import java.security.CryptoPrimitive; +import java.security.GeneralSecurityException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.Key; -import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.Signature; import java.security.SignatureException; -import java.security.interfaces.ECPublicKey; -import java.security.spec.ECParameterSpec; -import java.security.spec.ECPoint; -import java.security.spec.ECPublicKeySpec; -import java.security.spec.InvalidKeySpecException; import java.text.MessageFormat; -import java.util.EnumSet; import java.util.Locale; -import sun.security.ssl.ECDHKeyExchange.ECDHECredentials; -import sun.security.ssl.ECDHKeyExchange.ECDHEPossession; import sun.security.ssl.SSLHandshake.HandshakeMessage; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; import sun.security.ssl.X509Authentication.X509Credentials; import sun.security.ssl.X509Authentication.X509Possession; -import sun.security.util.ECUtil; import sun.security.util.HexDumpEncoder; /** @@ -80,14 +69,14 @@ // signature bytes, or null if anonymous private final byte[] paramsSignature; - // public key object encapsulated in this message - private final ECPublicKey publicKey; - private final boolean useExplicitSigAlgorithm; // the signature algorithm used by this ServerKeyExchange message private final SignatureScheme signatureScheme; + // the parsed credential object + private SSLCredentials sslCredentials; + ECDHServerKeyExchangeMessage( HandshakeContext handshakeContext) throws IOException { super(handshakeContext); @@ -96,38 +85,38 @@ ServerHandshakeContext shc = (ServerHandshakeContext)handshakeContext; - ECDHEPossession ecdhePossession = null; + // Find the Possessions needed + NamedGroupPossession namedGroupPossession = null; X509Possession x509Possession = null; for (SSLPossession possession : shc.handshakePossessions) { - if (possession instanceof ECDHEPossession) { - ecdhePossession = (ECDHEPossession)possession; + if (possession instanceof NamedGroupPossession) { + namedGroupPossession = (NamedGroupPossession)possession; if (x509Possession != null) { break; } } else if (possession instanceof X509Possession) { x509Possession = (X509Possession)possession; - if (ecdhePossession != null) { + if (namedGroupPossession != null) { break; } } } - if (ecdhePossession == null) { + if (namedGroupPossession == null) { // unlikely throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER, "No ECDHE credentials negotiated for server key exchange"); } - publicKey = ecdhePossession.publicKey; - ECParameterSpec params = publicKey.getParams(); - ECPoint point = publicKey.getW(); - publicPoint = ECUtil.encodePoint(point, params.getCurve()); + // Find the NamedGroup used for the ephemeral keys. + namedGroup = namedGroupPossession.getNamedGroup(); + publicPoint = namedGroup.encodePossessionPublicKey( + namedGroupPossession); - this.namedGroup = NamedGroup.valueOf(params); if ((namedGroup == null) || (namedGroup.oid == null) ) { // unlikely throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - "Unnamed EC parameter spec: " + params); + "Missing Named Group"); } if (x509Possession == null) { @@ -216,39 +205,23 @@ "Unsupported named group: " + namedGroup); } - if (namedGroup.oid == null) { - throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - "Unknown named EC curve: " + namedGroup); - } - - ECParameterSpec parameters = - ECUtil.getECParameterSpec(null, namedGroup.oid); - if (parameters == null) { - throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - "No supported EC parameter: " + namedGroup); - } - publicPoint = Record.getBytes8(m); if (publicPoint.length == 0) { throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - "Insufficient ECPoint data: " + namedGroup); + "Insufficient Point data: " + namedGroup); } - ECPublicKey ecPublicKey = null; try { - ECPoint point = - ECUtil.decodePoint(publicPoint, parameters.getCurve()); - KeyFactory factory = KeyFactory.getInstance("EC"); - ecPublicKey = (ECPublicKey)factory.generatePublic( - new ECPublicKeySpec(point, parameters)); - } catch (NoSuchAlgorithmException | - InvalidKeySpecException | IOException ex) { - throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER, - "Invalid ECPoint: " + namedGroup, ex); + sslCredentials = namedGroup.decodeCredentials( + publicPoint, handshakeContext.algorithmConstraints, + s -> chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY, + "ServerKeyExchange " + namedGroup + ": " + (s))); + } catch (GeneralSecurityException ex) { + throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, + "Cannot decode named group: " + + NamedGroup.nameOf(namedGroupId)); } - publicKey = ecPublicKey; - X509Credentials x509Credentials = null; for (SSLCredentials cd : chc.handshakeCredentials) { if (cd instanceof X509Credentials) { @@ -529,6 +502,7 @@ // The consuming happens in client side only. ClientHandshakeContext chc = (ClientHandshakeContext)context; + // AlgorithmConstraints are checked during decoding ECDHServerKeyExchangeMessage skem = new ECDHServerKeyExchangeMessage(chc, message); if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { @@ -537,22 +511,9 @@ } // - // validate - // - // check constraints of EC PublicKey - if (!chc.algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - skem.publicKey)) { - throw chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY, - "ECDH ServerKeyExchange does not comply " + - "to algorithm constraints"); - } - - // // update // - chc.handshakeCredentials.add( - new ECDHECredentials(skem.publicKey, skem.namedGroup)); + chc.handshakeCredentials.add(skem.sslCredentials); // // produce diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/ECPointFormatsExtension.java --- a/src/java.base/share/classes/sun/security/ssl/ECPointFormatsExtension.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/ECPointFormatsExtension.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -34,7 +34,7 @@ import sun.security.ssl.SSLExtension.ExtensionConsumer; import sun.security.ssl.SSLExtension.SSLExtensionSpec; import sun.security.ssl.SSLHandshake.HandshakeMessage; -import sun.security.ssl.SupportedGroupsExtension.NamedGroupType; +import sun.security.ssl.NamedGroup.NamedGroupType; /** * Pack of the "ec_point_formats" extensions [RFC 4492]. diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/Finished.java --- a/src/java.base/share/classes/sun/security/ssl/Finished.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/Finished.java Fri Jun 21 14:07:48 2019 +0530 @@ -410,6 +410,10 @@ chc.conContext.clientVerifyData = fm.verifyData; } + if (chc.statelessResumption) { + chc.handshakeConsumers.put( + SSLHandshake.NEW_SESSION_TICKET.id, SSLHandshake.NEW_SESSION_TICKET); + } // update the consumers and producers if (!chc.isResumption) { chc.conContext.consumers.put(ContentType.CHANGE_CIPHER_SPEC.id, @@ -441,6 +445,10 @@ private byte[] onProduceFinished(ServerHandshakeContext shc, HandshakeMessage message) throws IOException { + if (shc.statelessResumption) { + NewSessionTicket.handshake12Producer.produce(shc, message); + } + // Refresh handshake hash shc.handshakeHash.update(); @@ -473,7 +481,8 @@ SSLHandshake.FINISHED.id, SSLHandshake.FINISHED); shc.conContext.inputRecord.expectingFinishFlight(); } else { - if (shc.handshakeSession.isRejoinable()) { + if (shc.handshakeSession.isRejoinable() && + !shc.statelessResumption) { ((SSLSessionContextImpl)shc.sslContext. engineGetServerSessionContext()).put( shc.handshakeSession); @@ -591,7 +600,8 @@ } if (shc.isResumption) { - if (shc.handshakeSession.isRejoinable()) { + if (shc.handshakeSession.isRejoinable() && + !shc.statelessResumption) { ((SSLSessionContextImpl)shc.sslContext. engineGetServerSessionContext()).put( shc.handshakeSession); @@ -915,9 +925,9 @@ // save the session if (!chc.isResumption && chc.handshakeSession.isRejoinable()) { - SSLSessionContextImpl sessionContext = (SSLSessionContextImpl) - chc.sslContext.engineGetClientSessionContext(); - sessionContext.put(chc.handshakeSession); + ((SSLSessionContextImpl)chc.sslContext. + engineGetClientSessionContext()). + put(chc.handshakeSession); } // derive salt secret @@ -1028,10 +1038,11 @@ shc.negotiatedProtocol); } - // save the session - if (!shc.isResumption && shc.handshakeSession.isRejoinable()) { + // Save the session if possible and not stateless + if (!shc.statelessResumption && !shc.isResumption && + shc.handshakeSession.isRejoinable()) { SSLSessionContextImpl sessionContext = (SSLSessionContextImpl) - shc.sslContext.engineGetServerSessionContext(); + shc.sslContext.engineGetServerSessionContext(); sessionContext.put(shc.handshakeSession); } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/HandshakeContext.java --- a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java Fri Jun 21 14:07:48 2019 +0530 @@ -46,9 +46,8 @@ import javax.net.ssl.SNIServerName; import javax.net.ssl.SSLHandshakeException; import javax.security.auth.x500.X500Principal; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; -import sun.security.ssl.SupportedGroupsExtension.NamedGroupType; -import static sun.security.ssl.SupportedGroupsExtension.NamedGroupType.*; +import sun.security.ssl.NamedGroup.NamedGroupType; +import static sun.security.ssl.NamedGroup.NamedGroupType.*; import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; abstract class HandshakeContext implements ConnectionContext { @@ -102,6 +101,8 @@ // Resumption boolean isResumption; SSLSessionImpl resumingSession; + // Session is using stateless resumption + boolean statelessResumption = false; final Queue> delegatedActions; volatile boolean taskDelegated = false; @@ -517,31 +518,38 @@ return true; } - boolean available; - NamedGroupType groupType = suite.keyExchange.groupType; - if (groupType != NAMED_GROUP_NONE) { - Boolean checkedStatus = cachedStatus.get(groupType); - if (checkedStatus == null) { - available = SupportedGroups.isActivatable( - algorithmConstraints, groupType); - cachedStatus.put(groupType, available); + // Is at least one of the group types available? + boolean groupAvailable, retval = false; + NamedGroupType[] groupTypes = suite.keyExchange.groupTypes; + for (NamedGroupType groupType : groupTypes) { + if (groupType != NAMED_GROUP_NONE) { + Boolean checkedStatus = cachedStatus.get(groupType); + if (checkedStatus == null) { + groupAvailable = SupportedGroups.isActivatable( + algorithmConstraints, groupType); + cachedStatus.put(groupType, groupAvailable); - if (!available && - SSLLogger.isOn && SSLLogger.isOn("verbose")) { - SSLLogger.fine("No activated named group"); + if (!groupAvailable && + SSLLogger.isOn && SSLLogger.isOn("verbose")) { + SSLLogger.fine( + "No activated named group in " + groupType); + } + } else { + groupAvailable = checkedStatus; } + + retval |= groupAvailable; } else { - available = checkedStatus; + retval |= true; } + } - if (!available && SSLLogger.isOn && SSLLogger.isOn("verbose")) { - SSLLogger.fine( - "No active named group, ignore " + suite); - } - return available; - } else { - return true; + if (!retval && SSLLogger.isOn && SSLLogger.isOn("verbose")) { + SSLLogger.fine("No active named group(s), ignore " + suite); } + + return retval; + } else if (SSLLogger.isOn && SSLLogger.isOn("verbose")) { SSLLogger.fine("Ignore disabled cipher suite: " + suite); } @@ -551,7 +559,7 @@ List getRequestedServerNames() { if (requestedServerNames == null) { - return Collections.emptyList(); + return Collections.emptyList(); } return requestedServerNames; } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,132 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package sun.security.ssl; + +import javax.crypto.KeyAgreement; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import javax.net.ssl.SSLHandshakeException; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.AlgorithmParameterSpec; + +/** + * A common class for creating various KeyDerivation types. + */ +public class KAKeyDerivation implements SSLKeyDerivation { + + private final String algorithmName; + private final HandshakeContext context; + private final PrivateKey localPrivateKey; + private final PublicKey peerPublicKey; + + KAKeyDerivation(String algorithmName, + HandshakeContext context, + PrivateKey localPrivateKey, + PublicKey peerPublicKey) { + this.algorithmName = algorithmName; + this.context = context; + this.localPrivateKey = localPrivateKey; + this.peerPublicKey = peerPublicKey; + } + + @Override + public SecretKey deriveKey(String algorithm, + AlgorithmParameterSpec params) throws IOException { + if (!context.negotiatedProtocol.useTLS13PlusSpec()) { + return t12DeriveKey(algorithm, params); + } else { + return t13DeriveKey(algorithm, params); + } + } + + /** + * Handle the TLSv1-1.2 objects, which don't use the HKDF algorithms. + */ + private SecretKey t12DeriveKey(String algorithm, + AlgorithmParameterSpec params) throws IOException { + try { + KeyAgreement ka = KeyAgreement.getInstance(algorithmName); + ka.init(localPrivateKey); + ka.doPhase(peerPublicKey, true); + SecretKey preMasterSecret + = ka.generateSecret("TlsPremasterSecret"); + SSLMasterKeyDerivation mskd + = SSLMasterKeyDerivation.valueOf( + context.negotiatedProtocol); + if (mskd == null) { + // unlikely + throw new SSLHandshakeException( + "No expected master key derivation for protocol: " + + context.negotiatedProtocol.name); + } + SSLKeyDerivation kd = mskd.createKeyDerivation( + context, preMasterSecret); + return kd.deriveKey("MasterSecret", params); + } catch (GeneralSecurityException gse) { + throw (SSLHandshakeException) new SSLHandshakeException( + "Could not generate secret").initCause(gse); + } + } + + /** + * Handle the TLSv1.3 objects, which use the HKDF algorithms. + */ + private SecretKey t13DeriveKey(String algorithm, + AlgorithmParameterSpec params) throws IOException { + try { + KeyAgreement ka = KeyAgreement.getInstance(algorithmName); + ka.init(localPrivateKey); + ka.doPhase(peerPublicKey, true); + SecretKey sharedSecret + = ka.generateSecret("TlsPremasterSecret"); + + CipherSuite.HashAlg hashAlg = context.negotiatedCipherSuite.hashAlg; + SSLKeyDerivation kd = context.handshakeKeyDerivation; + HKDF hkdf = new HKDF(hashAlg.name); + if (kd == null) { // No PSK is in use. + // If PSK is not in use Early Secret will still be + // HKDF-Extract(0, 0). + byte[] zeros = new byte[hashAlg.hashLength]; + SecretKeySpec ikm + = new SecretKeySpec(zeros, "TlsPreSharedSecret"); + SecretKey earlySecret + = hkdf.extract(zeros, ikm, "TlsEarlySecret"); + kd = new SSLSecretDerivation(context, earlySecret); + } + + // derive salt secret + SecretKey saltSecret = kd.deriveKey("TlsSaltSecret", null); + + // derive handshake secret + return hkdf.extract(saltSecret, sharedSecret, algorithm); + } catch (GeneralSecurityException gse) { + throw (SSLHandshakeException) new SSLHandshakeException( + "Could not generate secret").initCause(gse); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java --- a/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -27,27 +27,19 @@ import java.io.IOException; import java.nio.ByteBuffer; -import java.security.CryptoPrimitive; import java.security.GeneralSecurityException; import java.text.MessageFormat; import java.util.Arrays; import java.util.Collections; -import java.util.EnumSet; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import javax.net.ssl.SSLProtocolException; -import sun.security.ssl.DHKeyExchange.DHECredentials; -import sun.security.ssl.DHKeyExchange.DHEPossession; -import sun.security.ssl.ECDHKeyExchange.ECDHECredentials; -import sun.security.ssl.ECDHKeyExchange.ECDHEPossession; import sun.security.ssl.KeyShareExtension.CHKeyShareSpec; import sun.security.ssl.SSLExtension.ExtensionConsumer; import sun.security.ssl.SSLExtension.SSLExtensionSpec; import sun.security.ssl.SSLHandshake.HandshakeMessage; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; -import sun.security.ssl.SupportedGroupsExtension.NamedGroupType; import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; import sun.security.util.HexDumpEncoder; @@ -264,8 +256,7 @@ for (SSLPossession pos : poses) { // update the context chc.handshakePossessions.add(pos); - if (!(pos instanceof ECDHEPossession) && - !(pos instanceof DHEPossession)) { + if (!(pos instanceof NamedGroupPossession)) { // May need more possesion types in the future. continue; } @@ -353,46 +344,18 @@ continue; } - if (ng.type == NamedGroupType.NAMED_GROUP_ECDHE) { - try { - ECDHECredentials ecdhec = - ECDHECredentials.valueOf(ng, entry.keyExchange); - if (ecdhec != null) { - if (!shc.algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - ecdhec.popPublicKey)) { - SSLLogger.warning( - "ECDHE key share entry does not " + - "comply to algorithm constraints"); - } else { - credentials.add(ecdhec); - } - } - } catch (IOException | GeneralSecurityException ex) { - SSLLogger.warning( - "Cannot decode named group: " + - NamedGroup.nameOf(entry.namedGroupId)); + try { + SSLCredentials kaCred = + ng.decodeCredentials(entry.keyExchange, + shc.algorithmConstraints, + s -> SSLLogger.warning(s)); + if (kaCred != null) { + credentials.add(kaCred); } - } else if (ng.type == NamedGroupType.NAMED_GROUP_FFDHE) { - try { - DHECredentials dhec = - DHECredentials.valueOf(ng, entry.keyExchange); - if (dhec != null) { - if (!shc.algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - dhec.popPublicKey)) { - SSLLogger.warning( - "DHE key share entry does not " + - "comply to algorithm constraints"); - } else { - credentials.add(dhec); - } - } - } catch (IOException | GeneralSecurityException ex) { - SSLLogger.warning( - "Cannot decode named group: " + - NamedGroup.nameOf(entry.namedGroupId)); - } + } catch (GeneralSecurityException ex) { + SSLLogger.warning( + "Cannot decode named group: " + + NamedGroup.nameOf(entry.namedGroupId)); } } @@ -526,10 +489,9 @@ KeyShareEntry keyShare = null; for (SSLCredentials cd : shc.handshakeCredentials) { NamedGroup ng = null; - if (cd instanceof ECDHECredentials) { - ng = ((ECDHECredentials)cd).namedGroup; - } else if (cd instanceof DHECredentials) { - ng = ((DHECredentials)cd).namedGroup; + if (cd instanceof NamedGroupCredentials) { + NamedGroupCredentials creds = (NamedGroupCredentials)cd; + ng = creds.getNamedGroup(); } if (ng == null) { @@ -547,8 +509,7 @@ SSLPossession[] poses = ke.createPossessions(shc); for (SSLPossession pos : poses) { - if (!(pos instanceof ECDHEPossession) && - !(pos instanceof DHEPossession)) { + if (!(pos instanceof NamedGroupPossession)) { // May need more possesion types in the future. continue; } @@ -567,7 +528,7 @@ me.getKey(), me.getValue()); } - // We have got one! Don't forgor to break. + // We have got one! Don't forget to break. break; } } @@ -643,49 +604,16 @@ } SSLCredentials credentials = null; - if (ng.type == NamedGroupType.NAMED_GROUP_ECDHE) { - try { - ECDHECredentials ecdhec = - ECDHECredentials.valueOf(ng, keyShare.keyExchange); - if (ecdhec != null) { - if (!chc.algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - ecdhec.popPublicKey)) { - throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, - "ECDHE key share entry does not " + - "comply to algorithm constraints"); - } else { - credentials = ecdhec; - } - } - } catch (IOException | GeneralSecurityException ex) { - throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, - "Cannot decode named group: " + - NamedGroup.nameOf(keyShare.namedGroupId)); + try { + SSLCredentials kaCred = ng.decodeCredentials( + keyShare.keyExchange, chc.algorithmConstraints, + s -> chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, s)); + if (kaCred != null) { + credentials = kaCred; } - } else if (ng.type == NamedGroupType.NAMED_GROUP_FFDHE) { - try { - DHECredentials dhec = - DHECredentials.valueOf(ng, keyShare.keyExchange); - if (dhec != null) { - if (!chc.algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - dhec.popPublicKey)) { - throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, - "DHE key share entry does not " + - "comply to algorithm constraints"); - } else { - credentials = dhec; - } - } - } catch (IOException | GeneralSecurityException ex) { - throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, - "Cannot decode named group: " + - NamedGroup.nameOf(keyShare.namedGroupId)); - } - } else { + } catch (GeneralSecurityException ex) { throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, - "Unsupported named group: " + + "Cannot decode named group: " + NamedGroup.nameOf(keyShare.namedGroupId)); } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/NamedGroup.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/classes/sun/security/ssl/NamedGroup.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,781 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package sun.security.ssl; + +import javax.crypto.spec.DHParameterSpec; +import javax.net.ssl.SSLException; +import java.io.IOException; +import java.security.*; +import java.security.spec.*; +import java.util.EnumSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; +import javax.crypto.*; +import sun.security.ssl.DHKeyExchange.DHEPossession; +import sun.security.ssl.ECDHKeyExchange.ECDHEPossession; + +import sun.security.util.ECUtil; + +/** + * An enum containing all known named groups for use in TLS. + * + * The enum also contains the required properties of each group and the + * required functions (e.g. encoding/decoding). + */ +enum NamedGroup { + // Elliptic Curves (RFC 4492) + // + // See sun.security.util.CurveDB for the OIDs + // NIST K-163 + + SECT163_K1(0x0001, "sect163k1", "1.3.132.0.1", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECT163_R1(0x0002, "sect163r1", "1.3.132.0.2", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST B-163 + SECT163_R2(0x0003, "sect163r2", "1.3.132.0.15", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECT193_R1(0x0004, "sect193r1", "1.3.132.0.24", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECT193_R2(0x0005, "sect193r2", "1.3.132.0.25", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST K-233 + SECT233_K1(0x0006, "sect233k1", "1.3.132.0.26", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST B-233 + SECT233_R1(0x0007, "sect233r1", "1.3.132.0.27", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECT239_K1(0x0008, "sect239k1", "1.3.132.0.3", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST K-283 + SECT283_K1(0x0009, "sect283k1", "1.3.132.0.16", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST B-283 + SECT283_R1(0x000A, "sect283r1", "1.3.132.0.17", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST K-409 + SECT409_K1(0x000B, "sect409k1", "1.3.132.0.36", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST B-409 + SECT409_R1(0x000C, "sect409r1", "1.3.132.0.37", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST K-571 + SECT571_K1(0x000D, "sect571k1", "1.3.132.0.38", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST B-571 + SECT571_R1(0x000E, "sect571r1", "1.3.132.0.39", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECP160_K1(0x000F, "secp160k1", "1.3.132.0.9", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECP160_R1(0x0010, "secp160r1", "1.3.132.0.8", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECP160_R2(0x0011, "secp160r2", "1.3.132.0.30", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECP192_K1(0x0012, "secp192k1", "1.3.132.0.31", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST P-192 + SECP192_R1(0x0013, "secp192r1", "1.2.840.10045.3.1.1", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECP224_K1(0x0014, "secp224k1", "1.3.132.0.32", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST P-224 + SECP224_R1(0x0015, "secp224r1", "1.3.132.0.33", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + SECP256_K1(0x0016, "secp256k1", "1.3.132.0.10", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_12), + + // NIST P-256 + SECP256_R1(0x0017, "secp256r1", "1.2.840.10045.3.1.7", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_13), + + // NIST P-384 + SECP384_R1(0x0018, "secp384r1", "1.3.132.0.34", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_13), + + // NIST P-521 + SECP521_R1(0x0019, "secp521r1", "1.3.132.0.35", + NamedGroupType.NAMED_GROUP_ECDHE, + ProtocolVersion.PROTOCOLS_TO_13), + + // x25519 and x448 (RFC 8422/8446) + X25519(0x001D, "x25519", "1.3.101.110", + NamedGroupType.NAMED_GROUP_XDH, + ProtocolVersion.PROTOCOLS_TO_13), + X448(0x001E, "x448", "1.3.101.111", + NamedGroupType.NAMED_GROUP_XDH, + ProtocolVersion.PROTOCOLS_TO_13), + + // Finite Field Diffie-Hellman Ephemeral Parameters (RFC 7919) + FFDHE_2048(0x0100, "ffdhe2048", null, + NamedGroupType.NAMED_GROUP_FFDHE, + ProtocolVersion.PROTOCOLS_TO_13), + FFDHE_3072(0x0101, "ffdhe3072", null, + NamedGroupType.NAMED_GROUP_FFDHE, + ProtocolVersion.PROTOCOLS_TO_13), + FFDHE_4096(0x0102, "ffdhe4096", null, + NamedGroupType.NAMED_GROUP_FFDHE, + ProtocolVersion.PROTOCOLS_TO_13), + FFDHE_6144(0x0103, "ffdhe6144", null, + NamedGroupType.NAMED_GROUP_FFDHE, + ProtocolVersion.PROTOCOLS_TO_13), + FFDHE_8192(0x0104, "ffdhe8192", null, + NamedGroupType.NAMED_GROUP_FFDHE, + ProtocolVersion.PROTOCOLS_TO_13), + + // Elliptic Curves (RFC 4492) + // + // arbitrary prime and characteristic-2 curves + ARBITRARY_PRIME(0xFF01, "arbitrary_explicit_prime_curves", null, + NamedGroupType.NAMED_GROUP_ARBITRARY, + ProtocolVersion.PROTOCOLS_TO_12), + ARBITRARY_CHAR2(0xFF02, "arbitrary_explicit_char2_curves", null, + NamedGroupType.NAMED_GROUP_ARBITRARY, + ProtocolVersion.PROTOCOLS_TO_12); + + final int id; // hash + signature + final NamedGroupType type; // group type + final String name; // literal name + final String oid; // object identifier of the named group + final String algorithm; // signature algorithm + final ProtocolVersion[] supportedProtocols; + private final NamedGroupFunctions functions; // may be null + + // Constructor used for all NamedGroup types + private NamedGroup(int id, String name, String oid, + NamedGroupType namedGroupType, + ProtocolVersion[] supportedProtocols) { + this.id = id; + this.name = name; + this.oid = oid; + this.type = namedGroupType; + this.supportedProtocols = supportedProtocols; + + if (this.type == NamedGroupType.NAMED_GROUP_ECDHE) { + this.functions = ECDHFunctions.getInstance(); + this.algorithm = "EC"; + } else if (this.type == NamedGroupType.NAMED_GROUP_FFDHE) { + this.functions = FFDHFunctions.getInstance(); + this.algorithm = "DiffieHellman"; + } else if (this.type == NamedGroupType.NAMED_GROUP_XDH) { + this.functions = XDHFunctions.getInstance(); + this.algorithm = "XDH"; + } else if (this.type == NamedGroupType.NAMED_GROUP_ARBITRARY) { + this.functions = null; + this.algorithm = "EC"; + } else { + throw new RuntimeException("Unexpected Named Group Type"); + } + } + + private Optional getFunctions() { + return Optional.ofNullable(functions); + } + + // The next set of methods search & retrieve NamedGroups. + + static NamedGroup valueOf(int id) { + for (NamedGroup group : NamedGroup.values()) { + if (group.id == id) { + return group; + } + } + + return null; + } + + static NamedGroup valueOf(ECParameterSpec params) { + String oid = ECUtil.getCurveName(null, params); + if ((oid != null) && (!oid.isEmpty())) { + for (NamedGroup group : NamedGroup.values()) { + if ((group.type == NamedGroupType.NAMED_GROUP_ECDHE) + && oid.equals(group.oid)) { + return group; + } + } + } + + return null; + } + + static NamedGroup valueOf(DHParameterSpec params) { + for (NamedGroup ng : NamedGroup.values()) { + if (ng.type != NamedGroupType.NAMED_GROUP_FFDHE) { + continue; + } + + DHParameterSpec ngParams = null; + // functions is non-null for FFDHE type + AlgorithmParameters aps = ng.functions.getParameters(ng); + try { + ngParams = aps.getParameterSpec(DHParameterSpec.class); + } catch (InvalidParameterSpecException ipse) { + // should be unlikely + } + + if (ngParams == null) { + continue; + } + + if (ngParams.getP().equals(params.getP()) + && ngParams.getG().equals(params.getG())) { + return ng; + } + } + + return null; + } + + static NamedGroup nameOf(String name) { + for (NamedGroup group : NamedGroup.values()) { + if (group.name.equals(name)) { + return group; + } + } + + return null; + } + + static String nameOf(int id) { + for (NamedGroup group : NamedGroup.values()) { + if (group.id == id) { + return group.name; + } + } + + return "UNDEFINED-NAMED-GROUP(" + id + ")"; + } + + // Are the NamedGroups available for the protocol desired? + + boolean isAvailable(List protocolVersions) { + for (ProtocolVersion pv : supportedProtocols) { + if (protocolVersions.contains(pv)) { + return true; + } + } + return false; + } + + boolean isAvailable(ProtocolVersion protocolVersion) { + for (ProtocolVersion pv : supportedProtocols) { + if (protocolVersion == pv) { + return true; + } + } + return false; + } + + // Are the NamedGroups available for the ciphersuites desired? + + boolean isSupported(List cipherSuites) { + for (CipherSuite cs : cipherSuites) { + boolean isMatch = isAvailable(cs.supportedProtocols); + if (isMatch && ((cs.keyExchange == null) + || (NamedGroupType.arrayContains( + cs.keyExchange.groupTypes, type)))) { + return true; + } + } + return false; + } + + // lazy loading of parameters + AlgorithmParameters getParameters() { + Optional ngf = getFunctions(); + if (ngf.isEmpty()) { + return null; + } + return ngf.get().getParameters(this); + } + + // The next set of methods use the NamedGroupFunctions table + // to do various operations in a consistent way. + + AlgorithmParameterSpec getParameterSpec() { + Optional ngf = getFunctions(); + if (ngf.isEmpty()) { + return null; + } + return ngf.get().getParameterSpec(this); + } + + byte[] encodePossessionPublicKey( + NamedGroupPossession namedGroupPossession) { + + Optional ngf = getFunctions(); + if (ngf.isEmpty()) { + return null; + } + return ngf.get().encodePossessionPublicKey(namedGroupPossession); + } + + SSLCredentials decodeCredentials(byte[] encoded, + AlgorithmConstraints constraints, + ExceptionSupplier onConstraintFail) + throws IOException, GeneralSecurityException { + + Optional ngf = getFunctions(); + if (ngf.isEmpty()) { + return null; + } + return ngf.get().decodeCredentials(this, encoded, constraints, + onConstraintFail); + } + + SSLPossession createPossession(SecureRandom random) { + + Optional ngf = getFunctions(); + if (ngf.isEmpty()) { + return null; + } + return ngf.get().createPossession(this, random); + } + + SSLKeyDerivation createKeyDerivation(HandshakeContext hc) + throws IOException { + + Optional ngf = getFunctions(); + if (ngf.isEmpty()) { + return null; + } + return ngf.get().createKeyDerivation(hc); + + } + + boolean isAvailableGroup() { + Optional ngfOpt = getFunctions(); + if (ngfOpt.isEmpty()) { + return false; + } + NamedGroupFunctions ngf = ngfOpt.get(); + return ngf.isAvailable(this); + } + + enum NamedGroupType { + NAMED_GROUP_ECDHE, // Elliptic Curve Groups (ECDHE) + NAMED_GROUP_FFDHE, // Finite Field Groups (DHE) + NAMED_GROUP_XDH, // Finite Field Groups (XDH) + NAMED_GROUP_ARBITRARY, // arbitrary prime and curves (ECDHE) + NAMED_GROUP_NONE; // Not predefined named group + + boolean isSupported(List cipherSuites) { + for (CipherSuite cs : cipherSuites) { + if (cs.keyExchange == null || + arrayContains(cs.keyExchange.groupTypes, this)) { + return true; + } + } + + return false; + } + + static boolean arrayContains(NamedGroupType[] namedGroupTypes, + NamedGroupType namedGroupType) { + for (NamedGroupType ng : namedGroupTypes) { + if (ng == namedGroupType) { + return true; + } + } + return false; + } + } + + interface ExceptionSupplier { + void apply(String s) throws SSLException; + } + + /* + * A list of functions to do NamedGroup operations in a + * algorithm-independent and consistent way. + */ + private static abstract class NamedGroupFunctions { + + // cache to speed up the parameters construction + protected static final Map + namedGroupParams = new ConcurrentHashMap<>(); + + protected void checkConstraints(PublicKey publicKey, + AlgorithmConstraints constraints, + ExceptionSupplier onConstraintFail) + throws SSLException { + + if (!constraints.permits( + EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), + publicKey)) { + + onConstraintFail.apply("key share entry does not " + + "comply with algorithm constraints"); + } + } + + public AlgorithmParameters getParameters(NamedGroup ng) { + + AlgorithmParameters result = namedGroupParams.get(ng); + if (result == null) { + Optional paramsOpt = getParametersImpl(ng); + if (paramsOpt.isPresent()) { + result = paramsOpt.get(); + namedGroupParams.put(ng, result); + } + } + + return result; + } + + public abstract byte[] encodePossessionPublicKey( + NamedGroupPossession namedGroupPossession); + + public abstract SSLCredentials decodeCredentials( + NamedGroup ng, byte[] encoded, + AlgorithmConstraints constraints, + ExceptionSupplier onConstraintFail) + throws IOException, GeneralSecurityException; + + public abstract SSLPossession createPossession(NamedGroup ng, + SecureRandom random); + + public abstract SSLKeyDerivation createKeyDerivation( + HandshakeContext hc) throws IOException; + + protected abstract Optional getParametersImpl( + NamedGroup ng); + + public abstract AlgorithmParameterSpec getParameterSpec(NamedGroup ng); + + public abstract boolean isAvailable(NamedGroup ng); + } + + private static class FFDHFunctions extends NamedGroupFunctions { + + // lazy initialization + private static class FunctionsHolder { + private static final FFDHFunctions instance = new FFDHFunctions(); + } + + private static FFDHFunctions getInstance() { + return FunctionsHolder.instance; + } + + @Override + public byte[] encodePossessionPublicKey( + NamedGroupPossession namedGroupPossession) { + return ((DHEPossession)namedGroupPossession).encode(); + } + + @Override + public SSLCredentials decodeCredentials(NamedGroup ng, byte[] encoded, + AlgorithmConstraints constraints, + ExceptionSupplier onConstraintFail) + throws IOException, GeneralSecurityException { + + DHKeyExchange.DHECredentials result + = DHKeyExchange.DHECredentials.valueOf(ng, encoded); + + checkConstraints(result.getPublicKey(), constraints, + onConstraintFail); + + return result; + } + + @Override + public SSLPossession createPossession( + NamedGroup ng, SecureRandom random) { + return new DHKeyExchange.DHEPossession(ng, random); + } + + @Override + public SSLKeyDerivation createKeyDerivation(HandshakeContext hc) + throws IOException { + + return DHKeyExchange.kaGenerator.createKeyDerivation(hc); + } + + @Override + public AlgorithmParameterSpec getParameterSpec(NamedGroup ng) { + return getDHParameterSpec(ng); + } + + DHParameterSpec getDHParameterSpec(NamedGroup ng) { + + AlgorithmParameters params = getParameters(ng); + try { + return params.getParameterSpec(DHParameterSpec.class); + } catch (InvalidParameterSpecException ipse) { + // should be unlikely + return getPredefinedDHParameterSpec(ng); + } + } + + private static DHParameterSpec getFFDHEDHParameterSpec( + NamedGroup namedGroup) { + + DHParameterSpec spec = null; + switch (namedGroup) { + case FFDHE_2048: + spec = PredefinedDHParameterSpecs.ffdheParams.get(2048); + break; + case FFDHE_3072: + spec = PredefinedDHParameterSpecs.ffdheParams.get(3072); + break; + case FFDHE_4096: + spec = PredefinedDHParameterSpecs.ffdheParams.get(4096); + break; + case FFDHE_6144: + spec = PredefinedDHParameterSpecs.ffdheParams.get(6144); + break; + case FFDHE_8192: + spec = PredefinedDHParameterSpecs.ffdheParams.get(8192); + } + + return spec; + } + + private static DHParameterSpec getPredefinedDHParameterSpec( + NamedGroup namedGroup) { + + DHParameterSpec spec = null; + switch (namedGroup) { + case FFDHE_2048: + spec = PredefinedDHParameterSpecs.definedParams.get(2048); + break; + case FFDHE_3072: + spec = PredefinedDHParameterSpecs.definedParams.get(3072); + break; + case FFDHE_4096: + spec = PredefinedDHParameterSpecs.definedParams.get(4096); + break; + case FFDHE_6144: + spec = PredefinedDHParameterSpecs.definedParams.get(6144); + break; + case FFDHE_8192: + spec = PredefinedDHParameterSpecs.definedParams.get(8192); + } + + return spec; + } + + @Override + public boolean isAvailable(NamedGroup ng) { + + AlgorithmParameters params = getParameters(ng); + return params != null; + } + + @Override + protected Optional getParametersImpl( + NamedGroup ng) { + try { + AlgorithmParameters params + = AlgorithmParameters.getInstance("DiffieHellman"); + AlgorithmParameterSpec spec + = getFFDHEDHParameterSpec(ng); + params.init(spec); + return Optional.of(params); + } catch (InvalidParameterSpecException + | NoSuchAlgorithmException ex) { + return Optional.empty(); + } + } + + } + + private static class ECDHFunctions extends NamedGroupFunctions { + + // lazy initialization + private static class FunctionsHolder { + private static final ECDHFunctions instance = new ECDHFunctions(); + } + + private static ECDHFunctions getInstance() { + return FunctionsHolder.instance; + } + + @Override + public byte[] encodePossessionPublicKey( + NamedGroupPossession namedGroupPossession) { + return ((ECDHEPossession)namedGroupPossession).encode(); + } + + @Override + public SSLCredentials decodeCredentials(NamedGroup ng, byte[] encoded, + AlgorithmConstraints constraints, + ExceptionSupplier onConstraintFail) + throws IOException, GeneralSecurityException { + + ECDHKeyExchange.ECDHECredentials result + = ECDHKeyExchange.ECDHECredentials.valueOf(ng, encoded); + + checkConstraints(result.getPublicKey(), constraints, + onConstraintFail); + + return result; + } + + @Override + public SSLPossession createPossession( + NamedGroup ng, SecureRandom random) { + return new ECDHKeyExchange.ECDHEPossession(ng, random); + } + + @Override + public SSLKeyDerivation createKeyDerivation(HandshakeContext hc) + throws IOException { + + return ECDHKeyExchange.ecdheKAGenerator.createKeyDerivation(hc); + } + + @Override + public AlgorithmParameterSpec getParameterSpec(NamedGroup ng) { + return SupportedGroupsExtension.SupportedGroups + .getECGenParamSpec(ng); + } + + @Override + public boolean isAvailable(NamedGroup ng) { + + AlgorithmParameters params = getParameters(ng); + return params != null; + } + + @Override + protected Optional getParametersImpl( + NamedGroup ng) { + try { + AlgorithmParameters params + = AlgorithmParameters.getInstance("EC"); + AlgorithmParameterSpec spec + = new ECGenParameterSpec(ng.oid); + params.init(spec); + return Optional.of(params); + } catch (InvalidParameterSpecException + | NoSuchAlgorithmException ex) { + return Optional.empty(); + } + } + } + + private static class XDHFunctions extends NamedGroupFunctions { + + // lazy initialization + private static class FunctionsHolder { + private static final XDHFunctions instance = new XDHFunctions(); + } + + private static XDHFunctions getInstance() { + return FunctionsHolder.instance; + } + + @Override + public byte[] encodePossessionPublicKey(NamedGroupPossession poss) { + return ((XDHKeyExchange.XDHEPossession)poss).encode(); + } + + @Override + public SSLCredentials decodeCredentials(NamedGroup ng, byte[] encoded, + AlgorithmConstraints constraints, + ExceptionSupplier onConstraintFail) + throws IOException, GeneralSecurityException { + + XDHKeyExchange.XDHECredentials result + = XDHKeyExchange.XDHECredentials.valueOf(ng, encoded); + + checkConstraints(result.getPublicKey(), constraints, + onConstraintFail); + + return result; + } + + @Override + public SSLPossession createPossession( + NamedGroup ng, SecureRandom random) { + return new XDHKeyExchange.XDHEPossession(ng, random); + } + + @Override + public SSLKeyDerivation createKeyDerivation(HandshakeContext hc) + throws IOException { + return XDHKeyExchange.xdheKAGenerator.createKeyDerivation(hc); + } + + @Override + public AlgorithmParameterSpec getParameterSpec(NamedGroup ng) { + return new NamedParameterSpec(ng.name); + } + + @Override + public boolean isAvailable(NamedGroup ng) { + + try { + KeyAgreement.getInstance(ng.algorithm); + return true; + } catch (NoSuchAlgorithmException ex) { + return false; + } + } + + @Override + protected Optional getParametersImpl( + NamedGroup ng) { + return Optional.empty(); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/NamedGroupCredentials.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/classes/sun/security/ssl/NamedGroupCredentials.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,36 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.security.ssl; + +import java.security.PublicKey; + +interface NamedGroupCredentials extends SSLCredentials { + + PublicKey getPublicKey(); + + NamedGroup getNamedGroup(); + +} diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/NamedGroupPossession.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/classes/sun/security/ssl/NamedGroupPossession.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,38 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.security.ssl; + +import java.security.PrivateKey; +import java.security.PublicKey; + +interface NamedGroupPossession extends SSLPossession { + + NamedGroup getNamedGroup(); + + PublicKey getPublicKey(); + + PrivateKey getPrivateKey(); +} diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java --- a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java Fri Jun 21 14:07:48 2019 +0530 @@ -28,40 +28,139 @@ import java.math.BigInteger; import java.nio.ByteBuffer; import java.security.GeneralSecurityException; -import java.security.ProviderException; import java.security.SecureRandom; import java.text.MessageFormat; import java.util.Locale; import javax.crypto.SecretKey; import javax.net.ssl.SSLHandshakeException; import sun.security.ssl.PskKeyExchangeModesExtension.PskKeyExchangeModesSpec; +import sun.security.ssl.SessionTicketExtension.SessionTicketSpec; +import sun.security.ssl.SSLHandshake.HandshakeMessage; +import sun.security.util.HexDumpEncoder; -import sun.security.ssl.SSLHandshake.HandshakeMessage; +import static sun.security.ssl.SSLHandshake.NEW_SESSION_TICKET; /** * Pack of the NewSessionTicket handshake message. */ final class NewSessionTicket { - private static final int MAX_TICKET_LIFETIME = 604800; // seconds, 7 days + static final int MAX_TICKET_LIFETIME = 604800; // seconds, 7 days static final SSLConsumer handshakeConsumer = - new NewSessionTicketConsumer(); + new T13NewSessionTicketConsumer(); + static final SSLConsumer handshake12Consumer = + new T12NewSessionTicketConsumer(); static final SSLProducer kickstartProducer = new NewSessionTicketKickstartProducer(); - static final HandshakeProducer handshakeProducer = - new NewSessionTicketProducer(); + static final HandshakeProducer handshake12Producer = + new T12NewSessionTicketProducer(); /** - * The NewSessionTicketMessage handshake message. + * The NewSessionTicketMessage handshake messages. + */ + abstract static class NewSessionTicketMessage extends HandshakeMessage { + int ticketLifetime; + byte[] ticket; + + NewSessionTicketMessage(HandshakeContext context) { + super(context); + } + + @Override + public SSLHandshake handshakeType() { + return NEW_SESSION_TICKET; + } + + // For TLS 1.3 only + int getTicketAgeAdd() throws IOException { + throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER, + "TicketAgeAdd not part of RFC 5077."); + } + + // For TLS 1.3 only + byte[] getTicketNonce() throws IOException { + throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER, + "TicketNonce not part of RFC 5077."); + } + + } + /** + * NewSessionTicket for TLS 1.2 and below (RFC 5077) */ - static final class NewSessionTicketMessage extends HandshakeMessage { - final int ticketLifetime; - final int ticketAgeAdd; - final byte[] ticketNonce; - final byte[] ticket; - final SSLExtensions extensions; + static final class T12NewSessionTicketMessage extends NewSessionTicketMessage { + + T12NewSessionTicketMessage(HandshakeContext context, + int ticketLifetime, byte[] ticket) { + super(context); + + this.ticketLifetime = ticketLifetime; + this.ticket = ticket; + } + + T12NewSessionTicketMessage(HandshakeContext context, + ByteBuffer m) throws IOException { + + // RFC5077 struct { + // uint32 ticket_lifetime; + // opaque ticket<1..2^16-1>; + // } NewSessionTicket; + + super(context); + if (m.remaining() < 14) { + throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER, + "Invalid NewSessionTicket message: no sufficient data"); + } + + this.ticketLifetime = Record.getInt32(m); + this.ticket = Record.getBytes16(m); + } + + @Override + public SSLHandshake handshakeType() { + return NEW_SESSION_TICKET; + } - NewSessionTicketMessage(HandshakeContext context, + @Override + public int messageLength() { + return 4 + // ticketLifetime + 2 + ticket.length; // len of ticket + ticket + } + + @Override + public void send(HandshakeOutStream hos) throws IOException { + hos.putInt32(ticketLifetime); + hos.putBytes16(ticket); + } + + @Override + public String toString() { + MessageFormat messageFormat = new MessageFormat( + "\"NewSessionTicket\": '{'\n" + + " \"ticket_lifetime\" : \"{0}\",\n" + + " \"ticket\" : '{'\n" + + "{1}\n" + + " '}'" + + "'}'", + Locale.ENGLISH); + + HexDumpEncoder hexEncoder = new HexDumpEncoder(); + Object[] messageFields = { + ticketLifetime, + Utilities.indent(hexEncoder.encode(ticket), " "), + }; + return messageFormat.format(messageFields); + } + } + + /** + * NewSessionTicket defined by the TLS 1.3 + */ + static final class T13NewSessionTicketMessage extends NewSessionTicketMessage { + int ticketAgeAdd; + byte[] ticketNonce; + SSLExtensions extensions; + + T13NewSessionTicketMessage(HandshakeContext context, int ticketLifetime, SecureRandom generator, byte[] ticketNonce, byte[] ticket) { super(context); @@ -73,7 +172,7 @@ this.extensions = new SSLExtensions(this); } - NewSessionTicketMessage(HandshakeContext context, + T13NewSessionTicketMessage(HandshakeContext context, ByteBuffer m) throws IOException { super(context); @@ -84,6 +183,7 @@ // opaque ticket<1..2^16-1>; // Extension extensions<0..2^16-2>; // } NewSessionTicket; + if (m.remaining() < 14) { throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER, "Invalid NewSessionTicket message: no sufficient data"); @@ -111,24 +211,36 @@ SSLExtension[] supportedExtensions = context.sslConfig.getEnabledExtensions( - SSLHandshake.NEW_SESSION_TICKET); + NEW_SESSION_TICKET); this.extensions = new SSLExtensions(this, m, supportedExtensions); } @Override public SSLHandshake handshakeType() { - return SSLHandshake.NEW_SESSION_TICKET; + return NEW_SESSION_TICKET; + } + + int getTicketAgeAdd() { + return ticketAgeAdd; + } + + byte[] getTicketNonce() { + return ticketNonce; } @Override public int messageLength() { + int extLen = extensions.length(); if (extLen == 0) { extLen = 2; // empty extensions } - return 8 + ticketNonce.length + 1 + - ticket.length + 2 + extLen; + return 4 +// ticketLifetime + 4 + // ticketAgeAdd + 1 + ticketNonce.length + // len of nonce + nonce + 2 + ticket.length + // len of ticket + ticket + extLen; } @Override @@ -153,18 +265,21 @@ " \"ticket_lifetime\" : \"{0}\",\n" + " \"ticket_age_add\" : \"{1}\",\n" + " \"ticket_nonce\" : \"{2}\",\n" + - " \"ticket\" : \"{3}\",\n" + + " \"ticket\" : '{'\n" + + "{3}\n" + + " '}'" + " \"extensions\" : [\n" + "{4}\n" + " ]\n" + "'}'", Locale.ENGLISH); + HexDumpEncoder hexEncoder = new HexDumpEncoder(); Object[] messageFields = { ticketLifetime, "", //ticketAgeAdd should not be logged Utilities.toHexString(ticketNonce), - Utilities.toHexString(ticket), + Utilities.indent(hexEncoder.encode(ticket), " "), Utilities.indent(extensions.toString(), " ") }; @@ -248,25 +363,46 @@ } return null; } - NewSessionTicketMessage nstm = new NewSessionTicketMessage(shc, - sessionTimeoutSeconds, shc.sslContext.getSecureRandom(), - nonceArr, newId.getId()); - if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { - SSLLogger.fine( - "Produced NewSessionTicket handshake message", nstm); - } - // create and cache the new session - // The new session must be a child of the existing session so - // they will be invalidated together, etc. + NewSessionTicketMessage nstm; + SSLSessionImpl sessionCopy = new SSLSessionImpl(shc.handshakeSession, newId); - shc.handshakeSession.addChild(sessionCopy); sessionCopy.setPreSharedKey(psk); sessionCopy.setPskIdentity(newId.getId()); - sessionCopy.setTicketAgeAdd(nstm.ticketAgeAdd); - sessionCache.put(sessionCopy); + if (shc.statelessResumption) { + try { + nstm = new T13NewSessionTicketMessage(shc, + sessionTimeoutSeconds, shc.sslContext.getSecureRandom(), + nonceArr, new SessionTicketSpec().encrypt(shc, sessionCopy)); + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine( + "Produced NewSessionTicket stateless " + + "handshake message", nstm); + } + } catch (Exception e) { + // Error with NST ticket, abort NST + shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, e); + return null; + } + } else { + nstm = new T13NewSessionTicketMessage(shc, sessionTimeoutSeconds, + shc.sslContext.getSecureRandom(), nonceArr, + newId.getId()); + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine( + "Produced NewSessionTicket handshake message", + nstm); + } + + // create and cache the new session + // The new session must be a child of the existing session so + // they will be invalidated together, etc. + shc.handshakeSession.addChild(sessionCopy); + sessionCopy.setTicketAgeAdd(nstm.getTicketAgeAdd()); + sessionCache.put(sessionCopy); + } // Output the handshake message. nstm.write(shc.handshakeOutput); shc.handshakeOutput.flush(); @@ -277,13 +413,13 @@ } /** - * The "NewSessionTicket" handshake message producer. + * The "NewSessionTicket" handshake message producer for RFC 5077 */ - private static final class NewSessionTicketProducer + private static final class T12NewSessionTicketProducer implements HandshakeProducer { // Prevent instantiation of this class. - private NewSessionTicketProducer() { + private T12NewSessionTicketProducer() { // blank } @@ -291,24 +427,65 @@ public byte[] produce(ConnectionContext context, HandshakeMessage message) throws IOException { - // NSTM may be sent in response to handshake messages. - // For example: key update + ServerHandshakeContext shc = (ServerHandshakeContext)context; + + // Is this session resumable? + if (!shc.handshakeSession.isRejoinable()) { + return null; + } + + // get a new session ID + SessionId newId = shc.handshakeSession.getSessionId(); + + SSLSessionContextImpl sessionCache = (SSLSessionContextImpl) + shc.sslContext.engineGetServerSessionContext(); + int sessionTimeoutSeconds = sessionCache.getSessionTimeout(); + if (sessionTimeoutSeconds > MAX_TICKET_LIFETIME) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine( + "Session timeout is too long. No ticket sent."); + } + return null; + } + + NewSessionTicketMessage nstm; - throw new ProviderException( - "NewSessionTicket handshake producer not implemented"); + SSLSessionImpl sessionCopy = + new SSLSessionImpl(shc.handshakeSession, newId); + sessionCopy.setPskIdentity(newId.getId()); + + try { + nstm = new T12NewSessionTicketMessage(shc, sessionTimeoutSeconds, + new SessionTicketSpec().encrypt(shc, sessionCopy)); + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine( + "Produced NewSessionTicket stateless handshake message", nstm); + } + } catch (Exception e) { + // Abort on error with NST ticket + shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, e); + return null; + } + + // Output the handshake message. + nstm.write(shc.handshakeOutput); + shc.handshakeOutput.flush(); + + // The message has been delivered. + return null; } } private static final - class NewSessionTicketConsumer implements SSLConsumer { + class T13NewSessionTicketConsumer implements SSLConsumer { // Prevent instantiation of this class. - private NewSessionTicketConsumer() { + private T13NewSessionTicketConsumer() { // blank } @Override public void consume(ConnectionContext context, - ByteBuffer message) throws IOException { + ByteBuffer message) throws IOException { // Note: Although the resumption master secret depends on the // client's second flight, servers which do not request client @@ -317,13 +494,12 @@ // upon sending its Finished rather than waiting for the client // Finished. // - // The consuming happens in client side only. As the server - // may send the NewSessionTicket before handshake complete, the - // context may be a PostHandshakeContext or HandshakeContext - // instance. + // The consuming happens in client side only and is received after + // the server's Finished message with PostHandshakeContext. + HandshakeContext hc = (HandshakeContext)context; NewSessionTicketMessage nstm = - new NewSessionTicketMessage(hc, message); + new T13NewSessionTicketMessage(hc, message); if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { SSLLogger.fine( "Consuming NewSessionTicket message", nstm); @@ -352,37 +528,95 @@ } SSLSessionImpl sessionToSave = hc.conContext.conSession; - - SecretKey resumptionMasterSecret = - sessionToSave.getResumptionMasterSecret(); - if (resumptionMasterSecret == null) { - if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { - SSLLogger.fine( - "Session has no resumption master secret. Ignoring ticket."); + SecretKey psk = null; + if (hc.negotiatedProtocol.useTLS13PlusSpec()) { + SecretKey resumptionMasterSecret = + sessionToSave.getResumptionMasterSecret(); + if (resumptionMasterSecret == null) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine( + "Session has no resumption master secret." + + " Ignoring ticket."); + } + return; } - return; + + // derive the PSK + psk = derivePreSharedKey( + sessionToSave.getSuite().hashAlg, + resumptionMasterSecret, nstm.getTicketNonce()); } - // derive the PSK - SecretKey psk = derivePreSharedKey( - sessionToSave.getSuite().hashAlg, resumptionMasterSecret, - nstm.ticketNonce); - // create and cache the new session // The new session must be a child of the existing session so // they will be invalidated together, etc. SessionId newId = - new SessionId(true, hc.sslContext.getSecureRandom()); + new SessionId(true, hc.sslContext.getSecureRandom()); SSLSessionImpl sessionCopy = new SSLSessionImpl(sessionToSave, newId); sessionToSave.addChild(sessionCopy); sessionCopy.setPreSharedKey(psk); - sessionCopy.setTicketAgeAdd(nstm.ticketAgeAdd); + sessionCopy.setTicketAgeAdd(nstm.getTicketAgeAdd()); sessionCopy.setPskIdentity(nstm.ticket); sessionCache.put(sessionCopy); // clean handshake context - hc.conContext.finishPostHandshake(); + if (hc.negotiatedProtocol.useTLS13PlusSpec()) { + hc.conContext.finishPostHandshake(); + } + } + } + + private static final + class T12NewSessionTicketConsumer implements SSLConsumer { + // Prevent instantiation of this class. + private T12NewSessionTicketConsumer() { + // blank + } + + @Override + public void consume(ConnectionContext context, + ByteBuffer message) throws IOException { + + HandshakeContext hc = (HandshakeContext)context; + hc.handshakeConsumers.remove(NEW_SESSION_TICKET.id); + + NewSessionTicketMessage nstm = new T12NewSessionTicketMessage(hc, + message); + if (nstm.ticket.length == 0) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("NewSessionTicket ticket was empty"); + } + return; + } + + // discard tickets with timeout 0 + if (nstm.ticketLifetime <= 0 || + nstm.ticketLifetime > MAX_TICKET_LIFETIME) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine( + "Discarding NewSessionTicket with lifetime " + + nstm.ticketLifetime, nstm); + } + return; + } + + SSLSessionContextImpl sessionCache = (SSLSessionContextImpl) + hc.sslContext.engineGetClientSessionContext(); + + if (sessionCache.getSessionTimeout() > MAX_TICKET_LIFETIME) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine( + "Session cache lifetime is too long. Discarding ticket."); + } + return; + } + + hc.handshakeSession.setPskIdentity(nstm.ticket); + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("Consuming NewSessionTicket\n" + + nstm.toString()); + } } } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java --- a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java Fri Jun 21 14:07:48 2019 +0530 @@ -32,7 +32,6 @@ import java.util.ArrayList; import java.util.Locale; import java.util.Arrays; -import java.util.Objects; import java.util.Collection; import javax.crypto.Mac; import javax.crypto.SecretKey; @@ -42,6 +41,9 @@ import sun.security.ssl.SSLExtension.ExtensionConsumer; import sun.security.ssl.SSLExtension.SSLExtensionSpec; import sun.security.ssl.SSLHandshake.HandshakeMessage; +import sun.security.ssl.SessionTicketExtension.SessionTicketSpec; +import sun.security.util.HexDumpEncoder; + import static sun.security.ssl.SSLExtension.*; /** @@ -88,7 +90,7 @@ @Override public String toString() { - return "{" + Utilities.toHexString(identity) + "," + + return "{" + Utilities.toHexString(identity) + ", " + obfuscatedAge + "}"; } } @@ -208,8 +210,10 @@ public String toString() { MessageFormat messageFormat = new MessageFormat( "\"PreSharedKey\": '{'\n" + - " \"identities\" : \"{0}\",\n" + - " \"binders\" : \"{1}\",\n" + + " \"identities\": '{'\n" + + "{0}\n" + + " '}'" + + " \"binders\": \"{1}\",\n" + "'}'", Locale.ENGLISH); @@ -222,9 +226,13 @@ } String identitiesString() { + HexDumpEncoder hexEncoder = new HexDumpEncoder(); + StringBuilder result = new StringBuilder(); for (PskIdentity curId : identities) { - result.append(curId.toString() + "\n"); + result.append(" {\n"+ Utilities.indent( + hexEncoder.encode(curId.identity), " ") + + "\n }\n"); } return result.toString(); @@ -278,7 +286,7 @@ this.selectedIdentity = Record.getInt16(m); } - byte[] getEncoded() throws IOException { + byte[] getEncoded() { return new byte[] { (byte)((selectedIdentity >> 8) & 0xFF), (byte)(selectedIdentity & 0xFF) @@ -368,8 +376,36 @@ SSLSessionContextImpl sessionCache = (SSLSessionContextImpl) shc.sslContext.engineGetServerSessionContext(); int idIndex = 0; + SSLSessionImpl s = null; + for (PskIdentity requestedId : pskSpec.identities) { - SSLSessionImpl s = sessionCache.get(requestedId.identity); + // If we are keeping state, see if the identity is in the cache + if (requestedId.identity.length == SessionId.MAX_LENGTH) { + s = sessionCache.get(requestedId.identity); + } + // See if the identity is a stateless ticket + if (s == null && + requestedId.identity.length > SessionId.MAX_LENGTH && + sessionCache.statelessEnabled()) { + ByteBuffer b = + new SessionTicketSpec(requestedId.identity). + decrypt(shc); + if (b != null) { + try { + s = new SSLSessionImpl(shc, b); + } catch (IOException | RuntimeException e) { + s = null; + } + } + if (b == null || s == null) { + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine( + "Stateless session ticket invalid"); + } + } + } + if (s != null && canRejoin(clientHello, shc, s)) { if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { SSLLogger.fine("Resuming session: ", s); @@ -391,7 +427,6 @@ shc.resumingSession = null; } } - // update the context shc.handshakeExtensions.put( SSLExtension.CH_PRE_SHARED_KEY, pskSpec); @@ -708,7 +743,8 @@ int hashLength, List identities) { List binders = new ArrayList<>(); byte[] binderProto = new byte[hashLength]; - for (PskIdentity curId : identities) { + int i = identities.size(); + while (i-- > 0) { binders.add(binderProto); } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -71,11 +71,13 @@ private volatile StatusResponseManager statusResponseManager; private final ReentrantLock contextLock = new ReentrantLock(); + final HashMap keyHashMap = new HashMap<>(); + SSLContextImpl() { ephemeralKeyManager = new EphemeralKeyManager(); - clientCache = new SSLSessionContextImpl(); - serverCache = new SSLSessionContextImpl(); + clientCache = new SSLSessionContextImpl(false); + serverCache = new SSLSessionContextImpl(true); } @Override diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SSLExtension.java --- a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -309,8 +309,28 @@ // extensions defined in RFC 7924 CACHED_INFO (0x0019, "cached_info"), - // extensions defined in RFC 4507/5077 - SESSION_TICKET (0x0023, "session_ticket"), + // extensions defined in RFC 5077 + CH_SESSION_TICKET (0x0023, "session_ticket", + SSLHandshake.CLIENT_HELLO, + ProtocolVersion.PROTOCOLS_10_12, + SessionTicketExtension.chNetworkProducer, + SessionTicketExtension.chOnLoadConsumer, + null, + null, + null, + SessionTicketExtension.steStringizer), + //null), + + SH_SESSION_TICKET (0x0023, "session_ticket", + SSLHandshake.SERVER_HELLO, + ProtocolVersion.PROTOCOLS_10_12, + SessionTicketExtension.shNetworkProducer, + SessionTicketExtension.shOnLoadConsumer, + null, + null, + null, + SessionTicketExtension.steStringizer), + //null), // extensions defined in TLS 1.3 CH_EARLY_DATA (0x002A, "early_data"), @@ -464,6 +484,25 @@ final SSLHandshake handshakeType; final String name; final ProtocolVersion[] supportedProtocols; + + /* + * networkProducer: produces outbound handshake data. + * + * onLoadConsumer: parses inbound data. It may not be appropriate + * to act until all of the message inputs have + * been parsed. (e.g. parsing keyShares and choosing + * a local value without having seen the SupportedGroups + * extension.) + * + * onLoadAbsence: if a missing message needs special handling + * during the load phase. + * + * onTradeConsumer: act on the parsed message once all inbound data has + * been traded and parsed. + * + * onTradeAbsence: if a missing message needs special handling + * during the trade phase. + */ final HandshakeProducer networkProducer; final ExtensionConsumer onLoadConsumer; final HandshakeAbsence onLoadAbsence; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SSLHandshake.java --- a/src/java.base/share/classes/sun/security/ssl/SSLHandshake.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SSLHandshake.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -115,15 +115,19 @@ NEW_SESSION_TICKET ((byte)0x04, "new_session_ticket", (Map.Entry[])(new Map.Entry[] { new SimpleImmutableEntry( - NewSessionTicket.handshakeConsumer, - ProtocolVersion.PROTOCOLS_OF_13 - ) + NewSessionTicket.handshake12Consumer, + ProtocolVersion.PROTOCOLS_TO_12 + ), + new SimpleImmutableEntry( + NewSessionTicket.handshakeConsumer, + ProtocolVersion.PROTOCOLS_OF_13 + ) }), (Map.Entry[])(new Map.Entry[] { new SimpleImmutableEntry( - NewSessionTicket.handshakeProducer, - ProtocolVersion.PROTOCOLS_OF_13 - ) + NewSessionTicket.handshake12Producer, + ProtocolVersion.PROTOCOLS_TO_12 + ) })), END_OF_EARLY_DATA ((byte)0x05, "end_of_early_data"), diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java --- a/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -30,10 +30,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import sun.security.ssl.DHKeyExchange.DHEPossession; -import sun.security.ssl.ECDHKeyExchange.ECDHEPossession; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; -import sun.security.ssl.SupportedGroupsExtension.NamedGroupType; import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; import sun.security.ssl.X509Authentication.X509Possession; @@ -243,8 +239,7 @@ static SSLKeyExchange valueOf(NamedGroup namedGroup) { SSLKeyAgreement ka = T13KeyAgreement.valueOf(namedGroup); if (ka != null) { - return new SSLKeyExchange( - null, T13KeyAgreement.valueOf(namedGroup)); + return new SSLKeyExchange(null, ka); } return null; @@ -337,7 +332,7 @@ ECDH ("ecdh", null, ECDHKeyExchange.ecdhKAGenerator), ECDHE ("ecdhe", ECDHKeyExchange.poGenerator, - ECDHKeyExchange.ecdheKAGenerator); + ECDHKeyExchange.ecdheXdhKAGenerator); final String name; final SSLPossessionGenerator possessionGenerator; @@ -570,27 +565,13 @@ @Override public SSLPossession createPossession(HandshakeContext hc) { - if (namedGroup.type == NamedGroupType.NAMED_GROUP_ECDHE) { - return new ECDHEPossession( - namedGroup, hc.sslContext.getSecureRandom()); - } else if (namedGroup.type == NamedGroupType.NAMED_GROUP_FFDHE) { - return new DHEPossession( - namedGroup, hc.sslContext.getSecureRandom()); - } - - return null; + return namedGroup.createPossession(hc.sslContext.getSecureRandom()); } @Override public SSLKeyDerivation createKeyDerivation( HandshakeContext hc) throws IOException { - if (namedGroup.type == NamedGroupType.NAMED_GROUP_ECDHE) { - return ECDHKeyExchange.ecdheKAGenerator.createKeyDerivation(hc); - } else if (namedGroup.type == NamedGroupType.NAMED_GROUP_FFDHE) { - return DHKeyExchange.kaGenerator.createKeyDerivation(hc); - } - - return null; + return namedGroup.createKeyDerivation(hc); } } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SSLSessionContextImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLSessionContextImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionContextImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -33,11 +33,34 @@ import javax.net.ssl.SSLSessionContext; import sun.security.action.GetIntegerAction; +import sun.security.action.GetPropertyAction; import sun.security.util.Cache; +/** + * @systemProperty jdk.tls.server.enableSessionTicketExtension} determines if the + * server will provide stateless session tickets, if the client supports it, + * as described in RFC 5077 and RFC 8446. a stateless session ticket + * contains the encrypted server's state which saves server resources. + * + * {@systemProperty jdk.tls.client.enableSessionTicketExtension} determines if the + * client will send an extension in the ClientHello in the pre-TLS 1.3. + * This extension allows the client to accept the server's session state for + * Server Side stateless resumption (RFC 5077). Setting the property to + * "true" turns this on, by default it is false. For TLS 1.3, the system + * property is not needed as this support is part of the spec. + * + * {@systemProperty jdk.tls.server.sessionTicketTimeout} determines how long + * a session in the server cache or the stateless resumption tickets are + * available for use. The value set by the property can be modified by + * {@code SSLSessionContext.setSessionTimeout()} during runtime. + * + */ + final class SSLSessionContextImpl implements SSLSessionContext { private final static int DEFAULT_MAX_CACHE_SIZE = 20480; + // Default lifetime of a session. 24 hours + final static int DEFAULT_SESSION_TIMEOUT = 86400; private final Cache sessionCache; // session cache, session id as key @@ -46,16 +69,24 @@ private int cacheLimit; // the max cache size private int timeout; // timeout in seconds + // Does this context support stateless session (RFC 5077) + private boolean statelessSession = true; + // package private - SSLSessionContextImpl() { - cacheLimit = getDefaultCacheLimit(); // default cache size - timeout = 86400; // default, 24 hours + SSLSessionContextImpl(boolean server) { + timeout = DEFAULT_SESSION_TIMEOUT; + cacheLimit = getDefaults(server); // default cache size // use soft reference sessionCache = Cache.newSoftMemoryCache(cacheLimit, timeout); sessionHostPortCache = Cache.newSoftMemoryCache(cacheLimit, timeout); } + // Stateless sessions when available, but there is a cache + boolean statelessEnabled() { + return statelessSession; + } + /** * Returns the SSLSession bound to the specified session id. */ @@ -163,8 +194,7 @@ } private static String getKey(String hostname, int port) { - return (hostname + ":" + - String.valueOf(port)).toLowerCase(Locale.ENGLISH); + return (hostname + ":" + port).toLowerCase(Locale.ENGLISH); } // cache a SSLSession @@ -197,8 +227,51 @@ } } - private static int getDefaultCacheLimit() { + private int getDefaults(boolean server) { try { + String st; + + // Property for Session Cache state + if (server) { + st = GetPropertyAction.privilegedGetProperty( + "jdk.tls.server.enableSessionTicketExtension", "true"); + } else { + st = GetPropertyAction.privilegedGetProperty( + "jdk.tls.client.enableSessionTicketExtension", "true"); + } + if (st.compareToIgnoreCase("false") == 0) { + statelessSession = false; + } + + // Property for Session Ticket Timeout. The value can be changed + // by SSLSessionContext.setSessionTimeout(int) + String s = GetPropertyAction.privilegedGetProperty( + "jdk.tls.server.sessionTicketTimeout"); + if (s != null) { + try { + int t = Integer.parseInt(s); + if (t < 0 || + t > NewSessionTicket.MAX_TICKET_LIFETIME) { + timeout = DEFAULT_SESSION_TIMEOUT; + if (SSLLogger.isOn && SSLLogger.isOn("ssl")) { + SSLLogger.warning("Invalid timeout given " + + "jdk.tls.server.sessionTicketTimeout: " + t + + ". Set to default value " + timeout); + } + } else { + timeout = t; + } + } catch (NumberFormatException e) { + setSessionTimeout(DEFAULT_SESSION_TIMEOUT); + if (SSLLogger.isOn && SSLLogger.isOn("ssl")) { + SSLLogger.warning("Invalid timeout for " + + "jdk.tls.server.sessionTicketTimeout: " + s + + ". Set to default value " + timeout); + + } + } + } + int defaultCacheLimit = GetIntegerAction.privilegedGetProperty( "javax.net.ssl.sessionCacheSize", DEFAULT_MAX_CACHE_SIZE); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -24,8 +24,12 @@ */ package sun.security.ssl; +import sun.security.x509.X509CertImpl; + +import java.io.IOException; import java.math.BigInteger; import java.net.InetAddress; +import java.nio.ByteBuffer; import java.security.Principal; import java.security.PrivateKey; import java.security.cert.CertificateEncodingException; @@ -40,8 +44,11 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; import javax.net.ssl.ExtendedSSLSession; +import javax.net.ssl.SNIHostName; import javax.net.ssl.SNIServerName; +import javax.net.ssl.SSLException; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLPermission; import javax.net.ssl.SSLSessionBindingEvent; @@ -251,6 +258,371 @@ } } + /** + * < 2 bytes > protocolVersion + * < 2 bytes > cipherSuite + * < 2 bytes > localSupportedSignAlgs entries + * < 2 bytes per entries > localSupportedSignAlgs + * < 2 bytes > preSharedKey length + * < length in bytes > preSharedKey + * < 1 byte > pskIdentity length + * < length in bytes > pskIdentity + * < 1 byte > masterSecret length + * < 1 byte > masterSecret algorithm length + * < length in bytes > masterSecret algorithm + * < 2 bytes > masterSecretKey length + * < length in bytes> masterSecretKey + * < 1 byte > useExtendedMasterSecret + * < 1 byte > identificationProtocol length + * < length in bytes > identificationProtocol + * < 1 byte > serverNameIndication length + * < length in bytes > serverNameIndication + * < 1 byte > Number of requestedServerNames entries + * < 1 byte > ServerName length + * < length in bytes > ServerName + * < 4 bytes > creationTime + * < 1 byte > Length of peer host + * < length in bytes > peer host + * < 2 bytes> peer port + * < 1 byte > Number of peerCerts entries + * < 4 byte > peerCert length + * < length in bytes > peerCert + * < 1 byte > localCerts type (Cert, PSK, Anonymous) + * Certificate + * < 1 byte > Number of Certificate entries + * < 4 byte> Certificate length + * < length in bytes> Certificate + * PSK + * < 1 byte > Number of PSK entries + * < 1 bytes > PSK algorithm length + * < length in bytes > PSK algorithm string + * < 4 bytes > PSK key length + * < length in bytes> PSK key + * < 4 bytes > PSK identity length + * < length in bytes> PSK identity + * Anonymous + * < 1 byte > + */ + + SSLSessionImpl(HandshakeContext hc, ByteBuffer buf) throws IOException { + int i = 0; + byte[] b; + + this.localSupportedSignAlgs = new ArrayList<>(); + + boundValues = null; + + this.protocolVersion = ProtocolVersion.valueOf(Short.toUnsignedInt(buf.getShort())); + + if (protocolVersion.useTLS13PlusSpec()) { + this.sessionId = new SessionId(false, null); + } else { + // The CH session id may reset this if it's provided + this.sessionId = new SessionId(true, + hc.sslContext.getSecureRandom()); + } + + this.cipherSuite = CipherSuite.valueOf(Short.toUnsignedInt(buf.getShort())); + + // Local Supported signature algorithms + i = Short.toUnsignedInt(buf.getShort()); + while (i-- > 0) { + this.localSupportedSignAlgs.add(SignatureScheme.valueOf( + Short.toUnsignedInt(buf.getShort()))); + } + + // PSK + i = Short.toUnsignedInt(buf.getShort()); + if (i > 0) { + b = new byte[i]; + // Get algorithm string + buf.get(b, 0, i); + // Encoded length + i = Short.toUnsignedInt(buf.getShort()); + // Encoded SecretKey + b = new byte[i]; + buf.get(b); + this.preSharedKey = new SecretKeySpec(b, "TlsMasterSecret"); + } else { + this.preSharedKey = null; + } + + // PSK identity + i = buf.get(); + if (i > 0) { + b = new byte[i]; + buf.get(b); + this.pskIdentity = b; + } else { + this.pskIdentity = null; + } + + // Master secret length of secret key algorithm (one byte) + i = buf.get(); + if (i > 0) { + b = new byte[i]; + // Get algorithm string + buf.get(b, 0, i); + // Encoded length + i = Short.toUnsignedInt(buf.getShort()); + // Encoded SecretKey + b = new byte[i]; + buf.get(b); + this.masterSecret = new SecretKeySpec(b, "TlsMasterSecret"); + } else { + this.masterSecret = null; + } + // Use extended master secret + this.useExtendedMasterSecret = (buf.get() != 0); + + // Identification Protocol + i = buf.get(); + if (i == 0) { + identificationProtocol = null; + } else { + b = new byte[i]; + identificationProtocol = + buf.get(b, 0, i).asCharBuffer().toString(); + } + + // SNI + i = buf.get(); // length + if (i == 0) { + serverNameIndication = null; + } else { + b = new byte[i]; + buf.get(b, 0, b.length); + serverNameIndication = new SNIHostName(b); + } + + // List of SNIServerName + int len = Short.toUnsignedInt(buf.getShort()); + if (len == 0) { + this.requestedServerNames = Collections.emptyList(); + } else { + requestedServerNames = new ArrayList<>(); + while (len > 0) { + int l = buf.get(); + b = new byte[l]; + buf.get(b, 0, l); + requestedServerNames.add(new SNIHostName(new String(b))); + len--; + } + } + + // Get creation time + this.creationTime = buf.getLong(); + + // Get Peer host & port + i = Byte.toUnsignedInt(buf.get()); + if (i == 0) { + this.host = new String(); + } else { + b = new byte[i]; + this.host = buf.get(b).toString(); + } + this.port = Short.toUnsignedInt(buf.getShort()); + + // Peer certs + i = buf.get(); + if (i == 0) { + this.peerCerts = null; + } else { + this.peerCerts = new X509Certificate[i]; + int j = 0; + while (i > j) { + b = new byte[buf.getInt()]; + buf.get(b); + try { + this.peerCerts[j] = new X509CertImpl(b); + } catch (Exception e) { + throw new IOException(e); + } + j++; + } + } + + // Get local certs of PSK + switch (buf.get()) { + case 0: + break; + case 1: + // number of certs + len = buf.get(); + this.localCerts = new X509Certificate[len]; + i = 0; + while (len > i) { + b = new byte[buf.getInt()]; + buf.get(b); + try { + this.localCerts[i] = new X509CertImpl(b); + } catch (Exception e) { + throw new IOException(e); + } + i++; + } + break; + case 2: + // pre-shared key + // Length of pre-shared key algorithm (one byte) + i = buf.get(); + b = new byte[i]; + String alg = buf.get(b, 0, i).asCharBuffer().toString(); + // Get length of encoding + i = Short.toUnsignedInt(buf.getShort()); + // Get encoding + b = new byte[i]; + buf.get(b); + this.preSharedKey = new SecretKeySpec(b, alg); + // Get identity len + this.pskIdentity = new byte[buf.get()]; + buf.get(pskIdentity); + break; + default: + throw new SSLException("Failed local certs of session."); + } + + context = (SSLSessionContextImpl) + hc.sslContext.engineGetServerSessionContext(); + } + + /** + * Write out a SSLSessionImpl in a byte array for a stateless session ticket + */ + byte[] write() throws Exception { + byte[] b; + HandshakeOutStream hos = new HandshakeOutStream(null); + + hos.putInt16(protocolVersion.id); + hos.putInt16(cipherSuite.id); + + // Local Supported signature algorithms + int l = localSupportedSignAlgs.size(); + hos.putInt16(l); + SignatureScheme[] sig = new SignatureScheme[l]; + localSupportedSignAlgs.toArray(sig); + for (SignatureScheme s : sig) { + hos.putInt16(s.id); + } + + // PSK + if (preSharedKey == null || + preSharedKey.getAlgorithm() == null) { + hos.putInt16(0); + } else { + hos.putInt16(preSharedKey.getAlgorithm().length()); + if (preSharedKey.getAlgorithm().length() != 0) { + hos.write(preSharedKey.getAlgorithm().getBytes()); + } + b = preSharedKey.getEncoded(); + hos.putInt16(b.length); + hos.write(b, 0, b.length); + } + + // PSK Identity + if (pskIdentity == null) { + hos.putInt8(0); + } else { + hos.putInt8(pskIdentity.length); + hos.write(pskIdentity, 0, pskIdentity.length); + } + + // Master Secret + if (getMasterSecret() == null || + getMasterSecret().getAlgorithm() == null) { + hos.putInt8(0); + } else { + hos.putInt8(getMasterSecret().getAlgorithm().length()); + if (getMasterSecret().getAlgorithm().length() != 0) { + hos.write(getMasterSecret().getAlgorithm().getBytes()); + } + b = getMasterSecret().getEncoded(); + hos.putInt16(b.length); + hos.write(b, 0, b.length); + } + + hos.putInt8(useExtendedMasterSecret ? 1 : 0); + + // Identification Protocol + if (identificationProtocol == null) { + hos.putInt8(0); + } else { + hos.putInt8(identificationProtocol.length()); + hos.write(identificationProtocol.getBytes(), 0, + identificationProtocol.length()); + } + + // SNI + if (serverNameIndication == null) { + hos.putInt8(0); + } else { + b = serverNameIndication.getEncoded(); + hos.putInt8(b.length); + hos.write(b, 0, b.length); + } + + // List of SNIServerName + hos.putInt16(requestedServerNames.size()); + if (requestedServerNames.size() > 0) { + for (SNIServerName host: requestedServerNames) { + b = host.getEncoded(); + hos.putInt8(b.length); + hos.write(b, 0, b.length); + } + } + + ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); + hos.writeBytes(buffer.putLong(creationTime).array()); + + // peer Host & Port + if (host == null || host.length() == 0) { + hos.putInt8(0); + } else { + hos.putInt8(host.length()); + hos.writeBytes(host.getBytes()); + } + hos.putInt16(port); + + // Peer cert + if (peerCerts == null || peerCerts.length == 0) { + hos.putInt8(0); + } else { + hos.putInt8(peerCerts.length); + for (X509Certificate c : peerCerts) { + b = c.getEncoded(); + hos.putInt32(b.length); + hos.writeBytes(b); + } + } + + // Client identity + if (localCerts != null && localCerts.length > 0) { + // certificate based + hos.putInt8(1); + hos.putInt8(localCerts.length); + for (X509Certificate c : localCerts) { + b = c.getEncoded(); + hos.putInt32(b.length); + hos.writeBytes(b); + } + } else if (preSharedKey != null) { + // pre-shared key + hos.putInt8(2); + hos.putInt8(preSharedKey.getAlgorithm().length()); + hos.write(preSharedKey.getAlgorithm().getBytes()); + b = preSharedKey.getEncoded(); + hos.putInt32(b.length); + hos.writeBytes(b); + hos.putInt32(pskIdentity.length); + hos.writeBytes(pskIdentity); + } else { + // anonymous + hos.putInt8(0); + } + + return hos.toByteArray(); + } + void setMasterSecret(SecretKey secret) { masterSecret = secret; } @@ -333,6 +705,10 @@ } } + byte[] getPskIdentity() { + return pskIdentity; + } + void setPeerCertificates(X509Certificate[] peer) { if (peerCerts == null) { peerCerts = peer; @@ -400,8 +776,12 @@ * maximum lifetime in any case. */ boolean isRejoinable() { + // TLS 1.3 can have no session id + if (protocolVersion.useTLS13PlusSpec()) { + return (!invalidated && isLocalAuthenticationValid()); + } return sessionId != null && sessionId.length() != 0 && - !invalidated && isLocalAuthenticationValid(); + !invalidated && isLocalAuthenticationValid(); } @Override diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -38,6 +38,7 @@ import java.net.UnknownHostException; import java.nio.ByteBuffer; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; import java.util.function.BiFunction; import javax.net.ssl.HandshakeCompletedListener; @@ -618,27 +619,76 @@ // Need a lock here so that the user_canceled alert and the // close_notify alert can be delivered together. - conContext.outputRecord.recordLock.lock(); - try { + int linger = getSoLinger(); + if (linger >= 0) { + // don't wait more than SO_LINGER for obtaining the + // the lock. + // + // keep and clear the current thread interruption status. + boolean interrupted = Thread.interrupted(); try { - // send a user_canceled alert if needed. - if (useUserCanceled) { - conContext.warning(Alert.USER_CANCELED); + if (conContext.outputRecord.recordLock.tryLock() || + conContext.outputRecord.recordLock.tryLock( + linger, TimeUnit.SECONDS)) { + try { + handleClosedNotifyAlert(useUserCanceled); + } finally { + conContext.outputRecord.recordLock.unlock(); + } + } else { + // For layered, non-autoclose sockets, we are not + // able to bring them into a usable state, so we + // treat it as fatal error. + if (!super.isOutputShutdown()) { + if (isLayered() && !autoClose) { + throw new SSLException( + "SO_LINGER timeout, " + + "close_notify message cannot be sent."); + } else { + super.shutdownOutput(); + if (SSLLogger.isOn && SSLLogger.isOn("ssl")) { + SSLLogger.warning( + "SSLSocket output duplex close failed: " + + "SO_LINGER timeout, " + + "close_notify message cannot be sent."); + } + } + } + + // RFC2246 requires that the session becomes + // unresumable if any connection is terminated + // without proper close_notify messages with + // level equal to warning. + // + // RFC4346 no longer requires that a session not be + // resumed if failure to properly close a connection. + // + // We choose to make the session unresumable if + // failed to send the close_notify message. + // + conContext.conSession.invalidate(); + if (SSLLogger.isOn && SSLLogger.isOn("ssl")) { + SSLLogger.warning( + "Invalidate the session: SO_LINGER timeout, " + + "close_notify message cannot be sent."); + } } + } catch (InterruptedException ex) { + // keep interrupted status + interrupted = true; + } - // send a close_notify alert - conContext.warning(Alert.CLOSE_NOTIFY); + // restore the interrupted status + if (interrupted) { + Thread.currentThread().interrupt(); + } + } else { + conContext.outputRecord.recordLock.lock(); + try { + handleClosedNotifyAlert(useUserCanceled); } finally { - if (!conContext.isOutboundClosed()) { - conContext.outputRecord.close(); - } - - if ((autoClose || !isLayered()) && !super.isOutputShutdown()) { - super.shutdownOutput(); - } + conContext.outputRecord.recordLock.unlock(); } - } finally { - conContext.outputRecord.recordLock.unlock(); } if (!isInputShutdown()) { @@ -646,6 +696,28 @@ } } + private void handleClosedNotifyAlert( + boolean useUserCanceled) throws IOException { + try { + // send a user_canceled alert if needed. + if (useUserCanceled) { + conContext.warning(Alert.USER_CANCELED); + } + + // send a close_notify alert + conContext.warning(Alert.CLOSE_NOTIFY); + } finally { + if (!conContext.isOutboundClosed()) { + conContext.outputRecord.close(); + } + + if (!super.isOutputShutdown() && + (autoClose || !isLayered())) { + super.shutdownOutput(); + } + } + } + /** * Duplex close, start from closing inbound. * diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -313,7 +313,9 @@ handshakeBuffer.put(handshakeFrag); handshakeBuffer.rewind(); break; - } if (remaining == handshakeMessageLen) { + } + + if (remaining == handshakeMessageLen) { if (handshakeHash.isHashable(handshakeType)) { handshakeHash.receive(handshakeFrag); } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/ServerHello.java --- a/src/java.base/share/classes/sun/security/ssl/ServerHello.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/ServerHello.java Fri Jun 21 14:07:48 2019 +0530 @@ -47,6 +47,8 @@ import sun.security.ssl.SSLHandshake.HandshakeMessage; import sun.security.ssl.SupportedVersionsExtension.SHSupportedVersionsSpec; +import static sun.security.ssl.SSLExtension.SH_SESSION_TICKET; + /** * Pack of the ServerHello/HelloRetryRequest handshake message. */ @@ -337,6 +339,15 @@ shc.handshakeProducers.put(SSLHandshake.SERVER_HELLO_DONE.id, SSLHandshake.SERVER_HELLO_DONE); } else { + // stateless and use the client session id (RFC 5077 3.4) + if (shc.statelessResumption) { + shc.resumingSession = new SSLSessionImpl(shc.resumingSession, + (clientHello.sessionId.length() == 0) ? + new SessionId(true, + shc.sslContext.getSecureRandom()) : + new SessionId(clientHello.sessionId.getId()) + ); + } shc.handshakeSession = shc.resumingSession; shc.negotiatedProtocol = shc.resumingSession.getProtocolVersion(); @@ -491,6 +502,9 @@ ServerHandshakeContext shc = (ServerHandshakeContext)context; ClientHelloMessage clientHello = (ClientHelloMessage)message; + SSLSessionContextImpl sessionCache = (SSLSessionContextImpl) + shc.sslContext.engineGetServerSessionContext(); + // If client hasn't specified a session we can resume, start a // new one and choose its cipher suite and compression options, // unless new session creation is disabled for this connection! @@ -546,8 +560,6 @@ shc.resumingSession.consumePreSharedKey()); // The session can't be resumed again---remove it from cache - SSLSessionContextImpl sessionCache = (SSLSessionContextImpl) - shc.sslContext.engineGetServerSessionContext(); sessionCache.remove(shc.resumingSession.getSessionId()); } @@ -679,6 +691,11 @@ // Update the context for master key derivation. shc.handshakeKeyDerivation = kd; + // Check if the server supports stateless resumption + if (sessionCache.statelessEnabled()) { + shc.statelessResumption = true; + } + // The handshake message has been delivered. return null; } @@ -1098,9 +1115,23 @@ throw chc.conContext.fatal(Alert.PROTOCOL_VERSION, "New session creation is disabled"); } - chc.handshakeSession = new SSLSessionImpl(chc, - chc.negotiatedCipherSuite, - serverHello.sessionId); + + if (serverHello.sessionId.length() == 0 && + chc.statelessResumption) { + SessionId newId = new SessionId(true, + chc.sslContext.getSecureRandom()); + chc.handshakeSession = new SSLSessionImpl(chc, + chc.negotiatedCipherSuite, newId); + + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("Locally assigned Session Id: " + + newId.toString()); + } + } else { + chc.handshakeSession = new SSLSessionImpl(chc, + chc.negotiatedCipherSuite, + serverHello.sessionId); + } chc.handshakeSession.setMaximumPacketSize( chc.sslConfig.maximumPacketSize); } @@ -1127,6 +1158,11 @@ chc.conContext.consumers.putIfAbsent( ContentType.CHANGE_CIPHER_SPEC.id, ChangeCipherSpec.t10Consumer); + if (chc.statelessResumption) { + chc.handshakeConsumers.putIfAbsent( + SSLHandshake.NEW_SESSION_TICKET.id, + SSLHandshake.NEW_SESSION_TICKET); + } chc.handshakeConsumers.put( SSLHandshake.FINISHED.id, SSLHandshake.FINISHED); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SessionId.java --- a/src/java.base/share/classes/sun/security/ssl/SessionId.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SessionId.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -36,7 +36,7 @@ * @author David Brownell */ final class SessionId { - private static final int MAX_LENGTH = 32; + static final int MAX_LENGTH = 32; private final byte[] sessionId; // max 32 bytes // Constructs a new session ID ... perhaps for a rejoinable session diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SessionTicketExtension.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/classes/sun/security/ssl/SessionTicketExtension.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,539 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.security.ssl; + +import sun.security.action.GetPropertyAction; +import sun.security.ssl.SSLExtension.ExtensionConsumer; +import sun.security.ssl.SSLExtension.SSLExtensionSpec; +import sun.security.ssl.SSLHandshake.HandshakeMessage; +import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; +import sun.security.util.HexDumpEncoder; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import javax.crypto.spec.GCMParameterSpec; +import javax.net.ssl.SSLProtocolException; + +import static sun.security.ssl.SSLExtension.CH_SESSION_TICKET; +import static sun.security.ssl.SSLExtension.SH_SESSION_TICKET; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.text.MessageFormat; +import java.util.Collection; +import java.util.Locale; + +/** + * SessionTicketExtension is an implementation of RFC 5077 with some internals + * that are used for stateless operation in TLS 1.3. + * + * {@systemProperty jdk.tls.server.statelessKeyTimeout} can override the default + * amount of time, in seconds, for how long a randomly-generated key and + * parameters can be used before being regenerated. The key material is used + * to encrypt the stateless session ticket that is sent to the client that will + * be used during resumption. Default is 3600 seconds (1 hour) + * + */ + +final class SessionTicketExtension { + + static final HandshakeProducer chNetworkProducer = + new T12CHSessionTicketProducer(); + static final ExtensionConsumer chOnLoadConsumer = + new T12CHSessionTicketConsumer(); + static final HandshakeProducer shNetworkProducer = + new T12SHSessionTicketProducer(); + static final ExtensionConsumer shOnLoadConsumer = + new T12SHSessionTicketConsumer(); + + static final SSLStringizer steStringizer = new SessionTicketStringizer(); + + // Time in milliseconds until key is changed for encrypting session state + private static final int TIMEOUT_DEFAULT = 3600 * 1000; + private static final int keyTimeout; + private static int currentKeyID = new SecureRandom().nextInt(); + private static final int KEYLEN = 256; + + static { + String s = GetPropertyAction.privilegedGetProperty( + "jdk.tls.server.statelessKeyTimeout"); + if (s != null) { + int kt; + try { + kt = Integer.parseInt(s) * 1000; // change to ms + if (kt < 0 || + kt > NewSessionTicket.MAX_TICKET_LIFETIME) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl")) { + SSLLogger.warning("Invalid timeout for " + + "jdk.tls.server.statelessKeyTimeout: " + + kt + ". Set to default value " + + TIMEOUT_DEFAULT + "sec"); + } + kt = TIMEOUT_DEFAULT; + } + } catch (NumberFormatException e) { + kt = TIMEOUT_DEFAULT; + if (SSLLogger.isOn && SSLLogger.isOn("ssl")) { + SSLLogger.warning("Invalid timeout for " + + "jdk.tls.server.statelessKeyTimeout: " + s + + ". Set to default value " + TIMEOUT_DEFAULT + + "sec"); + } + } + keyTimeout = kt; + } else { + keyTimeout = TIMEOUT_DEFAULT; + } + } + + // Crypto key context for session state. Used with stateless operation. + final static class StatelessKey { + final long timeout; + final SecretKey key; + final int num; + + StatelessKey(HandshakeContext hc, int newNum) { + SecretKey k = null; + try { + KeyGenerator kg = KeyGenerator.getInstance("AES"); + kg.init(KEYLEN, hc.sslContext.getSecureRandom()); + k = kg.generateKey(); + } catch (NoSuchAlgorithmException e) { + // should not happen; + } + key = k; + timeout = System.currentTimeMillis() + keyTimeout; + num = newNum; + hc.sslContext.keyHashMap.put(Integer.valueOf(num), this); + } + + // Check if key needs to be changed + boolean isExpired() { + return ((System.currentTimeMillis()) > timeout); + } + + // Check if this key is ready for deletion. + boolean isInvalid(long sessionTimeout) { + return ((System.currentTimeMillis()) > (timeout + sessionTimeout)); + } + } + + private static final class KeyState { + + // Get a key with a specific key number + static StatelessKey getKey(HandshakeContext hc, int num) { + StatelessKey ssk = hc.sslContext.keyHashMap.get(num); + + if (ssk == null || ssk.isInvalid(getSessionTimeout(hc))) { + return null; + } + return ssk; + } + + // Get the current valid key, this will generate a new key if needed + static StatelessKey getCurrentKey(HandshakeContext hc) { + StatelessKey ssk = hc.sslContext.keyHashMap.get(currentKeyID); + + if (ssk != null && !ssk.isExpired()) { + return ssk; + } + return nextKey(hc); + } + + // This method locks when the first getCurrentKey() finds it to be too + // old and create a new key to replace the current key. After the new + // key established, the lock can be released so following + // operations will start using the new key. + // The first operation will take a longer code path by generating the + // next key and cleaning up old keys. + private static StatelessKey nextKey(HandshakeContext hc) { + StatelessKey ssk; + + synchronized (hc.sslContext.keyHashMap) { + // If the current key is no longer expired, it was already + // updated by a previous operation and we can return. + ssk = hc.sslContext.keyHashMap.get(currentKeyID); + if (ssk != null && !ssk.isExpired()) { + return ssk; + } + int newNum; + if (currentKeyID == Integer.MAX_VALUE) { + newNum = 0; + } else { + newNum = currentKeyID + 1; + } + // Get new key + ssk = new StatelessKey(hc, newNum); + currentKeyID = newNum; + // Release lock since the new key is ready to be used. + } + + // Clean up any old keys, then return the current key + cleanup(hc); + return ssk; + } + + // Deletes any invalid SessionStateKeys. + static void cleanup(HandshakeContext hc) { + int sessionTimeout = getSessionTimeout(hc); + + StatelessKey ks; + for (Object o : hc.sslContext.keyHashMap.keySet().toArray()) { + Integer i = (Integer)o; + ks = hc.sslContext.keyHashMap.get(i); + if (ks.isInvalid(sessionTimeout)) { + try { + ks.key.destroy(); + } catch (Exception e) { + // Suppress + } + hc.sslContext.keyHashMap.remove(i); + } + } + } + + static int getSessionTimeout(HandshakeContext hc) { + return hc.sslContext.engineGetServerSessionContext(). + getSessionTimeout() * 1000; + } + } + + /** + * This class contains the session state that is in the session ticket. + * Using the key associated with the ticket, the class encrypts and + * decrypts the data, but does not interpret the data. + */ + static final class SessionTicketSpec implements SSLExtensionSpec { + private static final int GCM_TAG_LEN = 128; + ByteBuffer data; + static final ByteBuffer zero = ByteBuffer.wrap(new byte[0]); + + SessionTicketSpec() { + data = zero; + } + + SessionTicketSpec(byte[] b) throws IOException { + this(ByteBuffer.wrap(b)); + } + + SessionTicketSpec(ByteBuffer buf) throws IOException { + if (buf == null) { + throw new SSLProtocolException( + "SessionTicket buffer too small"); + } + if (buf.remaining() > 65536) { + throw new SSLProtocolException( + "SessionTicket buffer too large. " + buf.remaining()); + } + + data = buf; + } + + public byte[] encrypt(HandshakeContext hc, SSLSessionImpl session) + throws IOException { + byte[] encrypted; + StatelessKey key = KeyState.getCurrentKey(hc); + byte[] iv = new byte[16]; + + try { + SecureRandom random = hc.sslContext.getSecureRandom(); + random.nextBytes(iv); + Cipher c = Cipher.getInstance("AES/GCM/NoPadding"); + c.init(Cipher.ENCRYPT_MODE, key.key, + new GCMParameterSpec(GCM_TAG_LEN, iv)); + c.updateAAD(new byte[] { + (byte)(key.num >>> 24), + (byte)(key.num >>> 16), + (byte)(key.num >>> 8), + (byte)(key.num)} + ); + encrypted = c.doFinal(session.write()); + + byte[] result = new byte[encrypted.length + Integer.BYTES + + iv.length]; + result[0] = (byte)(key.num >>> 24); + result[1] = (byte)(key.num >>> 16); + result[2] = (byte)(key.num >>> 8); + result[3] = (byte)(key.num); + System.arraycopy(iv, 0, result, Integer.BYTES, iv.length); + System.arraycopy(encrypted, 0, result, + Integer.BYTES + iv.length, encrypted.length); + return result; + } catch (Exception e) { + throw hc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, e); + } + } + + ByteBuffer decrypt(HandshakeContext hc) { + int keyID; + byte[] iv; + try { + keyID = data.getInt(); + StatelessKey key = KeyState.getKey(hc, keyID); + if (key == null) { + return null; + } + + iv = new byte[16]; + data.get(iv); + Cipher c = Cipher.getInstance("AES/GCM/NoPadding"); + c.init(Cipher.DECRYPT_MODE, key.key, + new GCMParameterSpec(GCM_TAG_LEN, iv)); + c.updateAAD(new byte[] { + (byte)(keyID >>> 24), + (byte)(keyID >>> 16), + (byte)(keyID >>> 8), + (byte)(keyID)} + ); + /* + return ByteBuffer.wrap(c.doFinal(data, + Integer.BYTES + iv.length, + data.length - (Integer.BYTES + iv.length))); + */ + ByteBuffer out; + out = ByteBuffer.allocate(data.remaining() - GCM_TAG_LEN / 8); + c.doFinal(data, out); + out.flip(); + return out; + } catch (Exception e) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("Decryption failed." + e.getMessage()); + } + } + return null; + } + + byte[] getEncoded() { + byte[] out = new byte[data.capacity()]; + data.duplicate().get(out); + return out; + } + + @Override + public String toString() { + if (data == null) { + return ""; + } + if (data.capacity() == 0) { + return ""; + } + + MessageFormat messageFormat = new MessageFormat( + " \"ticket\" : '{'\n" + + "{0}\n" + + " '}'", + Locale.ENGLISH); + HexDumpEncoder hexEncoder = new HexDumpEncoder(); + + Object[] messageFields = { + Utilities.indent(hexEncoder.encode(data.duplicate()), + " "), + }; + + return messageFormat.format(messageFields); + } + } + + static final class SessionTicketStringizer implements SSLStringizer { + SessionTicketStringizer() {} + + @Override + public String toString(ByteBuffer buffer) { + try { + return new SessionTicketSpec(buffer).toString(); + } catch (IOException e) { + return e.getMessage(); + } + } + } + + private static final class T12CHSessionTicketProducer + extends SupportedGroups implements HandshakeProducer { + T12CHSessionTicketProducer() { + } + + @Override + public byte[] produce(ConnectionContext context, + HandshakeMessage message) throws IOException { + + ClientHandshakeContext chc = (ClientHandshakeContext)context; + + // If the context does not allow stateless tickets, exit + if (!((SSLSessionContextImpl)chc.sslContext. + engineGetClientSessionContext()).statelessEnabled()) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("Stateless resumption not supported"); + } + return null; + } + + chc.statelessResumption = true; + + // If resumption is not in progress, return an empty value + if (!chc.isResumption || chc.resumingSession == null) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("Stateless resumption supported"); + } + return new SessionTicketSpec().getEncoded(); + } + + if (chc.localSupportedSignAlgs == null) { + chc.localSupportedSignAlgs = + SignatureScheme.getSupportedAlgorithms( + chc.algorithmConstraints, chc.activeProtocols); + } + + return chc.resumingSession.getPskIdentity(); + } + + } + + private static final class T12CHSessionTicketConsumer + implements ExtensionConsumer { + T12CHSessionTicketConsumer() { + } + + @Override + public void consume(ConnectionContext context, + HandshakeMessage message, ByteBuffer buffer) + throws IOException { + ServerHandshakeContext shc = (ServerHandshakeContext) context; + + // Skip if extension is not provided + if (!shc.sslConfig.isAvailable(CH_SESSION_TICKET)) { + return; + } + + // Skip consumption if we are already in stateless resumption + if (shc.statelessResumption) { + return; + } + // If the context does not allow stateless tickets, exit + SSLSessionContextImpl cache = (SSLSessionContextImpl)shc.sslContext + .engineGetServerSessionContext(); + if (!cache.statelessEnabled()) { + return; + } + + if (buffer.remaining() == 0) { + shc.statelessResumption = true; + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("Client accepts session tickets."); + } + return; + } + + // Parse the extension. + SessionTicketSpec spec; + try { + spec = new SessionTicketSpec(buffer); + } catch (IOException | RuntimeException e) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("SessionTicket data invalid. Doing full " + + "handshake."); + } + return; + } + ByteBuffer b = spec.decrypt(shc); + if (b != null) { + shc.resumingSession = new SSLSessionImpl(shc, b); + shc.isResumption = true; + shc.statelessResumption = true; + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.fine("Valid stateless session ticket found"); + } + } + } + } + + + private static final class T12SHSessionTicketProducer + extends SupportedGroups implements HandshakeProducer { + T12SHSessionTicketProducer() { + } + + @Override + public byte[] produce(ConnectionContext context, + HandshakeMessage message) { + + ServerHandshakeContext shc = (ServerHandshakeContext)context; + + // If boolean is false, the CH did not have this extension + if (!shc.statelessResumption) { + return null; + } + // If the client has sent a SessionTicketExtension and stateless + // is enabled on the server, return an empty message. + // If the context does not allow stateless tickets, exit + SSLSessionContextImpl cache = (SSLSessionContextImpl)shc.sslContext + .engineGetServerSessionContext(); + if (cache.statelessEnabled()) { + return new byte[0]; + } + + shc.statelessResumption = false; + return null; + } + } + + private static final class T12SHSessionTicketConsumer + implements ExtensionConsumer { + T12SHSessionTicketConsumer() { + } + + @Override + public void consume(ConnectionContext context, + HandshakeMessage message, ByteBuffer buffer) + throws IOException { + ClientHandshakeContext chc = (ClientHandshakeContext) context; + + // Skip if extension is not provided + if (!chc.sslConfig.isAvailable(SH_SESSION_TICKET)) { + chc.statelessResumption = false; + return; + } + + // If the context does not allow stateless tickets, exit + if (!((SSLSessionContextImpl)chc.sslContext. + engineGetClientSessionContext()).statelessEnabled()) { + chc.statelessResumption = false; + return; + } + + try { + if (new SessionTicketSpec(buffer) == null) { + return; + } + chc.statelessResumption = true; + } catch (IOException e) { + throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, e); + } + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SignatureScheme.java --- a/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java Fri Jun 21 14:07:48 2019 +0530 @@ -26,7 +26,6 @@ package sun.security.ssl; import java.security.*; -import java.security.interfaces.ECPrivateKey; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.ECParameterSpec; import java.security.spec.MGF1ParameterSpec; @@ -39,8 +38,8 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; -import sun.security.ssl.SupportedGroupsExtension.NamedGroupType; +import sun.security.ssl.NamedGroup.NamedGroupType; +import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; import sun.security.ssl.X509Authentication.X509Possession; import sun.security.util.KeyUtil; import sun.security.util.SignatureUtil; @@ -432,16 +431,49 @@ } for (SignatureScheme ss : schemes) { if (ss.isAvailable && (keySize >= ss.minimalKeySize) && - ss.handshakeSupportedProtocols.contains(version) && - keyAlgorithm.equalsIgnoreCase(ss.keyAlgorithm)) { - if (ss.namedGroup != null && - ss.namedGroup.type == NamedGroupType.NAMED_GROUP_ECDHE) { + ss.handshakeSupportedProtocols.contains(version) && + keyAlgorithm.equalsIgnoreCase(ss.keyAlgorithm)) { + if ((ss.namedGroup != null) && (ss.namedGroup.type == + NamedGroupType.NAMED_GROUP_ECDHE)) { ECParameterSpec params = x509Possession.getECParameterSpec(); if (params != null && ss.namedGroup == NamedGroup.valueOf(params)) { return ss; } + + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.finest( + "Ignore the signature algorithm (" + ss + + "), unsupported EC parameter spec: " + params); + } + } else if ("EC".equals(ss.keyAlgorithm)) { + // Must be a legacy signature algorithm, which does not + // specify the associated named groups. The connection + // cannot be established if the peer cannot recognize + // the named group used for the signature. RFC 8446 + // does not define countermeasures for the corner cases. + // In order to mitigate the impact, we choose to check + // against the local supported named groups. The risk + // should be minimal as applications should not use + // unsupported named groups for its certificates. + ECParameterSpec params = + x509Possession.getECParameterSpec(); + if (params != null) { + NamedGroup keyGroup = NamedGroup.valueOf(params); + if (keyGroup != null && + SupportedGroups.isSupported(keyGroup)) { + return ss; + } + } + + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.finest( + "Ignore the legacy signature algorithm (" + ss + + "), unsupported EC parameter spec: " + params); + } } else { return ss; } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java --- a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java Fri Jun 21 14:07:48 2019 +0530 @@ -30,29 +30,24 @@ import java.security.AlgorithmConstraints; import java.security.AlgorithmParameters; import java.security.CryptoPrimitive; -import java.security.NoSuchAlgorithmException; -import java.security.spec.AlgorithmParameterSpec; import java.security.spec.ECGenParameterSpec; -import java.security.spec.ECParameterSpec; import java.security.spec.InvalidParameterSpecException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; -import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Locale; -import java.util.Map; -import javax.crypto.spec.DHParameterSpec; import javax.net.ssl.SSLProtocolException; import sun.security.action.GetPropertyAction; +import sun.security.ssl.NamedGroup.NamedGroupType; import static sun.security.ssl.SSLExtension.CH_SUPPORTED_GROUPS; import static sun.security.ssl.SSLExtension.EE_SUPPORTED_GROUPS; import sun.security.ssl.SSLExtension.ExtensionConsumer; import sun.security.ssl.SSLExtension.SSLExtensionSpec; import sun.security.ssl.SSLHandshake.HandshakeMessage; -import sun.security.util.ECUtil; + /** * Pack of the "supported_groups" extensions [RFC 4492/7919]. @@ -158,320 +153,11 @@ } } - static enum NamedGroupType { - NAMED_GROUP_ECDHE ("EC"), - NAMED_GROUP_FFDHE ("DiffieHellman"), - NAMED_GROUP_X25519 ("x25519"), - NAMED_GROUP_X448 ("x448"), - NAMED_GROUP_ARBITRARY ("EC"), - NAMED_GROUP_NONE (""); - - private final String algorithm; - - private NamedGroupType(String algorithm) { - this.algorithm = algorithm; - } - - boolean isSupported(List cipherSuites) { - for (CipherSuite cs : cipherSuites) { - if (cs.keyExchange == null || - cs.keyExchange.groupType == this) { - return true; - } - } - - return false; - } - } - - static enum NamedGroup { - // Elliptic Curves (RFC 4492) - // - // See sun.security.util.CurveDB for the OIDs - // NIST K-163 - SECT163_K1 (0x0001, "sect163k1", "1.3.132.0.1", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECT163_R1 (0x0002, "sect163r1", "1.3.132.0.2", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST B-163 - SECT163_R2 (0x0003, "sect163r2", "1.3.132.0.15", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECT193_R1 (0x0004, "sect193r1", "1.3.132.0.24", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECT193_R2 (0x0005, "sect193r2", "1.3.132.0.25", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST K-233 - SECT233_K1 (0x0006, "sect233k1", "1.3.132.0.26", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST B-233 - SECT233_R1 (0x0007, "sect233r1", "1.3.132.0.27", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECT239_K1 (0x0008, "sect239k1", "1.3.132.0.3", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST K-283 - SECT283_K1 (0x0009, "sect283k1", "1.3.132.0.16", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST B-283 - SECT283_R1 (0x000A, "sect283r1", "1.3.132.0.17", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST K-409 - SECT409_K1 (0x000B, "sect409k1", "1.3.132.0.36", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST B-409 - SECT409_R1 (0x000C, "sect409r1", "1.3.132.0.37", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST K-571 - SECT571_K1 (0x000D, "sect571k1", "1.3.132.0.38", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST B-571 - SECT571_R1 (0x000E, "sect571r1", "1.3.132.0.39", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECP160_K1 (0x000F, "secp160k1", "1.3.132.0.9", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECP160_R1 (0x0010, "secp160r1", "1.3.132.0.8", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECP160_R2 (0x0011, "secp160r2", "1.3.132.0.30", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECP192_K1 (0x0012, "secp192k1", "1.3.132.0.31", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST P-192 - SECP192_R1 (0x0013, "secp192r1", "1.2.840.10045.3.1.1", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECP224_K1 (0x0014, "secp224k1", "1.3.132.0.32", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - // NIST P-224 - SECP224_R1 (0x0015, "secp224r1", "1.3.132.0.33", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - SECP256_K1 (0x0016, "secp256k1", "1.3.132.0.10", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_12), - - // NIST P-256 - SECP256_R1 (0x0017, "secp256r1", "1.2.840.10045.3.1.7", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_13), - - // NIST P-384 - SECP384_R1 (0x0018, "secp384r1", "1.3.132.0.34", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_13), - - // NIST P-521 - SECP521_R1 (0x0019, "secp521r1", "1.3.132.0.35", - NamedGroupType.NAMED_GROUP_ECDHE, - ProtocolVersion.PROTOCOLS_TO_13), - - // x25519 and x448 - X25519 (0x001D, "x25519", null, - NamedGroupType.NAMED_GROUP_X25519, - ProtocolVersion.PROTOCOLS_TO_13), - X448 (0x001E, "x448", null, - NamedGroupType.NAMED_GROUP_X448, - ProtocolVersion.PROTOCOLS_TO_13), - - // Finite Field Diffie-Hellman Ephemeral Parameters (RFC 7919) - FFDHE_2048 (0x0100, "ffdhe2048", null, - NamedGroupType.NAMED_GROUP_FFDHE, - ProtocolVersion.PROTOCOLS_TO_13), - FFDHE_3072 (0x0101, "ffdhe3072", null, - NamedGroupType.NAMED_GROUP_FFDHE, - ProtocolVersion.PROTOCOLS_TO_13), - FFDHE_4096 (0x0102, "ffdhe4096", null, - NamedGroupType.NAMED_GROUP_FFDHE, - ProtocolVersion.PROTOCOLS_TO_13), - FFDHE_6144 (0x0103, "ffdhe6144", null, - NamedGroupType.NAMED_GROUP_FFDHE, - ProtocolVersion.PROTOCOLS_TO_13), - FFDHE_8192 (0x0104, "ffdhe8192", null, - NamedGroupType.NAMED_GROUP_FFDHE, - ProtocolVersion.PROTOCOLS_TO_13), - - // Elliptic Curves (RFC 4492) - // - // arbitrary prime and characteristic-2 curves - ARBITRARY_PRIME (0xFF01, "arbitrary_explicit_prime_curves", null, - NamedGroupType.NAMED_GROUP_ARBITRARY, - ProtocolVersion.PROTOCOLS_TO_12), - ARBITRARY_CHAR2 (0xFF02, "arbitrary_explicit_char2_curves", null, - NamedGroupType.NAMED_GROUP_ARBITRARY, - ProtocolVersion.PROTOCOLS_TO_12); - - final int id; // hash + signature - final NamedGroupType type; // group type - final String name; // literal name - final String oid; // object identifier of the named group - final String algorithm; // signature algorithm - final ProtocolVersion[] supportedProtocols; - - private NamedGroup(int id, String name, String oid, - NamedGroupType namedGroupType, - ProtocolVersion[] supportedProtocols) { - this.id = id; - this.type = namedGroupType; - this.name = name; - this.oid = oid; - this.algorithm = namedGroupType.algorithm; - this.supportedProtocols = supportedProtocols; - } - - static NamedGroup valueOf(int id) { - for (NamedGroup group : NamedGroup.values()) { - if (group.id == id) { - return group; - } - } - - return null; - } - - static NamedGroup valueOf(ECParameterSpec params) { - String oid = ECUtil.getCurveName(null, params); - if ((oid != null) && (!oid.isEmpty())) { - for (NamedGroup group : NamedGroup.values()) { - if ((group.type == NamedGroupType.NAMED_GROUP_ECDHE) && - oid.equals(group.oid)) { - return group; - } - } - } - - return null; - } - - static NamedGroup valueOf(DHParameterSpec params) { - for (Map.Entry me : - SupportedGroups.namedGroupParams.entrySet()) { - NamedGroup ng = me.getKey(); - if (ng.type != NamedGroupType.NAMED_GROUP_FFDHE) { - continue; - } - - DHParameterSpec ngParams = null; - AlgorithmParameters aps = me.getValue(); - try { - ngParams = aps.getParameterSpec(DHParameterSpec.class); - } catch (InvalidParameterSpecException ipse) { - // should be unlikely - } - - if (ngParams == null) { - continue; - } - - if (ngParams.getP().equals(params.getP()) && - ngParams.getG().equals(params.getG())) { - return ng; - } - } - - return null; - } - - static NamedGroup nameOf(String name) { - for (NamedGroup group : NamedGroup.values()) { - if (group.name.equals(name)) { - return group; - } - } - - return null; - } - - static String nameOf(int id) { - for (NamedGroup group : NamedGroup.values()) { - if (group.id == id) { - return group.name; - } - } - - return "UNDEFINED-NAMED-GROUP(" + id + ")"; - } - - boolean isAvailable(List protocolVersions) { - for (ProtocolVersion pv : supportedProtocols) { - if (protocolVersions.contains(pv)) { - return true; - } - } - return false; - } - - boolean isAvailable(ProtocolVersion protocolVersion) { - for (ProtocolVersion pv : supportedProtocols) { - if (protocolVersion == pv) { - return true; - } - } - return false; - } - - boolean isSupported(List cipherSuites) { - for (CipherSuite cs : cipherSuites) { - boolean isMatch = isAvailable(cs.supportedProtocols); - if (isMatch && (cs.keyExchange == null || - cs.keyExchange.groupType == type)) { - return true; - } - } - return false; - } - - // lazy loading of parameters - AlgorithmParameters getParameters() { - return SupportedGroups.namedGroupParams.get(this); - } - - AlgorithmParameterSpec getParameterSpec() { - if (this.type == NamedGroupType.NAMED_GROUP_ECDHE) { - return SupportedGroups.getECGenParamSpec(this); - } else if (this.type == NamedGroupType.NAMED_GROUP_FFDHE) { - return SupportedGroups.getDHParameterSpec(this); - } - - return null; - } - } - static class SupportedGroups { // To switch off the supported_groups extension for DHE cipher suite. static final boolean enableFFDHE = Utilities.getBooleanProperty("jsse.enableFFDHE", true); - // cache to speed up the parameters construction - static final Map namedGroupParams = new HashMap<>(); - // the supported named groups static final NamedGroup[] supportedNamedGroups; @@ -516,10 +202,19 @@ } } else { // default groups NamedGroup[] groups = new NamedGroup[] { - // NIST curves first + + // Primary XDH (RFC 7748) curves + NamedGroup.X25519, + + // Primary NIST curves (e.g. used in TLSv1.3) NamedGroup.SECP256_R1, NamedGroup.SECP384_R1, NamedGroup.SECP521_R1, + + // Secondary XDH curves + NamedGroup.X448, + + // Secondary NIST curves NamedGroup.SECT283_K1, NamedGroup.SECT283_R1, NamedGroup.SECT409_K1, @@ -530,7 +225,7 @@ // non-NIST curves NamedGroup.SECP256_K1, - // FFDHE 2048 + // FFDHE (RFC 7919) NamedGroup.FFDHE_2048, NamedGroup.FFDHE_3072, NamedGroup.FFDHE_4096, @@ -560,126 +255,27 @@ // check whether the group is supported by the underlying providers private static boolean isAvailableGroup(NamedGroup namedGroup) { - AlgorithmParameters params = null; - AlgorithmParameterSpec spec = null; - if (namedGroup.type == NamedGroupType.NAMED_GROUP_ECDHE) { - if (namedGroup.oid != null) { - try { - params = AlgorithmParameters.getInstance("EC"); - spec = new ECGenParameterSpec(namedGroup.oid); - } catch (NoSuchAlgorithmException e) { - return false; - } - } - } else if (namedGroup.type == NamedGroupType.NAMED_GROUP_FFDHE) { - try { - params = AlgorithmParameters.getInstance("DiffieHellman"); - spec = getFFDHEDHParameterSpec(namedGroup); - } catch (NoSuchAlgorithmException e) { - return false; - } - } // Otherwise, unsupported. - - if ((params != null) && (spec != null)) { - try { - params.init(spec); - } catch (InvalidParameterSpecException e) { - return false; - } - - // cache the parameters - namedGroupParams.put(namedGroup, params); - - return true; - } - - return false; + return namedGroup.isAvailableGroup(); } - private static DHParameterSpec getFFDHEDHParameterSpec( - NamedGroup namedGroup) { - DHParameterSpec spec = null; - switch (namedGroup) { - case FFDHE_2048: - spec = PredefinedDHParameterSpecs.ffdheParams.get(2048); - break; - case FFDHE_3072: - spec = PredefinedDHParameterSpecs.ffdheParams.get(3072); - break; - case FFDHE_4096: - spec = PredefinedDHParameterSpecs.ffdheParams.get(4096); - break; - case FFDHE_6144: - spec = PredefinedDHParameterSpecs.ffdheParams.get(6144); - break; - case FFDHE_8192: - spec = PredefinedDHParameterSpecs.ffdheParams.get(8192); + static ECGenParameterSpec getECGenParamSpec(NamedGroup ng) { + if (ng.type != NamedGroupType.NAMED_GROUP_ECDHE) { + throw new RuntimeException( + "Not a named EC group: " + ng); } - return spec; - } - - private static DHParameterSpec getPredefinedDHParameterSpec( - NamedGroup namedGroup) { - DHParameterSpec spec = null; - switch (namedGroup) { - case FFDHE_2048: - spec = PredefinedDHParameterSpecs.definedParams.get(2048); - break; - case FFDHE_3072: - spec = PredefinedDHParameterSpecs.definedParams.get(3072); - break; - case FFDHE_4096: - spec = PredefinedDHParameterSpecs.definedParams.get(4096); - break; - case FFDHE_6144: - spec = PredefinedDHParameterSpecs.definedParams.get(6144); - break; - case FFDHE_8192: - spec = PredefinedDHParameterSpecs.definedParams.get(8192); - } - - return spec; - } - - static ECGenParameterSpec getECGenParamSpec(NamedGroup namedGroup) { - if (namedGroup.type != NamedGroupType.NAMED_GROUP_ECDHE) { - throw new RuntimeException( - "Not a named EC group: " + namedGroup); - } - - AlgorithmParameters params = namedGroupParams.get(namedGroup); - if (params == null) { - throw new RuntimeException( - "Not a supported EC named group: " + namedGroup); - } - + // parameters are non-null + AlgorithmParameters params = ng.getParameters(); try { return params.getParameterSpec(ECGenParameterSpec.class); } catch (InvalidParameterSpecException ipse) { // should be unlikely - return new ECGenParameterSpec(namedGroup.oid); + return new ECGenParameterSpec(ng.oid); } } - static DHParameterSpec getDHParameterSpec(NamedGroup namedGroup) { - if (namedGroup.type != NamedGroupType.NAMED_GROUP_FFDHE) { - throw new RuntimeException( - "Not a named DH group: " + namedGroup); - } - - AlgorithmParameters params = namedGroupParams.get(namedGroup); - if (params == null) { - throw new RuntimeException( - "Not a supported DH named group: " + namedGroup); - } - - try { - return params.getParameterSpec(DHParameterSpec.class); - } catch (InvalidParameterSpecException ipse) { - // should be unlikely - return getPredefinedDHParameterSpec(namedGroup); - } + static AlgorithmParameters getParameters(NamedGroup ng) { + return ng.getParameters(); } // Is there any supported group permitted by the constraints? @@ -692,7 +288,7 @@ if (constraints.permits( EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), namedGroup.algorithm, - namedGroupParams.get(namedGroup))) { + getParameters(namedGroup))) { return true; } @@ -723,7 +319,7 @@ return constraints.permits( EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), namedGroup.algorithm, - namedGroupParams.get(namedGroup)); + getParameters(namedGroup)); } // Is the named group supported? @@ -739,16 +335,16 @@ static NamedGroup getPreferredGroup( ProtocolVersion negotiatedProtocol, - AlgorithmConstraints constraints, NamedGroupType type, + AlgorithmConstraints constraints, NamedGroupType[] types, List requestedNamedGroups) { for (NamedGroup namedGroup : requestedNamedGroups) { - if ((namedGroup.type == type) && + if ((NamedGroupType.arrayContains(types, namedGroup.type)) && namedGroup.isAvailable(negotiatedProtocol) && isSupported(namedGroup) && constraints.permits( EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), namedGroup.algorithm, - namedGroupParams.get(namedGroup))) { + getParameters(namedGroup))) { return namedGroup; } } @@ -758,14 +354,14 @@ static NamedGroup getPreferredGroup( ProtocolVersion negotiatedProtocol, - AlgorithmConstraints constraints, NamedGroupType type) { + AlgorithmConstraints constraints, NamedGroupType[] types) { for (NamedGroup namedGroup : supportedNamedGroups) { - if ((namedGroup.type == type) && + if ((NamedGroupType.arrayContains(types, namedGroup.type)) && namedGroup.isAvailable(negotiatedProtocol) && constraints.permits( EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), namedGroup.algorithm, - namedGroupParams.get(namedGroup))) { + getParameters(namedGroup))) { return namedGroup; } } @@ -813,7 +409,7 @@ ng.isSupported(chc.activeCipherSuites) && chc.algorithmConstraints.permits( EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - ng.algorithm, namedGroupParams.get(ng))) { + ng.algorithm, getParameters(ng))) { namedGroups.add(ng); } else if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { SSLLogger.fine( @@ -940,7 +536,7 @@ ng.isSupported(shc.activeCipherSuites) && shc.algorithmConstraints.permits( EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - ng.algorithm, namedGroupParams.get(ng))) { + ng.algorithm, getParameters(ng))) { namedGroups.add(ng); } else if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { SSLLogger.fine( diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/TransportContext.java --- a/src/java.base/share/classes/sun/security/ssl/TransportContext.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/TransportContext.java Fri Jun 21 14:07:48 2019 +0530 @@ -39,7 +39,6 @@ import javax.net.ssl.SSLEngineResult.HandshakeStatus; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSocket; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; /** * SSL/(D)TLS transportation context. @@ -159,14 +158,19 @@ if (handshakeContext == null) { if (type == SSLHandshake.KEY_UPDATE.id || type == SSLHandshake.NEW_SESSION_TICKET.id) { - if (isNegotiated && - protocolVersion.useTLS13PlusSpec()) { - handshakeContext = new PostHandshakeContext(this); - } else { + if (!isNegotiated) { + throw fatal(Alert.UNEXPECTED_MESSAGE, + "Unexpected unnegotiated post-handshake" + + " message: " + + SSLHandshake.nameOf(type)); + } + if (type == SSLHandshake.KEY_UPDATE.id && + !protocolVersion.useTLS13PlusSpec()) { throw fatal(Alert.UNEXPECTED_MESSAGE, "Unexpected post-handshake message: " + SSLHandshake.nameOf(type)); } + handshakeContext = new PostHandshakeContext(this); } else { handshakeContext = sslConfig.isClientMode ? new ClientHandshakeContext(sslContext, this) : diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/Utilities.java --- a/src/java.base/share/classes/sun/security/ssl/Utilities.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/Utilities.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -61,8 +61,8 @@ int size = serverNames.size(); List sniList = (size != 0) ? - new ArrayList(serverNames) : - new ArrayList(1); + new ArrayList<>(serverNames) : + new ArrayList<>(1); boolean reset = false; for (int i = 0; i < size; i++) { @@ -147,7 +147,7 @@ static String indent(String source, String prefix) { StringBuilder builder = new StringBuilder(); if (source == null) { - builder.append("\n" + prefix + ""); + builder.append("\n").append(prefix).append(""); } else { String[] lines = lineBreakPatern.split(source); boolean isFirst = true; @@ -232,4 +232,21 @@ } return b; } + + static void reverseBytes(byte[] arr) { + int i = 0; + int j = arr.length - 1; + + while (i < j) { + swap(arr, i, j); + i++; + j--; + } + } + + private static void swap(byte[] arr, int i, int j) { + byte tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; + } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/X509Authentication.java --- a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -30,13 +30,15 @@ import java.security.cert.X509Certificate; import java.security.interfaces.ECKey; import java.security.interfaces.ECPublicKey; +import java.security.interfaces.XECKey; +import java.security.spec.AlgorithmParameterSpec; import java.security.spec.ECParameterSpec; +import java.security.spec.NamedParameterSpec; import java.util.AbstractMap.SimpleImmutableEntry; import java.util.Map; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLSocket; import javax.net.ssl.X509ExtendedKeyManager; -import sun.security.ssl.SupportedGroupsExtension.NamedGroup; import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; enum X509Authentication implements SSLAuthentication { @@ -67,7 +69,7 @@ final String keyType; final SSLPossessionGenerator possessionGenerator; - X509Authentication(String keyType, + private X509Authentication(String keyType, SSLPossessionGenerator possessionGenerator) { this.keyType = keyType; this.possessionGenerator = possessionGenerator; @@ -148,6 +150,35 @@ return null; } + + // Similar to above, but for XEC. + NamedParameterSpec getXECParameterSpec() { + if (popPrivateKey == null || + !"XEC".equals(popPrivateKey.getAlgorithm())) { + return null; + } + + if (popPrivateKey instanceof XECKey) { + AlgorithmParameterSpec params = + ((XECKey)popPrivateKey).getParams(); + if (params instanceof NamedParameterSpec){ + return (NamedParameterSpec)params; + } + } else if (popCerts != null && popCerts.length != 0) { + // The private key not extractable, get the parameters from + // the X.509 certificate. + PublicKey publicKey = popCerts[0].getPublicKey(); + if (publicKey instanceof XECKey) { + AlgorithmParameterSpec params = + ((XECKey)publicKey).getParams(); + if (params instanceof NamedParameterSpec){ + return (NamedParameterSpec)params; + } + } + } + + return null; + } } static final class X509Credentials implements SSLCredentials { @@ -295,10 +326,12 @@ return null; } - // For ECC certs, check whether we support the EC domain - // parameters. If the client sent a SupportedEllipticCurves - // ClientHello extension, check against that too. - if (keyType.equals("EC")) { + // For TLS 1.2 and prior versions, the public key of a EC cert + // MUST use a curve and point format supported by the client. + // But for TLS 1.3, signature algorithms are negotiated + // independently via the "signature_algorithms" extension. + if (!shc.negotiatedProtocol.useTLS13PlusSpec() && + keyType.equals("EC")) { if (!(serverPublicKey instanceof ECPublicKey)) { if (SSLLogger.isOn && SSLLogger.isOn("ssl")) { SSLLogger.warning(serverAlias + @@ -308,8 +341,9 @@ } // For ECC certs, check whether we support the EC domain - // parameters. If the client sent a SupportedEllipticCurves - // ClientHello extension, check against that too. + // parameters. If the client sent a supported_groups + // ClientHello extension, check against that too for + // TLS 1.2 and prior versions. ECParameterSpec params = ((ECPublicKey)serverPublicKey).getParams(); NamedGroup namedGroup = NamedGroup.valueOf(params); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/ssl/XDHKeyExchange.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/classes/sun/security/ssl/XDHKeyExchange.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,210 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package sun.security.ssl; + +import java.io.IOException; +import java.math.BigInteger; +import java.security.*; +import java.security.interfaces.XECPublicKey; +import java.security.spec.*; +import sun.security.ssl.NamedGroup.NamedGroupType; +import sun.security.util.*; + +/** + * Specifics for XEC/XDH Keys/Exchanges + */ +final class XDHKeyExchange { + + static final SSLKeyAgreementGenerator xdheKAGenerator + = new XDHEKAGenerator(); + + static final class XDHECredentials implements NamedGroupCredentials { + + final XECPublicKey popPublicKey; + final NamedGroup namedGroup; + + XDHECredentials(XECPublicKey popPublicKey, NamedGroup namedGroup) { + this.popPublicKey = popPublicKey; + this.namedGroup = namedGroup; + } + + @Override + public PublicKey getPublicKey() { + return popPublicKey; + } + + @Override + public NamedGroup getNamedGroup() { + return namedGroup; + } + + /** + * Parse the encoded Point into the XDHECredentials using the + * namedGroup. + */ + static XDHECredentials valueOf(NamedGroup namedGroup, + byte[] encodedPoint) throws IOException, + GeneralSecurityException { + + if (namedGroup.type != NamedGroupType.NAMED_GROUP_XDH) { + throw new RuntimeException( + "Credentials decoding: Not XDH named group"); + } + + if (encodedPoint == null || encodedPoint.length == 0) { + return null; + } + + byte[] uBytes = encodedPoint.clone(); + Utilities.reverseBytes(uBytes); + BigInteger u = new BigInteger(1, uBytes); + + XECPublicKeySpec xecPublicKeySpec = new XECPublicKeySpec( + new NamedParameterSpec(namedGroup.name), u); + KeyFactory factory = KeyFactory.getInstance(namedGroup.algorithm); + XECPublicKey publicKey = (XECPublicKey) factory.generatePublic( + xecPublicKeySpec); + + return new XDHECredentials(publicKey, namedGroup); + } + } + + static final class XDHEPossession implements NamedGroupPossession { + + final PrivateKey privateKey; + final XECPublicKey publicKey; + final NamedGroup namedGroup; + + XDHEPossession(NamedGroup namedGroup, SecureRandom random) { + try { + KeyPairGenerator kpg + = KeyPairGenerator.getInstance(namedGroup.algorithm); + AlgorithmParameterSpec params = namedGroup.getParameterSpec(); + kpg.initialize(params, random); + KeyPair kp = kpg.generateKeyPair(); + privateKey = kp.getPrivate(); + publicKey = (XECPublicKey) kp.getPublic(); + } catch (GeneralSecurityException e) { + throw new RuntimeException( + "Could not generate XDH keypair", e); + } + + this.namedGroup = namedGroup; + } + + @Override + public byte[] encode() { + + byte[] uBytes = ECUtil.trimZeroes(publicKey.getU().toByteArray()); + + int expLength; + switch (namedGroup) { + case X25519: + expLength = 32; + break; + case X448: + expLength = 56; + break; + default: + throw new RuntimeException("Invalid XDH group"); + } + + if (uBytes.length > expLength) { + throw new RuntimeException("Encoded XDH key too large"); + } + + if (uBytes.length != expLength) { + byte[] tmp = new byte[expLength]; + System.arraycopy(uBytes, 0, tmp, + expLength - uBytes.length, uBytes.length); + uBytes = tmp; + } + + Utilities.reverseBytes(uBytes); + return (uBytes); + } + + @Override + public PublicKey getPublicKey() { + return publicKey; + } + + @Override + public NamedGroup getNamedGroup() { + return namedGroup; + } + + @Override + public PrivateKey getPrivateKey() { + return privateKey; + } + } + + private static final class XDHEKAGenerator + implements SSLKeyAgreementGenerator { + + // Prevent instantiation of this class. + private XDHEKAGenerator() { + // blank + } + + @Override + public SSLKeyDerivation createKeyDerivation( + HandshakeContext context) throws IOException { + XDHEPossession xdhePossession = null; + XDHECredentials xdheCredentials = null; + for (SSLPossession poss : context.handshakePossessions) { + if (!(poss instanceof XDHEPossession)) { + continue; + } + + NamedGroup ng = ((XDHEPossession) poss).namedGroup; + for (SSLCredentials cred : context.handshakeCredentials) { + if (!(cred instanceof XDHECredentials)) { + continue; + } + if (ng.equals(((XDHECredentials) cred).namedGroup)) { + xdheCredentials = (XDHECredentials) cred; + break; + } + } + + if (xdheCredentials != null) { + xdhePossession = (XDHEPossession) poss; + break; + } + } + + if (xdhePossession == null || xdheCredentials == null) { + context.conContext.fatal(Alert.HANDSHAKE_FAILURE, + "No sufficient XDHE key agreement " + + "parameters negotiated"); + } + + return new KAKeyDerivation("XDH", context, + xdhePossession.privateKey, xdheCredentials.popPublicKey); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/tools/keytool/Main.java --- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java Fri Jun 21 14:07:48 2019 +0530 @@ -2418,9 +2418,9 @@ out.println(form.format(source)); out.println(); - for (Enumeration e = keyStore.aliases(); - e.hasMoreElements(); ) { - String alias = e.nextElement(); + List aliases = Collections.list(keyStore.aliases()); + aliases.sort(String::compareTo); + for (String alias : aliases) { doPrintEntry("<" + alias + ">", alias, out); if (verbose || rfc) { out.println(rb.getString("NEWLINE")); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/classes/sun/security/util/GCMParameters.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/classes/sun/security/util/GCMParameters.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,153 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.security.util; + +import java.io.IOException; +import java.security.AlgorithmParametersSpi; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.InvalidParameterSpecException; +import javax.crypto.spec.GCMParameterSpec; +import sun.security.util.HexDumpEncoder; +import sun.security.util.*; + +/** + * This class implements the parameter set used with + * GCM encryption, which is defined in RFC 5084 as follows: + * + *

+ *    GCMParameters ::= SEQUENCE {
+ *      aes-iv      OCTET STRING, -- recommended size is 12 octets
+ *      aes-tLen    AES-GCM-ICVlen DEFAULT 12 }
+ *
+ *    AES-GCM-ICVlen ::= INTEGER (12 | 13 | 14 | 15 | 16)
+ *
+ * 
+ * + * @since 13 + */ +public final class GCMParameters extends AlgorithmParametersSpi { + + // the iv + private byte[] iv; + // the tag length in bytes + private int tLen; + + public GCMParameters() {} + + protected void engineInit(AlgorithmParameterSpec paramSpec) + throws InvalidParameterSpecException { + + if (!(paramSpec instanceof GCMParameterSpec)) { + throw new InvalidParameterSpecException + ("Inappropriate parameter specification"); + } + GCMParameterSpec gps = (GCMParameterSpec) paramSpec; + // need to convert from bits to bytes for ASN.1 encoding + this.tLen = gps.getTLen()/8; + if (this.tLen < 12 || this.tLen > 16 ) { + throw new InvalidParameterSpecException + ("GCM parameter parsing error: unsupported tag len: " + + this.tLen); + } + this.iv = gps.getIV(); + } + + protected void engineInit(byte[] encoded) throws IOException { + DerValue val = new DerValue(encoded); + // check if IV or params + if (val.tag == DerValue.tag_Sequence) { + byte[] iv = val.data.getOctetString(); + int tLen; + if (val.data.available() != 0) { + tLen = val.data.getInteger(); + if (tLen < 12 || tLen > 16 ) { + throw new IOException + ("GCM parameter parsing error: unsupported tag len: " + + tLen); + } + if (val.data.available() != 0) { + throw new IOException + ("GCM parameter parsing error: extra data"); + } + } else { + tLen = 12; + } + this.iv = iv.clone(); + this.tLen = tLen; + } else { + throw new IOException("GCM parameter parsing error: no SEQ tag"); + } + } + + protected void engineInit(byte[] encoded, String decodingMethod) + throws IOException { + engineInit(encoded); + } + + protected + T engineGetParameterSpec(Class paramSpec) + throws InvalidParameterSpecException { + + if (GCMParameterSpec.class.isAssignableFrom(paramSpec)) { + return paramSpec.cast(new GCMParameterSpec(tLen * 8, iv)); + } else { + throw new InvalidParameterSpecException + ("Inappropriate parameter specification"); + } + } + + protected byte[] engineGetEncoded() throws IOException { + DerOutputStream out = new DerOutputStream(); + DerOutputStream bytes = new DerOutputStream(); + + bytes.putOctetString(iv); + // Only put non-default values + if (tLen != 12) { + bytes.putInteger(tLen); + } + out.write(DerValue.tag_Sequence, bytes); + return out.toByteArray(); + } + + protected byte[] engineGetEncoded(String encodingMethod) + throws IOException { + return engineGetEncoded(); + } + + /* + * Returns a formatted string describing the parameters. + */ + protected String engineToString() { + String LINE_SEP = System.lineSeparator(); + HexDumpEncoder encoder = new HexDumpEncoder(); + StringBuilder sb + = new StringBuilder(LINE_SEP + " iv:" + LINE_SEP + "[" + + encoder.encodeBuffer(iv) + "]"); + + sb.append(LINE_SEP + "tLen(bits):" + LINE_SEP + tLen*8 + LINE_SEP); + return sb.toString(); + } +} diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/native/libnet/Inet6Address.c --- a/src/java.base/share/native/libnet/Inet6Address.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/native/libnet/Inet6Address.c Fri Jun 21 14:07:48 2019 +0530 @@ -37,7 +37,6 @@ jfieldID ia6_ipaddressID; jfieldID ia6_scopeidID; -jfieldID ia6_cachedscopeidID; jfieldID ia6_scopeidsetID; jfieldID ia6_scopeifnameID; jmethodID ia6_ctrID; @@ -65,8 +64,6 @@ CHECK_NULL(ia6_ipaddressID); ia6_scopeidID = (*env)->GetFieldID(env, ia6h_class, "scope_id", "I"); CHECK_NULL(ia6_scopeidID); - ia6_cachedscopeidID = (*env)->GetFieldID(env, ia6_class, "cached_scope_id", "I"); - CHECK_NULL(ia6_cachedscopeidID); ia6_scopeidsetID = (*env)->GetFieldID(env, ia6h_class, "scope_id_set", "Z"); CHECK_NULL(ia6_scopeidsetID); ia6_scopeifnameID = (*env)->GetFieldID(env, ia6h_class, "scope_ifname", "Ljava/net/NetworkInterface;"); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/native/libnet/net_util.h --- a/src/java.base/share/native/libnet/net_util.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/native/libnet/net_util.h Fri Jun 21 14:07:48 2019 +0530 @@ -107,7 +107,6 @@ extern jfieldID ia6_holder6ID; extern jfieldID ia6_ipaddressID; extern jfieldID ia6_scopeidID; -extern jfieldID ia6_cachedscopeidID; extern jfieldID ia6_scopeidsetID; extern jfieldID ia6_scopeifnameID; extern jmethodID ia6_ctrID; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/native/libzip/Deflater.c --- a/src/java.base/share/native/libzip/Deflater.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/native/libzip/Deflater.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -76,9 +76,8 @@ } } -static void doSetDictionary(JNIEnv *env, jlong addr, jbyte *buf, jint len) +static void checkSetDictionaryResult(JNIEnv *env, jlong addr, jint res) { - int res = deflateSetDictionary(jlong_to_ptr(addr), (Bytef *) buf, len); switch (res) { case Z_OK: break; @@ -95,30 +94,33 @@ Java_java_util_zip_Deflater_setDictionary(JNIEnv *env, jclass cls, jlong addr, jbyteArray b, jint off, jint len) { - jbyte *buf = (*env)->GetPrimitiveArrayCritical(env, b, 0); + int res; + Bytef *buf = (*env)->GetPrimitiveArrayCritical(env, b, 0); if (buf == NULL) /* out of memory */ return; - doSetDictionary(env, addr, buf + off, len); + res = deflateSetDictionary(jlong_to_ptr(addr), buf, len); (*env)->ReleasePrimitiveArrayCritical(env, b, buf, 0); + checkSetDictionaryResult(env, addr, res); } JNIEXPORT void JNICALL Java_java_util_zip_Deflater_setDictionaryBuffer(JNIEnv *env, jclass cls, jlong addr, jlong bufferAddr, jint len) { - jbyte *buf = jlong_to_ptr(bufferAddr); - doSetDictionary(env, addr, buf, len); + int res; + Bytef *buf = jlong_to_ptr(bufferAddr); + res = deflateSetDictionary(jlong_to_ptr(addr), buf, len); + checkSetDictionaryResult(env, addr, res); } -static jlong doDeflate(JNIEnv *env, jobject this, jlong addr, +static jint doDeflate(JNIEnv *env, jlong addr, jbyte *input, jint inputLen, jbyte *output, jint outputLen, jint flush, jint params) { z_stream *strm = jlong_to_ptr(addr); - jint inputUsed = 0, outputUsed = 0; - int finished = 0; int setParams = params & 1; + int res; strm->next_in = (Bytef *) input; strm->next_out = (Bytef *) output; @@ -128,7 +130,24 @@ if (setParams) { int strategy = (params >> 1) & 3; int level = params >> 3; - int res = deflateParams(strm, level, strategy); + res = deflateParams(strm, level, strategy); + } else { + res = deflate(strm, flush); + } + return res; +} + +static jlong checkDeflateStatus(JNIEnv *env, jlong addr, + jint inputLen, + jint outputLen, + jint params, int res) +{ + z_stream *strm = jlong_to_ptr(addr); + jint inputUsed = 0, outputUsed = 0; + int finished = 0; + int setParams = params & 1; + + if (setParams) { switch (res) { case Z_OK: setParams = 0; @@ -142,7 +161,6 @@ return 0; } } else { - int res = deflate(strm, flush); switch (res) { case Z_STREAM_END: finished = 1; @@ -169,6 +187,8 @@ jbyte *input = (*env)->GetPrimitiveArrayCritical(env, inputArray, 0); jbyte *output; jlong retVal; + jint res; + if (input == NULL) { if (inputLen != 0 && (*env)->ExceptionOccurred(env) == NULL) JNU_ThrowOutOfMemoryError(env, 0); @@ -182,14 +202,13 @@ return 0L; } - retVal = doDeflate(env, this, addr, - input + inputOff, inputLen, - output + outputOff, outputLen, - flush, params); + res = doDeflate(env, addr, input + inputOff, inputLen,output + outputOff, + outputLen, flush, params); (*env)->ReleasePrimitiveArrayCritical(env, outputArray, output, 0); (*env)->ReleasePrimitiveArrayCritical(env, inputArray, input, 0); + retVal = checkDeflateStatus(env, addr, inputLen, outputLen, params, res); return retVal; } @@ -203,6 +222,7 @@ jbyte *input = (*env)->GetPrimitiveArrayCritical(env, inputArray, 0); jbyte *output; jlong retVal; + jint res; if (input == NULL) { if (inputLen != 0 && (*env)->ExceptionOccurred(env) == NULL) JNU_ThrowOutOfMemoryError(env, 0); @@ -210,13 +230,12 @@ } output = jlong_to_ptr(outputBuffer); - retVal = doDeflate(env, this, addr, - input + inputOff, inputLen, - output, outputLen, - flush, params); + res = doDeflate(env, addr, input + inputOff, inputLen, output, outputLen, + flush, params); (*env)->ReleasePrimitiveArrayCritical(env, inputArray, input, 0); + retVal = checkDeflateStatus(env, addr, inputLen, outputLen, params, res); return retVal; } @@ -229,19 +248,18 @@ jbyte *input = jlong_to_ptr(inputBuffer); jbyte *output = (*env)->GetPrimitiveArrayCritical(env, outputArray, 0); jlong retVal; + jint res; if (output == NULL) { if (outputLen != 0 && (*env)->ExceptionOccurred(env) == NULL) JNU_ThrowOutOfMemoryError(env, 0); return 0L; } - retVal = doDeflate(env, this, addr, - input, inputLen, - output + outputOff, outputLen, - flush, params); - + res = doDeflate(env, addr, input, inputLen, output + outputOff, outputLen, + flush, params); (*env)->ReleasePrimitiveArrayCritical(env, outputArray, input, 0); + retVal = checkDeflateStatus(env, addr, inputLen, outputLen, params, res); return retVal; } @@ -253,11 +271,12 @@ { jbyte *input = jlong_to_ptr(inputBuffer); jbyte *output = jlong_to_ptr(outputBuffer); + jlong retVal; + jint res; - return doDeflate(env, this, addr, - input, inputLen, - output, outputLen, - flush, params); + res = doDeflate(env, addr, input, inputLen, output, outputLen, flush, params); + retVal = checkDeflateStatus(env, addr, inputLen, outputLen, params, res); + return retVal; } JNIEXPORT jint JNICALL diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/share/native/libzip/Inflater.c --- a/src/java.base/share/native/libzip/Inflater.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/share/native/libzip/Inflater.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -87,9 +87,8 @@ } } -static void doSetDictionary(JNIEnv *env, jlong addr, jbyte *buf, jint len) +static void checkSetDictionaryResult(JNIEnv *env, jlong addr, int res) { - int res = inflateSetDictionary(jlong_to_ptr(addr), (Bytef *) buf, len); switch (res) { case Z_OK: break; @@ -107,30 +106,31 @@ Java_java_util_zip_Inflater_setDictionary(JNIEnv *env, jclass cls, jlong addr, jbyteArray b, jint off, jint len) { - jbyte *buf = (*env)->GetPrimitiveArrayCritical(env, b, 0); + jint res; + Bytef *buf = (*env)->GetPrimitiveArrayCritical(env, b, 0); if (buf == NULL) /* out of memory */ return; - doSetDictionary(env, addr, buf + off, len); + res = inflateSetDictionary(jlong_to_ptr(addr), buf + off, len); (*env)->ReleasePrimitiveArrayCritical(env, b, buf, 0); + checkSetDictionaryResult(env, addr, res); } JNIEXPORT void JNICALL Java_java_util_zip_Inflater_setDictionaryBuffer(JNIEnv *env, jclass cls, jlong addr, jlong bufferAddr, jint len) { - jbyte *buf = jlong_to_ptr(bufferAddr); - doSetDictionary(env, addr, buf, len); + jint res; + Bytef *buf = jlong_to_ptr(bufferAddr); + res = inflateSetDictionary(jlong_to_ptr(addr), buf, len); + checkSetDictionaryResult(env, addr, res); } -static jlong doInflate(JNIEnv *env, jobject this, jlong addr, +static jint doInflate(jlong addr, jbyte *input, jint inputLen, jbyte *output, jint outputLen) { + jint ret; z_stream *strm = jlong_to_ptr(addr); - jint inputUsed = 0, outputUsed = 0; - int finished = 0; - int needDict = 0; - int ret; strm->next_in = (Bytef *) input; strm->next_out = (Bytef *) output; @@ -138,6 +138,16 @@ strm->avail_out = outputLen; ret = inflate(strm, Z_PARTIAL_FLUSH); + return ret; +} + +static jlong checkInflateStatus(JNIEnv *env, jobject this, jlong addr, + jint inputLen, jint outputLen, jint ret ) +{ + z_stream *strm = jlong_to_ptr(addr); + jint inputUsed = 0, outputUsed = 0; + int finished = 0; + int needDict = 0; switch (ret) { case Z_STREAM_END: @@ -180,6 +190,7 @@ { jbyte *input = (*env)->GetPrimitiveArrayCritical(env, inputArray, 0); jbyte *output; + jint ret; jlong retVal; if (input == NULL) { @@ -195,13 +206,13 @@ return 0L; } - retVal = doInflate(env, this, addr, - input + inputOff, inputLen, - output + outputOff, outputLen); + ret = doInflate(addr, input + inputOff, inputLen, output + outputOff, + outputLen); (*env)->ReleasePrimitiveArrayCritical(env, outputArray, output, 0); (*env)->ReleasePrimitiveArrayCritical(env, inputArray, input, 0); + retVal = checkInflateStatus(env, this, addr, inputLen, outputLen, ret ); return retVal; } @@ -212,6 +223,7 @@ { jbyte *input = (*env)->GetPrimitiveArrayCritical(env, inputArray, 0); jbyte *output; + jint ret; jlong retVal; if (input == NULL) { @@ -221,11 +233,10 @@ } output = jlong_to_ptr(outputBuffer); - retVal = doInflate(env, this, addr, - input + inputOff, inputLen, - output, outputLen); + ret = doInflate(addr, input + inputOff, inputLen, output, outputLen); (*env)->ReleasePrimitiveArrayCritical(env, inputArray, input, 0); + retVal = checkInflateStatus(env, this, addr, inputLen, outputLen, ret ); return retVal; } @@ -237,6 +248,7 @@ { jbyte *input = jlong_to_ptr(inputBuffer); jbyte *output = (*env)->GetPrimitiveArrayCritical(env, outputArray, 0); + jint ret; jlong retVal; if (output == NULL) { @@ -245,11 +257,10 @@ return 0L; } - retVal = doInflate(env, this, addr, - input, inputLen, - output + outputOff, outputLen); + ret = doInflate(addr, input, inputLen, output + outputOff, outputLen); (*env)->ReleasePrimitiveArrayCritical(env, outputArray, output, 0); + retVal = checkInflateStatus(env, this, addr, inputLen, outputLen, ret ); return retVal; } @@ -261,10 +272,12 @@ { jbyte *input = jlong_to_ptr(inputBuffer); jbyte *output = jlong_to_ptr(outputBuffer); + jint ret; + jlong retVal; - return doInflate(env, this, addr, - input, inputLen, - output, outputLen); + ret = doInflate(addr, input, inputLen, output, outputLen); + retVal = checkInflateStatus(env, this, addr, inputLen, outputLen, ret); + return retVal; } JNIEXPORT jint JNICALL diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java --- a/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -57,7 +57,7 @@ protected synchronized native void bind0(int lport, InetAddress laddr) throws SocketException; - protected native void send(DatagramPacket p) throws IOException; + protected native void send0(DatagramPacket p) throws IOException; protected synchronized native int peek(InetAddress i) throws IOException; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/unix/native/libjava/ProcessImpl_md.c --- a/src/java.base/unix/native/libjava/ProcessImpl_md.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c Fri Jun 21 14:07:48 2019 +0530 @@ -354,6 +354,27 @@ free(errmsg); } +/** + * Throws an IOException with a message composed from the result of waitpid status. + */ +static void throwExitCause(JNIEnv *env, int pid, int status) { + char ebuf[128]; + if (WIFEXITED(status)) { + snprintf(ebuf, sizeof ebuf, + "Failed to exec spawn helper: pid: %d, exit value: %d", + pid, WEXITSTATUS(status)); + } else if (WIFSIGNALED(status)) { + snprintf(ebuf, sizeof ebuf, + "Failed to exec spawn helper: pid: %d, signal: %d", + pid, WTERMSIG(status)); + } else { + snprintf(ebuf, sizeof ebuf, + "Failed to exec spawn helper: pid: %d, status: 0x%08x", + pid, status); + } + throwIOException(env, 0, ebuf); +} + #ifdef DEBUG_PROCESS /* Debugging process code is difficult; where to write debug output? */ static void @@ -690,9 +711,12 @@ if (c->sendAlivePing) { switch(readFully(fail[0], &errnum, sizeof(errnum))) { case 0: /* First exec failed; */ - waitpid(resultPid, NULL, 0); - throwIOException(env, 0, "Failed to exec spawn helper."); - goto Catch; + { + int tmpStatus = 0; + int p = waitpid(resultPid, &tmpStatus, 0); + throwExitCause(env, p, tmpStatus); + goto Catch; + } case sizeof(errnum): assert(errnum == CHILD_IS_ALIVE); if (errnum != CHILD_IS_ALIVE) { @@ -700,7 +724,7 @@ * helper should do is to send an alive ping to the parent, * before doing any subsequent work. */ throwIOException(env, 0, "Bad code from spawn helper " - "(Failed to exec spawn helper."); + "(Failed to exec spawn helper)"); goto Catch; } break; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/unix/native/libnet/Inet6AddressImpl.c --- a/src/java.base/unix/native/libnet/Inet6AddressImpl.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/unix/native/libnet/Inet6AddressImpl.c Fri Jun 21 14:07:48 2019 +0530 @@ -703,10 +703,6 @@ sa.sa6.sin6_family = AF_INET6; if (scope > 0) { sa.sa6.sin6_scope_id = scope; -#if defined(__linux__) - } else { - sa.sa6.sin6_scope_id = getDefaultIPv6Interface(&sa.sa6.sin6_addr); -#endif } // load network interface address to SOCKETADDRESS, if specified diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c --- a/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Fri Jun 21 14:07:48 2019 +0530 @@ -79,10 +79,6 @@ static jfieldID pdsi_connectedAddress; static jfieldID pdsi_connectedPort; -extern void setDefaultScopeID(JNIEnv *env, struct sockaddr *him); -extern int getDefaultScopeID(JNIEnv *env); - - /* * Returns a java.lang.Integer based on 'i' */ @@ -200,7 +196,6 @@ JNI_TRUE) != 0) { return; } - setDefaultScopeID(env, &sa.sa); if (NET_Bind(fd, &sa, len) < 0) { if (errno == EADDRINUSE || errno == EADDRNOTAVAIL || @@ -266,8 +261,6 @@ return; } - setDefaultScopeID(env, &rmtaddr.sa); - if (NET_Connect(fd, &rmtaddr.sa, len) == -1) { NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException", "Connect failed"); @@ -334,11 +327,11 @@ /* * Class: java_net_PlainDatagramSocketImpl - * Method: send + * Method: send0 * Signature: (Ljava/net/DatagramPacket;)V */ JNIEXPORT void JNICALL -Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this, +Java_java_net_PlainDatagramSocketImpl_send0(JNIEnv *env, jobject this, jobject packet) { char BUF[MAX_BUFFER_LEN]; @@ -393,7 +386,6 @@ } rmtaddrP = &rmtaddr.sa; } - setDefaultScopeID(env, &rmtaddr.sa); if (packetBufferLen > MAX_BUFFER_LEN) { /* When JNI-ifying the JDK's IO routines, we turned @@ -2145,26 +2137,6 @@ NET_ThrowCurrent(env, "getsockopt IPV6_MULTICAST_IF failed"); return; } - -#ifdef __linux__ - /* - * On 2.4.8+ if we join a group with the interface set to 0 - * then the kernel records the interface it decides. This causes - * subsequent leave groups to fail as there is no match. Thus we - * pick the interface if there is a matching route. - */ - if (index == 0) { - int rt_index = getDefaultIPv6Interface(&(mname6.ipv6mr_multiaddr)); - if (rt_index > 0) { - index = rt_index; - } - } -#endif -#ifdef MACOSX - if (family == AF_INET6 && index == 0) { - index = getDefaultScopeID(env); - } -#endif mname6.ipv6mr_interface = index; } else { jint idx = (*env)->GetIntField(env, niObj, ni_indexID); diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/unix/native/libnet/PlainSocketImpl.c --- a/src/java.base/unix/native/libnet/PlainSocketImpl.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/unix/native/libnet/PlainSocketImpl.c Fri Jun 21 14:07:48 2019 +0530 @@ -46,8 +46,6 @@ jfieldID psi_fdLockID; jfieldID psi_closePendingID; -extern void setDefaultScopeID(JNIEnv *env, struct sockaddr *him); - /* * file descriptor used for dup2 */ @@ -261,7 +259,6 @@ JNI_TRUE) != 0) { return; } - setDefaultScopeID(env, &sa.sa); if (trafficClass != 0 && ipv6_available()) { NET_SetTrafficClass(&sa, trafficClass); @@ -509,7 +506,6 @@ &len, JNI_TRUE) != 0) { return; } - setDefaultScopeID(env, &sa.sa); if (NET_Bind(fd, &sa, len) < 0) { if (errno == EADDRINUSE || errno == EADDRNOTAVAIL || diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/unix/native/libnet/net_util_md.c --- a/src/java.base/unix/native/libnet/net_util_md.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/unix/native/libnet/net_util_md.c Fri Jun 21 14:07:48 2019 +0530 @@ -452,285 +452,7 @@ } } -#if defined(__linux__) - -/* following code creates a list of addresses from the kernel - * routing table that are routed via the loopback address. - * We check all destination addresses against this table - * and override the scope_id field to use the relevant value for "lo" - * in order to work-around the Linux bug that prevents packets destined - * for certain local addresses from being sent via a physical interface. - */ - -struct loopback_route { - struct in6_addr addr; /* destination address */ - int plen; /* prefix length */ -}; - -static struct loopback_route *loRoutes = 0; -static int nRoutes = 0; /* number of routes */ -static int loRoutes_size = 16; /* initial size */ -static int lo_scope_id = 0; - -static void initLoopbackRoutes(); - -void printAddr (struct in6_addr *addr) { - int i; - for (i=0; i<16; i++) { - printf ("%02x", addr->s6_addr[i]); - } - printf ("\n"); -} - -static jboolean needsLoopbackRoute (struct in6_addr* dest_addr) { - int byte_count; - int extra_bits, i; - struct loopback_route *ptr; - - if (loRoutes == 0) { - initLoopbackRoutes(); - } - - for (ptr = loRoutes, i=0; iaddr; - int dest_plen = ptr->plen; - byte_count = dest_plen >> 3; - extra_bits = dest_plen & 0x3; - - if (byte_count > 0) { - if (memcmp(target_addr, dest_addr, byte_count)) { - continue; /* no match */ - } - } - - if (extra_bits > 0) { - unsigned char c1 = ((unsigned char *)target_addr)[byte_count]; - unsigned char c2 = ((unsigned char *)&dest_addr)[byte_count]; - unsigned char mask = 0xff << (8 - extra_bits); - if ((c1 & mask) != (c2 & mask)) { - continue; - } - } - return JNI_TRUE; - } - return JNI_FALSE; -} - - -static void initLoopbackRoutes() { - FILE *f; - char srcp[8][5]; - char hopp[8][5]; - int dest_plen, src_plen, use, refcnt, metric; - unsigned long flags; - char dest_str[40]; - struct in6_addr dest_addr; - char device[16]; - struct loopback_route *loRoutesTemp; - - if (loRoutes != 0) { - free (loRoutes); - } - loRoutes = calloc (loRoutes_size, sizeof(struct loopback_route)); - if (loRoutes == 0) { - return; - } - /* - * Scan /proc/net/ipv6_route looking for a matching - * route. - */ - if ((f = fopen("/proc/net/ipv6_route", "r")) == NULL) { - return ; - } - while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x " - "%4s%4s%4s%4s%4s%4s%4s%4s %02x " - "%4s%4s%4s%4s%4s%4s%4s%4s " - "%08x %08x %08x %08lx %8s", - dest_str, &dest_str[5], &dest_str[10], &dest_str[15], - &dest_str[20], &dest_str[25], &dest_str[30], &dest_str[35], - &dest_plen, - srcp[0], srcp[1], srcp[2], srcp[3], - srcp[4], srcp[5], srcp[6], srcp[7], - &src_plen, - hopp[0], hopp[1], hopp[2], hopp[3], - hopp[4], hopp[5], hopp[6], hopp[7], - &metric, &use, &refcnt, &flags, device) == 31) { - - /* - * Some routes should be ignored - */ - if ( (dest_plen < 0 || dest_plen > 128) || - (src_plen != 0) || - (flags & (RTF_POLICY | RTF_FLOW)) || - ((flags & RTF_REJECT) && dest_plen == 0) ) { - continue; - } - - /* - * Convert the destination address - */ - dest_str[4] = ':'; - dest_str[9] = ':'; - dest_str[14] = ':'; - dest_str[19] = ':'; - dest_str[24] = ':'; - dest_str[29] = ':'; - dest_str[34] = ':'; - dest_str[39] = '\0'; - - if (inet_pton(AF_INET6, dest_str, &dest_addr) < 0) { - /* not an Ipv6 address */ - continue; - } - if (strcmp(device, "lo") != 0) { - /* Not a loopback route */ - continue; - } else { - if (nRoutes == loRoutes_size) { - loRoutesTemp = realloc (loRoutes, loRoutes_size * - sizeof (struct loopback_route) * 2); - - if (loRoutesTemp == 0) { - free(loRoutes); - loRoutes = NULL; - nRoutes = 0; - fclose (f); - return; - } - loRoutes=loRoutesTemp; - loRoutes_size *= 2; - } - memcpy (&loRoutes[nRoutes].addr,&dest_addr,sizeof(struct in6_addr)); - loRoutes[nRoutes].plen = dest_plen; - nRoutes ++; - } - } - - fclose (f); - { - /* now find the scope_id for "lo" */ - - char devname[21]; - char addr6p[8][5]; - int plen, scope, dad_status, if_idx; - - if ((f = fopen("/proc/net/if_inet6", "r")) != NULL) { - while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n", - addr6p[0], addr6p[1], addr6p[2], addr6p[3], - addr6p[4], addr6p[5], addr6p[6], addr6p[7], - &if_idx, &plen, &scope, &dad_status, devname) == 13) { - - if (strcmp(devname, "lo") == 0) { - /* - * Found - so just return the index - */ - fclose(f); - lo_scope_id = if_idx; - return; - } - } - fclose(f); - } - } -} - -/* - * Following is used for binding to local addresses. Equivalent - * to code above, for bind(). - */ - -struct localinterface { - int index; - char localaddr [16]; -}; - -static struct localinterface *localifs = 0; -static int localifsSize = 0; /* size of array */ -static int nifs = 0; /* number of entries used in array */ - -/* not thread safe: make sure called once from one thread */ - -static void initLocalIfs () { - FILE *f; - unsigned char staddr [16]; - char ifname [33]; - struct localinterface *lif=0; - struct localinterface *localifsTemp; - int index, x1, x2, x3; - unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf; - - if ((f = fopen("/proc/net/if_inet6", "r")) == NULL) { - return ; - } - while (fscanf (f, "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x " - "%d %x %x %x %32s",&u0,&u1,&u2,&u3,&u4,&u5,&u6,&u7, - &u8,&u9,&ua,&ub,&uc,&ud,&ue,&uf, - &index, &x1, &x2, &x3, ifname) == 21) { - staddr[0] = (unsigned char)u0; - staddr[1] = (unsigned char)u1; - staddr[2] = (unsigned char)u2; - staddr[3] = (unsigned char)u3; - staddr[4] = (unsigned char)u4; - staddr[5] = (unsigned char)u5; - staddr[6] = (unsigned char)u6; - staddr[7] = (unsigned char)u7; - staddr[8] = (unsigned char)u8; - staddr[9] = (unsigned char)u9; - staddr[10] = (unsigned char)ua; - staddr[11] = (unsigned char)ub; - staddr[12] = (unsigned char)uc; - staddr[13] = (unsigned char)ud; - staddr[14] = (unsigned char)ue; - staddr[15] = (unsigned char)uf; - nifs ++; - if (nifs > localifsSize) { - localifsTemp = (struct localinterface *) realloc( - localifs, sizeof (struct localinterface)* (localifsSize+5)); - if (localifsTemp == 0) { - free(localifs); - localifs = 0; - localifsSize = 0; - nifs = 0; - fclose(f); - return; - } - localifs = localifsTemp; - lif = localifs + localifsSize; - localifsSize += 5; - } else { - lif ++; - } - memcpy (lif->localaddr, staddr, 16); - lif->index = index; - } - fclose (f); -} - -/* return the scope_id (interface index) of the - * interface corresponding to the given address - * returns 0 if no match found - */ - -static int getLocalScopeID (char *addr) { - struct localinterface *lif; - int i; - if (localifs == 0) { - initLocalIfs(); - } - for (i=0, lif=localifs; ilocaladdr, 16) == 0) { - return lif->index; - } - } - return 0; -} - -void platformInit () { - initLoopbackRoutes(); - initLocalIfs(); -} - -#elif defined(_AIX) +#if defined(_AIX) /* Initialize stubs for blocking I/O workarounds (see src/solaris/native/java/net/linux_close.c) */ extern void aix_close_init(); @@ -816,71 +538,12 @@ *len = sizeof(struct sockaddr_in6); } -#ifdef __linux__ - /* - * On Linux if we are connecting to a link-local address - * we need to specify the interface in the scope_id (2.4 kernel only) - * - * If the scope was cached then we use the cached value. If not cached but - * specified in the Inet6Address we use that, but we first check if the - * address needs to be routed via the loopback interface. In this case, - * we override the specified value with that of the loopback interface. - * If no cached value exists and no value was specified by user, then - * we try to determine a value from the routing table. In all these - * cases the used value is cached for further use. - */ - if (IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr)) { - unsigned int cached_scope_id = 0, scope_id = 0; - - if (ia6_cachedscopeidID) { - cached_scope_id = (int)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID); - /* if cached value exists then use it. Otherwise, check - * if scope is set in the address. - */ - if (!cached_scope_id) { - if (ia6_scopeidID) { - scope_id = getInet6Address_scopeid(env, iaObj); - } - if (scope_id != 0) { - /* check user-specified value for loopback case - * that needs to be overridden - */ - if (kernelIsV24() && needsLoopbackRoute(&sa->sa6.sin6_addr)) { - cached_scope_id = lo_scope_id; - (*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id); - } - } else { - /* - * Otherwise consult the IPv6 routing tables to - * try determine the appropriate interface. - */ - if (kernelIsV24()) { - cached_scope_id = getDefaultIPv6Interface(&sa->sa6.sin6_addr); - } else { - cached_scope_id = getLocalScopeID((char *)&(sa->sa6.sin6_addr)); - if (cached_scope_id == 0) { - cached_scope_id = getDefaultIPv6Interface(&sa->sa6.sin6_addr); - } - } - (*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id); - } - } - } - - /* - * If we have a scope_id use the extended form - * of sockaddr_in6. - */ - sa->sa6.sin6_scope_id = cached_scope_id == 0 ? scope_id : cached_scope_id; - } -#else /* handle scope_id */ if (family != java_net_InetAddress_IPv4) { if (ia6_scopeidID) { sa->sa6.sin6_scope_id = getInet6Address_scopeid(env, iaObj); } } -#endif } else { jint address; if (family != java_net_InetAddress_IPv4) { @@ -1015,158 +678,6 @@ } /* - * Determine the default interface for an IPv6 address. - * - * 1. Scans /proc/net/ipv6_route for a matching route - * (eg: fe80::/10 or a route for the specific address). - * This will tell us the interface to use (eg: "eth0"). - * - * 2. Lookup /proc/net/if_inet6 to map the interface - * name to an interface index. - * - * Returns :- - * -1 if error - * 0 if no matching interface - * >1 interface index to use for the link-local address. - */ -#if defined(__linux__) -int getDefaultIPv6Interface(struct in6_addr *target_addr) { - FILE *f; - char srcp[8][5]; - char hopp[8][5]; - int dest_plen, src_plen, use, refcnt, metric; - unsigned long flags; - char dest_str[40]; - struct in6_addr dest_addr; - char device[16]; - jboolean match = JNI_FALSE; - - /* - * Scan /proc/net/ipv6_route looking for a matching - * route. - */ - if ((f = fopen("/proc/net/ipv6_route", "r")) == NULL) { - return -1; - } - while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x " - "%4s%4s%4s%4s%4s%4s%4s%4s %02x " - "%4s%4s%4s%4s%4s%4s%4s%4s " - "%08x %08x %08x %08lx %8s", - dest_str, &dest_str[5], &dest_str[10], &dest_str[15], - &dest_str[20], &dest_str[25], &dest_str[30], &dest_str[35], - &dest_plen, - srcp[0], srcp[1], srcp[2], srcp[3], - srcp[4], srcp[5], srcp[6], srcp[7], - &src_plen, - hopp[0], hopp[1], hopp[2], hopp[3], - hopp[4], hopp[5], hopp[6], hopp[7], - &metric, &use, &refcnt, &flags, device) == 31) { - - /* - * Some routes should be ignored - */ - if ( (dest_plen < 0 || dest_plen > 128) || - (src_plen != 0) || - (flags & (RTF_POLICY | RTF_FLOW)) || - ((flags & RTF_REJECT) && dest_plen == 0) ) { - continue; - } - - /* - * Convert the destination address - */ - dest_str[4] = ':'; - dest_str[9] = ':'; - dest_str[14] = ':'; - dest_str[19] = ':'; - dest_str[24] = ':'; - dest_str[29] = ':'; - dest_str[34] = ':'; - dest_str[39] = '\0'; - - if (inet_pton(AF_INET6, dest_str, &dest_addr) < 0) { - /* not an Ipv6 address */ - continue; - } else { - /* - * The prefix len (dest_plen) indicates the number of bits we - * need to match on. - * - * dest_plen / 8 => number of bytes to match - * dest_plen % 8 => number of additional bits to match - * - * eg: fe80::/10 => match 1 byte + 2 additional bits in the - * next byte. - */ - int byte_count = dest_plen >> 3; - int extra_bits = dest_plen & 0x3; - - if (byte_count > 0) { - if (memcmp(target_addr, &dest_addr, byte_count)) { - continue; /* no match */ - } - } - - if (extra_bits > 0) { - unsigned char c1 = ((unsigned char *)target_addr)[byte_count]; - unsigned char c2 = ((unsigned char *)&dest_addr)[byte_count]; - unsigned char mask = 0xff << (8 - extra_bits); - if ((c1 & mask) != (c2 & mask)) { - continue; - } - } - - /* - * We have a match - */ - match = JNI_TRUE; - break; - } - } - fclose(f); - - /* - * If there's a match then we lookup the interface - * index. - */ - if (match) { - char devname[21]; - char addr6p[8][5]; - int plen, scope, dad_status, if_idx; - - if ((f = fopen("/proc/net/if_inet6", "r")) != NULL) { - while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n", - addr6p[0], addr6p[1], addr6p[2], addr6p[3], - addr6p[4], addr6p[5], addr6p[6], addr6p[7], - &if_idx, &plen, &scope, &dad_status, devname) == 13) { - - if (strcmp(devname, device) == 0) { - /* - * Found - so just return the index - */ - fclose(f); - return if_idx; - } - } - fclose(f); - } else { - /* - * Couldn't open /proc/net/if_inet6 - */ - return -1; - } - } - - /* - * If we get here it means we didn't there wasn't any - * route or we couldn't get the index of the interface. - */ - return 0; -} -#endif - - -/* * Wrapper for getsockopt system routine - does any necessary * pre/post processing to deal with OS specific oddities :- * diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/unix/native/libnet/net_util_md.h --- a/src/java.base/unix/native/libnet/net_util_md.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/unix/native/libnet/net_util_md.h Fri Jun 21 14:07:48 2019 +0530 @@ -101,7 +101,6 @@ #ifdef __linux__ int kernelIsV24(); -int getDefaultIPv6Interface(struct in6_addr *target_addr); #endif #ifdef __solaris__ diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java --- a/src/java.base/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -124,7 +124,7 @@ socketReceiveOrPeekData(nativefd, p, timeout, connected, false /*receive*/); } - protected void send(DatagramPacket p) throws IOException { + protected void send0(DatagramPacket p) throws IOException { int nativefd = checkAndReturnNativeFD(); if (p == null) diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java --- a/src/java.base/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -184,7 +184,7 @@ boolean exclBind) throws SocketException; - protected native void send(DatagramPacket p) throws IOException; + protected native void send0(DatagramPacket p) throws IOException; protected synchronized native int peek(InetAddress i) throws IOException; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/windows/native/libnet/Inet4AddressImpl.c --- a/src/java.base/windows/native/libnet/Inet4AddressImpl.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/windows/native/libnet/Inet4AddressImpl.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -359,7 +359,8 @@ } if (dwRetVal == 0) { // if the call failed - TCHAR *buf; + TCHAR *buf = NULL; + DWORD n; DWORD err = WSAGetLastError(); switch (err) { case ERROR_NO_NETWORK: @@ -379,9 +380,17 @@ case IP_REQ_TIMED_OUT: break; default: - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&buf, 0, NULL); + n = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR)&buf, 0, NULL); + if (n > 3) { + // Drop final '.', CR, LF + if (buf[n - 1] == TEXT('\n')) n--; + if (buf[n - 1] == TEXT('\r')) n--; + if (buf[n - 1] == TEXT('.')) n--; + buf[n] = TEXT('\0'); + } NET_ThrowNew(env, err, buf); LocalFree(buf); break; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c --- a/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c Fri Jun 21 14:07:48 2019 +0530 @@ -415,11 +415,11 @@ /* * Class: java_net_TwoStacksPlainDatagramSocketImpl - * Method: send + * Method: send0 * Signature: (Ljava/net/DatagramPacket;)V */ JNIEXPORT void JNICALL -Java_java_net_TwoStacksPlainDatagramSocketImpl_send +Java_java_net_TwoStacksPlainDatagramSocketImpl_send0 (JNIEnv *env, jobject this, jobject packet) { char BUF[MAX_BUFFER_LEN]; diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/windows/native/libnet/net_util_md.c --- a/src/java.base/windows/native/libnet/net_util_md.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/windows/native/libnet/net_util_md.c Fri Jun 21 14:07:48 2019 +0530 @@ -752,37 +752,6 @@ return 0; } -/* - * Determine the default interface for an IPv6 address. - * - * Returns :- - * 0 if error - * > 0 interface index to use - */ -jint getDefaultIPv6Interface(JNIEnv *env, struct sockaddr_in6 *target_addr) -{ - int ret; - DWORD b; - struct sockaddr_in6 route; - SOCKET fd = socket(AF_INET6, SOCK_STREAM, 0); - if (fd == INVALID_SOCKET) { - return 0; - } - - ret = WSAIoctl(fd, SIO_ROUTING_INTERFACE_QUERY, - (void *)target_addr, sizeof(struct sockaddr_in6), - (void *)&route, sizeof(struct sockaddr_in6), - &b, 0, 0); - if (ret == SOCKET_ERROR) { - // error - closesocket(fd); - return 0; - } else { - closesocket(fd); - return route.sin6_scope_id; - } -} - /** * Enables SIO_LOOPBACK_FAST_PATH */ @@ -820,7 +789,7 @@ { jbyte caddr[16]; jint address; - unsigned int scopeid = 0, cached_scope_id = 0; + unsigned int scopeid = 0; if (family == java_net_InetAddress_IPv4) { // convert to IPv4-mapped address @@ -842,19 +811,11 @@ } else { getInet6Address_ipaddress(env, iaObj, (char *)caddr); scopeid = getInet6Address_scopeid(env, iaObj); - cached_scope_id = (unsigned int)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID); } sa->sa6.sin6_port = (u_short)htons((u_short)port); memcpy((void *)&sa->sa6.sin6_addr, caddr, sizeof(struct in6_addr)); sa->sa6.sin6_family = AF_INET6; - if ((family == java_net_InetAddress_IPv6) && - IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr) && - (!scopeid && !cached_scope_id)) - { - cached_scope_id = getDefaultIPv6Interface(env, &sa->sa6); - (*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id); - } - sa->sa6.sin6_scope_id = scopeid == 0 ? cached_scope_id : scopeid; + sa->sa6.sin6_scope_id = scopeid; if (len != NULL) { *len = sizeof(struct sockaddr_in6); } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/windows/native/libnio/ch/Iocp.c --- a/src/java.base/windows/native/libnio/ch/Iocp.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/windows/native/libnio/ch/Iocp.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -142,6 +142,14 @@ if (len == 0) { return NULL; } else { + if (len > 3) { + // Drop final '.', CR, LF + if (message[len - 1] == L'\n') len--; + if (message[len - 1] == L'\r') len--; + if (message[len - 1] == L'.') len--; + message[len] = L'\0'; + } + return (*env)->NewString(env, (const jchar *)message, (jsize)wcslen(message)); } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c --- a/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c Fri Jun 21 14:07:48 2019 +0530 @@ -177,6 +177,14 @@ if (len == 0) { return NULL; } else { + if (len > 3) { + // Drop final '.', CR, LF + if (message[len - 1] == L'\n') len--; + if (message[len - 1] == L'\r') len--; + if (message[len - 1] == L'.') len--; + message[len] = L'\0'; + } + return (*env)->NewString(env, (const jchar *)message, (jsize)wcslen(message)); } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/SourceVersion.java --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Fri Jun 21 14:07:48 2019 +0530 @@ -58,8 +58,9 @@ * 9: modules, small cleanups to 1.7 and 1.8 changes * 10: local-variable type inference (var) * 11: local-variable syntax for lambda parameters - * 12: no changes (switch expressions in preview) - * 13: TBD + * 12: no changes (switch expressions were in preview) + * 13: no changes (switch expressions and text blocks in preview) + * 14: TBD */ /** @@ -192,7 +193,15 @@ * * @since 13 */ - RELEASE_13; + RELEASE_13, + + /** + * The version recognized by the Java Platform, Standard Edition + * 14. + * + * @since 14 + */ + RELEASE_14; // Note that when adding constants for newer releases, the // behavior of latest() and latestSupported() must be updated too. @@ -203,7 +212,7 @@ * @return the latest source version that can be modeled */ public static SourceVersion latest() { - return RELEASE_13; + return RELEASE_14; } private static final SourceVersion latestSupported = getLatestSupported(); @@ -218,7 +227,7 @@ private static SourceVersion getLatestSupported() { int intVersion = Runtime.version().feature(); return (intVersion >= 11) ? - valueOf("RELEASE_" + Math.min(13, intVersion)): + valueOf("RELEASE_" + Math.min(14, intVersion)): RELEASE_10; } diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -32,7 +32,7 @@ /** * A skeletal visitor for annotation values with default behavior * appropriate for source versions {@link SourceVersion#RELEASE_9 - * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}. + * RELEASE_9} through {@link SourceVersion#RELEASE_14 RELEASE_14}. * *

WARNING: The {@code AnnotationValueVisitor} interface * implemented by this class may have methods added to it in the @@ -59,7 +59,7 @@ * @see AbstractAnnotationValueVisitor8 * @since 9 */ -@SupportedSourceVersion(RELEASE_13) +@SupportedSourceVersion(RELEASE_14) public abstract class AbstractAnnotationValueVisitor9 extends AbstractAnnotationValueVisitor8 { /** diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -34,7 +34,7 @@ /** * A skeletal visitor of program elements with default behavior * appropriate for source versions {@link SourceVersion#RELEASE_9 - * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}. + * RELEASE_9} through {@link SourceVersion#RELEASE_14 RELEASE_14}. * *

WARNING: The {@code ElementVisitor} interface * implemented by this class may have methods added to it in the @@ -65,7 +65,7 @@ * @since 9 * @spec JPMS */ -@SupportedSourceVersion(RELEASE_13) +@SupportedSourceVersion(RELEASE_14) public abstract class AbstractElementVisitor9 extends AbstractElementVisitor8 { /** * Constructor for concrete subclasses to call. diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -33,7 +33,7 @@ /** * A skeletal visitor of types with default behavior appropriate for * source versions {@link SourceVersion#RELEASE_9 RELEASE_9} through - * {@link SourceVersion#RELEASE_13 RELEASE_13}. + * {@link SourceVersion#RELEASE_14 RELEASE_14}. * *

WARNING: The {@code TypeVisitor} interface implemented * by this class may have methods added to it in the future to @@ -63,7 +63,7 @@ * @see AbstractTypeVisitor8 * @since 9 */ -@SupportedSourceVersion(RELEASE_13) +@SupportedSourceVersion(RELEASE_14) public abstract class AbstractTypeVisitor9 extends AbstractTypeVisitor8 { /** * Constructor for concrete subclasses to call. diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -34,7 +34,7 @@ * A visitor of program elements based on their {@linkplain * ElementKind kind} with default behavior appropriate for source * versions {@link SourceVersion#RELEASE_9 RELEASE_9} through {@link - * SourceVersion#RELEASE_13 RELEASE_13}. + * SourceVersion#RELEASE_14 RELEASE_14}. * * For {@linkplain * Element elements} Xyz that may have more than one @@ -80,7 +80,7 @@ * @since 9 * @spec JPMS */ -@SupportedSourceVersion(RELEASE_13) +@SupportedSourceVersion(RELEASE_14) public class ElementKindVisitor9 extends ElementKindVisitor8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -34,7 +34,7 @@ /** * A scanning visitor of program elements with default behavior * appropriate for source versions {@link SourceVersion#RELEASE_9 - * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}. + * RELEASE_9} through {@link SourceVersion#RELEASE_14 RELEASE_14}. * * The visitXyz methods in this * class scan their component elements by calling {@code scan} on @@ -92,7 +92,7 @@ * @since 9 * @spec JPMS */ -@SupportedSourceVersion(RELEASE_13) +@SupportedSourceVersion(RELEASE_14) public class ElementScanner9 extends ElementScanner8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -32,7 +32,7 @@ /** * A simple visitor for annotation values with default behavior * appropriate for source versions {@link SourceVersion#RELEASE_9 - * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}. + * RELEASE_9} through {@link SourceVersion#RELEASE_14 RELEASE_14}. * * Visit methods call {@link #defaultAction * defaultAction} passing their arguments to {@code defaultAction}'s @@ -68,7 +68,7 @@ * @see SimpleAnnotationValueVisitor8 * @since 9 */ -@SupportedSourceVersion(RELEASE_13) +@SupportedSourceVersion(RELEASE_14) public class SimpleAnnotationValueVisitor9 extends SimpleAnnotationValueVisitor8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -33,7 +33,7 @@ /** * A simple visitor of program elements with default behavior * appropriate for source versions {@link SourceVersion#RELEASE_9 - * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}. + * RELEASE_9} through {@link SourceVersion#RELEASE_14 RELEASE_14}. * * Visit methods corresponding to {@code RELEASE_9} and earlier * language constructs call {@link #defaultAction defaultAction}, @@ -73,7 +73,7 @@ * @since 9 * @spec JPMS */ -@SupportedSourceVersion(RELEASE_13) +@SupportedSourceVersion(RELEASE_14) public class SimpleElementVisitor9 extends SimpleElementVisitor8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -33,7 +33,7 @@ /** * A simple visitor of types with default behavior appropriate for * source versions {@link SourceVersion#RELEASE_9 RELEASE_9} through - * {@link SourceVersion#RELEASE_13 RELEASE_13}. + * {@link SourceVersion#RELEASE_14 RELEASE_14}. * * Visit methods corresponding to {@code RELEASE_9} and earlier * language constructs call {@link #defaultAction defaultAction}, @@ -73,7 +73,7 @@ * @see SimpleTypeVisitor8 * @since 9 */ -@SupportedSourceVersion(RELEASE_13) +@SupportedSourceVersion(RELEASE_14) public class SimpleTypeVisitor9 extends SimpleTypeVisitor8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 28582d575a98 -r fd4ec73925c3 src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -34,7 +34,7 @@ * A visitor of types based on their {@linkplain TypeKind kind} with * default behavior appropriate for source versions {@link * SourceVersion#RELEASE_9 RELEASE_9} through {@link - * SourceVersion#RELEASE_13 RELEASE_13}. + * SourceVersion#RELEASE_14 RELEASE_14}. * * For {@linkplain * TypeMirror types} Xyz that may have more than one @@ -77,7 +77,7 @@ * @see TypeKindVisitor8 * @since 9 */ -@SupportedSourceVersion(RELEASE_13) +@SupportedSourceVersion(RELEASE_14) public class TypeKindVisitor9 extends TypeKindVisitor8 { /** * Constructor for concrete subclasses to call; uses {@code null} diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java --- a/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -67,6 +67,7 @@ "DELETE", DefaultEditorKit.deleteNextCharAction, "alt DELETE", "delete-next-word", "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, + "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction, "alt BACK_SPACE", "delete-previous-word", "LEFT", DefaultEditorKit.backwardAction, diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/classes/com/sun/media/sound/AuFileFormat.java --- a/src/java.desktop/share/classes/com/sun/media/sound/AuFileFormat.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/classes/com/sun/media/sound/AuFileFormat.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -45,8 +45,8 @@ static final int AU_LINEAR_24 = 4; /* 24-bit linear PCM */ static final int AU_LINEAR_32 = 5; /* 32-bit linear PCM */ static final int AU_FLOAT = 6; /* 32-bit IEEE floating point */ + static final int AU_DOUBLE = 7; /* 64-bit IEEE floating point */ // we don't support these ... -// static final int AU_DOUBLE = 7; /* 64-bit IEEE floating point */ // static final int AU_ADPCM_G721 = 23; /* 4-bit CCITT g.721 ADPCM */ // static final int AU_ADPCM_G722 = 24; /* CCITT g.722 ADPCM */ // static final int AU_ADPCM_G723_3 = 25; /* CCITT g.723 3-bit ADPCM */ @@ -93,6 +93,8 @@ } else if (AudioFormat.Encoding.PCM_FLOAT.equals(encoding)) { if (format.getSampleSizeInBits() == 32) { auType = AU_FLOAT; + } else if (format.getSampleSizeInBits() == 64) { + auType = AU_DOUBLE; } } } diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java --- a/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -101,12 +101,12 @@ encoding = AudioFormat.Encoding.PCM_FLOAT; sampleSizeInBits = 32; break; + case AuFileFormat.AU_DOUBLE: + encoding = AudioFormat.Encoding.PCM_FLOAT; + sampleSizeInBits = 64; + break; // we don't support these ... - /* case AuFileFormat.AU_DOUBLE: - encoding = new AudioFormat.DOUBLE; - sampleSizeInBits = 8; - break; - case AuFileFormat.AU_ADPCM_G721: + /* case AuFileFormat.AU_ADPCM_G721: encoding = new AudioFormat.G721_ADPCM; sampleSizeInBits = 16; break; diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/classes/java/awt/Font.java --- a/src/java.desktop/share/classes/java/awt/Font.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/classes/java/awt/Font.java Fri Jun 21 14:07:48 2019 +0530 @@ -2144,9 +2144,10 @@ * Checks if this {@code Font} has a glyph for the specified * character. * - *

Note: This method cannot handle supplementary - * characters. To support all Unicode characters, including + *

Note: This method cannot handle + * + * supplementary characters. + * To support all Unicode characters, including * supplementary characters, use the {@link #canDisplay(int)} * method or {@code canDisplayUpTo} methods. * diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/classes/java/awt/FontMetrics.java --- a/src/java.desktop/share/classes/java/awt/FontMetrics.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/classes/java/awt/FontMetrics.java Fri Jun 21 14:07:48 2019 +0530 @@ -317,8 +317,9 @@ * of its characters. * *

Note: This method cannot handle supplementary - * characters. To support all Unicode characters, including + * href="../../../java.base/java/lang/Character.html#supplementary"> + * supplementary characters. + * To support all Unicode characters, including * supplementary characters, use the {@link #charWidth(int)} method. * * @param ch the character to be measured diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/classes/java/awt/doc-files/DesktopProperties.html --- a/src/java.desktop/share/classes/java/awt/doc-files/DesktopProperties.html Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/classes/java/awt/doc-files/DesktopProperties.html Fri Jun 21 14:07:48 2019 +0530 @@ -65,12 +65,12 @@ awt.font.desktophints -java.util.Map +{@link java.util.Map java.util.Map} Font smoothing (text antialiasing) settings. sun.awt.enableExtraMouseButtons -java.lang.Boolean +{@link java.lang.Boolean java.lang.Boolean} Controls if mouse events from extra buttons are to be generated or not diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html --- a/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html Fri Jun 21 14:07:48 2019 +0530 @@ -191,7 +191,7 @@ with the ICC profile-based color space, then a second ImageTypeSpecifier derived from this inferred color space will be included in the -Iterator returned by +{@link java.util.Iterator Iterator} returned by ImageReader.getImageTypes. If the iterator contains more than one type, the first one will be based on the ICC profile and the second on the inferred color space.

diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/classes/javax/print/DocFlavor.java --- a/src/java.desktop/share/classes/javax/print/DocFlavor.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/classes/javax/print/DocFlavor.java Fri Jun 21 14:07:48 2019 +0530 @@ -44,9 +44,9 @@ * the IANA MIME-preferred name, or its canonical name if no preferred name is * specified. Additionally a few historical names supported by earlier * versions of the Java platform may be recognized. See - * character encodings - * for more information on the character encodings supported on the Java - * platform. + * + * character encodings for more information on the character encodings + * supported on the Java platform. *
  • Representation class name. This specifies the fully-qualified * name of the class of the object from which the actual print data comes, as * returned by the {@link Class#getName() Class.getName()} method. (Thus the diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/classes/javax/print/attribute/package-info.java --- a/src/java.desktop/share/classes/javax/print/attribute/package-info.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/classes/javax/print/attribute/package-info.java Fri Jun 21 14:07:48 2019 +0530 @@ -137,7 +137,7 @@ * AttributeSet interface. *

    * The {@code AttributeSet} interface is similar to the - * Map interface: it provides a map of + * {@link java.util.Map Map} interface: it provides a map of * key to values, in which each key is unique and can contain no more than one * value. However, the {@code AttributeSet} interface is designed to * specifically support the needs of the Java Print Service API. An diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/legal/giflib.md --- a/src/java.desktop/share/legal/giflib.md Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/legal/giflib.md Fri Jun 21 14:07:48 2019 +0530 @@ -1,7 +1,7 @@ ## GIFLIB v5.1.8 ### GIFLIB License -

    +```
     
     The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
     
    @@ -17,10 +17,27 @@
     
     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     THE SOFTWARE.
     
    -
    + +https://sourceforge.net/p/giflib/code/ci/master/tree/openbsd-reallocarray.c + +Copyright (c) 2008 Otto Moerbeek + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +``` diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/share/native/libfontmanager/freetypeScaler.c --- a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c Fri Jun 21 14:07:48 2019 +0530 @@ -29,7 +29,10 @@ #include "sunfontids.h" #include "sun_font_FreetypeFontScaler.h" -#include +#include +#if !defined(_WIN32) && !defined(__APPLE_) +#include +#endif #include #include "ft2build.h" #include FT_FREETYPE_H @@ -39,6 +42,7 @@ #include FT_OUTLINE_H #include FT_SYNTHESIS_H #include FT_LCD_FILTER_H +#include FT_MODULE_H #include "fontscaler.h" @@ -204,6 +208,52 @@ } } +typedef FT_Error (*FT_Prop_Set_Func)(FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + const void* value ); + +/** + * Prefer the older v35 freetype byte code interpreter. + */ +static void setInterpreterVersion(FT_Library library) { + + char* props = getenv("FREETYPE_PROPERTIES"); + int version = 35; + const char* module = "truetype"; + const char* property = "interpreter-version"; + + /* If some one is setting this, don't override it */ + if (props != NULL && strstr(property, props)) { + return; + } + /* + * FT_Property_Set was introduced in 2.4.11. + * Some older supported Linux OSes may not include it so look + * this up dynamically. + * And if its not available it doesn't matter, since the reason + * we need it dates from 2.7. + * On Windows & Mac the library is always bundled so it is safe + * to use directly in those cases. + */ +#if defined(_WIN32) || defined(__APPLE__) + FT_Property_Set(library, module, property, (void*)(&version)); +#else + void *lib = dlopen("libfreetype.so", RTLD_LOCAL|RTLD_LAZY); + if (lib == NULL) { + lib = dlopen("libfreetype.so.6", RTLD_LOCAL|RTLD_LAZY); + if (lib == NULL) { + return; + } + } + FT_Prop_Set_Func func = (FT_Prop_Set_Func)dlsym(lib, "FT_Property_Set"); + if (func != NULL) { + func(library, module, property, (void*)(&version)); + } + dlclose(lib); +#endif +} + /* * Class: sun_font_FreetypeFontScaler * Method: initNativeScaler @@ -243,6 +293,7 @@ free(scalerInfo); return 0; } + setInterpreterVersion(scalerInfo->library); #define TYPE1_FROM_JAVA 2 diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c --- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c Fri Jun 21 14:07:48 2019 +0530 @@ -119,9 +119,8 @@ } XineramaScreenInfo; typedef XineramaScreenInfo* XineramaQueryScreensFunc(Display*, int*); - +static XineramaQueryScreensFunc* XineramaQueryScreens = NULL; Bool usingXinerama = False; -XRectangle fbrects[MAXFRAMEBUFFERS]; JNIEXPORT void JNICALL Java_sun_awt_X11GraphicsConfig_initIDs (JNIEnv *env, jclass cls) @@ -586,7 +585,6 @@ int32_t locNumScr = 0; XineramaScreenInfo *xinInfo; char* XineramaQueryScreensName = "XineramaQueryScreens"; - XineramaQueryScreensFunc* XineramaQueryScreens = NULL; gotXinExt = XQueryExtension(awt_display, XinExtName, &major_opcode, &first_event, &first_error); @@ -612,36 +610,27 @@ XineramaQueryScreens = (XineramaQueryScreensFunc*) dlsym(libHandle, XineramaQueryScreensName); - if (XineramaQueryScreens != NULL) { + if (XineramaQueryScreens == NULL) { + DTRACE_PRINTLN("couldn't load XineramaQueryScreens symbol"); + dlclose(libHandle); + } else { DTRACE_PRINTLN("calling XineramaQueryScreens func"); xinInfo = (*XineramaQueryScreens)(awt_display, &locNumScr); - if (xinInfo != NULL && locNumScr > XScreenCount(awt_display)) { - int32_t idx; - DTRACE_PRINTLN("Enabling Xinerama support"); - usingXinerama = True; - /* set global number of screens */ - DTRACE_PRINTLN1(" num screens = %i\n", locNumScr); - awt_numScreens = locNumScr; - - /* stuff values into fbrects */ - for (idx = 0; idx < awt_numScreens; idx++) { - DASSERT(xinInfo[idx].screen_number == idx); - - fbrects[idx].width = xinInfo[idx].width; - fbrects[idx].height = xinInfo[idx].height; - fbrects[idx].x = xinInfo[idx].x_org; - fbrects[idx].y = xinInfo[idx].y_org; + if (xinInfo != NULL) { + if (locNumScr > XScreenCount(awt_display)) { + DTRACE_PRINTLN("Enabling Xinerama support"); + usingXinerama = True; + /* set global number of screens */ + DTRACE_PRINTLN1(" num screens = %i\n", locNumScr); + awt_numScreens = locNumScr; + } else { + DTRACE_PRINTLN("XineramaQueryScreens <= XScreenCount"); } + XFree(xinInfo); } else { - DTRACE_PRINTLN((xinInfo == NULL) ? - "calling XineramaQueryScreens didn't work" : - "XineramaQueryScreens <= XScreenCount" - ); + DTRACE_PRINTLN("calling XineramaQueryScreens didn't work"); } - } else { - DTRACE_PRINTLN("couldn't load XineramaQueryScreens symbol"); } - dlclose(libHandle); } else { DTRACE_PRINTLN1("\ncouldn't open shared library: %s\n", dlerror()); } @@ -1303,6 +1292,8 @@ jmethodID mid; jobject bounds = NULL; AwtGraphicsConfigDataPtr adata; + int32_t locNumScr = 0; + XineramaScreenInfo *xinInfo; adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, this, x11GraphicsConfigIDs.aData); @@ -1313,17 +1304,30 @@ if (mid != NULL) { if (usingXinerama) { if (0 <= screen && screen < awt_numScreens) { - bounds = (*env)->NewObject(env, clazz, mid, fbrects[screen].x, - fbrects[screen].y, - fbrects[screen].width, - fbrects[screen].height); + AWT_LOCK(); + xinInfo = (*XineramaQueryScreens)(awt_display, &locNumScr); + AWT_UNLOCK(); + if (xinInfo != NULL && locNumScr > 0) { + if (screen >= locNumScr) { + screen = 0; // fallback to the main screen + } + DASSERT(xinInfo[screen].screen_number == screen); + bounds = (*env)->NewObject(env, clazz, mid, + xinInfo[screen].x_org, + xinInfo[screen].y_org, + xinInfo[screen].width, + xinInfo[screen].height); + XFree(xinInfo); + } } else { jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalArgumentException"); if (exceptionClass != NULL) { (*env)->ThrowNew(env, exceptionClass, "Illegal screen index"); } } - } else { + } + if (!bounds) { + // Xinerama cannot provide correct bounds, will try X11 XWindowAttributes xwa; memset(&xwa, 0, sizeof(xwa)); diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c --- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c Fri Jun 21 14:07:48 2019 +0530 @@ -324,6 +324,8 @@ /* GDK */ fp_gdk_get_default_root_window = dl_symbol("gdk_get_default_root_window"); + fp_gdk_window_get_scale_factor = + dl_symbol("gdk_window_get_scale_factor"); /* Pixbuf */ fp_gdk_pixbuf_new = dl_symbol("gdk_pixbuf_new"); @@ -2888,7 +2890,10 @@ jint *ary; GdkWindow *root = (*fp_gdk_get_default_root_window)(); - pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(root, x, y, width, height); + int win_scale = (*fp_gdk_window_get_scale_factor)(root); + pixbuf = (*fp_gdk_pixbuf_get_from_drawable)( + root, x, y, (int)(width / (float)win_scale + 0.5), (int)(height / (float)win_scale + 0.5)); + if (pixbuf && scale != 1) { GdkPixbuf *scaledPixbuf; x /= scale; @@ -2906,8 +2911,8 @@ if (pixbuf) { int nchan = (*fp_gdk_pixbuf_get_n_channels)(pixbuf); int stride = (*fp_gdk_pixbuf_get_rowstride)(pixbuf); - if ((*fp_gdk_pixbuf_get_width)(pixbuf) == width - && (*fp_gdk_pixbuf_get_height)(pixbuf) == height + if ((*fp_gdk_pixbuf_get_width)(pixbuf) >= width + && (*fp_gdk_pixbuf_get_height)(pixbuf) >= height && (*fp_gdk_pixbuf_get_bits_per_sample)(pixbuf) == 8 && (*fp_gdk_pixbuf_get_colorspace)(pixbuf) == GDK_COLORSPACE_RGB && nchan >= 3 diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h --- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h Fri Jun 21 14:07:48 2019 +0530 @@ -253,6 +253,7 @@ static void (*fp_g_free)(gpointer mem); static void (*fp_g_object_unref)(gpointer object); static GdkWindow *(*fp_gdk_get_default_root_window) (void); +static int (*fp_gdk_window_get_scale_factor) (GdkWindow *window); static int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf); static guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf); diff -r 28582d575a98 -r fd4ec73925c3 src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java --- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -25,23 +25,38 @@ package sun.awt.shell; -import java.awt.*; +import java.awt.Image; +import java.awt.Toolkit; import java.awt.image.BufferedImage; -import java.awt.image.BaseMultiResolutionImage; - import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import java.util.concurrent.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import java.util.stream.Stream; -import static sun.awt.shell.Win32ShellFolder2.*; import sun.awt.OSInfo; import sun.awt.util.ThreadGroupUtils; +import sun.util.logging.PlatformLogger; + +import static sun.awt.shell.Win32ShellFolder2.DESKTOP; +import static sun.awt.shell.Win32ShellFolder2.DRIVES; +import static sun.awt.shell.Win32ShellFolder2.Invoker; +import static sun.awt.shell.Win32ShellFolder2.MultiResolutionIconImage; +import static sun.awt.shell.Win32ShellFolder2.NETWORK; +import static sun.awt.shell.Win32ShellFolder2.PERSONAL; +import static sun.awt.shell.Win32ShellFolder2.RECENT; // NOTE: This class supersedes Win32ShellFolderManager, which was removed // from distribution after version 1.4.2. @@ -54,6 +69,9 @@ final class Win32ShellFolderManager2 extends ShellFolderManager { + private static final PlatformLogger + log = PlatformLogger.getLogger("sun.awt.shell.Win32ShellFolderManager2"); + static { // Load library here sun.awt.windows.WToolkit.loadLibraries(); @@ -145,12 +163,13 @@ if (desktop == null) { try { desktop = new Win32ShellFolder2(DESKTOP); - } catch (SecurityException e) { - // Ignore error - } catch (IOException e) { - // Ignore error - } catch (InterruptedException e) { - // Ignore error + } catch (final SecurityException ignored) { + // Ignore, the message may have sensitive information, not + // accessible other ways + } catch (IOException | InterruptedException e) { + if (log.isLoggable(PlatformLogger.Level.WARNING)) { + log.warning("Cannot access 'Desktop'", e); + } } } return desktop; @@ -160,12 +179,13 @@ if (drives == null) { try { drives = new Win32ShellFolder2(DRIVES); - } catch (SecurityException e) { - // Ignore error - } catch (IOException e) { - // Ignore error - } catch (InterruptedException e) { - // Ignore error + } catch (final SecurityException ignored) { + // Ignore, the message may have sensitive information, not + // accessible other ways + } catch (IOException | InterruptedException e) { + if (log.isLoggable(PlatformLogger.Level.WARNING)) { + log.warning("Cannot access 'Drives'", e); + } } } return drives; @@ -178,12 +198,13 @@ if (path != null) { recent = createShellFolder(getDesktop(), new File(path)); } - } catch (SecurityException e) { - // Ignore error - } catch (InterruptedException e) { - // Ignore error - } catch (IOException e) { - // Ignore error + } catch (final SecurityException ignored) { + // Ignore, the message may have sensitive information, not + // accessible other ways + } catch (InterruptedException | IOException e) { + if (log.isLoggable(PlatformLogger.Level.WARNING)) { + log.warning("Cannot access 'Recent'", e); + } } } return recent; @@ -193,12 +214,13 @@ if (network == null) { try { network = new Win32ShellFolder2(NETWORK); - } catch (SecurityException e) { - // Ignore error - } catch (IOException e) { - // Ignore error - } catch (InterruptedException e) { - // Ignore error + } catch (final SecurityException ignored) { + // Ignore, the message may have sensitive information, not + // accessible other ways + } catch (IOException | InterruptedException e) { + if (log.isLoggable(PlatformLogger.Level.WARNING)) { + log.warning("Cannot access 'Network'", e); + } } } return network; @@ -218,12 +240,13 @@ personal.setIsPersonal(); } } - } catch (SecurityException e) { - // Ignore error - } catch (InterruptedException e) { - // Ignore error - } catch (IOException e) { - // Ignore error + } catch (final SecurityException ignored) { + // Ignore, the message may have sensitive information, not + // accessible other ways + } catch (InterruptedException | IOException e) { + if (log.isLoggable(PlatformLogger.Level.WARNING)) { + log.warning("Cannot access 'Personal'", e); + } } } return personal; @@ -324,8 +347,14 @@ folders.add(createShellFolder(new File((String)value))); } } catch (IOException e) { + if (log.isLoggable(PlatformLogger.Level.WARNING)) { + log.warning("Cannot read value = " + value, e); + } // Skip this value } catch (InterruptedException e) { + if (log.isLoggable(PlatformLogger.Level.WARNING)) { + log.warning("Cannot read value = " + value, e); + } // Return empty result return new File[0]; } diff -r 28582d575a98 -r fd4ec73925c3 src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java --- a/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java Fri Jun 21 14:07:48 2019 +0530 @@ -411,6 +411,14 @@ BerDecoder readReply(LdapRequest ldr) throws IOException, NamingException { BerDecoder rber; + // If socket closed, don't even try + synchronized (this) { + if (sock == null) { + throw new ServiceUnavailableException(host + ":" + port + + "; socket closed"); + } + } + try { // if no timeout is set so we wait infinitely until // a response is received diff -r 28582d575a98 -r fd4ec73925c3 src/java.net.http/share/classes/java/net/http/HttpResponse.java --- a/src/java.net.http/share/classes/java/net/http/HttpResponse.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.net.http/share/classes/java/net/http/HttpResponse.java Fri Jun 21 14:07:48 2019 +0530 @@ -1253,7 +1253,7 @@ /** * Returns a {@code BodySubscriber} which buffers data before delivering * it to the given downstream subscriber. The subscriber guarantees to - * deliver {@code buffersize} bytes of data to each invocation of the + * deliver {@code bufferSize} bytes of data to each invocation of the * downstream's {@link BodySubscriber#onNext(Object) onNext} method, * except for the final invocation, just before * {@link BodySubscriber#onComplete() onComplete} is invoked. The final diff -r 28582d575a98 -r fd4ec73925c3 src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java Fri Jun 21 14:07:48 2019 +0530 @@ -194,7 +194,15 @@ if (statusLine.length() < 12) { throw protocolException("Invalid status line: \"%s\"", statusLine); } - responseCode = Integer.parseInt(statusLine.substring(9, 12)); + try { + responseCode = Integer.parseInt(statusLine.substring(9, 12)); + } catch (NumberFormatException nfe) { + throw protocolException("Invalid status line: \"%s\"", statusLine); + } + // response code expected to be a 3-digit integer (RFC-2616, section 6.1.1) + if (responseCode < 100) { + throw protocolException("Invalid status line: \"%s\"", statusLine); + } state = State.STATUS_LINE_END; } diff -r 28582d575a98 -r fd4ec73925c3 src/java.net.http/share/classes/jdk/internal/net/http/LineSubscriberAdapter.java --- a/src/java.net.http/share/classes/jdk/internal/net/http/LineSubscriberAdapter.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.net.http/share/classes/jdk/internal/net/http/LineSubscriberAdapter.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -40,6 +40,7 @@ import java.util.concurrent.Flow; import java.util.concurrent.Flow.Subscriber; import java.util.concurrent.Flow.Subscription; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; @@ -56,6 +57,7 @@ private final Function finisher; private final Charset charset; private final String eol; + private final AtomicBoolean subscribed = new AtomicBoolean(); private volatile LineSubscription downstream; private LineSubscriberAdapter(S subscriber, @@ -72,6 +74,12 @@ @Override public void onSubscribe(Subscription subscription) { + Objects.requireNonNull(subscription); + if (!subscribed.compareAndSet(false, true)) { + subscription.cancel(); + return; + } + downstream = LineSubscription.create(subscription, charset, eol, @@ -82,6 +90,7 @@ @Override public void onNext(List item) { + Objects.requireNonNull(item); try { downstream.submit(item); } catch (Throwable t) { @@ -91,6 +100,7 @@ @Override public void onError(Throwable throwable) { + Objects.requireNonNull(throwable); try { downstream.signalError(throwable); } finally { diff -r 28582d575a98 -r fd4ec73925c3 src/java.net.http/share/classes/jdk/internal/net/http/PullPublisher.java --- a/src/java.net.http/share/classes/jdk/internal/net/http/PullPublisher.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.net.http/share/classes/jdk/internal/net/http/PullPublisher.java Fri Jun 21 14:07:48 2019 +0530 @@ -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 @@ -103,11 +103,19 @@ } while (demand.tryDecrement() && !cancelled) { - if (!iter.hasNext()) { - break; - } else { - subscriber.onNext(iter.next()); + T next; + try { + if (!iter.hasNext()) { + break; + } + next = iter.next(); + } catch (Throwable t1) { + completed = true; + pullScheduler.stop(); + subscriber.onError(t1); + return; } + subscriber.onNext(next); } if (!iter.hasNext() && !cancelled) { completed = true; @@ -123,7 +131,7 @@ return; // no-op if (n <= 0) { - error = new IllegalArgumentException("illegal non-positive request:" + n); + error = new IllegalArgumentException("non-positive subscription request: " + n); } else { demand.increase(n); } diff -r 28582d575a98 -r fd4ec73925c3 src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java --- a/src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java Fri Jun 21 14:07:48 2019 +0530 @@ -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 @@ -271,12 +271,13 @@ @Override public void subscribe(Flow.Subscriber subscriber) { - InputStream is; + InputStream is = null; + Throwable t = null; if (System.getSecurityManager() == null) { try { is = new FileInputStream(file); } catch (IOException ioe) { - throw new UncheckedIOException(ioe); + t = ioe; } } else { try { @@ -284,11 +285,16 @@ () -> new FileInputStream(file); is = AccessController.doPrivileged(pa, null, filePermissions); } catch (PrivilegedActionException pae) { - throw new UncheckedIOException((IOException) pae.getCause()); + t = pae.getCause(); } } - PullPublisher publisher = - new PullPublisher<>(() -> new StreamIterator(is)); + final InputStream fis = is; + PullPublisher publisher; + if (t == null) { + publisher = new PullPublisher<>(() -> new StreamIterator(fis)); + } else { + publisher = new PullPublisher<>(null, t); + } publisher.subscribe(subscriber); } diff -r 28582d575a98 -r fd4ec73925c3 src/java.net.http/share/classes/jdk/internal/net/http/ResponseSubscribers.java --- a/src/java.net.http/share/classes/jdk/internal/net/http/ResponseSubscribers.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.net.http/share/classes/jdk/internal/net/http/ResponseSubscribers.java Fri Jun 21 14:07:48 2019 +0530 @@ -125,6 +125,7 @@ @Override public void onSubscribe(Flow.Subscription subscription) { + Objects.requireNonNull(subscription); if (!subscribed.compareAndSet(false, true)) { subscription.cancel(); } else { @@ -135,6 +136,7 @@ @Override public void onNext(List items) { + Objects.requireNonNull(items); for (ByteBuffer item : items) { byte[] buf = new byte[item.remaining()]; item.get(buf); @@ -145,6 +147,7 @@ @Override public void onError(Throwable throwable) { + Objects.requireNonNull(throwable); result.completeExceptionally(throwable); } @@ -172,6 +175,7 @@ private final FilePermission[] filePermissions; private final CompletableFuture result = new MinimalFuture<>(); + private final AtomicBoolean subscribed = new AtomicBoolean(); private volatile Flow.Subscription subscription; private volatile FileChannel out; @@ -211,6 +215,12 @@ @Override public void onSubscribe(Flow.Subscription subscription) { + Objects.requireNonNull(subscription); + if (!subscribed.compareAndSet(false, true)) { + subscription.cancel(); + return; + } + this.subscription = subscription; if (System.getSecurityManager() == null) { try { @@ -470,6 +480,7 @@ @Override public void onSubscribe(Flow.Subscription s) { + Objects.requireNonNull(s); try { if (!subscribed.compareAndSet(false, true)) { s.cancel(); @@ -600,6 +611,7 @@ @Override public void onSubscribe(Flow.Subscription subscription) { + Objects.requireNonNull(subscription); if (!subscribed.compareAndSet(false, true)) { subscription.cancel(); } else { @@ -614,6 +626,7 @@ @Override public void onError(Throwable throwable) { + Objects.requireNonNull(throwable); cf.completeExceptionally(throwable); } @@ -907,13 +920,21 @@ } } + private final AtomicBoolean subscribed = new AtomicBoolean(); + @Override public void onSubscribe(Flow.Subscription subscription) { - subscriptionCF.complete(subscription); + Objects.requireNonNull(subscription); + if (!subscribed.compareAndSet(false, true)) { + subscription.cancel(); + } else { + subscriptionCF.complete(subscription); + } } @Override public void onNext(List item) { + Objects.requireNonNull(item); try { // cannot be called before onSubscribe() assert subscriptionCF.isDone(); @@ -941,6 +962,7 @@ // onError can be called before request(1), and therefore can // be called before subscriberRef is set. signalError(throwable); + Objects.requireNonNull(throwable); } @Override diff -r 28582d575a98 -r fd4ec73925c3 src/java.security.jgss/share/classes/sun/security/jgss/spnego/NegTokenTarg.java --- a/src/java.security.jgss/share/classes/sun/security/jgss/spnego/NegTokenTarg.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/jgss/spnego/NegTokenTarg.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -26,7 +26,6 @@ package sun.security.jgss.spnego; import java.io.*; -import java.util.*; import org.ietf.jgss.*; import sun.security.jgss.*; import sun.security.util.*; @@ -113,18 +112,6 @@ mic.putOctetString(mechListMIC); targToken.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte) 0x03), mic); - } else if (GSSUtil.useMSInterop()) { - // required for MS-interoperability - if (responseToken != null) { - if (DEBUG) { - System.out.println("SpNegoToken NegTokenTarg: " + - "sending additional token for MS Interop"); - } - DerOutputStream rspToken = new DerOutputStream(); - rspToken.putOctetString(responseToken); - targToken.write(DerValue.createTag(DerValue.TAG_CONTEXT, - true, (byte) 0x03), rspToken); - } } // insert in a SEQUENCE diff -r 28582d575a98 -r fd4ec73925c3 src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java --- a/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -66,7 +66,7 @@ static { MECH_MAP = AccessController.doPrivileged( - new PrivilegedAction>() { + new PrivilegedAction<>() { public HashMap run() { DEBUG = Boolean.parseBoolean( System.getProperty("sun.security.nativegss.debug")); @@ -77,7 +77,7 @@ if (DEBUG) err.printStackTrace(); return null; } - String[] gssLibs = new String[0]; + String[] gssLibs; String defaultLib = System.getProperty("sun.security.jgss.lib"); if (defaultLib == null || defaultLib.trim().equals("")) { @@ -95,6 +95,12 @@ "libgssapi_krb5.dylib", "/usr/lib/sasl2/libgssapiv2.2.so", }; + } else if (osname.contains("Windows")) { + // Full path needed, DLL is in jre/bin + gssLibs = new String[]{ System.getProperty("java.home") + + "\\bin\\sspi_bridge.dll" }; + } else { + gssLibs = new String[0]; } } else { gssLibs = new String[]{ defaultLib }; @@ -103,8 +109,7 @@ if (GSSLibStub.init(libName, DEBUG)) { debug("Loaded GSS library: " + libName); Oid[] mechs = GSSLibStub.indicateMechs(); - HashMap map = - new HashMap(); + HashMap map = new HashMap<>(); for (int i = 0; i < mechs.length; i++) { debug("Native MF for " + mechs[i]); map.put("GssApiMechanism." + mechs[i], diff -r 28582d575a98 -r fd4ec73925c3 src/java.security.jgss/share/native/libj2gss/GSSLibStub.c --- a/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -982,7 +982,7 @@ OM_uint32 aFlags; OM_uint32 aTime; gss_cred_id_t delCred; - jobject jsrcName=GSS_C_NO_NAME; + jobject jsrcName = NULL; jobject jdelCred; jobject jMech; jboolean setTarget; diff -r 28582d575a98 -r fd4ec73925c3 src/java.security.jgss/share/native/libj2gss/NativeFunc.h --- a/src/java.security.jgss/share/native/libj2gss/NativeFunc.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.security.jgss/share/native/libj2gss/NativeFunc.h Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -57,38 +57,38 @@ typedef OM_uint32 (*IMPORT_NAME_FN_PTR) (OM_uint32 *minor_status, - gss_buffer_t input_name_buffer, - gss_OID input_name_type, + const gss_buffer_t input_name_buffer, + const gss_OID input_name_type, gss_name_t *output_name); typedef OM_uint32 (*COMPARE_NAME_FN_PTR) (OM_uint32 *minor_status, - gss_name_t name1, - gss_name_t name2, + gss_const_name_t name1, + gss_const_name_t name2, int *name_equal); typedef OM_uint32 (*CANONICALIZE_NAME_FN_PTR) (OM_uint32 *minor_status, - gss_name_t input_name, - gss_OID mech_type, + gss_const_name_t input_name, + const gss_OID mech_type, gss_name_t *output_name); typedef OM_uint32 (*EXPORT_NAME_FN_PTR) (OM_uint32 *minor_status, - gss_name_t input_name, + gss_const_name_t input_name, gss_buffer_t exported_name); typedef OM_uint32 (*DISPLAY_NAME_FN_PTR) (OM_uint32 *minor_status, - gss_name_t input_name, + gss_const_name_t input_name, gss_buffer_t output_name_buffer, gss_OID *output_name_type); typedef OM_uint32 (*ACQUIRE_CRED_FN_PTR) (OM_uint32 *minor_status, - gss_name_t desired_name, + gss_const_name_t desired_name, OM_uint32 time_req, - gss_OID_set desired_mech, + const gss_OID_set desired_mech, gss_cred_usage_t cred_usage, gss_cred_id_t *output_cred_handle, gss_OID_set *actual_mechs, @@ -100,7 +100,7 @@ typedef OM_uint32 (*INQUIRE_CRED_FN_PTR) (OM_uint32 *minor_status, - gss_cred_id_t cred_handle, + gss_const_cred_id_t cred_handle, gss_name_t *name, OM_uint32 *lifetime, gss_cred_usage_t *cred_usage, @@ -108,19 +108,19 @@ typedef OM_uint32 (*IMPORT_SEC_CONTEXT_FN_PTR) (OM_uint32 *minor_status, - gss_buffer_t interprocess_token, + const gss_buffer_t interprocess_token, gss_ctx_id_t *context_handle); typedef OM_uint32 (*INIT_SEC_CONTEXT_FN_PTR) (OM_uint32 *minor_status, - gss_cred_id_t initiator_cred_handle, + gss_const_cred_id_t initiator_cred_handle, gss_ctx_id_t *context_handle, - gss_name_t *target_name, - gss_OID mech_type, + gss_const_name_t target_name, + const gss_OID mech_type, OM_uint32 req_flags, OM_uint32 time_req, - gss_channel_bindings_t input_chan_bindings, - gss_buffer_t input_token, + const gss_channel_bindings_t input_chan_bindings, + const gss_buffer_t input_token, gss_OID *actual_mech_type, gss_buffer_t output_token, OM_uint32 *ret_flags, @@ -129,9 +129,9 @@ typedef OM_uint32 (*ACCEPT_SEC_CONTEXT_FN_PTR) (OM_uint32 *minor_status, gss_ctx_id_t *context_handle, - gss_cred_id_t acceptor_cred_handle, - gss_buffer_t input_token, - gss_channel_bindings_t input_chan_bindings, + gss_const_cred_id_t acceptor_cred_handle, + const gss_buffer_t input_token, + const gss_channel_bindings_t input_chan_bindings, gss_name_t *src_name, gss_OID *mech_type, gss_buffer_t output_token, @@ -141,7 +141,7 @@ typedef OM_uint32 (*INQUIRE_CONTEXT_FN_PTR) (OM_uint32 *minor_status, - gss_ctx_id_t context_handle, + gss_const_ctx_id_t context_handle, gss_name_t *src_name, gss_name_t *targ_name, OM_uint32 *lifetime_rec, @@ -157,12 +157,12 @@ typedef OM_uint32 (*CONTEXT_TIME_FN_PTR) (OM_uint32 *minor_status, - gss_ctx_id_t *context_handle, + gss_const_ctx_id_t context_handle, OM_uint32 *time_rec); typedef OM_uint32 (*WRAP_SIZE_LIMIT_FN_PTR) (OM_uint32 *minor_status, - gss_ctx_id_t context_handle, + gss_const_ctx_id_t context_handle, int conf_req_flag, gss_qop_t qop_req, OM_uint32 req_output_size, @@ -175,31 +175,31 @@ typedef OM_uint32 (*GET_MIC_FN_PTR) (OM_uint32 *minor_status, - gss_ctx_id_t context_handle, + gss_const_ctx_id_t context_handle, gss_qop_t qop_req, - gss_buffer_t message_buffer, + const gss_buffer_t message_buffer, gss_buffer_t msg_token); typedef OM_uint32 (*VERIFY_MIC_FN_PTR) (OM_uint32 *minor_status, - gss_ctx_id_t context_handle, - gss_buffer_t message_buffer, - gss_buffer_t token_buffer, + gss_const_ctx_id_t context_handle, + const gss_buffer_t message_buffer, + const gss_buffer_t token_buffer, gss_qop_t *qop_state); typedef OM_uint32 (*WRAP_FN_PTR) (OM_uint32 *minor_status, - gss_ctx_id_t context_handle, + gss_const_ctx_id_t context_handle, int conf_req_flag, gss_qop_t qop_req, - gss_buffer_t input_message_buffer, + const gss_buffer_t input_message_buffer, int *conf_state, gss_buffer_t output_message_buffer); typedef OM_uint32 (*UNWRAP_FN_PTR) (OM_uint32 *minor_status, - gss_ctx_id_t context_handle, - gss_buffer_t input_message_buffer, + gss_const_ctx_id_t context_handle, + const gss_buffer_t input_message_buffer, gss_buffer_t output_message_buffer, int *conf_state, gss_qop_t *qop_state); @@ -215,14 +215,14 @@ typedef OM_uint32 (*ADD_OID_SET_MEMBER_FN_PTR) (OM_uint32 *minor_status, - gss_OID member_oid, + const gss_OID member_oid, gss_OID_set *oid_set); typedef OM_uint32 (*DISPLAY_STATUS_FN_PTR) (OM_uint32 *minor_status, OM_uint32 status_value, int status_type, - gss_OID mech_type, + const gss_OID mech_type, OM_uint32 *message_context, gss_buffer_t status_string); diff -r 28582d575a98 -r fd4ec73925c3 src/java.security.jgss/share/native/libj2gss/NativeUtil.h --- a/src/java.security.jgss/share/native/libj2gss/NativeUtil.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.security.jgss/share/native/libj2gss/NativeUtil.h Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -83,10 +83,10 @@ extern jfieldID FID_NativeGSSContext_flags; extern jfieldID FID_NativeGSSContext_lifetime; extern jfieldID FID_NativeGSSContext_actualMech; - #define TRACE0(s) { if (JGSS_DEBUG) { puts(s); fflush(stdout); }} - #define TRACE1(s, p1) { if (JGSS_DEBUG) { printf(s"\n", p1); fflush(stdout); }} - #define TRACE2(s, p1, p2) { if (JGSS_DEBUG) { printf(s"\n", p1, p2); fflush(stdout); }} - #define TRACE3(s, p1, p2, p3) { if (JGSS_DEBUG) { printf(s"\n", p1, p2, p3); fflush(stdout); }} + #define TRACE0(s) { if (JGSS_DEBUG) { printf("[GSSLibStub:%d] %s\n", __LINE__, s); fflush(stdout); }} + #define TRACE1(s, p1) { if (JGSS_DEBUG) { printf("[GSSLibStub:%d] "s"\n", __LINE__, p1); fflush(stdout); }} + #define TRACE2(s, p1, p2) { if (JGSS_DEBUG) { printf("[GSSLibStub:%d] "s"\n", __LINE__, p1, p2); fflush(stdout); }} + #define TRACE3(s, p1, p2, p3) { if (JGSS_DEBUG) { printf("[GSSLibStub:%d] "s"\n", __LINE__, p1, p2, p3); fflush(stdout); }} #ifdef __cplusplus diff -r 28582d575a98 -r fd4ec73925c3 src/java.security.jgss/share/native/libj2gss/gssapi.h --- a/src/java.security.jgss/share/native/libj2gss/gssapi.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.security.jgss/share/native/libj2gss/gssapi.h Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -57,9 +57,17 @@ */ #include -typedef void * gss_name_t; -typedef void * gss_cred_id_t; -typedef void * gss_ctx_id_t; +struct gss_name_struct; +typedef struct gss_name_struct * gss_name_t; +typedef const struct gss_name_struct *gss_const_name_t; + +struct gss_cred_id_struct; +typedef struct gss_cred_id_struct * gss_cred_id_t; +typedef const struct gss_cred_id_struct *gss_const_cred_id_t; + +struct gss_ctx_id_struct; +typedef struct gss_ctx_id_struct * gss_ctx_id_t; +typedef const struct gss_ctx_id_struct *gss_const_ctx_id_t; /* * The following type must be defined as the smallest natural unsigned integer @@ -82,16 +90,19 @@ OM_uint32 length; void *elements; } gss_OID_desc, *gss_OID; +typedef const gss_OID_desc * gss_const_OID; typedef struct gss_OID_set_desc_struct { size_t count; gss_OID elements; } gss_OID_set_desc, *gss_OID_set; +typedef const gss_OID_set_desc * gss_const_OID_set; typedef struct gss_buffer_desc_struct { size_t length; void *value; } gss_buffer_desc, *gss_buffer_t; +typedef const gss_buffer_desc * gss_const_buffer_t; typedef struct gss_channel_bindings_struct { OM_uint32 initiator_addrtype; @@ -100,6 +111,7 @@ gss_buffer_desc acceptor_address; gss_buffer_desc application_data; } *gss_channel_bindings_t; +typedef const struct gss_channel_bindings_struct *gss_const_channel_bindings_t; /* * For now, define a QOP-type as an OM_uint32 @@ -119,6 +131,7 @@ #define GSS_C_ANON_FLAG 64 #define GSS_C_PROT_READY_FLAG 128 #define GSS_C_TRANS_FLAG 256 +#define GSS_C_DELEG_POLICY_FLAG 32768 /* * Credential usage options @@ -389,9 +402,9 @@ GSS_DLLIMP OM_uint32 gss_acquire_cred( OM_uint32 *, /* minor_status */ - gss_name_t, /* desired_name */ + gss_const_name_t, /* desired_name */ OM_uint32, /* time_req */ - gss_OID_set, /* desired_mechs */ + const gss_OID_set, /* desired_mechs */ gss_cred_usage_t, /* cred_usage */ gss_cred_id_t *, /* output_cred_handle */ gss_OID_set *, /* actual_mechs */ @@ -405,14 +418,14 @@ GSS_DLLIMP OM_uint32 gss_init_sec_context( OM_uint32 *, /* minor_status */ - gss_cred_id_t, /* claimant_cred_handle */ + gss_const_cred_id_t, /* claimant_cred_handle */ gss_ctx_id_t *, /* context_handle */ - gss_name_t, /* target_name */ - gss_OID, /* mech_type (used to be const) */ + gss_const_name_t, /* target_name */ + const gss_OID, /* mech_type */ OM_uint32, /* req_flags */ OM_uint32, /* time_req */ - gss_channel_bindings_t, /* input_chan_bindings */ - gss_buffer_t, /* input_token */ + const gss_channel_bindings_t, /* input_chan_bindings */ + const gss_buffer_t, /* input_token */ gss_OID *, /* actual_mech_type */ gss_buffer_t, /* output_token */ OM_uint32 *, /* ret_flags */ @@ -422,9 +435,9 @@ GSS_DLLIMP OM_uint32 gss_accept_sec_context( OM_uint32 *, /* minor_status */ gss_ctx_id_t *, /* context_handle */ - gss_cred_id_t, /* acceptor_cred_handle */ - gss_buffer_t, /* input_token_buffer */ - gss_channel_bindings_t, /* input_chan_bindings */ + gss_const_cred_id_t, /* acceptor_cred_handle */ + const gss_buffer_t, /* input_token_buffer */ + const gss_channel_bindings_t, /* input_chan_bindings */ gss_name_t *, /* src_name */ gss_OID *, /* mech_type */ gss_buffer_t, /* output_token */ @@ -435,8 +448,8 @@ GSS_DLLIMP OM_uint32 gss_process_context_token( OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_buffer_t /* token_buffer */ + gss_const_ctx_id_t, /* context_handle */ + const gss_buffer_t /* token_buffer */ ); GSS_DLLIMP OM_uint32 gss_delete_sec_context( @@ -447,35 +460,35 @@ GSS_DLLIMP OM_uint32 gss_context_time( OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ + gss_const_ctx_id_t, /* context_handle */ OM_uint32 * /* time_rec */ ); /* New for V2 */ GSS_DLLIMP OM_uint32 gss_get_mic( OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ + gss_const_ctx_id_t, /* context_handle */ gss_qop_t, /* qop_req */ - gss_buffer_t, /* message_buffer */ + const gss_buffer_t, /* message_buffer */ gss_buffer_t /* message_token */ ); /* New for V2 */ GSS_DLLIMP OM_uint32 gss_verify_mic( OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_buffer_t, /* message_buffer */ - gss_buffer_t, /* message_token */ + gss_const_ctx_id_t, /* context_handle */ + const gss_buffer_t, /* message_buffer */ + const gss_buffer_t, /* message_token */ gss_qop_t * /* qop_state */ ); /* New for V2 */ GSS_DLLIMP OM_uint32 gss_wrap( OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ + gss_const_ctx_id_t, /* context_handle */ int, /* conf_req_flag */ gss_qop_t, /* qop_req */ - gss_buffer_t, /* input_message_buffer */ + const gss_buffer_t, /* input_message_buffer */ int *, /* conf_state */ gss_buffer_t /* output_message_buffer */ ); @@ -483,8 +496,8 @@ /* New for V2 */ GSS_DLLIMP OM_uint32 gss_unwrap( OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ - gss_buffer_t, /* input_message_buffer */ + gss_const_ctx_id_t, /* context_handle */ + const gss_buffer_t, /* input_message_buffer */ gss_buffer_t, /* output_message_buffer */ int *, /* conf_state */ gss_qop_t * /* qop_state */ @@ -494,7 +507,7 @@ OM_uint32 *, /* minor_status */ OM_uint32, /* status_value */ int, /* status_type */ - gss_OID, /* mech_type (used to be const) */ + const gss_OID, /* mech_type (used to be const) */ OM_uint32 *, /* message_context */ gss_buffer_t /* status_string */ ); @@ -506,22 +519,22 @@ GSS_DLLIMP OM_uint32 gss_compare_name( OM_uint32 *, /* minor_status */ - gss_name_t, /* name1 */ - gss_name_t, /* name2 */ + gss_const_name_t, /* name1 */ + gss_const_name_t, /* name2 */ int * /* name_equal */ ); GSS_DLLIMP OM_uint32 gss_display_name( OM_uint32 *, /* minor_status */ - gss_name_t, /* input_name */ + gss_const_name_t, /* input_name */ gss_buffer_t, /* output_name_buffer */ gss_OID * /* output_name_type */ ); GSS_DLLIMP OM_uint32 gss_import_name( OM_uint32 *, /* minor_status */ - gss_buffer_t, /* input_name_buffer */ - gss_OID, /* input_name_type(used to be const) */ + const gss_buffer_t, /* input_name_buffer */ + const gss_OID, /* input_name_type(used to be const) */ gss_name_t * /* output_name */ ); @@ -542,7 +555,7 @@ GSS_DLLIMP OM_uint32 gss_inquire_cred( OM_uint32 *, /* minor_status */ - gss_cred_id_t, /* cred_handle */ + gss_const_cred_id_t, /* cred_handle */ gss_name_t *, /* name */ OM_uint32 *, /* lifetime */ gss_cred_usage_t *, /* cred_usage */ @@ -552,7 +565,7 @@ /* Last argument new for V2 */ GSS_DLLIMP OM_uint32 gss_inquire_context( OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ + gss_const_ctx_id_t, /* context_handle */ gss_name_t *, /* src_name */ gss_name_t *, /* targ_name */ OM_uint32 *, /* lifetime_rec */ @@ -565,7 +578,7 @@ /* New for V2 */ GSS_DLLIMP OM_uint32 gss_wrap_size_limit( OM_uint32 *, /* minor_status */ - gss_ctx_id_t, /* context_handle */ + gss_const_ctx_id_t, /* context_handle */ int, /* conf_req_flag */ gss_qop_t, /* qop_req */ OM_uint32, /* req_output_size */ @@ -575,9 +588,9 @@ /* New for V2 */ GSS_DLLIMP OM_uint32 gss_add_cred( OM_uint32 *, /* minor_status */ - gss_cred_id_t, /* input_cred_handle */ - gss_name_t, /* desired_name */ - gss_OID, /* desired_mech */ + gss_const_cred_id_t, /* input_cred_handle */ + gss_const_name_t, /* desired_name */ + const gss_OID, /* desired_mech */ gss_cred_usage_t, /* cred_usage */ OM_uint32, /* initiator_time_req */ OM_uint32, /* acceptor_time_req */ @@ -590,8 +603,8 @@ /* New for V2 */ GSS_DLLIMP OM_uint32 gss_inquire_cred_by_mech( OM_uint32 *, /* minor_status */ - gss_cred_id_t, /* cred_handle */ - gss_OID, /* mech_type */ + gss_const_cred_id_t, /* cred_handle */ + const gss_OID, /* mech_type */ gss_name_t *, /* name */ OM_uint32 *, /* initiator_lifetime */ OM_uint32 *, /* acceptor_lifetime */ @@ -608,7 +621,7 @@ /* New for V2 */ GSS_DLLIMP OM_uint32 gss_import_sec_context( OM_uint32 *, /* minor_status */ - gss_buffer_t, /* interprocess_token */ + const gss_buffer_t, /* interprocess_token */ gss_ctx_id_t * /* context_handle */ ); @@ -627,22 +640,22 @@ /* New for V2 */ GSS_DLLIMP OM_uint32 gss_add_oid_set_member( OM_uint32 *, /* minor_status */ - gss_OID, /* member_oid */ + const gss_OID, /* member_oid */ gss_OID_set * /* oid_set */ ); /* New for V2 */ GSS_DLLIMP OM_uint32 gss_test_oid_set_member( OM_uint32 *, /* minor_status */ - gss_OID, /* member */ - gss_OID_set, /* set */ + const gss_OID, /* member */ + const gss_OID_set, /* set */ int * /* present */ ); /* New for V2 */ GSS_DLLIMP OM_uint32 gss_str_to_oid( OM_uint32 *, /* minor_status */ - gss_buffer_t, /* oid_str */ + const gss_buffer_t, /* oid_str */ gss_OID * /* oid */ ); @@ -656,28 +669,28 @@ /* New for V2 */ GSS_DLLIMP OM_uint32 gss_inquire_names_for_mech( OM_uint32 *, /* minor_status */ - gss_OID, /* mechanism */ + const gss_OID, /* mechanism */ gss_OID_set * /* name_types */ ); /* New for V2 */ GSS_DLLIMP OM_uint32 gss_export_name( OM_uint32 *, /* minor_status */ - const gss_name_t, /* input_name */ + gss_const_name_t, /* input_name */ gss_buffer_t /* exported_name */ ); /* New for V2 */ GSS_DLLIMP OM_uint32 gss_duplicate_name( OM_uint32 *, /* minor_status */ - const gss_name_t, /* input_name */ + gss_const_name_t, /* input_name */ gss_name_t * /* dest_name */ ); /* New for V2 */ GSS_DLLIMP OM_uint32 gss_canonicalize_name( OM_uint32 *, /* minor_status */ - const gss_name_t, /* input_name */ + gss_const_name_t, /* input_name */ const gss_OID, /* mech_type */ gss_name_t * /* output_name */ ); diff -r 28582d575a98 -r fd4ec73925c3 src/java.security.jgss/windows/native/libsspi_bridge/sspi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.security.jgss/windows/native/libsspi_bridge/sspi.cpp Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,1575 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +// This library is client-side only, and only supports the default credentials. +// It speaks krb5 and SPNEGO. NTLM is excluded from SPNEGO negotiation. +// +// This library can be built directly with the following command: +// cl -I %OPENJDK%\src\java.security.jgss\share\native\libj2gss\ sspi.cpp \ +// -link -dll -out:sspi_bridge.dll + +#define UNICODE +#define _UNICODE + +#include +#include +#include +#include +#include +#include +#include + +#define GSS_DLL_FILE +#include + +#define SECURITY_WIN32 +#include + +#pragma comment(lib, "secur32.lib") + +// Otherwise an exception will be thrown +#define new new (std::nothrow) + +// A debugging macro +#define PP(fmt, ...) \ + if (trace) { \ + fprintf(stderr, "[SSPI:%ld] "fmt"\n", __LINE__, ##__VA_ARGS__); \ + fflush(stderr); \ + } +#define SEC_SUCCESS(status) ((*minor_status = (status)), (status) >= SEC_E_OK) + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +// When SSPI_BRIDGE_TRACE is set, debug info goes to stderr. The value is ignored. +char* trace = getenv("SSPI_BRIDGE_TRACE"); + +void +dump(const char* title, PBYTE data, size_t len) +{ + if (trace) { + fprintf(stderr, "==== %s ====\n", title); + for (size_t i = 0; i < len; i++) { + if (i != 0 && i % 16 == 0) { + fprintf(stderr, "\n"); + } + fprintf(stderr, "%02X ", *(data + i) & 0xff); + } + fprintf(stderr, "\n"); + } +} + +gss_OID_desc KRB5_OID = {9, (void*)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"}; +gss_OID_desc SPNEGO_OID = {6, (void*)"\x2b\x06\x01\x05\x05\x02"}; +gss_OID_desc USER_NAME_OID = {10, (void*)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"}; +gss_OID_desc KRB5_NAME_OID = {10, (void*)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"}; +gss_OID_desc HOST_SERVICE_NAME_OID = {10, (void*)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"}; +gss_OID_desc EXPORT_NAME_OID = {6, (void*)"\x2b\x06\x01\x05\x06\x04"}; + +struct gss_name_struct { + SEC_WCHAR* name; +}; + +struct gss_ctx_id_struct { + CredHandle* phCred; + CtxtHandle hCtxt; + SecPkgContext_Sizes SecPkgContextSizes; + SecPkgContext_NativeNames nnames; + BOOLEAN established; + BOOLEAN isSPNEGO; + BOOLEAN isLocalCred; + OM_uint32 flags; +}; + +struct gss_cred_id_struct { + CredHandle* phCredK; + CredHandle* phCredS; + long time; +}; + +/* This section holds supporting functions that are not exported */ + +static OM_uint32 +seconds_until(int inputIsUTC, TimeStamp *time) +{ + // time is local time + LARGE_INTEGER uiLocal; + FILETIME now; + GetSystemTimeAsFileTime(&now); + if (!inputIsUTC) { + FILETIME nowLocal; + if (FileTimeToLocalFileTime(&now, &nowLocal) == 0) { + return -1; + } + now = nowLocal; + } + uiLocal.HighPart = now.dwHighDateTime; + uiLocal.LowPart = now.dwLowDateTime; + if (time->QuadPart < uiLocal.QuadPart) { + return 0; + } + ULONGLONG diff = (time->QuadPart - uiLocal.QuadPart) / 10000000; + if (diff > (ULONGLONG)~(OM_uint32)0) + return GSS_C_INDEFINITE; + return (OM_uint32)diff; +} + +static void +show_time(char* label, TimeStamp* ts) +{ + if (trace) { + SYSTEMTIME stLocal; + FileTimeToSystemTime((FILETIME*)ts, &stLocal); + + // Build a string showing the date and time. + PP("%s: %02d/%02d/%d %02d:%02d %uld", label, + stLocal.wMonth, stLocal.wDay, stLocal.wYear, + stLocal.wHour, stLocal.wMinute, + seconds_until(1, ts)); + } +} + +// isSPNEGO: true, SPNEGO. false, Kerberos. +static gss_ctx_id_t +new_context(BOOLEAN isSPNEGO) +{ + gss_ctx_id_t out = new gss_ctx_id_struct; + if (out == NULL) { + return NULL; + } + out->phCred = NULL; + out->hCtxt.dwLower = out->hCtxt.dwUpper = NULL; + out->established = FALSE; + out->SecPkgContextSizes.cbMaxSignature + = out->SecPkgContextSizes.cbBlockSize + = out->SecPkgContextSizes.cbSecurityTrailer + = 0; + out->nnames.sClientName = out->nnames.sServerName = NULL; + out->isSPNEGO = isSPNEGO; + out->isLocalCred = FALSE; + return out; +} + +static gss_cred_id_t +new_cred() +{ + gss_cred_id_t out = new gss_cred_id_struct; + out->phCredK = out->phCredS = NULL; + out->time = 0L; + return out; +} + +static int +flag_sspi_to_gss(int fin) +{ + int fout = 0; + if (fin & ISC_REQ_MUTUAL_AUTH) fout |= GSS_C_MUTUAL_FLAG; + if (fin & ISC_REQ_CONFIDENTIALITY) fout |= GSS_C_CONF_FLAG; + if (fin & ISC_REQ_DELEGATE) fout |= GSS_C_DELEG_FLAG; + if (fin & ISC_REQ_INTEGRITY) fout |= GSS_C_INTEG_FLAG; + if (fin & ISC_REQ_REPLAY_DETECT) fout |= GSS_C_REPLAY_FLAG; + if (fin & ISC_REQ_SEQUENCE_DETECT) fout |= GSS_C_SEQUENCE_FLAG; + return fout; +} + +static int +flag_gss_to_sspi(int fin) +{ + int fout = 0; + if (fin & GSS_C_MUTUAL_FLAG) fout |= ISC_RET_MUTUAL_AUTH; + if (fin & GSS_C_CONF_FLAG) fout |= ISC_RET_CONFIDENTIALITY; + if (fin & GSS_C_DELEG_FLAG) fout |= ISC_RET_DELEGATE; + if (fin & GSS_C_INTEG_FLAG) fout |= ISC_RET_INTEGRITY; + if (fin & GSS_C_REPLAY_FLAG) fout |= ISC_RET_REPLAY_DETECT; + if (fin & GSS_C_SEQUENCE_FLAG) fout |= ISC_RET_SEQUENCE_DETECT; + return fout; +} + +static BOOLEAN +is_same_oid(gss_OID o2, gss_OID o1) +{ + return o1 && o2 && o1->length == o2->length + && !memcmp(o1->elements, o2->elements, o2->length); +} + +static BOOLEAN +has_oid(gss_OID_set set, gss_OID oid) +{ + for (int i = 0; i < set->count; i++) { + if (is_same_oid(&set->elements[i], oid)) { + return TRUE; + } + } + return FALSE; +} + +static void +get_oid_desc(gss_OID mech) +{ + if (trace) { + if (is_same_oid(mech, &KRB5_OID)) { + PP("Kerberos mech"); + } else if (is_same_oid(mech, &SPNEGO_OID)) { + PP("SPNEGO mech"); + } else if (is_same_oid(mech, &USER_NAME_OID)) { + PP("NT_USER_NAME name-type"); + } else if (is_same_oid(mech, &KRB5_NAME_OID)) { + PP("KRB5_NAME name-type"); + } else if (is_same_oid(mech, &HOST_SERVICE_NAME_OID)) { + PP("NT_HOSTBASED_SERVICE name-type"); + } else if (is_same_oid(mech, &EXPORT_NAME_OID)) { + PP("NT_EXPORT_NAME name-type"); + } else { + dump("UNKNOWN OID", (PBYTE)mech->elements, mech->length); + } + } +} + +static void +get_oid_set_desc(gss_OID_set mechs) +{ + if (trace) { + if (mechs == NULL) { + PP("OID set is NULL"); + return; + } + PP("gss_OID_set.count is %d", (int)mechs->count); + for (int i = 0; i < mechs->count; i++) { + get_oid_desc(&mechs->elements[i]); + } + } +} + +// Add realm to a name if there was none. +// Returns a newly allocated name. +static WCHAR* +get_full_name(WCHAR* input) +{ + // input has realm, no need to add one + for (int i = 0;; i++) { + if (!input[i]) { // the end + break; + } + if (input[i] == L'\\') { // escaped + i++; + continue; + } + if (input[i] == L'@') { + return _wcsdup(input); + } + } + + // Always use the default domain + WCHAR* realm = _wgetenv(L"USERDNSDOMAIN"); + if (realm == NULL) { + realm = L""; + } + + size_t oldlen = wcslen(input); + size_t newlen = oldlen + 1 + wcslen(realm) + 1; + + WCHAR* fullname = new WCHAR[newlen]; + if (!fullname) { + return NULL; + } + wcscpy_s(fullname, newlen, input); + wcscat_s(fullname, newlen, L"@"); + wcscat_s(fullname, newlen, realm); + + PP("get_full_name returns %ls", fullname); + return fullname; +} + +/* End support section */ + +/* This section holds GSS-API exported functions */ + +#define CHECK_OUTPUT(x) if (!x) return GSS_S_CALL_INACCESSIBLE_WRITE; +#define CHECK_BUFFER(b) if (!b || !b->value) return GSS_S_CALL_INACCESSIBLE_READ; +#define CHECK_OID(o) if (!o || !o->elements) return GSS_S_CALL_INACCESSIBLE_READ; +#define CHECK_NAME(n) if (!n || !(n->name)) return GSS_S_BAD_NAME; +#define CHECK_CONTEXT(c) if (!c) return GSS_S_NO_CONTEXT; +#define CHECK_CRED(c) if (!c || (!(cred_handle->phCredK) && !(cred_handle->phCredS))) \ + return GSS_S_NO_CRED; + +__declspec(dllexport) OM_uint32 +gss_release_name(OM_uint32 *minor_status, + gss_name_t *name) +{ + PP(">>>> Calling gss_release_name %p...", *name); + if (name != NULL && *name != GSS_C_NO_NAME) { + if ((*name)->name != NULL) { + delete[] (*name)->name; + } + delete *name; + *name = GSS_C_NO_NAME; + } + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_import_name(OM_uint32 *minor_status, + const gss_buffer_t input_name_buffer, + const gss_OID input_name_type, + gss_name_t *output_name) +{ + PP(">>>> Calling gss_import_name..."); + CHECK_BUFFER(input_name_buffer) + CHECK_OUTPUT(output_name) + + int len = (int)input_name_buffer->length; + LPSTR input = (LPSTR)input_name_buffer->value; + if (input_name_type != NULL + && is_same_oid(input_name_type, &EXPORT_NAME_OID)) { + int mechLen = (int)input[3]; /* including 06 len */ + len -= mechLen + 8; /* 4 header bytes, and an int32 length after OID */ + if (len <= 0) { + return GSS_S_FAILURE; + } + // Reject if mech is not krb5 + if (mechLen - 2!= KRB5_OID.length || + memcmp(input + 6, KRB5_OID.elements, mechLen - 2)) { + return GSS_S_FAILURE;; + } + input = input + mechLen + 8; + } + + SEC_WCHAR* value = new SEC_WCHAR[len + 1]; + if (value == NULL) { + goto err; + } + + len = MultiByteToWideChar(CP_UTF8, 0, input, len, value, len+1); + if (len == 0) { + goto err; + } + value[len] = 0; + + PP("import_name from %ls", value); + + if (len > 33 && !wcscmp(value+len-33, L"@WELLKNOWN:ORG.H5L.REFERALS-REALM")) { + // Remove the wellknown referrals realms + value[len-33] = 0; + len -= 33; + } else if (value[len-1] == L'@') { + // Remove the empty realm. It might come from an NT_EXPORT_NAME. + value[len-1] = 0; + len--; + } + if (len == 0) { + goto err; + } + + if (input_name_type != NULL + && is_same_oid(input_name_type, &HOST_SERVICE_NAME_OID)) { + // HOST_SERVICE_NAME_OID takes the form of service@host. + for (int i = 0; i < len; i++) { + if (value[i] == L'\\') { + i++; + continue; + } + if (value[i] == L'@') { + value[i] = L'/'; + break; + } + } + PP("Host-based service now %ls", value); + } + PP("import_name to %ls", value); + gss_name_struct* name = new gss_name_struct; + if (name == NULL) { + goto err; + } + name->name = value; + *output_name = (gss_name_t) name; + return GSS_S_COMPLETE; +err: + if (value != NULL) { + delete[] value; + } + return GSS_S_FAILURE; +} + +__declspec(dllexport) OM_uint32 +gss_compare_name(OM_uint32 *minor_status, + gss_const_name_t name1, + gss_const_name_t name2, + int *name_equal) +{ + PP(">>>> Calling gss_compare_name..."); + CHECK_NAME(name1) + CHECK_NAME(name2) + CHECK_OUTPUT(name_equal) + + *name_equal = 0; + + SEC_WCHAR* n1 = name1->name; + SEC_WCHAR* n2 = name2->name; + PP("Comparing %ls and %ls", n1, n2); + int l1 = lstrlen(n1); + int l2 = lstrlen(n2); + if (l1 < l2 && n2[l1] != L'@' + || l2 < l1 && n1[l2] != L'@') { + return GSS_S_COMPLETE; // different + } + if (l1 > l2) { + l1 = l2; // choose the smaller one. longer=smaller @ ... + } + if (CompareStringEx(LOCALE_NAME_SYSTEM_DEFAULT, NORM_IGNORECASE, + n1, l1, n2, l1, NULL, NULL, 0) == CSTR_EQUAL) { + *name_equal = 1; + } + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_canonicalize_name(OM_uint32 *minor_status, + gss_const_name_t input_name, + const gss_OID mech_type, + gss_name_t *output_name) +{ + PP(">>>> Calling gss_canonicalize_name..."); + CHECK_NAME(input_name) + CHECK_OID(mech_type) + CHECK_OUTPUT(output_name) + + gss_name_t names2 = new gss_name_struct; + if (names2 == NULL) { + return GSS_S_FAILURE; + } + names2->name = get_full_name(input_name->name); + if (names2->name == NULL) { + delete names2; + return GSS_S_FAILURE; + } + *output_name = names2; + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_export_name(OM_uint32 *minor_status, + gss_const_name_t input_name, + gss_buffer_t exported_name) +{ + PP(">>>> Calling gss_export_name..."); + CHECK_NAME(input_name) + CHECK_OUTPUT(exported_name) + + OM_uint32 result = GSS_S_FAILURE; + SEC_WCHAR* name = input_name->name; + SEC_WCHAR* fullname = get_full_name(name); + if (!fullname) { + goto err; + } + PP("Make fullname: %ls -> %ls", name, fullname); + int len; + size_t namelen = wcslen(fullname); + if (namelen > 255) { + goto err; + } + len = (int)namelen; + // We only deal with not-so-long names. + // 04 01 00 ** 06 ** OID len:int32 name + int mechLen = KRB5_OID.length; + char* buffer = new char[10 + mechLen + len]; + if (buffer == NULL) { + goto err; + } + buffer[0] = 4; + buffer[1] = 1; + buffer[2] = 0; + buffer[3] = 2 + mechLen; + buffer[4] = 6; + buffer[5] = mechLen; + memcpy_s(buffer + 6, mechLen, KRB5_OID.elements, mechLen); + buffer[6 + mechLen] = buffer[7 + mechLen] = buffer[8 + mechLen] = 0; + buffer[9 + mechLen] = (char)len; + len = WideCharToMultiByte(CP_UTF8, 0, fullname, len, + buffer+10+mechLen, len, NULL, NULL); + if (len == 0) { + delete[] buffer; + goto err; + } + exported_name->length = 10 + mechLen + len; + exported_name->value = buffer; + result = GSS_S_COMPLETE; +err: + if (fullname != name) { + delete[] fullname; + } + return result; +} + +__declspec(dllexport) OM_uint32 +gss_display_name(OM_uint32 *minor_status, + gss_const_name_t input_name, + gss_buffer_t output_name_buffer, + gss_OID *output_name_type) +{ + PP(">>>> Calling gss_display_name..."); + CHECK_NAME(input_name) + CHECK_OUTPUT(output_name_buffer) + + SEC_WCHAR* names = input_name->name; + int len = (int)wcslen(names); + char* buffer = new char[4*len+1]; + if (buffer == NULL) { + return GSS_S_FAILURE; + } + len = WideCharToMultiByte(CP_UTF8, 0, names, len, buffer, 4*len, NULL, NULL); + if (len == 0) { + delete[] buffer; + return GSS_S_FAILURE; + } + buffer[len] = 0; + output_name_buffer->length = len; + output_name_buffer->value = buffer; + PP("Name found: %ls -> %d [%s]", names, len, buffer); + if (output_name_type != NULL) { + *output_name_type = &KRB5_NAME_OID; + } + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_acquire_cred(OM_uint32 *minor_status, + gss_const_name_t desired_name, + OM_uint32 time_req, + const gss_OID_set desired_mechs, + gss_cred_usage_t cred_usage, + gss_cred_id_t *output_cred_handle, + gss_OID_set *actual_mechs, + OM_uint32 *time_rec) +{ + PP(">>>> Calling gss_acquire_cred..."); + CHECK_OUTPUT(output_cred_handle) + + SECURITY_STATUS ss; + TimeStamp ts; + ts.QuadPart = 0; + cred_usage = 0; + PP("AcquireCredentialsHandle with %d %p", cred_usage, desired_mechs); + get_oid_set_desc(desired_mechs); + + BOOLEAN reqKerberos, reqSPNEGO; + + if (!desired_mechs) { + reqKerberos = reqSPNEGO = TRUE; + } else { + if (has_oid(desired_mechs, &KRB5_OID)) { + PP("reqKerberos"); + reqKerberos = TRUE; + } + if (has_oid(desired_mechs, &SPNEGO_OID)) { + PP("reqSPNEGO"); + reqSPNEGO = TRUE; + } + if (!reqSPNEGO && !reqKerberos) { + return GSS_S_BAD_MECH; + } + } + + if (actual_mechs) { + *actual_mechs = GSS_C_NO_OID_SET; + } + + gss_cred_id_t cred = new_cred(); + if (cred == NULL) { + goto err; + } + + if (reqKerberos) { + cred->phCredK = new CredHandle; + if (cred->phCredK == NULL) { + goto err; + } + ss = AcquireCredentialsHandle( + NULL, + L"Kerberos", + cred_usage == 0 ? SECPKG_CRED_BOTH : + (cred_usage == 1 ? SECPKG_CRED_OUTBOUND : SECPKG_CRED_INBOUND), + NULL, + NULL, + NULL, + NULL, + cred->phCredK, + &ts); + if (!(SEC_SUCCESS(ss))) { + delete cred->phCredK; + cred->phCredK = NULL; + goto err; + } + } + + if (reqSPNEGO) { + cred->phCredS = new CredHandle; + if (cred->phCredS == NULL) { + goto err; + } + SEC_WINNT_AUTH_IDENTITY_EX auth; + ZeroMemory(&auth, sizeof(auth)); + auth.Version = SEC_WINNT_AUTH_IDENTITY_VERSION; + auth.Length = sizeof(auth); + auth.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; + auth.PackageList = (unsigned short*)L"Kerberos"; + auth.PackageListLength = 8; + ss = AcquireCredentialsHandle( + NULL, + L"Negotiate", + cred_usage == 0 ? SECPKG_CRED_BOTH : + (cred_usage == 1 ? SECPKG_CRED_OUTBOUND : SECPKG_CRED_INBOUND), + NULL, + &auth, + NULL, + NULL, + cred->phCredS, + &ts); + if (!(SEC_SUCCESS(ss))) { + delete cred->phCredS; + cred->phCredS = NULL; + goto err; + } + } + + if (actual_mechs) { + if (gss_create_empty_oid_set(minor_status, actual_mechs)) { + goto err; + } + if (reqKerberos) { + if (gss_add_oid_set_member(minor_status, &KRB5_OID, actual_mechs)) { + goto err; + } + } + if (reqSPNEGO) { + if (gss_add_oid_set_member(minor_status, &SPNEGO_OID, actual_mechs)) { + goto err; + } + } + } + + *output_cred_handle = (gss_cred_id_t)cred; + + // Note: ts here is weirdly huge, maybe because LSA retains the + // password and can re-acquire a TGT at anytime. It will be + // GSSCredential.INDEFINITE_LIFETIME. + show_time("cred expiration", &ts); + cred->time = seconds_until(1, &ts); + if (time_rec != NULL) { + *time_rec = cred->time; + } + + // Since only default cred is supported, if there is a desired_name, + // we must make sure it is the same as the realname of the default cred. + if (desired_name != NULL) { + PP("Acquiring cred with a name. Check if it's me."); + gss_name_t realname; + if (gss_inquire_cred(minor_status, *output_cred_handle, &realname, + NULL, NULL, NULL) != GSS_S_COMPLETE) { + PP("Cannot get owner name of default creds"); + goto err; + } + SEC_WCHAR* rnames = realname->name; + SEC_WCHAR* dnames = desired_name->name; + int equals = 0; + gss_compare_name(minor_status, realname, desired_name, &equals); + gss_release_name(minor_status, &realname); + PP("Comparing result: %d", equals); + if (!equals) { + goto err; + } + } + + return GSS_S_COMPLETE; +err: + if (cred) { + OM_uint32 dummy; + gss_release_cred(&dummy, &cred); + } + if (actual_mechs) { + OM_uint32 dummy; + gss_release_oid_set(&dummy, actual_mechs); + } + return GSS_S_FAILURE; +} + +__declspec(dllexport) OM_uint32 +gss_release_cred(OM_uint32 *minor_status, + gss_cred_id_t *cred_handle) +{ + PP(">>>> Calling gss_release_cred..."); + if (cred_handle && *cred_handle) { + if ((*cred_handle)->phCredK) { + FreeCredentialsHandle((*cred_handle)->phCredK); + delete (*cred_handle)->phCredK; + } + if ((*cred_handle)->phCredS) { + FreeCredentialsHandle((*cred_handle)->phCredS); + delete (*cred_handle)->phCredS; + } + delete *cred_handle; + *cred_handle = GSS_C_NO_CREDENTIAL; + } + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_inquire_cred(OM_uint32 *minor_status, + gss_const_cred_id_t cred_handle, + gss_name_t *name, + OM_uint32 *lifetime, + gss_cred_usage_t *cred_usage, + gss_OID_set *mechanisms) +{ + PP(">>>> Calling gss_inquire_cred..."); + CHECK_CRED(cred_handle) + + CredHandle* cred = cred_handle->phCredK + ? cred_handle->phCredK + : cred_handle->phCredS; + SECURITY_STATUS ss; + if (name) { + *name = GSS_C_NO_NAME; + SecPkgCredentials_Names snames; + ss = QueryCredentialsAttributes(cred, SECPKG_CRED_ATTR_NAMES, &snames); + if (!SEC_SUCCESS(ss)) { + return GSS_S_FAILURE; + } + SEC_WCHAR* names = new SEC_WCHAR[lstrlen(snames.sUserName) + 1]; + if (names == NULL) { + return GSS_S_FAILURE; + } + StringCchCopy(names, lstrlen(snames.sUserName) + 1, snames.sUserName); + FreeContextBuffer(snames.sUserName); + PP("Allocate new name at %p", names); + gss_name_t name1 = new gss_name_struct; + if (name1 == NULL) { + delete[] names; + return GSS_S_FAILURE; + } + name1->name = names; + *name = (gss_name_t) name1; + } + if (lifetime) { + *lifetime = cred_handle->time; + } + if (cred_usage) { + *cred_usage = 1; // We only support INITIATE_ONLY now + } + if (mechanisms) { + // Useless for Java + } + // Others inquiries not supported yet + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_import_sec_context(OM_uint32 *minor_status, + const gss_buffer_t interprocess_token, + gss_ctx_id_t *context_handle) +{ + // Not transferable, return FAILURE + PP(">>>> Calling UNIMPLEMENTED gss_import_sec_context..."); + *minor_status = 0; + return GSS_S_FAILURE; +} + +__declspec(dllexport) OM_uint32 +gss_init_sec_context(OM_uint32 *minor_status, + gss_const_cred_id_t initiator_cred_handle, + gss_ctx_id_t *context_handle, + gss_const_name_t target_name, + const gss_OID mech_type, + OM_uint32 req_flags, + OM_uint32 time_req, + const gss_channel_bindings_t input_chan_bindings, + const gss_buffer_t input_token, + gss_OID *actual_mech_type, + gss_buffer_t output_token, + OM_uint32 *ret_flags, + OM_uint32 *time_rec) +{ + PP(">>>> Calling gss_init_sec_context..."); + CHECK_NAME(target_name) + CHECK_OUTPUT(output_token) + + SECURITY_STATUS ss; + TimeStamp lifeTime; + SecBufferDesc inBuffDesc; + SecBuffer inSecBuff; + SecBufferDesc outBuffDesc; + SecBuffer outSecBuff; + BOOLEAN isSPNEGO = is_same_oid(mech_type, &SPNEGO_OID); + + gss_ctx_id_t pc; + + output_token->length = 0; + output_token->value = NULL; + + BOOLEAN firstTime = (*context_handle == GSS_C_NO_CONTEXT); + PP("First time? %d", firstTime); + if (firstTime) { + pc = new_context(isSPNEGO); + if (pc == NULL) { + return GSS_S_FAILURE; + } + *context_handle = (gss_ctx_id_t) pc; + } else { + pc = *context_handle; + } + + if (pc == NULL) { + return GSS_S_NO_CONTEXT; + } + + DWORD outFlag; + TCHAR outName[100]; + + OM_uint32 minor; + gss_buffer_desc tn; + gss_display_name(&minor, target_name, &tn, NULL); + int len = MultiByteToWideChar(CP_UTF8, 0, (LPCCH)tn.value, (int)tn.length, + outName, sizeof(outName) - 1); + if (len == 0) { + goto err; + } + outName[len] = 0; + + int flag = flag_gss_to_sspi(req_flags) | ISC_REQ_ALLOCATE_MEMORY; + + outBuffDesc.ulVersion = SECBUFFER_VERSION; + outBuffDesc.cBuffers = 1; + outBuffDesc.pBuffers = &outSecBuff; + + outSecBuff.BufferType = SECBUFFER_TOKEN; + + if (!firstTime) { + inBuffDesc.ulVersion = SECBUFFER_VERSION; + inBuffDesc.cBuffers = 1; + inBuffDesc.pBuffers = &inSecBuff; + + inSecBuff.BufferType = SECBUFFER_TOKEN; + inSecBuff.cbBuffer = (ULONG)input_token->length; + inSecBuff.pvBuffer = input_token->value; + } else if (!pc->phCred) { + if (isSPNEGO && initiator_cred_handle + && initiator_cred_handle->phCredS) { + PP("Find SPNEGO credentials"); + pc->phCred = initiator_cred_handle->phCredS; + pc->isLocalCred = FALSE; + } else if (!isSPNEGO && initiator_cred_handle + && initiator_cred_handle->phCredK) { + PP("Find Kerberos credentials"); + pc->phCred = initiator_cred_handle->phCredK; + pc->isLocalCred = FALSE; + } else { + PP("No credentials provided, acquire myself"); + CredHandle* newCred = new CredHandle; + SEC_WINNT_AUTH_IDENTITY_EX auth; + ZeroMemory(&auth, sizeof(auth)); + auth.Version = SEC_WINNT_AUTH_IDENTITY_VERSION; + auth.Length = sizeof(auth); + auth.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; + auth.PackageList = (unsigned short*)L"Kerberos"; + auth.PackageListLength = 8; + ss = AcquireCredentialsHandle( + NULL, + isSPNEGO ? L"Negotiate" : L"Kerberos", + SECPKG_CRED_OUTBOUND, + NULL, + isSPNEGO ? &auth : NULL, + NULL, + NULL, + newCred, + &lifeTime); + if (!(SEC_SUCCESS(ss))) { + delete newCred; + goto err; + } + pc->phCred = newCred; + pc->isLocalCred = TRUE; + } + } + ss = InitializeSecurityContext( + pc->phCred, + firstTime ? NULL : &pc->hCtxt, + outName, + flag, + 0, + SECURITY_NATIVE_DREP, + firstTime ? NULL : &inBuffDesc, + 0, + &pc->hCtxt, + &outBuffDesc, + &outFlag, + &lifeTime); + + if (!SEC_SUCCESS(ss)) { + // TODO: seems NativeGSSContext has not failed here. + PP("InitializeSecurityContext failed"); + goto err; + } + + pc->flags = *ret_flags = flag_sspi_to_gss(outFlag); + + // Ignore the result of the next call. Might fail before context established. + QueryContextAttributes( + &pc->hCtxt, SECPKG_ATTR_SIZES, &pc->SecPkgContextSizes); + PP("cbMaxSignature: %ld. cbBlockSize: %ld. cbSecurityTrailer: %ld", + pc->SecPkgContextSizes.cbMaxSignature, + pc->SecPkgContextSizes.cbBlockSize, + pc->SecPkgContextSizes.cbSecurityTrailer); + + output_token->length = outSecBuff.cbBuffer; + if (outSecBuff.cbBuffer) { + // No idea how user would free the data. Let's duplicate one. + output_token->value = new char[outSecBuff.cbBuffer]; + if (!output_token->value) { + FreeContextBuffer(outSecBuff.pvBuffer); + output_token->length = 0; + goto err; + } + memcpy(output_token->value, outSecBuff.pvBuffer, outSecBuff.cbBuffer); + FreeContextBuffer(outSecBuff.pvBuffer); + } + + if (ss == SEC_I_CONTINUE_NEEDED) { + return GSS_S_CONTINUE_NEEDED; + } else { + pc->established = true; + ss = QueryContextAttributes(&pc->hCtxt, SECPKG_ATTR_NATIVE_NAMES, &pc->nnames); + if (!SEC_SUCCESS(ss)) { + goto err; + } + PP("Names. %ls %ls", pc->nnames.sClientName, pc->nnames.sServerName); + *ret_flags |= GSS_C_PROT_READY_FLAG; + return GSS_S_COMPLETE; + } +err: + if (firstTime) { + OM_uint32 dummy; + gss_delete_sec_context(&dummy, context_handle, GSS_C_NO_BUFFER); + } + if (output_token->value) { + gss_release_buffer(NULL, output_token); + output_token = GSS_C_NO_BUFFER; + } + return GSS_S_FAILURE; +} + +__declspec(dllexport) OM_uint32 +gss_accept_sec_context(OM_uint32 *minor_status, + gss_ctx_id_t *context_handle, + gss_const_cred_id_t acceptor_cred_handle, + const gss_buffer_t input_token, + const gss_channel_bindings_t input_chan_bindings, + gss_name_t *src_name, + gss_OID *mech_type, + gss_buffer_t output_token, + OM_uint32 *ret_flags, + OM_uint32 *time_rec, + gss_cred_id_t *delegated_cred_handle) +{ + PP(">>>> Calling UNIMPLEMENTED gss_accept_sec_context..."); + PP("gss_accept_sec_context is not supported in this initiator-only library"); + return GSS_S_FAILURE; +} + +__declspec(dllexport) OM_uint32 +gss_inquire_context(OM_uint32 *minor_status, + gss_const_ctx_id_t context_handle, + gss_name_t *src_name, + gss_name_t *targ_name, + OM_uint32 *lifetime_rec, + gss_OID *mech_type, + OM_uint32 *ctx_flags, + int *locally_initiated, + int *open) +{ + PP(">>>> Calling gss_inquire_context..."); + CHECK_CONTEXT(context_handle) + + gss_name_t n1 = NULL; + gss_name_t n2 = NULL; + if (!context_handle->established) { + return GSS_S_NO_CONTEXT; + } + if (src_name != NULL) { + n1 = new gss_name_struct; + if (n1 == NULL) { + goto err; + } + n1->name = new SEC_WCHAR[lstrlen(context_handle->nnames.sClientName) + 1]; + if (n1->name == NULL) { + goto err; + } + PP("Allocate new name at %p", n1->name); + StringCchCopy(n1->name, lstrlen(context_handle->nnames.sClientName) + 1, + context_handle->nnames.sClientName); + *src_name = (gss_name_t) n1; + } + if (targ_name != NULL) { + n2 = new gss_name_struct; + if (n2 == NULL) { + goto err; + } + n2->name = new SEC_WCHAR[lstrlen(context_handle->nnames.sServerName) + 1]; + if (n2->name == NULL) { + goto err; + } + PP("Allocate new name at %p", n2->name); + StringCchCopy(n2->name, lstrlen(context_handle->nnames.sServerName) + 1, + context_handle->nnames.sServerName); + *targ_name = (gss_name_t) n2; + } + if (lifetime_rec != NULL) { + SecPkgContext_Lifespan ls; + SECURITY_STATUS ss; + ss = QueryContextAttributes( + (PCtxtHandle)&context_handle->hCtxt, + SECPKG_ATTR_LIFESPAN, + &ls); + if (!SEC_SUCCESS(ss)) { + goto err; + } + *lifetime_rec = seconds_until(0, &ls.tsExpiry); + } + if (mech_type != NULL) { + *mech_type = context_handle->isSPNEGO + ? &SPNEGO_OID : &KRB5_OID; + } + if (ctx_flags != NULL) { + *ctx_flags = context_handle->flags; + } + if (locally_initiated != NULL) { + // We are always initiator + *locally_initiated = 1; + } + return GSS_S_COMPLETE; +err: + if (n1 != NULL) { + if (n1->name != NULL) { + delete[] n1->name; + } + delete n1; + n1 = NULL; + } + if (n2 != NULL) { + if (n2->name != NULL) { + delete[] n2->name; + } + delete n2; + n2 = NULL; + } + return GSS_S_FAILURE; +} + +__declspec(dllexport) OM_uint32 +gss_delete_sec_context(OM_uint32 *minor_status, + gss_ctx_id_t *context_handle, + gss_buffer_t output_token) +{ + PP(">>>> Calling gss_delete_sec_context..."); + CHECK_CONTEXT(context_handle) + + DeleteSecurityContext(&(*context_handle)->hCtxt); + if ((*context_handle)->isLocalCred && (*context_handle)->phCred != NULL) { + FreeCredentialsHandle((*context_handle)->phCred); + (*context_handle)->phCred = NULL; + } + if ((*context_handle)->nnames.sClientName != NULL) { + FreeContextBuffer((*context_handle)->nnames.sClientName); + (*context_handle)->nnames.sClientName = NULL; + } + if ((*context_handle)->nnames.sServerName != NULL) { + FreeContextBuffer((*context_handle)->nnames.sServerName); + (*context_handle)->nnames.sServerName = NULL; + } + delete (*context_handle); + *context_handle = GSS_C_NO_CONTEXT; + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_context_time(OM_uint32 *minor_status, + gss_const_ctx_id_t context_handle, + OM_uint32 *time_rec) +{ + PP(">>>> Calling IMPLEMENTED gss_context_time..."); + CHECK_CONTEXT(context_handle) + CHECK_OUTPUT(time_rec) + + SECURITY_STATUS ss; + SecPkgContext_Lifespan ls; + ss = QueryContextAttributes( + (PCtxtHandle)&context_handle->hCtxt, + SECPKG_ATTR_LIFESPAN, + &ls); + if (ss == SEC_E_OK) { + *time_rec = seconds_until(0, &ls.tsExpiry); + show_time("context start", &ls.tsStart); + show_time("context expiry", &ls.tsExpiry); + return *time_rec == 0 ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE; + } else { + return GSS_S_FAILURE; + } +} + +__declspec(dllexport) OM_uint32 +gss_wrap_size_limit(OM_uint32 *minor_status, + gss_const_ctx_id_t context_handle, + int conf_req_flag, + gss_qop_t qop_req, + OM_uint32 req_output_size, + OM_uint32 *max_input_size) +{ + PP(">>>> Calling gss_wrap_size_limit..."); + CHECK_CONTEXT(context_handle) + CHECK_OUTPUT(max_input_size) + + *max_input_size = req_output_size + - context_handle->SecPkgContextSizes.cbSecurityTrailer + - context_handle->SecPkgContextSizes.cbBlockSize; + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_export_sec_context(OM_uint32 *minor_status, + gss_ctx_id_t *context_handle, + gss_buffer_t interprocess_token) +{ + PP(">>>> Calling UNIMPLEMENTED gss_export_sec_context..."); + return GSS_S_FAILURE; +} + +__declspec(dllexport) OM_uint32 +gss_get_mic(OM_uint32 *minor_status, + gss_const_ctx_id_t context_handle, + gss_qop_t qop_req, + const gss_buffer_t message_buffer, + gss_buffer_t msg_token) +{ + PP(">>>> Calling gss_get_mic..."); + CHECK_CONTEXT(context_handle); + CHECK_BUFFER(message_buffer); + CHECK_OUTPUT(msg_token); + + SECURITY_STATUS ss; + SecBufferDesc buffDesc; + SecBuffer secBuff[2]; + + buffDesc.cBuffers = 2; + buffDesc.pBuffers = secBuff; + buffDesc.ulVersion = SECBUFFER_VERSION; + + secBuff[0].BufferType = SECBUFFER_DATA; + secBuff[0].cbBuffer = (ULONG)message_buffer->length; + secBuff[0].pvBuffer = message_buffer->value; + + secBuff[1].BufferType = SECBUFFER_TOKEN; + secBuff[1].cbBuffer = context_handle->SecPkgContextSizes.cbMaxSignature; + secBuff[1].pvBuffer = msg_token->value = new char[secBuff[1].cbBuffer]; + + ss = MakeSignature((PCtxtHandle)&context_handle->hCtxt, 0, &buffDesc, 0); + + if (!SEC_SUCCESS(ss)) { + msg_token->length = 0; + msg_token->value = NULL; + delete[] secBuff[1].pvBuffer; + return GSS_S_FAILURE; + } + + msg_token->length = secBuff[1].cbBuffer; + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_verify_mic(OM_uint32 *minor_status, + gss_const_ctx_id_t context_handle, + const gss_buffer_t message_buffer, + const gss_buffer_t token_buffer, + gss_qop_t *qop_state) +{ + PP(">>>> Calling gss_verify_mic..."); + CHECK_CONTEXT(context_handle); + CHECK_BUFFER(message_buffer); + CHECK_BUFFER(token_buffer); + + SECURITY_STATUS ss; + SecBufferDesc buffDesc; + SecBuffer secBuff[2]; + ULONG qop; + + buffDesc.ulVersion = SECBUFFER_VERSION; + buffDesc.cBuffers = 2; + buffDesc.pBuffers = secBuff; + + secBuff[0].BufferType = SECBUFFER_TOKEN; + secBuff[0].cbBuffer = (ULONG)token_buffer->length; + secBuff[0].pvBuffer = token_buffer->value; + + secBuff[1].BufferType = SECBUFFER_DATA; + secBuff[1].cbBuffer = (ULONG)message_buffer->length; + secBuff[1].pvBuffer = message_buffer->value; + + ss = VerifySignature((PCtxtHandle)&context_handle->hCtxt, &buffDesc, 0, &qop); + if (qop_state) { + *qop_state = qop; + } + + if (ss == SEC_E_OK) { + return GSS_S_COMPLETE; + } else if (ss == SEC_E_OUT_OF_SEQUENCE) { + return GSS_S_UNSEQ_TOKEN; + } else { + return GSS_S_BAD_SIG; + } +} + +__declspec(dllexport) OM_uint32 +gss_wrap(OM_uint32 *minor_status, + gss_const_ctx_id_t context_handle, + int conf_req_flag, + gss_qop_t qop_req, + const gss_buffer_t input_message_buffer, + int *conf_state, + gss_buffer_t output_message_buffer) +{ + PP(">>>> Calling gss_wrap..."); + CHECK_CONTEXT(context_handle); + CHECK_BUFFER(input_message_buffer); + CHECK_OUTPUT(output_message_buffer); + + SECURITY_STATUS ss; + SecBufferDesc buffDesc; + SecBuffer secBuff[3]; + + buffDesc.ulVersion = SECBUFFER_VERSION; + buffDesc.cBuffers = 3; + buffDesc.pBuffers = secBuff; + + secBuff[0].BufferType = SECBUFFER_TOKEN; + secBuff[0].cbBuffer = context_handle->SecPkgContextSizes.cbSecurityTrailer; + output_message_buffer->value = secBuff[0].pvBuffer = malloc( + context_handle->SecPkgContextSizes.cbSecurityTrailer + + input_message_buffer->length + + context_handle->SecPkgContextSizes.cbBlockSize);; + + secBuff[1].BufferType = SECBUFFER_DATA; + secBuff[1].cbBuffer = (ULONG)input_message_buffer->length; + secBuff[1].pvBuffer = malloc(secBuff[1].cbBuffer); + memcpy_s(secBuff[1].pvBuffer, secBuff[1].cbBuffer, + input_message_buffer->value, input_message_buffer->length); + + secBuff[2].BufferType = SECBUFFER_PADDING; + secBuff[2].cbBuffer = context_handle->SecPkgContextSizes.cbBlockSize; + secBuff[2].pvBuffer = malloc(secBuff[2].cbBuffer); + + ss = EncryptMessage((PCtxtHandle)&context_handle->hCtxt, + conf_req_flag ? 0 : SECQOP_WRAP_NO_ENCRYPT, + &buffDesc, 0); + if (conf_state) { + *conf_state = conf_req_flag; + } + + if (!SEC_SUCCESS(ss)) { + free(secBuff[0].pvBuffer); + free(secBuff[1].pvBuffer); + free(secBuff[2].pvBuffer); + output_message_buffer->length = 0; + output_message_buffer->value = NULL; + return GSS_S_FAILURE; + } + + memcpy_s((PBYTE)secBuff[0].pvBuffer + secBuff[0].cbBuffer, + input_message_buffer->length + context_handle->SecPkgContextSizes.cbBlockSize, + secBuff[1].pvBuffer, + secBuff[1].cbBuffer); + memcpy_s((PBYTE)secBuff[0].pvBuffer + secBuff[0].cbBuffer + secBuff[1].cbBuffer, + context_handle->SecPkgContextSizes.cbBlockSize, + secBuff[2].pvBuffer, + secBuff[2].cbBuffer); + + output_message_buffer->length = secBuff[0].cbBuffer + secBuff[1].cbBuffer + + secBuff[2].cbBuffer; + free(secBuff[1].pvBuffer); + free(secBuff[2].pvBuffer); + + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_unwrap(OM_uint32 *minor_status, + gss_const_ctx_id_t context_handle, + const gss_buffer_t input_message_buffer, + gss_buffer_t output_message_buffer, + int *conf_state, + gss_qop_t *qop_state) +{ + PP(">>>> Calling gss_unwrap..."); + CHECK_CONTEXT(context_handle); + CHECK_BUFFER(input_message_buffer); + CHECK_OUTPUT(output_message_buffer); + + SECURITY_STATUS ss; + SecBufferDesc buffDesc; + SecBuffer secBuff[2]; + ULONG ulQop = 0; + + buffDesc.cBuffers = 2; + buffDesc.pBuffers = secBuff; + buffDesc.ulVersion = SECBUFFER_VERSION; + + secBuff[0].BufferType = SECBUFFER_STREAM; + secBuff[0].cbBuffer = (ULONG)input_message_buffer->length; + secBuff[0].pvBuffer = malloc(input_message_buffer->length); + memcpy_s(secBuff[0].pvBuffer, input_message_buffer->length, + input_message_buffer->value, input_message_buffer->length); + + secBuff[1].BufferType = SECBUFFER_DATA; + secBuff[1].cbBuffer = 0; + secBuff[1].pvBuffer = NULL; + + ss = DecryptMessage((PCtxtHandle)&context_handle->hCtxt, &buffDesc, 0, &ulQop); + if (qop_state) { + *qop_state = ulQop; + } + if (!SEC_SUCCESS(ss)) { + free(secBuff[0].pvBuffer); + output_message_buffer->length = 0; + output_message_buffer->value = NULL; + return GSS_S_FAILURE; + } + + // Must allocate a new memory block so client can release it correctly + output_message_buffer->length = secBuff[1].cbBuffer; + output_message_buffer->value = new char[secBuff[1].cbBuffer]; + memcpy_s(output_message_buffer->value, secBuff[1].cbBuffer, + secBuff[1].pvBuffer, secBuff[1].cbBuffer); + *conf_state = ulQop == SECQOP_WRAP_NO_ENCRYPT ? 0 : 1; + + free(secBuff[0].pvBuffer); + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_indicate_mechs(OM_uint32 *minor_status, + gss_OID_set *mech_set) +{ + PP(">>>> Calling gss_indicate_mechs..."); + OM_uint32 major = GSS_S_COMPLETE; + + ULONG ccPackages; + PSecPkgInfo packages; + EnumerateSecurityPackages(&ccPackages, &packages); + PP("EnumerateSecurityPackages returns %ld", ccPackages); + for (unsigned int i = 0; i < ccPackages; i++) { + PP("#%d: %ls, %ls\n", i, packages[i].Name, packages[i].Comment); + } + FreeContextBuffer(packages); + + // Hardcode kerberos and SPNEGO support + major = gss_create_empty_oid_set(minor_status, mech_set); + if (major != GSS_S_COMPLETE) { + goto done; + } + + major = gss_add_oid_set_member(minor_status, &KRB5_OID, mech_set); + if (major != GSS_S_COMPLETE) { + goto done; + } + + major = gss_add_oid_set_member(minor_status, &SPNEGO_OID, mech_set); + if (major != GSS_S_COMPLETE) { + goto done; + } + +done: + + if (major != GSS_S_COMPLETE) { + gss_release_oid_set(minor_status, mech_set); + } + + return major; +} + +__declspec(dllexport) OM_uint32 +gss_inquire_names_for_mech(OM_uint32 *minor_status, + const gss_OID mechanism, + gss_OID_set *name_types) +{ + PP(">>>> Calling gss_inquire_names_for_mech..."); + CHECK_OID(mechanism); + + if (gss_create_empty_oid_set(minor_status, name_types)) { + return GSS_S_FAILURE; + } + if (gss_add_oid_set_member(minor_status, &USER_NAME_OID, name_types)) { + goto err; + } + if (gss_add_oid_set_member(minor_status, &HOST_SERVICE_NAME_OID, name_types)) { + goto err; + } + if (!is_same_oid(mechanism, &SPNEGO_OID)) { + if (gss_add_oid_set_member(minor_status, &EXPORT_NAME_OID, name_types)) { + goto err; + } + } + return GSS_S_COMPLETE; +err: + gss_release_oid_set(minor_status, name_types); + return GSS_S_FAILURE; +} + +__declspec(dllexport) OM_uint32 +gss_add_oid_set_member(OM_uint32 *minor_status, + const gss_OID member_oid, + gss_OID_set *oid_set) +{ + PP(">>>> Calling gss_add_oid_set_member..."); + CHECK_OID(member_oid); + CHECK_OUTPUT(oid_set); + + + int count = (int)(*oid_set)->count; + for (int i = 0; i < count; i++) { + if (is_same_oid(&(*oid_set)->elements[i], member_oid)) { + // already there + return GSS_S_COMPLETE; + } + } + gss_OID existing = (*oid_set)->elements; + gss_OID newcopy = new gss_OID_desc[count + 1]; + if (newcopy == NULL) { + return GSS_S_FAILURE; + } + if (existing) { + memcpy_s(newcopy, (count + 1) * sizeof(gss_OID_desc), + existing, count * sizeof(gss_OID_desc)); + } + newcopy[count].length = member_oid->length; + newcopy[count].elements = new char[member_oid->length]; + if (newcopy[count].elements == NULL) { + delete[] newcopy; + return GSS_S_FAILURE; + } + memcpy_s(newcopy[count].elements, member_oid->length, + member_oid->elements, member_oid->length); + (*oid_set)->elements = newcopy; + (*oid_set)->count++; + if (existing) { + delete[] existing; + } + + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_display_status(OM_uint32 *minor_status, + OM_uint32 status_value, + int status_type, + const gss_OID mech_type, + OM_uint32 *message_context, + gss_buffer_t status_string) +{ + PP(">>>> Calling gss_display_status..."); + TCHAR msg[256]; + int len = FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + 0, status_value, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + msg, 256, 0); + if (len > 0) { + status_string->value = new char[len + 20]; + status_string->length = sprintf_s( + (LPSTR)status_string->value, len + 19, + "(%lx) %ls", status_value, msg); + } else { + status_string->value = new char[33]; + status_string->length = sprintf_s( + (LPSTR)status_string->value, 32, + "status is %lx", status_value); + } + if (status_string->length <= 0) { + gss_release_buffer(NULL, status_string); + status_string = GSS_C_NO_BUFFER; + return GSS_S_FAILURE; + } else { + return GSS_S_COMPLETE; + } +} + +__declspec(dllexport) OM_uint32 +gss_create_empty_oid_set(OM_uint32 *minor_status, + gss_OID_set *oid_set) +{ + PP(">>>> Calling gss_create_empty_oid_set..."); + CHECK_OUTPUT(oid_set); + + if (*oid_set = new gss_OID_set_desc) { + memset(*oid_set, 0, sizeof(gss_OID_set_desc)); + return GSS_S_COMPLETE; + } + return GSS_S_FAILURE; +} + +__declspec(dllexport) OM_uint32 +gss_release_oid_set(OM_uint32 *minor_status, + gss_OID_set *set) +{ + PP(">>>> Calling gss_release_oid_set..."); + if (set == NULL || *set == GSS_C_NO_OID_SET) { + return GSS_S_COMPLETE; + } + for (int i = 0; i < (*set)->count; i++) { + delete[] (*set)->elements[i].elements; + } + delete[] (*set)->elements; + delete *set; + *set = GSS_C_NO_OID_SET; + return GSS_S_COMPLETE; +} + +__declspec(dllexport) OM_uint32 +gss_release_buffer(OM_uint32 *minor_status, + gss_buffer_t buffer) +{ + PP(">>>> Calling gss_release_buffer..."); + if (buffer == NULL || buffer == GSS_C_NO_BUFFER) { + return GSS_S_COMPLETE; + } + if (buffer->value) { + delete[] buffer->value; + buffer->value = NULL; + } + buffer->length = 0; + return GSS_S_COMPLETE; +} + +/* End implemented section */ + +#ifdef __cplusplus +} +#endif diff -r 28582d575a98 -r fd4ec73925c3 src/java.sql.rowset/share/classes/com/sun/rowset/providers/RIXMLProvider.java --- a/src/java.sql.rowset/share/classes/com/sun/rowset/providers/RIXMLProvider.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.sql.rowset/share/classes/com/sun/rowset/providers/RIXMLProvider.java Fri Jun 21 14:07:48 2019 +0530 @@ -46,7 +46,7 @@ * to read an XML data source or to write itself in XML format using the * WebRowSet XML schema definition available at *
    - *     http://java.sun.com/xml/ns/jdbc/webrowset.xsd
    + *     http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd
      * 
    * The RIXMLProvider implementation has a synchronization level of * GRADE_NONE, which means that it does no checking at all for conflicts. It diff -r 28582d575a98 -r fd4ec73925c3 src/java.sql.rowset/share/classes/javax/sql/rowset/WebRowSet.java --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/WebRowSet.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/WebRowSet.java Fri Jun 21 14:07:48 2019 +0530 @@ -44,7 +44,7 @@ * URI: * * It describes the standard XML document format required when describing a diff -r 28582d575a98 -r fd4ec73925c3 src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java --- a/src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java Fri Jun 21 14:07:48 2019 +0530 @@ -95,8 +95,8 @@ * SyncFactory in the form of SyncProvider * implementations. In order to ensure well formed XML usage, a standard generic XML * Schema is defined and published at - * - * http://java.sun.com/xml/ns/jdbc/webrowset.xsd. + * + * http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd. * *
  • FilteredRowSet - A * FilteredRowSet object provides filtering functionality in a programmatic @@ -154,7 +154,8 @@ * RowSet objects exist in a connected or disconnected environment. * The BaseRowSet abstract class provides any RowSet implementation * with its base functionality, including property manipulation and event notification - * that is fully compliant with JavaBeans + * that is fully compliant with + * JavaBeans * component requirements. As an example, all implementations provided in the * reference implementations (contained in the com.sun.rowset package) use * the BaseRowSet class as a basis for their implementations. diff -r 28582d575a98 -r fd4ec73925c3 src/java.sql/share/classes/java/sql/ConnectionBuilder.java --- a/src/java.sql/share/classes/java/sql/ConnectionBuilder.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.sql/share/classes/java/sql/ConnectionBuilder.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -44,8 +44,8 @@ * Connection con = ds.createConnectionBuilder() * .user("rafa") * .password("tennis") - * .setShardingKey(shardingKey) - * .setSuperShardingKey(superShardingKey) + * .shardingKey(shardingKey) + * .superShardingKey(superShardingKey) * .build(); * } * diff -r 28582d575a98 -r fd4ec73925c3 src/java.sql/share/classes/javax/sql/PooledConnectionBuilder.java --- a/src/java.sql/share/classes/javax/sql/PooledConnectionBuilder.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.sql/share/classes/javax/sql/PooledConnectionBuilder.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 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,8 +47,8 @@ * PooledConnection con = ds.createPooledConnectionBuilder() * .user("rafa") * .password("tennis") - * .setShardingKey(shardingKey) - * .setSuperShardingKey(superShardingKey) + * .shardingKey(shardingKey) + * .superShardingKey(superShardingKey) * .build(); * } * diff -r 28582d575a98 -r fd4ec73925c3 src/java.sql/share/classes/javax/sql/XAConnectionBuilder.java --- a/src/java.sql/share/classes/javax/sql/XAConnectionBuilder.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/java.sql/share/classes/javax/sql/XAConnectionBuilder.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 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,8 +47,8 @@ * XAConnection con = ds.createXAConnectionBuilder() * .user("rafa") * .password("tennis") - * .setShardingKey(shardingKey) - * .setSuperShardingKey(superShardingKey) + * .shardingKey(shardingKey) + * .superShardingKey(superShardingKey) * .build(); * } * diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java --- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -233,7 +233,7 @@ * InputStream for the socket connection to get target VM */ private class SocketInputStream extends InputStream { - int s; + int s = -1; public SocketInputStream(int s) { this.s = s; @@ -261,7 +261,12 @@ } public void close() throws IOException { - VirtualMachineImpl.close(s); + synchronized (this) { + if (s != -1) { + VirtualMachineImpl.close(s); + s = -1; + } + } } } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/doclint/Entity.java --- a/src/jdk.compiler/share/classes/com/sun/tools/doclint/Entity.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/doclint/Entity.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -26,305 +26,2163 @@ package com.sun.tools.doclint; import java.util.HashMap; -import java.util.Map; /** - * Table of entities defined in HTML 4.01. + * Table of entities defined in HTML 5.2. * - *

    Derived from - * Character entity references in HTML 4. - * - * The name of the member follows the name of the entity, - * except when it clashes with a keyword, in which case - * it is prefixed by '_'. + *

    Derived from the + * Named character references + * section of the HTML 5.2 specification. * *

    This is NOT part of any supported API. * If you write code that depends on this, you do so at your own * risk. This code and its internal interfaces are subject to change * or deletion without notice.

    */ -public enum Entity { - nbsp(160), - iexcl(161), - cent(162), - pound(163), - curren(164), - yen(165), - brvbar(166), - sect(167), - uml(168), - copy(169), - ordf(170), - laquo(171), - not(172), - shy(173), - reg(174), - macr(175), - deg(176), - plusmn(177), - sup2(178), - sup3(179), - acute(180), - micro(181), - para(182), - middot(183), - cedil(184), - sup1(185), - ordm(186), - raquo(187), - frac14(188), - frac12(189), - frac34(190), - iquest(191), - Agrave(192), - Aacute(193), - Acirc(194), - Atilde(195), - Auml(196), - Aring(197), - AElig(198), - Ccedil(199), - Egrave(200), - Eacute(201), - Ecirc(202), - Euml(203), - Igrave(204), - Iacute(205), - Icirc(206), - Iuml(207), - ETH(208), - Ntilde(209), - Ograve(210), - Oacute(211), - Ocirc(212), - Otilde(213), - Ouml(214), - times(215), - Oslash(216), - Ugrave(217), - Uacute(218), - Ucirc(219), - Uuml(220), - Yacute(221), - THORN(222), - szlig(223), - agrave(224), - aacute(225), - acirc(226), - atilde(227), - auml(228), - aring(229), - aelig(230), - ccedil(231), - egrave(232), - eacute(233), - ecirc(234), - euml(235), - igrave(236), - iacute(237), - icirc(238), - iuml(239), - eth(240), - ntilde(241), - ograve(242), - oacute(243), - ocirc(244), - otilde(245), - ouml(246), - divide(247), - oslash(248), - ugrave(249), - uacute(250), - ucirc(251), - uuml(252), - yacute(253), - thorn(254), - yuml(255), - fnof(402), - Alpha(913), - Beta(914), - Gamma(915), - Delta(916), - Epsilon(917), - Zeta(918), - Eta(919), - Theta(920), - Iota(921), - Kappa(922), - Lambda(923), - Mu(924), - Nu(925), - Xi(926), - Omicron(927), - Pi(928), - Rho(929), - Sigma(931), - Tau(932), - Upsilon(933), - Phi(934), - Chi(935), - Psi(936), - Omega(937), - alpha(945), - beta(946), - gamma(947), - delta(948), - epsilon(949), - zeta(950), - eta(951), - theta(952), - iota(953), - kappa(954), - lambda(955), - mu(956), - nu(957), - xi(958), - omicron(959), - pi(960), - rho(961), - sigmaf(962), - sigma(963), - tau(964), - upsilon(965), - phi(966), - chi(967), - psi(968), - omega(969), - thetasym(977), - upsih(978), - piv(982), - bull(8226), - hellip(8230), - prime(8242), - Prime(8243), - oline(8254), - frasl(8260), - weierp(8472), - image(8465), - real(8476), - trade(8482), - alefsym(8501), - larr(8592), - uarr(8593), - rarr(8594), - darr(8595), - harr(8596), - crarr(8629), - lArr(8656), - uArr(8657), - rArr(8658), - dArr(8659), - hArr(8660), - forall(8704), - part(8706), - exist(8707), - empty(8709), - nabla(8711), - isin(8712), - notin(8713), - ni(8715), - prod(8719), - sum(8721), - minus(8722), - lowast(8727), - radic(8730), - prop(8733), - infin(8734), - ang(8736), - and(8743), - or(8744), - cap(8745), - cup(8746), - _int(8747), - there4(8756), - sim(8764), - cong(8773), - asymp(8776), - ne(8800), - equiv(8801), - le(8804), - ge(8805), - sub(8834), - sup(8835), - nsub(8836), - sube(8838), - supe(8839), - oplus(8853), - otimes(8855), - perp(8869), - sdot(8901), - lceil(8968), - rceil(8969), - lfloor(8970), - rfloor(8971), - lang(9001), - rang(9002), - loz(9674), - spades(9824), - clubs(9827), - hearts(9829), - diams(9830), - quot(34), - amp(38), - lt(60), - gt(62), - OElig(338), - oelig(339), - Scaron(352), - scaron(353), - Yuml(376), - circ(710), - tilde(732), - ensp(8194), - emsp(8195), - thinsp(8201), - zwnj(8204), - zwj(8205), - lrm(8206), - rlm(8207), - ndash(8211), - mdash(8212), - lsquo(8216), - rsquo(8217), - sbquo(8218), - ldquo(8220), - rdquo(8221), - bdquo(8222), - dagger(8224), - Dagger(8225), - permil(8240), - lsaquo(8249), - rsaquo(8250), - euro(8364); +public class Entity { + + private static final HashMap html5Entities = new HashMap<>(); - public final int code; - - private Entity(int code) { - this.code = code; + static { + html5Entities.put("Aacute", "\u00C1"); + html5Entities.put("aacute", "\u00E1"); + html5Entities.put("Abreve", "\u0102"); + html5Entities.put("abreve", "\u0103"); + html5Entities.put("ac", "\u223E"); + html5Entities.put("acd", "\u223F"); + html5Entities.put("acE", "\u223E\u0333"); + html5Entities.put("Acirc", "\u00C2"); + html5Entities.put("acirc", "\u00E2"); + html5Entities.put("acute", "\u00B4"); + html5Entities.put("Acy", "\u0410"); + html5Entities.put("acy", "\u0430"); + html5Entities.put("AElig", "\u00C6"); + html5Entities.put("aelig", "\u00E6"); + html5Entities.put("af", "\u2061"); + html5Entities.put("Afr", "\uD835\uDD04"); + html5Entities.put("afr", "\uD835\uDD1E"); + html5Entities.put("Agrave", "\u00C0"); + html5Entities.put("agrave", "\u00E0"); + html5Entities.put("alefsym", "\u2135"); + html5Entities.put("aleph", "\u2135"); + html5Entities.put("Alpha", "\u0391"); + html5Entities.put("alpha", "\u03B1"); + html5Entities.put("Amacr", "\u0100"); + html5Entities.put("amacr", "\u0101"); + html5Entities.put("amalg", "\u2A3F"); + html5Entities.put("amp", "\u0026"); + html5Entities.put("AMP", "\u0026"); + html5Entities.put("andand", "\u2A55"); + html5Entities.put("And", "\u2A53"); + html5Entities.put("and", "\u2227"); + html5Entities.put("andd", "\u2A5C"); + html5Entities.put("andslope", "\u2A58"); + html5Entities.put("andv", "\u2A5A"); + html5Entities.put("ang", "\u2220"); + html5Entities.put("ange", "\u29A4"); + html5Entities.put("angle", "\u2220"); + html5Entities.put("angmsdaa", "\u29A8"); + html5Entities.put("angmsdab", "\u29A9"); + html5Entities.put("angmsdac", "\u29AA"); + html5Entities.put("angmsdad", "\u29AB"); + html5Entities.put("angmsdae", "\u29AC"); + html5Entities.put("angmsdaf", "\u29AD"); + html5Entities.put("angmsdag", "\u29AE"); + html5Entities.put("angmsdah", "\u29AF"); + html5Entities.put("angmsd", "\u2221"); + html5Entities.put("angrt", "\u221F"); + html5Entities.put("angrtvb", "\u22BE"); + html5Entities.put("angrtvbd", "\u299D"); + html5Entities.put("angsph", "\u2222"); + html5Entities.put("angst", "\u00C5"); + html5Entities.put("angzarr", "\u237C"); + html5Entities.put("Aogon", "\u0104"); + html5Entities.put("aogon", "\u0105"); + html5Entities.put("Aopf", "\uD835\uDD38"); + html5Entities.put("aopf", "\uD835\uDD52"); + html5Entities.put("apacir", "\u2A6F"); + html5Entities.put("ap", "\u2248"); + html5Entities.put("apE", "\u2A70"); + html5Entities.put("ape", "\u224A"); + html5Entities.put("apid", "\u224B"); + html5Entities.put("apos", "\u0027"); + html5Entities.put("ApplyFunction", "\u2061"); + html5Entities.put("approx", "\u2248"); + html5Entities.put("approxeq", "\u224A"); + html5Entities.put("Aring", "\u00C5"); + html5Entities.put("aring", "\u00E5"); + html5Entities.put("Ascr", "\uD835\uDC9C"); + html5Entities.put("ascr", "\uD835\uDCB6"); + html5Entities.put("Assign", "\u2254"); + html5Entities.put("ast", "\u002A"); + html5Entities.put("asymp", "\u2248"); + html5Entities.put("asympeq", "\u224D"); + html5Entities.put("Atilde", "\u00C3"); + html5Entities.put("atilde", "\u00E3"); + html5Entities.put("Auml", "\u00C4"); + html5Entities.put("auml", "\u00E4"); + html5Entities.put("awconint", "\u2233"); + html5Entities.put("awint", "\u2A11"); + html5Entities.put("backcong", "\u224C"); + html5Entities.put("backepsilon", "\u03F6"); + html5Entities.put("backprime", "\u2035"); + html5Entities.put("backsim", "\u223D"); + html5Entities.put("backsimeq", "\u22CD"); + html5Entities.put("Backslash", "\u2216"); + html5Entities.put("Barv", "\u2AE7"); + html5Entities.put("barvee", "\u22BD"); + html5Entities.put("barwed", "\u2305"); + html5Entities.put("Barwed", "\u2306"); + html5Entities.put("barwedge", "\u2305"); + html5Entities.put("bbrk", "\u23B5"); + html5Entities.put("bbrktbrk", "\u23B6"); + html5Entities.put("bcong", "\u224C"); + html5Entities.put("Bcy", "\u0411"); + html5Entities.put("bcy", "\u0431"); + html5Entities.put("bdquo", "\u201E"); + html5Entities.put("becaus", "\u2235"); + html5Entities.put("because", "\u2235"); + html5Entities.put("Because", "\u2235"); + html5Entities.put("bemptyv", "\u29B0"); + html5Entities.put("bepsi", "\u03F6"); + html5Entities.put("bernou", "\u212C"); + html5Entities.put("Bernoullis", "\u212C"); + html5Entities.put("Beta", "\u0392"); + html5Entities.put("beta", "\u03B2"); + html5Entities.put("beth", "\u2136"); + html5Entities.put("between", "\u226C"); + html5Entities.put("Bfr", "\uD835\uDD05"); + html5Entities.put("bfr", "\uD835\uDD1F"); + html5Entities.put("bigcap", "\u22C2"); + html5Entities.put("bigcirc", "\u25EF"); + html5Entities.put("bigcup", "\u22C3"); + html5Entities.put("bigodot", "\u2A00"); + html5Entities.put("bigoplus", "\u2A01"); + html5Entities.put("bigotimes", "\u2A02"); + html5Entities.put("bigsqcup", "\u2A06"); + html5Entities.put("bigstar", "\u2605"); + html5Entities.put("bigtriangledown", "\u25BD"); + html5Entities.put("bigtriangleup", "\u25B3"); + html5Entities.put("biguplus", "\u2A04"); + html5Entities.put("bigvee", "\u22C1"); + html5Entities.put("bigwedge", "\u22C0"); + html5Entities.put("bkarow", "\u290D"); + html5Entities.put("blacklozenge", "\u29EB"); + html5Entities.put("blacksquare", "\u25AA"); + html5Entities.put("blacktriangle", "\u25B4"); + html5Entities.put("blacktriangledown", "\u25BE"); + html5Entities.put("blacktriangleleft", "\u25C2"); + html5Entities.put("blacktriangleright", "\u25B8"); + html5Entities.put("blank", "\u2423"); + html5Entities.put("blk12", "\u2592"); + html5Entities.put("blk14", "\u2591"); + html5Entities.put("blk34", "\u2593"); + html5Entities.put("block", "\u2588"); + html5Entities.put("bne", "\u003D\u20E5"); + html5Entities.put("bnequiv", "\u2261\u20E5"); + html5Entities.put("bNot", "\u2AED"); + html5Entities.put("bnot", "\u2310"); + html5Entities.put("Bopf", "\uD835\uDD39"); + html5Entities.put("bopf", "\uD835\uDD53"); + html5Entities.put("bot", "\u22A5"); + html5Entities.put("bottom", "\u22A5"); + html5Entities.put("bowtie", "\u22C8"); + html5Entities.put("boxbox", "\u29C9"); + html5Entities.put("boxdl", "\u2510"); + html5Entities.put("boxdL", "\u2555"); + html5Entities.put("boxDl", "\u2556"); + html5Entities.put("boxDL", "\u2557"); + html5Entities.put("boxdr", "\u250C"); + html5Entities.put("boxdR", "\u2552"); + html5Entities.put("boxDr", "\u2553"); + html5Entities.put("boxDR", "\u2554"); + html5Entities.put("boxh", "\u2500"); + html5Entities.put("boxH", "\u2550"); + html5Entities.put("boxhd", "\u252C"); + html5Entities.put("boxHd", "\u2564"); + html5Entities.put("boxhD", "\u2565"); + html5Entities.put("boxHD", "\u2566"); + html5Entities.put("boxhu", "\u2534"); + html5Entities.put("boxHu", "\u2567"); + html5Entities.put("boxhU", "\u2568"); + html5Entities.put("boxHU", "\u2569"); + html5Entities.put("boxminus", "\u229F"); + html5Entities.put("boxplus", "\u229E"); + html5Entities.put("boxtimes", "\u22A0"); + html5Entities.put("boxul", "\u2518"); + html5Entities.put("boxuL", "\u255B"); + html5Entities.put("boxUl", "\u255C"); + html5Entities.put("boxUL", "\u255D"); + html5Entities.put("boxur", "\u2514"); + html5Entities.put("boxuR", "\u2558"); + html5Entities.put("boxUr", "\u2559"); + html5Entities.put("boxUR", "\u255A"); + html5Entities.put("boxv", "\u2502"); + html5Entities.put("boxV", "\u2551"); + html5Entities.put("boxvh", "\u253C"); + html5Entities.put("boxvH", "\u256A"); + html5Entities.put("boxVh", "\u256B"); + html5Entities.put("boxVH", "\u256C"); + html5Entities.put("boxvl", "\u2524"); + html5Entities.put("boxvL", "\u2561"); + html5Entities.put("boxVl", "\u2562"); + html5Entities.put("boxVL", "\u2563"); + html5Entities.put("boxvr", "\u251C"); + html5Entities.put("boxvR", "\u255E"); + html5Entities.put("boxVr", "\u255F"); + html5Entities.put("boxVR", "\u2560"); + html5Entities.put("bprime", "\u2035"); + html5Entities.put("breve", "\u02D8"); + html5Entities.put("Breve", "\u02D8"); + html5Entities.put("brvbar", "\u00A6"); + html5Entities.put("bscr", "\uD835\uDCB7"); + html5Entities.put("Bscr", "\u212C"); + html5Entities.put("bsemi", "\u204F"); + html5Entities.put("bsim", "\u223D"); + html5Entities.put("bsime", "\u22CD"); + html5Entities.put("bsolb", "\u29C5"); + html5Entities.put("bsol", "\\"); + html5Entities.put("bsolhsub", "\u27C8"); + html5Entities.put("bull", "\u2022"); + html5Entities.put("bullet", "\u2022"); + html5Entities.put("bump", "\u224E"); + html5Entities.put("bumpE", "\u2AAE"); + html5Entities.put("bumpe", "\u224F"); + html5Entities.put("Bumpeq", "\u224E"); + html5Entities.put("bumpeq", "\u224F"); + html5Entities.put("Cacute", "\u0106"); + html5Entities.put("cacute", "\u0107"); + html5Entities.put("capand", "\u2A44"); + html5Entities.put("capbrcup", "\u2A49"); + html5Entities.put("capcap", "\u2A4B"); + html5Entities.put("cap", "\u2229"); + html5Entities.put("Cap", "\u22D2"); + html5Entities.put("capcup", "\u2A47"); + html5Entities.put("capdot", "\u2A40"); + html5Entities.put("CapitalDifferentialD", "\u2145"); + html5Entities.put("caps", "\u2229\uFE00"); + html5Entities.put("caret", "\u2041"); + html5Entities.put("caron", "\u02C7"); + html5Entities.put("Cayleys", "\u212D"); + html5Entities.put("ccaps", "\u2A4D"); + html5Entities.put("Ccaron", "\u010C"); + html5Entities.put("ccaron", "\u010D"); + html5Entities.put("Ccedil", "\u00C7"); + html5Entities.put("ccedil", "\u00E7"); + html5Entities.put("Ccirc", "\u0108"); + html5Entities.put("ccirc", "\u0109"); + html5Entities.put("Cconint", "\u2230"); + html5Entities.put("ccups", "\u2A4C"); + html5Entities.put("ccupssm", "\u2A50"); + html5Entities.put("Cdot", "\u010A"); + html5Entities.put("cdot", "\u010B"); + html5Entities.put("cedil", "\u00B8"); + html5Entities.put("Cedilla", "\u00B8"); + html5Entities.put("cemptyv", "\u29B2"); + html5Entities.put("cent", "\u00A2"); + html5Entities.put("centerdot", "\u00B7"); + html5Entities.put("CenterDot", "\u00B7"); + html5Entities.put("cfr", "\uD835\uDD20"); + html5Entities.put("Cfr", "\u212D"); + html5Entities.put("CHcy", "\u0427"); + html5Entities.put("chcy", "\u0447"); + html5Entities.put("check", "\u2713"); + html5Entities.put("checkmark", "\u2713"); + html5Entities.put("Chi", "\u03A7"); + html5Entities.put("chi", "\u03C7"); + html5Entities.put("circ", "\u02C6"); + html5Entities.put("circeq", "\u2257"); + html5Entities.put("circlearrowleft", "\u21BA"); + html5Entities.put("circlearrowright", "\u21BB"); + html5Entities.put("circledast", "\u229B"); + html5Entities.put("circledcirc", "\u229A"); + html5Entities.put("circleddash", "\u229D"); + html5Entities.put("CircleDot", "\u2299"); + html5Entities.put("circledR", "\u00AE"); + html5Entities.put("circledS", "\u24C8"); + html5Entities.put("CircleMinus", "\u2296"); + html5Entities.put("CirclePlus", "\u2295"); + html5Entities.put("CircleTimes", "\u2297"); + html5Entities.put("cir", "\u25CB"); + html5Entities.put("cirE", "\u29C3"); + html5Entities.put("cire", "\u2257"); + html5Entities.put("cirfnint", "\u2A10"); + html5Entities.put("cirmid", "\u2AEF"); + html5Entities.put("cirscir", "\u29C2"); + html5Entities.put("ClockwiseContourIntegral", "\u2232"); + html5Entities.put("CloseCurlyDoubleQuote", "\u201D"); + html5Entities.put("CloseCurlyQuote", "\u2019"); + html5Entities.put("clubs", "\u2663"); + html5Entities.put("clubsuit", "\u2663"); + html5Entities.put("colon", "\u003A"); + html5Entities.put("Colon", "\u2237"); + html5Entities.put("Colone", "\u2A74"); + html5Entities.put("colone", "\u2254"); + html5Entities.put("coloneq", "\u2254"); + html5Entities.put("comma", "\u002C"); + html5Entities.put("commat", "\u0040"); + html5Entities.put("comp", "\u2201"); + html5Entities.put("compfn", "\u2218"); + html5Entities.put("complement", "\u2201"); + html5Entities.put("complexes", "\u2102"); + html5Entities.put("cong", "\u2245"); + html5Entities.put("congdot", "\u2A6D"); + html5Entities.put("Congruent", "\u2261"); + html5Entities.put("conint", "\u222E"); + html5Entities.put("Conint", "\u222F"); + html5Entities.put("ContourIntegral", "\u222E"); + html5Entities.put("copf", "\uD835\uDD54"); + html5Entities.put("Copf", "\u2102"); + html5Entities.put("coprod", "\u2210"); + html5Entities.put("Coproduct", "\u2210"); + html5Entities.put("copy", "\u00A9"); + html5Entities.put("COPY", "\u00A9"); + html5Entities.put("copysr", "\u2117"); + html5Entities.put("CounterClockwiseContourIntegral", "\u2233"); + html5Entities.put("crarr", "\u21B5"); + html5Entities.put("cross", "\u2717"); + html5Entities.put("Cross", "\u2A2F"); + html5Entities.put("Cscr", "\uD835\uDC9E"); + html5Entities.put("cscr", "\uD835\uDCB8"); + html5Entities.put("csub", "\u2ACF"); + html5Entities.put("csube", "\u2AD1"); + html5Entities.put("csup", "\u2AD0"); + html5Entities.put("csupe", "\u2AD2"); + html5Entities.put("ctdot", "\u22EF"); + html5Entities.put("cudarrl", "\u2938"); + html5Entities.put("cudarrr", "\u2935"); + html5Entities.put("cuepr", "\u22DE"); + html5Entities.put("cuesc", "\u22DF"); + html5Entities.put("cularr", "\u21B6"); + html5Entities.put("cularrp", "\u293D"); + html5Entities.put("cupbrcap", "\u2A48"); + html5Entities.put("cupcap", "\u2A46"); + html5Entities.put("CupCap", "\u224D"); + html5Entities.put("cup", "\u222A"); + html5Entities.put("Cup", "\u22D3"); + html5Entities.put("cupcup", "\u2A4A"); + html5Entities.put("cupdot", "\u228D"); + html5Entities.put("cupor", "\u2A45"); + html5Entities.put("cups", "\u222A\uFE00"); + html5Entities.put("curarr", "\u21B7"); + html5Entities.put("curarrm", "\u293C"); + html5Entities.put("curlyeqprec", "\u22DE"); + html5Entities.put("curlyeqsucc", "\u22DF"); + html5Entities.put("curlyvee", "\u22CE"); + html5Entities.put("curlywedge", "\u22CF"); + html5Entities.put("curren", "\u00A4"); + html5Entities.put("curvearrowleft", "\u21B6"); + html5Entities.put("curvearrowright", "\u21B7"); + html5Entities.put("cuvee", "\u22CE"); + html5Entities.put("cuwed", "\u22CF"); + html5Entities.put("cwconint", "\u2232"); + html5Entities.put("cwint", "\u2231"); + html5Entities.put("cylcty", "\u232D"); + html5Entities.put("dagger", "\u2020"); + html5Entities.put("Dagger", "\u2021"); + html5Entities.put("daleth", "\u2138"); + html5Entities.put("darr", "\u2193"); + html5Entities.put("Darr", "\u21A1"); + html5Entities.put("dArr", "\u21D3"); + html5Entities.put("dash", "\u2010"); + html5Entities.put("Dashv", "\u2AE4"); + html5Entities.put("dashv", "\u22A3"); + html5Entities.put("dbkarow", "\u290F"); + html5Entities.put("dblac", "\u02DD"); + html5Entities.put("Dcaron", "\u010E"); + html5Entities.put("dcaron", "\u010F"); + html5Entities.put("Dcy", "\u0414"); + html5Entities.put("dcy", "\u0434"); + html5Entities.put("ddagger", "\u2021"); + html5Entities.put("ddarr", "\u21CA"); + html5Entities.put("DD", "\u2145"); + html5Entities.put("dd", "\u2146"); + html5Entities.put("DDotrahd", "\u2911"); + html5Entities.put("ddotseq", "\u2A77"); + html5Entities.put("deg", "\u00B0"); + html5Entities.put("Del", "\u2207"); + html5Entities.put("Delta", "\u0394"); + html5Entities.put("delta", "\u03B4"); + html5Entities.put("demptyv", "\u29B1"); + html5Entities.put("dfisht", "\u297F"); + html5Entities.put("Dfr", "\uD835\uDD07"); + html5Entities.put("dfr", "\uD835\uDD21"); + html5Entities.put("dHar", "\u2965"); + html5Entities.put("dharl", "\u21C3"); + html5Entities.put("dharr", "\u21C2"); + html5Entities.put("DiacriticalAcute", "\u00B4"); + html5Entities.put("DiacriticalDot", "\u02D9"); + html5Entities.put("DiacriticalDoubleAcute", "\u02DD"); + html5Entities.put("DiacriticalGrave", "\u0060"); + html5Entities.put("DiacriticalTilde", "\u02DC"); + html5Entities.put("diam", "\u22C4"); + html5Entities.put("diamond", "\u22C4"); + html5Entities.put("Diamond", "\u22C4"); + html5Entities.put("diamondsuit", "\u2666"); + html5Entities.put("diams", "\u2666"); + html5Entities.put("die", "\u00A8"); + html5Entities.put("DifferentialD", "\u2146"); + html5Entities.put("digamma", "\u03DD"); + html5Entities.put("disin", "\u22F2"); + html5Entities.put("div", "\u00F7"); + html5Entities.put("divide", "\u00F7"); + html5Entities.put("divideontimes", "\u22C7"); + html5Entities.put("divonx", "\u22C7"); + html5Entities.put("DJcy", "\u0402"); + html5Entities.put("djcy", "\u0452"); + html5Entities.put("dlcorn", "\u231E"); + html5Entities.put("dlcrop", "\u230D"); + html5Entities.put("dollar", "\u0024"); + html5Entities.put("Dopf", "\uD835\uDD3B"); + html5Entities.put("dopf", "\uD835\uDD55"); + html5Entities.put("Dot", "\u00A8"); + html5Entities.put("dot", "\u02D9"); + html5Entities.put("DotDot", "\u20DC"); + html5Entities.put("doteq", "\u2250"); + html5Entities.put("doteqdot", "\u2251"); + html5Entities.put("DotEqual", "\u2250"); + html5Entities.put("dotminus", "\u2238"); + html5Entities.put("dotplus", "\u2214"); + html5Entities.put("dotsquare", "\u22A1"); + html5Entities.put("doublebarwedge", "\u2306"); + html5Entities.put("DoubleContourIntegral", "\u222F"); + html5Entities.put("DoubleDot", "\u00A8"); + html5Entities.put("DoubleDownArrow", "\u21D3"); + html5Entities.put("DoubleLeftArrow", "\u21D0"); + html5Entities.put("DoubleLeftRightArrow", "\u21D4"); + html5Entities.put("DoubleLeftTee", "\u2AE4"); + html5Entities.put("DoubleLongLeftArrow", "\u27F8"); + html5Entities.put("DoubleLongLeftRightArrow", "\u27FA"); + html5Entities.put("DoubleLongRightArrow", "\u27F9"); + html5Entities.put("DoubleRightArrow", "\u21D2"); + html5Entities.put("DoubleRightTee", "\u22A8"); + html5Entities.put("DoubleUpArrow", "\u21D1"); + html5Entities.put("DoubleUpDownArrow", "\u21D5"); + html5Entities.put("DoubleVerticalBar", "\u2225"); + html5Entities.put("DownArrowBar", "\u2913"); + html5Entities.put("downarrow", "\u2193"); + html5Entities.put("DownArrow", "\u2193"); + html5Entities.put("Downarrow", "\u21D3"); + html5Entities.put("DownArrowUpArrow", "\u21F5"); + html5Entities.put("DownBreve", "\u0311"); + html5Entities.put("downdownarrows", "\u21CA"); + html5Entities.put("downharpoonleft", "\u21C3"); + html5Entities.put("downharpoonright", "\u21C2"); + html5Entities.put("DownLeftRightVector", "\u2950"); + html5Entities.put("DownLeftTeeVector", "\u295E"); + html5Entities.put("DownLeftVectorBar", "\u2956"); + html5Entities.put("DownLeftVector", "\u21BD"); + html5Entities.put("DownRightTeeVector", "\u295F"); + html5Entities.put("DownRightVectorBar", "\u2957"); + html5Entities.put("DownRightVector", "\u21C1"); + html5Entities.put("DownTeeArrow", "\u21A7"); + html5Entities.put("DownTee", "\u22A4"); + html5Entities.put("drbkarow", "\u2910"); + html5Entities.put("drcorn", "\u231F"); + html5Entities.put("drcrop", "\u230C"); + html5Entities.put("Dscr", "\uD835\uDC9F"); + html5Entities.put("dscr", "\uD835\uDCB9"); + html5Entities.put("DScy", "\u0405"); + html5Entities.put("dscy", "\u0455"); + html5Entities.put("dsol", "\u29F6"); + html5Entities.put("Dstrok", "\u0110"); + html5Entities.put("dstrok", "\u0111"); + html5Entities.put("dtdot", "\u22F1"); + html5Entities.put("dtri", "\u25BF"); + html5Entities.put("dtrif", "\u25BE"); + html5Entities.put("duarr", "\u21F5"); + html5Entities.put("duhar", "\u296F"); + html5Entities.put("dwangle", "\u29A6"); + html5Entities.put("DZcy", "\u040F"); + html5Entities.put("dzcy", "\u045F"); + html5Entities.put("dzigrarr", "\u27FF"); + html5Entities.put("Eacute", "\u00C9"); + html5Entities.put("eacute", "\u00E9"); + html5Entities.put("easter", "\u2A6E"); + html5Entities.put("Ecaron", "\u011A"); + html5Entities.put("ecaron", "\u011B"); + html5Entities.put("Ecirc", "\u00CA"); + html5Entities.put("ecirc", "\u00EA"); + html5Entities.put("ecir", "\u2256"); + html5Entities.put("ecolon", "\u2255"); + html5Entities.put("Ecy", "\u042D"); + html5Entities.put("ecy", "\u044D"); + html5Entities.put("eDDot", "\u2A77"); + html5Entities.put("Edot", "\u0116"); + html5Entities.put("edot", "\u0117"); + html5Entities.put("eDot", "\u2251"); + html5Entities.put("ee", "\u2147"); + html5Entities.put("efDot", "\u2252"); + html5Entities.put("Efr", "\uD835\uDD08"); + html5Entities.put("efr", "\uD835\uDD22"); + html5Entities.put("eg", "\u2A9A"); + html5Entities.put("Egrave", "\u00C8"); + html5Entities.put("egrave", "\u00E8"); + html5Entities.put("egs", "\u2A96"); + html5Entities.put("egsdot", "\u2A98"); + html5Entities.put("el", "\u2A99"); + html5Entities.put("Element", "\u2208"); + html5Entities.put("elinters", "\u23E7"); + html5Entities.put("ell", "\u2113"); + html5Entities.put("els", "\u2A95"); + html5Entities.put("elsdot", "\u2A97"); + html5Entities.put("Emacr", "\u0112"); + html5Entities.put("emacr", "\u0113"); + html5Entities.put("empty", "\u2205"); + html5Entities.put("emptyset", "\u2205"); + html5Entities.put("EmptySmallSquare", "\u25FB"); + html5Entities.put("emptyv", "\u2205"); + html5Entities.put("EmptyVerySmallSquare", "\u25AB"); + html5Entities.put("emsp13", "\u2004"); + html5Entities.put("emsp14", "\u2005"); + html5Entities.put("emsp", "\u2003"); + html5Entities.put("ENG", "\u014A"); + html5Entities.put("eng", "\u014B"); + html5Entities.put("ensp", "\u2002"); + html5Entities.put("Eogon", "\u0118"); + html5Entities.put("eogon", "\u0119"); + html5Entities.put("Eopf", "\uD835\uDD3C"); + html5Entities.put("eopf", "\uD835\uDD56"); + html5Entities.put("epar", "\u22D5"); + html5Entities.put("eparsl", "\u29E3"); + html5Entities.put("eplus", "\u2A71"); + html5Entities.put("epsi", "\u03B5"); + html5Entities.put("Epsilon", "\u0395"); + html5Entities.put("epsilon", "\u03B5"); + html5Entities.put("epsiv", "\u03F5"); + html5Entities.put("eqcirc", "\u2256"); + html5Entities.put("eqcolon", "\u2255"); + html5Entities.put("eqsim", "\u2242"); + html5Entities.put("eqslantgtr", "\u2A96"); + html5Entities.put("eqslantless", "\u2A95"); + html5Entities.put("Equal", "\u2A75"); + html5Entities.put("equals", "\u003D"); + html5Entities.put("EqualTilde", "\u2242"); + html5Entities.put("equest", "\u225F"); + html5Entities.put("Equilibrium", "\u21CC"); + html5Entities.put("equiv", "\u2261"); + html5Entities.put("equivDD", "\u2A78"); + html5Entities.put("eqvparsl", "\u29E5"); + html5Entities.put("erarr", "\u2971"); + html5Entities.put("erDot", "\u2253"); + html5Entities.put("escr", "\u212F"); + html5Entities.put("Escr", "\u2130"); + html5Entities.put("esdot", "\u2250"); + html5Entities.put("Esim", "\u2A73"); + html5Entities.put("esim", "\u2242"); + html5Entities.put("Eta", "\u0397"); + html5Entities.put("eta", "\u03B7"); + html5Entities.put("ETH", "\u00D0"); + html5Entities.put("eth", "\u00F0"); + html5Entities.put("Euml", "\u00CB"); + html5Entities.put("euml", "\u00EB"); + html5Entities.put("euro", "\u20AC"); + html5Entities.put("excl", "\u0021"); + html5Entities.put("exist", "\u2203"); + html5Entities.put("Exists", "\u2203"); + html5Entities.put("expectation", "\u2130"); + html5Entities.put("exponentiale", "\u2147"); + html5Entities.put("ExponentialE", "\u2147"); + html5Entities.put("fallingdotseq", "\u2252"); + html5Entities.put("Fcy", "\u0424"); + html5Entities.put("fcy", "\u0444"); + html5Entities.put("female", "\u2640"); + html5Entities.put("ffilig", "\uFB03"); + html5Entities.put("fflig", "\uFB00"); + html5Entities.put("ffllig", "\uFB04"); + html5Entities.put("Ffr", "\uD835\uDD09"); + html5Entities.put("ffr", "\uD835\uDD23"); + html5Entities.put("filig", "\uFB01"); + html5Entities.put("FilledSmallSquare", "\u25FC"); + html5Entities.put("FilledVerySmallSquare", "\u25AA"); + html5Entities.put("fjlig", "\u0066\u006A"); + html5Entities.put("flat", "\u266D"); + html5Entities.put("fllig", "\uFB02"); + html5Entities.put("fltns", "\u25B1"); + html5Entities.put("fnof", "\u0192"); + html5Entities.put("Fopf", "\uD835\uDD3D"); + html5Entities.put("fopf", "\uD835\uDD57"); + html5Entities.put("forall", "\u2200"); + html5Entities.put("ForAll", "\u2200"); + html5Entities.put("fork", "\u22D4"); + html5Entities.put("forkv", "\u2AD9"); + html5Entities.put("Fouriertrf", "\u2131"); + html5Entities.put("fpartint", "\u2A0D"); + html5Entities.put("frac12", "\u00BD"); + html5Entities.put("frac13", "\u2153"); + html5Entities.put("frac14", "\u00BC"); + html5Entities.put("frac15", "\u2155"); + html5Entities.put("frac16", "\u2159"); + html5Entities.put("frac18", "\u215B"); + html5Entities.put("frac23", "\u2154"); + html5Entities.put("frac25", "\u2156"); + html5Entities.put("frac34", "\u00BE"); + html5Entities.put("frac35", "\u2157"); + html5Entities.put("frac38", "\u215C"); + html5Entities.put("frac45", "\u2158"); + html5Entities.put("frac56", "\u215A"); + html5Entities.put("frac58", "\u215D"); + html5Entities.put("frac78", "\u215E"); + html5Entities.put("frasl", "\u2044"); + html5Entities.put("frown", "\u2322"); + html5Entities.put("fscr", "\uD835\uDCBB"); + html5Entities.put("Fscr", "\u2131"); + html5Entities.put("gacute", "\u01F5"); + html5Entities.put("Gamma", "\u0393"); + html5Entities.put("gamma", "\u03B3"); + html5Entities.put("Gammad", "\u03DC"); + html5Entities.put("gammad", "\u03DD"); + html5Entities.put("gap", "\u2A86"); + html5Entities.put("Gbreve", "\u011E"); + html5Entities.put("gbreve", "\u011F"); + html5Entities.put("Gcedil", "\u0122"); + html5Entities.put("Gcirc", "\u011C"); + html5Entities.put("gcirc", "\u011D"); + html5Entities.put("Gcy", "\u0413"); + html5Entities.put("gcy", "\u0433"); + html5Entities.put("Gdot", "\u0120"); + html5Entities.put("gdot", "\u0121"); + html5Entities.put("ge", "\u2265"); + html5Entities.put("gE", "\u2267"); + html5Entities.put("gEl", "\u2A8C"); + html5Entities.put("gel", "\u22DB"); + html5Entities.put("geq", "\u2265"); + html5Entities.put("geqq", "\u2267"); + html5Entities.put("geqslant", "\u2A7E"); + html5Entities.put("gescc", "\u2AA9"); + html5Entities.put("ges", "\u2A7E"); + html5Entities.put("gesdot", "\u2A80"); + html5Entities.put("gesdoto", "\u2A82"); + html5Entities.put("gesdotol", "\u2A84"); + html5Entities.put("gesl", "\u22DB\uFE00"); + html5Entities.put("gesles", "\u2A94"); + html5Entities.put("Gfr", "\uD835\uDD0A"); + html5Entities.put("gfr", "\uD835\uDD24"); + html5Entities.put("gg", "\u226B"); + html5Entities.put("Gg", "\u22D9"); + html5Entities.put("ggg", "\u22D9"); + html5Entities.put("gimel", "\u2137"); + html5Entities.put("GJcy", "\u0403"); + html5Entities.put("gjcy", "\u0453"); + html5Entities.put("gla", "\u2AA5"); + html5Entities.put("gl", "\u2277"); + html5Entities.put("glE", "\u2A92"); + html5Entities.put("glj", "\u2AA4"); + html5Entities.put("gnap", "\u2A8A"); + html5Entities.put("gnapprox", "\u2A8A"); + html5Entities.put("gne", "\u2A88"); + html5Entities.put("gnE", "\u2269"); + html5Entities.put("gneq", "\u2A88"); + html5Entities.put("gneqq", "\u2269"); + html5Entities.put("gnsim", "\u22E7"); + html5Entities.put("Gopf", "\uD835\uDD3E"); + html5Entities.put("gopf", "\uD835\uDD58"); + html5Entities.put("grave", "\u0060"); + html5Entities.put("GreaterEqual", "\u2265"); + html5Entities.put("GreaterEqualLess", "\u22DB"); + html5Entities.put("GreaterFullEqual", "\u2267"); + html5Entities.put("GreaterGreater", "\u2AA2"); + html5Entities.put("GreaterLess", "\u2277"); + html5Entities.put("GreaterSlantEqual", "\u2A7E"); + html5Entities.put("GreaterTilde", "\u2273"); + html5Entities.put("Gscr", "\uD835\uDCA2"); + html5Entities.put("gscr", "\u210A"); + html5Entities.put("gsim", "\u2273"); + html5Entities.put("gsime", "\u2A8E"); + html5Entities.put("gsiml", "\u2A90"); + html5Entities.put("gtcc", "\u2AA7"); + html5Entities.put("gtcir", "\u2A7A"); + html5Entities.put("gt", "\u003E"); + html5Entities.put("GT", "\u003E"); + html5Entities.put("Gt", "\u226B"); + html5Entities.put("gtdot", "\u22D7"); + html5Entities.put("gtlPar", "\u2995"); + html5Entities.put("gtquest", "\u2A7C"); + html5Entities.put("gtrapprox", "\u2A86"); + html5Entities.put("gtrarr", "\u2978"); + html5Entities.put("gtrdot", "\u22D7"); + html5Entities.put("gtreqless", "\u22DB"); + html5Entities.put("gtreqqless", "\u2A8C"); + html5Entities.put("gtrless", "\u2277"); + html5Entities.put("gtrsim", "\u2273"); + html5Entities.put("gvertneqq", "\u2269\uFE00"); + html5Entities.put("gvnE", "\u2269\uFE00"); + html5Entities.put("Hacek", "\u02C7"); + html5Entities.put("hairsp", "\u200A"); + html5Entities.put("half", "\u00BD"); + html5Entities.put("hamilt", "\u210B"); + html5Entities.put("HARDcy", "\u042A"); + html5Entities.put("hardcy", "\u044A"); + html5Entities.put("harrcir", "\u2948"); + html5Entities.put("harr", "\u2194"); + html5Entities.put("hArr", "\u21D4"); + html5Entities.put("harrw", "\u21AD"); + html5Entities.put("Hat", "\u005E"); + html5Entities.put("hbar", "\u210F"); + html5Entities.put("Hcirc", "\u0124"); + html5Entities.put("hcirc", "\u0125"); + html5Entities.put("hearts", "\u2665"); + html5Entities.put("heartsuit", "\u2665"); + html5Entities.put("hellip", "\u2026"); + html5Entities.put("hercon", "\u22B9"); + html5Entities.put("hfr", "\uD835\uDD25"); + html5Entities.put("Hfr", "\u210C"); + html5Entities.put("HilbertSpace", "\u210B"); + html5Entities.put("hksearow", "\u2925"); + html5Entities.put("hkswarow", "\u2926"); + html5Entities.put("hoarr", "\u21FF"); + html5Entities.put("homtht", "\u223B"); + html5Entities.put("hookleftarrow", "\u21A9"); + html5Entities.put("hookrightarrow", "\u21AA"); + html5Entities.put("hopf", "\uD835\uDD59"); + html5Entities.put("Hopf", "\u210D"); + html5Entities.put("horbar", "\u2015"); + html5Entities.put("HorizontalLine", "\u2500"); + html5Entities.put("hscr", "\uD835\uDCBD"); + html5Entities.put("Hscr", "\u210B"); + html5Entities.put("hslash", "\u210F"); + html5Entities.put("Hstrok", "\u0126"); + html5Entities.put("hstrok", "\u0127"); + html5Entities.put("HumpDownHump", "\u224E"); + html5Entities.put("HumpEqual", "\u224F"); + html5Entities.put("hybull", "\u2043"); + html5Entities.put("hyphen", "\u2010"); + html5Entities.put("Iacute", "\u00CD"); + html5Entities.put("iacute", "\u00ED"); + html5Entities.put("ic", "\u2063"); + html5Entities.put("Icirc", "\u00CE"); + html5Entities.put("icirc", "\u00EE"); + html5Entities.put("Icy", "\u0418"); + html5Entities.put("icy", "\u0438"); + html5Entities.put("Idot", "\u0130"); + html5Entities.put("IEcy", "\u0415"); + html5Entities.put("iecy", "\u0435"); + html5Entities.put("iexcl", "\u00A1"); + html5Entities.put("iff", "\u21D4"); + html5Entities.put("ifr", "\uD835\uDD26"); + html5Entities.put("Ifr", "\u2111"); + html5Entities.put("Igrave", "\u00CC"); + html5Entities.put("igrave", "\u00EC"); + html5Entities.put("ii", "\u2148"); + html5Entities.put("iiiint", "\u2A0C"); + html5Entities.put("iiint", "\u222D"); + html5Entities.put("iinfin", "\u29DC"); + html5Entities.put("iiota", "\u2129"); + html5Entities.put("IJlig", "\u0132"); + html5Entities.put("ijlig", "\u0133"); + html5Entities.put("Imacr", "\u012A"); + html5Entities.put("imacr", "\u012B"); + html5Entities.put("image", "\u2111"); + html5Entities.put("ImaginaryI", "\u2148"); + html5Entities.put("imagline", "\u2110"); + html5Entities.put("imagpart", "\u2111"); + html5Entities.put("imath", "\u0131"); + html5Entities.put("Im", "\u2111"); + html5Entities.put("imof", "\u22B7"); + html5Entities.put("imped", "\u01B5"); + html5Entities.put("Implies", "\u21D2"); + html5Entities.put("incare", "\u2105"); + html5Entities.put("in", "\u2208"); + html5Entities.put("infin", "\u221E"); + html5Entities.put("infintie", "\u29DD"); + html5Entities.put("inodot", "\u0131"); + html5Entities.put("intcal", "\u22BA"); + html5Entities.put("int", "\u222B"); + html5Entities.put("Int", "\u222C"); + html5Entities.put("integers", "\u2124"); + html5Entities.put("Integral", "\u222B"); + html5Entities.put("intercal", "\u22BA"); + html5Entities.put("Intersection", "\u22C2"); + html5Entities.put("intlarhk", "\u2A17"); + html5Entities.put("intprod", "\u2A3C"); + html5Entities.put("InvisibleComma", "\u2063"); + html5Entities.put("InvisibleTimes", "\u2062"); + html5Entities.put("IOcy", "\u0401"); + html5Entities.put("iocy", "\u0451"); + html5Entities.put("Iogon", "\u012E"); + html5Entities.put("iogon", "\u012F"); + html5Entities.put("Iopf", "\uD835\uDD40"); + html5Entities.put("iopf", "\uD835\uDD5A"); + html5Entities.put("Iota", "\u0399"); + html5Entities.put("iota", "\u03B9"); + html5Entities.put("iprod", "\u2A3C"); + html5Entities.put("iquest", "\u00BF"); + html5Entities.put("iscr", "\uD835\uDCBE"); + html5Entities.put("Iscr", "\u2110"); + html5Entities.put("isin", "\u2208"); + html5Entities.put("isindot", "\u22F5"); + html5Entities.put("isinE", "\u22F9"); + html5Entities.put("isins", "\u22F4"); + html5Entities.put("isinsv", "\u22F3"); + html5Entities.put("isinv", "\u2208"); + html5Entities.put("it", "\u2062"); + html5Entities.put("Itilde", "\u0128"); + html5Entities.put("itilde", "\u0129"); + html5Entities.put("Iukcy", "\u0406"); + html5Entities.put("iukcy", "\u0456"); + html5Entities.put("Iuml", "\u00CF"); + html5Entities.put("iuml", "\u00EF"); + html5Entities.put("Jcirc", "\u0134"); + html5Entities.put("jcirc", "\u0135"); + html5Entities.put("Jcy", "\u0419"); + html5Entities.put("jcy", "\u0439"); + html5Entities.put("Jfr", "\uD835\uDD0D"); + html5Entities.put("jfr", "\uD835\uDD27"); + html5Entities.put("jmath", "\u0237"); + html5Entities.put("Jopf", "\uD835\uDD41"); + html5Entities.put("jopf", "\uD835\uDD5B"); + html5Entities.put("Jscr", "\uD835\uDCA5"); + html5Entities.put("jscr", "\uD835\uDCBF"); + html5Entities.put("Jsercy", "\u0408"); + html5Entities.put("jsercy", "\u0458"); + html5Entities.put("Jukcy", "\u0404"); + html5Entities.put("jukcy", "\u0454"); + html5Entities.put("Kappa", "\u039A"); + html5Entities.put("kappa", "\u03BA"); + html5Entities.put("kappav", "\u03F0"); + html5Entities.put("Kcedil", "\u0136"); + html5Entities.put("kcedil", "\u0137"); + html5Entities.put("Kcy", "\u041A"); + html5Entities.put("kcy", "\u043A"); + html5Entities.put("Kfr", "\uD835\uDD0E"); + html5Entities.put("kfr", "\uD835\uDD28"); + html5Entities.put("kgreen", "\u0138"); + html5Entities.put("KHcy", "\u0425"); + html5Entities.put("khcy", "\u0445"); + html5Entities.put("KJcy", "\u040C"); + html5Entities.put("kjcy", "\u045C"); + html5Entities.put("Kopf", "\uD835\uDD42"); + html5Entities.put("kopf", "\uD835\uDD5C"); + html5Entities.put("Kscr", "\uD835\uDCA6"); + html5Entities.put("kscr", "\uD835\uDCC0"); + html5Entities.put("lAarr", "\u21DA"); + html5Entities.put("Lacute", "\u0139"); + html5Entities.put("lacute", "\u013A"); + html5Entities.put("laemptyv", "\u29B4"); + html5Entities.put("lagran", "\u2112"); + html5Entities.put("Lambda", "\u039B"); + html5Entities.put("lambda", "\u03BB"); + html5Entities.put("lang", "\u27E8"); + html5Entities.put("Lang", "\u27EA"); + html5Entities.put("langd", "\u2991"); + html5Entities.put("langle", "\u27E8"); + html5Entities.put("lap", "\u2A85"); + html5Entities.put("Laplacetrf", "\u2112"); + html5Entities.put("laquo", "\u00AB"); + html5Entities.put("larrb", "\u21E4"); + html5Entities.put("larrbfs", "\u291F"); + html5Entities.put("larr", "\u2190"); + html5Entities.put("Larr", "\u219E"); + html5Entities.put("lArr", "\u21D0"); + html5Entities.put("larrfs", "\u291D"); + html5Entities.put("larrhk", "\u21A9"); + html5Entities.put("larrlp", "\u21AB"); + html5Entities.put("larrpl", "\u2939"); + html5Entities.put("larrsim", "\u2973"); + html5Entities.put("larrtl", "\u21A2"); + html5Entities.put("latail", "\u2919"); + html5Entities.put("lAtail", "\u291B"); + html5Entities.put("lat", "\u2AAB"); + html5Entities.put("late", "\u2AAD"); + html5Entities.put("lates", "\u2AAD\uFE00"); + html5Entities.put("lbarr", "\u290C"); + html5Entities.put("lBarr", "\u290E"); + html5Entities.put("lbbrk", "\u2772"); + html5Entities.put("lbrace", "\u007B"); + html5Entities.put("lbrack", "\u005B"); + html5Entities.put("lbrke", "\u298B"); + html5Entities.put("lbrksld", "\u298F"); + html5Entities.put("lbrkslu", "\u298D"); + html5Entities.put("Lcaron", "\u013D"); + html5Entities.put("lcaron", "\u013E"); + html5Entities.put("Lcedil", "\u013B"); + html5Entities.put("lcedil", "\u013C"); + html5Entities.put("lceil", "\u2308"); + html5Entities.put("lcub", "\u007B"); + html5Entities.put("Lcy", "\u041B"); + html5Entities.put("lcy", "\u043B"); + html5Entities.put("ldca", "\u2936"); + html5Entities.put("ldquo", "\u201C"); + html5Entities.put("ldquor", "\u201E"); + html5Entities.put("ldrdhar", "\u2967"); + html5Entities.put("ldrushar", "\u294B"); + html5Entities.put("ldsh", "\u21B2"); + html5Entities.put("le", "\u2264"); + html5Entities.put("lE", "\u2266"); + html5Entities.put("LeftAngleBracket", "\u27E8"); + html5Entities.put("LeftArrowBar", "\u21E4"); + html5Entities.put("leftarrow", "\u2190"); + html5Entities.put("LeftArrow", "\u2190"); + html5Entities.put("Leftarrow", "\u21D0"); + html5Entities.put("LeftArrowRightArrow", "\u21C6"); + html5Entities.put("leftarrowtail", "\u21A2"); + html5Entities.put("LeftCeiling", "\u2308"); + html5Entities.put("LeftDoubleBracket", "\u27E6"); + html5Entities.put("LeftDownTeeVector", "\u2961"); + html5Entities.put("LeftDownVectorBar", "\u2959"); + html5Entities.put("LeftDownVector", "\u21C3"); + html5Entities.put("LeftFloor", "\u230A"); + html5Entities.put("leftharpoondown", "\u21BD"); + html5Entities.put("leftharpoonup", "\u21BC"); + html5Entities.put("leftleftarrows", "\u21C7"); + html5Entities.put("leftrightarrow", "\u2194"); + html5Entities.put("LeftRightArrow", "\u2194"); + html5Entities.put("Leftrightarrow", "\u21D4"); + html5Entities.put("leftrightarrows", "\u21C6"); + html5Entities.put("leftrightharpoons", "\u21CB"); + html5Entities.put("leftrightsquigarrow", "\u21AD"); + html5Entities.put("LeftRightVector", "\u294E"); + html5Entities.put("LeftTeeArrow", "\u21A4"); + html5Entities.put("LeftTee", "\u22A3"); + html5Entities.put("LeftTeeVector", "\u295A"); + html5Entities.put("leftthreetimes", "\u22CB"); + html5Entities.put("LeftTriangleBar", "\u29CF"); + html5Entities.put("LeftTriangle", "\u22B2"); + html5Entities.put("LeftTriangleEqual", "\u22B4"); + html5Entities.put("LeftUpDownVector", "\u2951"); + html5Entities.put("LeftUpTeeVector", "\u2960"); + html5Entities.put("LeftUpVectorBar", "\u2958"); + html5Entities.put("LeftUpVector", "\u21BF"); + html5Entities.put("LeftVectorBar", "\u2952"); + html5Entities.put("LeftVector", "\u21BC"); + html5Entities.put("lEg", "\u2A8B"); + html5Entities.put("leg", "\u22DA"); + html5Entities.put("leq", "\u2264"); + html5Entities.put("leqq", "\u2266"); + html5Entities.put("leqslant", "\u2A7D"); + html5Entities.put("lescc", "\u2AA8"); + html5Entities.put("les", "\u2A7D"); + html5Entities.put("lesdot", "\u2A7F"); + html5Entities.put("lesdoto", "\u2A81"); + html5Entities.put("lesdotor", "\u2A83"); + html5Entities.put("lesg", "\u22DA\uFE00"); + html5Entities.put("lesges", "\u2A93"); + html5Entities.put("lessapprox", "\u2A85"); + html5Entities.put("lessdot", "\u22D6"); + html5Entities.put("lesseqgtr", "\u22DA"); + html5Entities.put("lesseqqgtr", "\u2A8B"); + html5Entities.put("LessEqualGreater", "\u22DA"); + html5Entities.put("LessFullEqual", "\u2266"); + html5Entities.put("LessGreater", "\u2276"); + html5Entities.put("lessgtr", "\u2276"); + html5Entities.put("LessLess", "\u2AA1"); + html5Entities.put("lesssim", "\u2272"); + html5Entities.put("LessSlantEqual", "\u2A7D"); + html5Entities.put("LessTilde", "\u2272"); + html5Entities.put("lfisht", "\u297C"); + html5Entities.put("lfloor", "\u230A"); + html5Entities.put("Lfr", "\uD835\uDD0F"); + html5Entities.put("lfr", "\uD835\uDD29"); + html5Entities.put("lg", "\u2276"); + html5Entities.put("lgE", "\u2A91"); + html5Entities.put("lHar", "\u2962"); + html5Entities.put("lhard", "\u21BD"); + html5Entities.put("lharu", "\u21BC"); + html5Entities.put("lharul", "\u296A"); + html5Entities.put("lhblk", "\u2584"); + html5Entities.put("LJcy", "\u0409"); + html5Entities.put("ljcy", "\u0459"); + html5Entities.put("llarr", "\u21C7"); + html5Entities.put("ll", "\u226A"); + html5Entities.put("Ll", "\u22D8"); + html5Entities.put("llcorner", "\u231E"); + html5Entities.put("Lleftarrow", "\u21DA"); + html5Entities.put("llhard", "\u296B"); + html5Entities.put("lltri", "\u25FA"); + html5Entities.put("Lmidot", "\u013F"); + html5Entities.put("lmidot", "\u0140"); + html5Entities.put("lmoustache", "\u23B0"); + html5Entities.put("lmoust", "\u23B0"); + html5Entities.put("lnap", "\u2A89"); + html5Entities.put("lnapprox", "\u2A89"); + html5Entities.put("lne", "\u2A87"); + html5Entities.put("lnE", "\u2268"); + html5Entities.put("lneq", "\u2A87"); + html5Entities.put("lneqq", "\u2268"); + html5Entities.put("lnsim", "\u22E6"); + html5Entities.put("loang", "\u27EC"); + html5Entities.put("loarr", "\u21FD"); + html5Entities.put("lobrk", "\u27E6"); + html5Entities.put("longleftarrow", "\u27F5"); + html5Entities.put("LongLeftArrow", "\u27F5"); + html5Entities.put("Longleftarrow", "\u27F8"); + html5Entities.put("longleftrightarrow", "\u27F7"); + html5Entities.put("LongLeftRightArrow", "\u27F7"); + html5Entities.put("Longleftrightarrow", "\u27FA"); + html5Entities.put("longmapsto", "\u27FC"); + html5Entities.put("longrightarrow", "\u27F6"); + html5Entities.put("LongRightArrow", "\u27F6"); + html5Entities.put("Longrightarrow", "\u27F9"); + html5Entities.put("looparrowleft", "\u21AB"); + html5Entities.put("looparrowright", "\u21AC"); + html5Entities.put("lopar", "\u2985"); + html5Entities.put("Lopf", "\uD835\uDD43"); + html5Entities.put("lopf", "\uD835\uDD5D"); + html5Entities.put("loplus", "\u2A2D"); + html5Entities.put("lotimes", "\u2A34"); + html5Entities.put("lowast", "\u2217"); + html5Entities.put("lowbar", "\u005F"); + html5Entities.put("LowerLeftArrow", "\u2199"); + html5Entities.put("LowerRightArrow", "\u2198"); + html5Entities.put("loz", "\u25CA"); + html5Entities.put("lozenge", "\u25CA"); + html5Entities.put("lozf", "\u29EB"); + html5Entities.put("lpar", "\u0028"); + html5Entities.put("lparlt", "\u2993"); + html5Entities.put("lrarr", "\u21C6"); + html5Entities.put("lrcorner", "\u231F"); + html5Entities.put("lrhar", "\u21CB"); + html5Entities.put("lrhard", "\u296D"); + html5Entities.put("lrm", "\u200E"); + html5Entities.put("lrtri", "\u22BF"); + html5Entities.put("lsaquo", "\u2039"); + html5Entities.put("lscr", "\uD835\uDCC1"); + html5Entities.put("Lscr", "\u2112"); + html5Entities.put("lsh", "\u21B0"); + html5Entities.put("Lsh", "\u21B0"); + html5Entities.put("lsim", "\u2272"); + html5Entities.put("lsime", "\u2A8D"); + html5Entities.put("lsimg", "\u2A8F"); + html5Entities.put("lsqb", "\u005B"); + html5Entities.put("lsquo", "\u2018"); + html5Entities.put("lsquor", "\u201A"); + html5Entities.put("Lstrok", "\u0141"); + html5Entities.put("lstrok", "\u0142"); + html5Entities.put("ltcc", "\u2AA6"); + html5Entities.put("ltcir", "\u2A79"); + html5Entities.put("lt", "\u003C"); + html5Entities.put("LT", "\u003C"); + html5Entities.put("Lt", "\u226A"); + html5Entities.put("ltdot", "\u22D6"); + html5Entities.put("lthree", "\u22CB"); + html5Entities.put("ltimes", "\u22C9"); + html5Entities.put("ltlarr", "\u2976"); + html5Entities.put("ltquest", "\u2A7B"); + html5Entities.put("ltri", "\u25C3"); + html5Entities.put("ltrie", "\u22B4"); + html5Entities.put("ltrif", "\u25C2"); + html5Entities.put("ltrPar", "\u2996"); + html5Entities.put("lurdshar", "\u294A"); + html5Entities.put("luruhar", "\u2966"); + html5Entities.put("lvertneqq", "\u2268\uFE00"); + html5Entities.put("lvnE", "\u2268\uFE00"); + html5Entities.put("macr", "\u00AF"); + html5Entities.put("male", "\u2642"); + html5Entities.put("malt", "\u2720"); + html5Entities.put("maltese", "\u2720"); + html5Entities.put("Map", "\u2905"); + html5Entities.put("map", "\u21A6"); + html5Entities.put("mapsto", "\u21A6"); + html5Entities.put("mapstodown", "\u21A7"); + html5Entities.put("mapstoleft", "\u21A4"); + html5Entities.put("mapstoup", "\u21A5"); + html5Entities.put("marker", "\u25AE"); + html5Entities.put("mcomma", "\u2A29"); + html5Entities.put("Mcy", "\u041C"); + html5Entities.put("mcy", "\u043C"); + html5Entities.put("mdash", "\u2014"); + html5Entities.put("mDDot", "\u223A"); + html5Entities.put("measuredangle", "\u2221"); + html5Entities.put("MediumSpace", "\u205F"); + html5Entities.put("Mellintrf", "\u2133"); + html5Entities.put("Mfr", "\uD835\uDD10"); + html5Entities.put("mfr", "\uD835\uDD2A"); + html5Entities.put("mho", "\u2127"); + html5Entities.put("micro", "\u00B5"); + html5Entities.put("midast", "\u002A"); + html5Entities.put("midcir", "\u2AF0"); + html5Entities.put("mid", "\u2223"); + html5Entities.put("middot", "\u00B7"); + html5Entities.put("minusb", "\u229F"); + html5Entities.put("minus", "\u2212"); + html5Entities.put("minusd", "\u2238"); + html5Entities.put("minusdu", "\u2A2A"); + html5Entities.put("MinusPlus", "\u2213"); + html5Entities.put("mlcp", "\u2ADB"); + html5Entities.put("mldr", "\u2026"); + html5Entities.put("mnplus", "\u2213"); + html5Entities.put("models", "\u22A7"); + html5Entities.put("Mopf", "\uD835\uDD44"); + html5Entities.put("mopf", "\uD835\uDD5E"); + html5Entities.put("mp", "\u2213"); + html5Entities.put("mscr", "\uD835\uDCC2"); + html5Entities.put("Mscr", "\u2133"); + html5Entities.put("mstpos", "\u223E"); + html5Entities.put("Mu", "\u039C"); + html5Entities.put("mu", "\u03BC"); + html5Entities.put("multimap", "\u22B8"); + html5Entities.put("mumap", "\u22B8"); + html5Entities.put("nabla", "\u2207"); + html5Entities.put("Nacute", "\u0143"); + html5Entities.put("nacute", "\u0144"); + html5Entities.put("nang", "\u2220\u20D2"); + html5Entities.put("nap", "\u2249"); + html5Entities.put("napE", "\u2A70\u0338"); + html5Entities.put("napid", "\u224B\u0338"); + html5Entities.put("napos", "\u0149"); + html5Entities.put("napprox", "\u2249"); + html5Entities.put("natural", "\u266E"); + html5Entities.put("naturals", "\u2115"); + html5Entities.put("natur", "\u266E"); + html5Entities.put("nbsp", "\u00A0"); + html5Entities.put("nbump", "\u224E\u0338"); + html5Entities.put("nbumpe", "\u224F\u0338"); + html5Entities.put("ncap", "\u2A43"); + html5Entities.put("Ncaron", "\u0147"); + html5Entities.put("ncaron", "\u0148"); + html5Entities.put("Ncedil", "\u0145"); + html5Entities.put("ncedil", "\u0146"); + html5Entities.put("ncong", "\u2247"); + html5Entities.put("ncongdot", "\u2A6D\u0338"); + html5Entities.put("ncup", "\u2A42"); + html5Entities.put("Ncy", "\u041D"); + html5Entities.put("ncy", "\u043D"); + html5Entities.put("ndash", "\u2013"); + html5Entities.put("nearhk", "\u2924"); + html5Entities.put("nearr", "\u2197"); + html5Entities.put("neArr", "\u21D7"); + html5Entities.put("nearrow", "\u2197"); + html5Entities.put("ne", "\u2260"); + html5Entities.put("nedot", "\u2250\u0338"); + html5Entities.put("NegativeMediumSpace", "\u200B"); + html5Entities.put("NegativeThickSpace", "\u200B"); + html5Entities.put("NegativeThinSpace", "\u200B"); + html5Entities.put("NegativeVeryThinSpace", "\u200B"); + html5Entities.put("nequiv", "\u2262"); + html5Entities.put("nesear", "\u2928"); + html5Entities.put("nesim", "\u2242\u0338"); + html5Entities.put("NestedGreaterGreater", "\u226B"); + html5Entities.put("NestedLessLess", "\u226A"); + html5Entities.put("NewLine", "\n"); + html5Entities.put("nexist", "\u2204"); + html5Entities.put("nexists", "\u2204"); + html5Entities.put("Nfr", "\uD835\uDD11"); + html5Entities.put("nfr", "\uD835\uDD2B"); + html5Entities.put("ngE", "\u2267\u0338"); + html5Entities.put("nge", "\u2271"); + html5Entities.put("ngeq", "\u2271"); + html5Entities.put("ngeqq", "\u2267\u0338"); + html5Entities.put("ngeqslant", "\u2A7E\u0338"); + html5Entities.put("nges", "\u2A7E\u0338"); + html5Entities.put("nGg", "\u22D9\u0338"); + html5Entities.put("ngsim", "\u2275"); + html5Entities.put("nGt", "\u226B\u20D2"); + html5Entities.put("ngt", "\u226F"); + html5Entities.put("ngtr", "\u226F"); + html5Entities.put("nGtv", "\u226B\u0338"); + html5Entities.put("nharr", "\u21AE"); + html5Entities.put("nhArr", "\u21CE"); + html5Entities.put("nhpar", "\u2AF2"); + html5Entities.put("ni", "\u220B"); + html5Entities.put("nis", "\u22FC"); + html5Entities.put("nisd", "\u22FA"); + html5Entities.put("niv", "\u220B"); + html5Entities.put("NJcy", "\u040A"); + html5Entities.put("njcy", "\u045A"); + html5Entities.put("nlarr", "\u219A"); + html5Entities.put("nlArr", "\u21CD"); + html5Entities.put("nldr", "\u2025"); + html5Entities.put("nlE", "\u2266\u0338"); + html5Entities.put("nle", "\u2270"); + html5Entities.put("nleftarrow", "\u219A"); + html5Entities.put("nLeftarrow", "\u21CD"); + html5Entities.put("nleftrightarrow", "\u21AE"); + html5Entities.put("nLeftrightarrow", "\u21CE"); + html5Entities.put("nleq", "\u2270"); + html5Entities.put("nleqq", "\u2266\u0338"); + html5Entities.put("nleqslant", "\u2A7D\u0338"); + html5Entities.put("nles", "\u2A7D\u0338"); + html5Entities.put("nless", "\u226E"); + html5Entities.put("nLl", "\u22D8\u0338"); + html5Entities.put("nlsim", "\u2274"); + html5Entities.put("nLt", "\u226A\u20D2"); + html5Entities.put("nlt", "\u226E"); + html5Entities.put("nltri", "\u22EA"); + html5Entities.put("nltrie", "\u22EC"); + html5Entities.put("nLtv", "\u226A\u0338"); + html5Entities.put("nmid", "\u2224"); + html5Entities.put("NoBreak", "\u2060"); + html5Entities.put("NonBreakingSpace", "\u00A0"); + html5Entities.put("nopf", "\uD835\uDD5F"); + html5Entities.put("Nopf", "\u2115"); + html5Entities.put("Not", "\u2AEC"); + html5Entities.put("not", "\u00AC"); + html5Entities.put("NotCongruent", "\u2262"); + html5Entities.put("NotCupCap", "\u226D"); + html5Entities.put("NotDoubleVerticalBar", "\u2226"); + html5Entities.put("NotElement", "\u2209"); + html5Entities.put("NotEqual", "\u2260"); + html5Entities.put("NotEqualTilde", "\u2242\u0338"); + html5Entities.put("NotExists", "\u2204"); + html5Entities.put("NotGreater", "\u226F"); + html5Entities.put("NotGreaterEqual", "\u2271"); + html5Entities.put("NotGreaterFullEqual", "\u2267\u0338"); + html5Entities.put("NotGreaterGreater", "\u226B\u0338"); + html5Entities.put("NotGreaterLess", "\u2279"); + html5Entities.put("NotGreaterSlantEqual", "\u2A7E\u0338"); + html5Entities.put("NotGreaterTilde", "\u2275"); + html5Entities.put("NotHumpDownHump", "\u224E\u0338"); + html5Entities.put("NotHumpEqual", "\u224F\u0338"); + html5Entities.put("notin", "\u2209"); + html5Entities.put("notindot", "\u22F5\u0338"); + html5Entities.put("notinE", "\u22F9\u0338"); + html5Entities.put("notinva", "\u2209"); + html5Entities.put("notinvb", "\u22F7"); + html5Entities.put("notinvc", "\u22F6"); + html5Entities.put("NotLeftTriangleBar", "\u29CF\u0338"); + html5Entities.put("NotLeftTriangle", "\u22EA"); + html5Entities.put("NotLeftTriangleEqual", "\u22EC"); + html5Entities.put("NotLess", "\u226E"); + html5Entities.put("NotLessEqual", "\u2270"); + html5Entities.put("NotLessGreater", "\u2278"); + html5Entities.put("NotLessLess", "\u226A\u0338"); + html5Entities.put("NotLessSlantEqual", "\u2A7D\u0338"); + html5Entities.put("NotLessTilde", "\u2274"); + html5Entities.put("NotNestedGreaterGreater", "\u2AA2\u0338"); + html5Entities.put("NotNestedLessLess", "\u2AA1\u0338"); + html5Entities.put("notni", "\u220C"); + html5Entities.put("notniva", "\u220C"); + html5Entities.put("notnivb", "\u22FE"); + html5Entities.put("notnivc", "\u22FD"); + html5Entities.put("NotPrecedes", "\u2280"); + html5Entities.put("NotPrecedesEqual", "\u2AAF\u0338"); + html5Entities.put("NotPrecedesSlantEqual", "\u22E0"); + html5Entities.put("NotReverseElement", "\u220C"); + html5Entities.put("NotRightTriangleBar", "\u29D0\u0338"); + html5Entities.put("NotRightTriangle", "\u22EB"); + html5Entities.put("NotRightTriangleEqual", "\u22ED"); + html5Entities.put("NotSquareSubset", "\u228F\u0338"); + html5Entities.put("NotSquareSubsetEqual", "\u22E2"); + html5Entities.put("NotSquareSuperset", "\u2290\u0338"); + html5Entities.put("NotSquareSupersetEqual", "\u22E3"); + html5Entities.put("NotSubset", "\u2282\u20D2"); + html5Entities.put("NotSubsetEqual", "\u2288"); + html5Entities.put("NotSucceeds", "\u2281"); + html5Entities.put("NotSucceedsEqual", "\u2AB0\u0338"); + html5Entities.put("NotSucceedsSlantEqual", "\u22E1"); + html5Entities.put("NotSucceedsTilde", "\u227F\u0338"); + html5Entities.put("NotSuperset", "\u2283\u20D2"); + html5Entities.put("NotSupersetEqual", "\u2289"); + html5Entities.put("NotTilde", "\u2241"); + html5Entities.put("NotTildeEqual", "\u2244"); + html5Entities.put("NotTildeFullEqual", "\u2247"); + html5Entities.put("NotTildeTilde", "\u2249"); + html5Entities.put("NotVerticalBar", "\u2224"); + html5Entities.put("nparallel", "\u2226"); + html5Entities.put("npar", "\u2226"); + html5Entities.put("nparsl", "\u2AFD\u20E5"); + html5Entities.put("npart", "\u2202\u0338"); + html5Entities.put("npolint", "\u2A14"); + html5Entities.put("npr", "\u2280"); + html5Entities.put("nprcue", "\u22E0"); + html5Entities.put("nprec", "\u2280"); + html5Entities.put("npreceq", "\u2AAF\u0338"); + html5Entities.put("npre", "\u2AAF\u0338"); + html5Entities.put("nrarrc", "\u2933\u0338"); + html5Entities.put("nrarr", "\u219B"); + html5Entities.put("nrArr", "\u21CF"); + html5Entities.put("nrarrw", "\u219D\u0338"); + html5Entities.put("nrightarrow", "\u219B"); + html5Entities.put("nRightarrow", "\u21CF"); + html5Entities.put("nrtri", "\u22EB"); + html5Entities.put("nrtrie", "\u22ED"); + html5Entities.put("nsc", "\u2281"); + html5Entities.put("nsccue", "\u22E1"); + html5Entities.put("nsce", "\u2AB0\u0338"); + html5Entities.put("Nscr", "\uD835\uDCA9"); + html5Entities.put("nscr", "\uD835\uDCC3"); + html5Entities.put("nshortmid", "\u2224"); + html5Entities.put("nshortparallel", "\u2226"); + html5Entities.put("nsim", "\u2241"); + html5Entities.put("nsime", "\u2244"); + html5Entities.put("nsimeq", "\u2244"); + html5Entities.put("nsmid", "\u2224"); + html5Entities.put("nspar", "\u2226"); + html5Entities.put("nsqsube", "\u22E2"); + html5Entities.put("nsqsupe", "\u22E3"); + html5Entities.put("nsub", "\u2284"); + html5Entities.put("nsubE", "\u2AC5\u0338"); + html5Entities.put("nsube", "\u2288"); + html5Entities.put("nsubset", "\u2282\u20D2"); + html5Entities.put("nsubseteq", "\u2288"); + html5Entities.put("nsubseteqq", "\u2AC5\u0338"); + html5Entities.put("nsucc", "\u2281"); + html5Entities.put("nsucceq", "\u2AB0\u0338"); + html5Entities.put("nsup", "\u2285"); + html5Entities.put("nsupE", "\u2AC6\u0338"); + html5Entities.put("nsupe", "\u2289"); + html5Entities.put("nsupset", "\u2283\u20D2"); + html5Entities.put("nsupseteq", "\u2289"); + html5Entities.put("nsupseteqq", "\u2AC6\u0338"); + html5Entities.put("ntgl", "\u2279"); + html5Entities.put("Ntilde", "\u00D1"); + html5Entities.put("ntilde", "\u00F1"); + html5Entities.put("ntlg", "\u2278"); + html5Entities.put("ntriangleleft", "\u22EA"); + html5Entities.put("ntrianglelefteq", "\u22EC"); + html5Entities.put("ntriangleright", "\u22EB"); + html5Entities.put("ntrianglerighteq", "\u22ED"); + html5Entities.put("Nu", "\u039D"); + html5Entities.put("nu", "\u03BD"); + html5Entities.put("num", "\u0023"); + html5Entities.put("numero", "\u2116"); + html5Entities.put("numsp", "\u2007"); + html5Entities.put("nvap", "\u224D\u20D2"); + html5Entities.put("nvdash", "\u22AC"); + html5Entities.put("nvDash", "\u22AD"); + html5Entities.put("nVdash", "\u22AE"); + html5Entities.put("nVDash", "\u22AF"); + html5Entities.put("nvge", "\u2265\u20D2"); + html5Entities.put("nvgt", "\u003E\u20D2"); + html5Entities.put("nvHarr", "\u2904"); + html5Entities.put("nvinfin", "\u29DE"); + html5Entities.put("nvlArr", "\u2902"); + html5Entities.put("nvle", "\u2264\u20D2"); + html5Entities.put("nvlt", "\u003C\u20D2"); + html5Entities.put("nvltrie", "\u22B4\u20D2"); + html5Entities.put("nvrArr", "\u2903"); + html5Entities.put("nvrtrie", "\u22B5\u20D2"); + html5Entities.put("nvsim", "\u223C\u20D2"); + html5Entities.put("nwarhk", "\u2923"); + html5Entities.put("nwarr", "\u2196"); + html5Entities.put("nwArr", "\u21D6"); + html5Entities.put("nwarrow", "\u2196"); + html5Entities.put("nwnear", "\u2927"); + html5Entities.put("Oacute", "\u00D3"); + html5Entities.put("oacute", "\u00F3"); + html5Entities.put("oast", "\u229B"); + html5Entities.put("Ocirc", "\u00D4"); + html5Entities.put("ocirc", "\u00F4"); + html5Entities.put("ocir", "\u229A"); + html5Entities.put("Ocy", "\u041E"); + html5Entities.put("ocy", "\u043E"); + html5Entities.put("odash", "\u229D"); + html5Entities.put("Odblac", "\u0150"); + html5Entities.put("odblac", "\u0151"); + html5Entities.put("odiv", "\u2A38"); + html5Entities.put("odot", "\u2299"); + html5Entities.put("odsold", "\u29BC"); + html5Entities.put("OElig", "\u0152"); + html5Entities.put("oelig", "\u0153"); + html5Entities.put("ofcir", "\u29BF"); + html5Entities.put("Ofr", "\uD835\uDD12"); + html5Entities.put("ofr", "\uD835\uDD2C"); + html5Entities.put("ogon", "\u02DB"); + html5Entities.put("Ograve", "\u00D2"); + html5Entities.put("ograve", "\u00F2"); + html5Entities.put("ogt", "\u29C1"); + html5Entities.put("ohbar", "\u29B5"); + html5Entities.put("ohm", "\u03A9"); + html5Entities.put("oint", "\u222E"); + html5Entities.put("olarr", "\u21BA"); + html5Entities.put("olcir", "\u29BE"); + html5Entities.put("olcross", "\u29BB"); + html5Entities.put("oline", "\u203E"); + html5Entities.put("olt", "\u29C0"); + html5Entities.put("Omacr", "\u014C"); + html5Entities.put("omacr", "\u014D"); + html5Entities.put("Omega", "\u03A9"); + html5Entities.put("omega", "\u03C9"); + html5Entities.put("Omicron", "\u039F"); + html5Entities.put("omicron", "\u03BF"); + html5Entities.put("omid", "\u29B6"); + html5Entities.put("ominus", "\u2296"); + html5Entities.put("Oopf", "\uD835\uDD46"); + html5Entities.put("oopf", "\uD835\uDD60"); + html5Entities.put("opar", "\u29B7"); + html5Entities.put("OpenCurlyDoubleQuote", "\u201C"); + html5Entities.put("OpenCurlyQuote", "\u2018"); + html5Entities.put("operp", "\u29B9"); + html5Entities.put("oplus", "\u2295"); + html5Entities.put("orarr", "\u21BB"); + html5Entities.put("Or", "\u2A54"); + html5Entities.put("or", "\u2228"); + html5Entities.put("ord", "\u2A5D"); + html5Entities.put("order", "\u2134"); + html5Entities.put("orderof", "\u2134"); + html5Entities.put("ordf", "\u00AA"); + html5Entities.put("ordm", "\u00BA"); + html5Entities.put("origof", "\u22B6"); + html5Entities.put("oror", "\u2A56"); + html5Entities.put("orslope", "\u2A57"); + html5Entities.put("orv", "\u2A5B"); + html5Entities.put("oS", "\u24C8"); + html5Entities.put("Oscr", "\uD835\uDCAA"); + html5Entities.put("oscr", "\u2134"); + html5Entities.put("Oslash", "\u00D8"); + html5Entities.put("oslash", "\u00F8"); + html5Entities.put("osol", "\u2298"); + html5Entities.put("Otilde", "\u00D5"); + html5Entities.put("otilde", "\u00F5"); + html5Entities.put("otimesas", "\u2A36"); + html5Entities.put("Otimes", "\u2A37"); + html5Entities.put("otimes", "\u2297"); + html5Entities.put("Ouml", "\u00D6"); + html5Entities.put("ouml", "\u00F6"); + html5Entities.put("ovbar", "\u233D"); + html5Entities.put("OverBar", "\u203E"); + html5Entities.put("OverBrace", "\u23DE"); + html5Entities.put("OverBracket", "\u23B4"); + html5Entities.put("OverParenthesis", "\u23DC"); + html5Entities.put("para", "\u00B6"); + html5Entities.put("parallel", "\u2225"); + html5Entities.put("par", "\u2225"); + html5Entities.put("parsim", "\u2AF3"); + html5Entities.put("parsl", "\u2AFD"); + html5Entities.put("part", "\u2202"); + html5Entities.put("PartialD", "\u2202"); + html5Entities.put("Pcy", "\u041F"); + html5Entities.put("pcy", "\u043F"); + html5Entities.put("percnt", "\u0025"); + html5Entities.put("period", "\u002E"); + html5Entities.put("permil", "\u2030"); + html5Entities.put("perp", "\u22A5"); + html5Entities.put("pertenk", "\u2031"); + html5Entities.put("Pfr", "\uD835\uDD13"); + html5Entities.put("pfr", "\uD835\uDD2D"); + html5Entities.put("Phi", "\u03A6"); + html5Entities.put("phi", "\u03C6"); + html5Entities.put("phiv", "\u03D5"); + html5Entities.put("phmmat", "\u2133"); + html5Entities.put("phone", "\u260E"); + html5Entities.put("Pi", "\u03A0"); + html5Entities.put("pi", "\u03C0"); + html5Entities.put("pitchfork", "\u22D4"); + html5Entities.put("piv", "\u03D6"); + html5Entities.put("planck", "\u210F"); + html5Entities.put("planckh", "\u210E"); + html5Entities.put("plankv", "\u210F"); + html5Entities.put("plusacir", "\u2A23"); + html5Entities.put("plusb", "\u229E"); + html5Entities.put("pluscir", "\u2A22"); + html5Entities.put("plus", "\u002B"); + html5Entities.put("plusdo", "\u2214"); + html5Entities.put("plusdu", "\u2A25"); + html5Entities.put("pluse", "\u2A72"); + html5Entities.put("PlusMinus", "\u00B1"); + html5Entities.put("plusmn", "\u00B1"); + html5Entities.put("plussim", "\u2A26"); + html5Entities.put("plustwo", "\u2A27"); + html5Entities.put("pm", "\u00B1"); + html5Entities.put("Poincareplane", "\u210C"); + html5Entities.put("pointint", "\u2A15"); + html5Entities.put("popf", "\uD835\uDD61"); + html5Entities.put("Popf", "\u2119"); + html5Entities.put("pound", "\u00A3"); + html5Entities.put("prap", "\u2AB7"); + html5Entities.put("Pr", "\u2ABB"); + html5Entities.put("pr", "\u227A"); + html5Entities.put("prcue", "\u227C"); + html5Entities.put("precapprox", "\u2AB7"); + html5Entities.put("prec", "\u227A"); + html5Entities.put("preccurlyeq", "\u227C"); + html5Entities.put("Precedes", "\u227A"); + html5Entities.put("PrecedesEqual", "\u2AAF"); + html5Entities.put("PrecedesSlantEqual", "\u227C"); + html5Entities.put("PrecedesTilde", "\u227E"); + html5Entities.put("preceq", "\u2AAF"); + html5Entities.put("precnapprox", "\u2AB9"); + html5Entities.put("precneqq", "\u2AB5"); + html5Entities.put("precnsim", "\u22E8"); + html5Entities.put("pre", "\u2AAF"); + html5Entities.put("prE", "\u2AB3"); + html5Entities.put("precsim", "\u227E"); + html5Entities.put("prime", "\u2032"); + html5Entities.put("Prime", "\u2033"); + html5Entities.put("primes", "\u2119"); + html5Entities.put("prnap", "\u2AB9"); + html5Entities.put("prnE", "\u2AB5"); + html5Entities.put("prnsim", "\u22E8"); + html5Entities.put("prod", "\u220F"); + html5Entities.put("Product", "\u220F"); + html5Entities.put("profalar", "\u232E"); + html5Entities.put("profline", "\u2312"); + html5Entities.put("profsurf", "\u2313"); + html5Entities.put("prop", "\u221D"); + html5Entities.put("Proportional", "\u221D"); + html5Entities.put("Proportion", "\u2237"); + html5Entities.put("propto", "\u221D"); + html5Entities.put("prsim", "\u227E"); + html5Entities.put("prurel", "\u22B0"); + html5Entities.put("Pscr", "\uD835\uDCAB"); + html5Entities.put("pscr", "\uD835\uDCC5"); + html5Entities.put("Psi", "\u03A8"); + html5Entities.put("psi", "\u03C8"); + html5Entities.put("puncsp", "\u2008"); + html5Entities.put("Qfr", "\uD835\uDD14"); + html5Entities.put("qfr", "\uD835\uDD2E"); + html5Entities.put("qint", "\u2A0C"); + html5Entities.put("qopf", "\uD835\uDD62"); + html5Entities.put("Qopf", "\u211A"); + html5Entities.put("qprime", "\u2057"); + html5Entities.put("Qscr", "\uD835\uDCAC"); + html5Entities.put("qscr", "\uD835\uDCC6"); + html5Entities.put("quaternions", "\u210D"); + html5Entities.put("quatint", "\u2A16"); + html5Entities.put("quest", "\u003F"); + html5Entities.put("questeq", "\u225F"); + html5Entities.put("quot", "\""); + html5Entities.put("QUOT", "\""); + html5Entities.put("rAarr", "\u21DB"); + html5Entities.put("race", "\u223D\u0331"); + html5Entities.put("Racute", "\u0154"); + html5Entities.put("racute", "\u0155"); + html5Entities.put("radic", "\u221A"); + html5Entities.put("raemptyv", "\u29B3"); + html5Entities.put("rang", "\u27E9"); + html5Entities.put("Rang", "\u27EB"); + html5Entities.put("rangd", "\u2992"); + html5Entities.put("range", "\u29A5"); + html5Entities.put("rangle", "\u27E9"); + html5Entities.put("raquo", "\u00BB"); + html5Entities.put("rarrap", "\u2975"); + html5Entities.put("rarrb", "\u21E5"); + html5Entities.put("rarrbfs", "\u2920"); + html5Entities.put("rarrc", "\u2933"); + html5Entities.put("rarr", "\u2192"); + html5Entities.put("Rarr", "\u21A0"); + html5Entities.put("rArr", "\u21D2"); + html5Entities.put("rarrfs", "\u291E"); + html5Entities.put("rarrhk", "\u21AA"); + html5Entities.put("rarrlp", "\u21AC"); + html5Entities.put("rarrpl", "\u2945"); + html5Entities.put("rarrsim", "\u2974"); + html5Entities.put("Rarrtl", "\u2916"); + html5Entities.put("rarrtl", "\u21A3"); + html5Entities.put("rarrw", "\u219D"); + html5Entities.put("ratail", "\u291A"); + html5Entities.put("rAtail", "\u291C"); + html5Entities.put("ratio", "\u2236"); + html5Entities.put("rationals", "\u211A"); + html5Entities.put("rbarr", "\u290D"); + html5Entities.put("rBarr", "\u290F"); + html5Entities.put("RBarr", "\u2910"); + html5Entities.put("rbbrk", "\u2773"); + html5Entities.put("rbrace", "\u007D"); + html5Entities.put("rbrack", "\u005D"); + html5Entities.put("rbrke", "\u298C"); + html5Entities.put("rbrksld", "\u298E"); + html5Entities.put("rbrkslu", "\u2990"); + html5Entities.put("Rcaron", "\u0158"); + html5Entities.put("rcaron", "\u0159"); + html5Entities.put("Rcedil", "\u0156"); + html5Entities.put("rcedil", "\u0157"); + html5Entities.put("rceil", "\u2309"); + html5Entities.put("rcub", "\u007D"); + html5Entities.put("Rcy", "\u0420"); + html5Entities.put("rcy", "\u0440"); + html5Entities.put("rdca", "\u2937"); + html5Entities.put("rdldhar", "\u2969"); + html5Entities.put("rdquo", "\u201D"); + html5Entities.put("rdquor", "\u201D"); + html5Entities.put("rdsh", "\u21B3"); + html5Entities.put("real", "\u211C"); + html5Entities.put("realine", "\u211B"); + html5Entities.put("realpart", "\u211C"); + html5Entities.put("reals", "\u211D"); + html5Entities.put("Re", "\u211C"); + html5Entities.put("rect", "\u25AD"); + html5Entities.put("reg", "\u00AE"); + html5Entities.put("REG", "\u00AE"); + html5Entities.put("ReverseElement", "\u220B"); + html5Entities.put("ReverseEquilibrium", "\u21CB"); + html5Entities.put("ReverseUpEquilibrium", "\u296F"); + html5Entities.put("rfisht", "\u297D"); + html5Entities.put("rfloor", "\u230B"); + html5Entities.put("rfr", "\uD835\uDD2F"); + html5Entities.put("Rfr", "\u211C"); + html5Entities.put("rHar", "\u2964"); + html5Entities.put("rhard", "\u21C1"); + html5Entities.put("rharu", "\u21C0"); + html5Entities.put("rharul", "\u296C"); + html5Entities.put("Rho", "\u03A1"); + html5Entities.put("rho", "\u03C1"); + html5Entities.put("rhov", "\u03F1"); + html5Entities.put("RightAngleBracket", "\u27E9"); + html5Entities.put("RightArrowBar", "\u21E5"); + html5Entities.put("rightarrow", "\u2192"); + html5Entities.put("RightArrow", "\u2192"); + html5Entities.put("Rightarrow", "\u21D2"); + html5Entities.put("RightArrowLeftArrow", "\u21C4"); + html5Entities.put("rightarrowtail", "\u21A3"); + html5Entities.put("RightCeiling", "\u2309"); + html5Entities.put("RightDoubleBracket", "\u27E7"); + html5Entities.put("RightDownTeeVector", "\u295D"); + html5Entities.put("RightDownVectorBar", "\u2955"); + html5Entities.put("RightDownVector", "\u21C2"); + html5Entities.put("RightFloor", "\u230B"); + html5Entities.put("rightharpoondown", "\u21C1"); + html5Entities.put("rightharpoonup", "\u21C0"); + html5Entities.put("rightleftarrows", "\u21C4"); + html5Entities.put("rightleftharpoons", "\u21CC"); + html5Entities.put("rightrightarrows", "\u21C9"); + html5Entities.put("rightsquigarrow", "\u219D"); + html5Entities.put("RightTeeArrow", "\u21A6"); + html5Entities.put("RightTee", "\u22A2"); + html5Entities.put("RightTeeVector", "\u295B"); + html5Entities.put("rightthreetimes", "\u22CC"); + html5Entities.put("RightTriangleBar", "\u29D0"); + html5Entities.put("RightTriangle", "\u22B3"); + html5Entities.put("RightTriangleEqual", "\u22B5"); + html5Entities.put("RightUpDownVector", "\u294F"); + html5Entities.put("RightUpTeeVector", "\u295C"); + html5Entities.put("RightUpVectorBar", "\u2954"); + html5Entities.put("RightUpVector", "\u21BE"); + html5Entities.put("RightVectorBar", "\u2953"); + html5Entities.put("RightVector", "\u21C0"); + html5Entities.put("ring", "\u02DA"); + html5Entities.put("risingdotseq", "\u2253"); + html5Entities.put("rlarr", "\u21C4"); + html5Entities.put("rlhar", "\u21CC"); + html5Entities.put("rlm", "\u200F"); + html5Entities.put("rmoustache", "\u23B1"); + html5Entities.put("rmoust", "\u23B1"); + html5Entities.put("rnmid", "\u2AEE"); + html5Entities.put("roang", "\u27ED"); + html5Entities.put("roarr", "\u21FE"); + html5Entities.put("robrk", "\u27E7"); + html5Entities.put("ropar", "\u2986"); + html5Entities.put("ropf", "\uD835\uDD63"); + html5Entities.put("Ropf", "\u211D"); + html5Entities.put("roplus", "\u2A2E"); + html5Entities.put("rotimes", "\u2A35"); + html5Entities.put("RoundImplies", "\u2970"); + html5Entities.put("rpar", "\u0029"); + html5Entities.put("rpargt", "\u2994"); + html5Entities.put("rppolint", "\u2A12"); + html5Entities.put("rrarr", "\u21C9"); + html5Entities.put("Rrightarrow", "\u21DB"); + html5Entities.put("rsaquo", "\u203A"); + html5Entities.put("rscr", "\uD835\uDCC7"); + html5Entities.put("Rscr", "\u211B"); + html5Entities.put("rsh", "\u21B1"); + html5Entities.put("Rsh", "\u21B1"); + html5Entities.put("rsqb", "\u005D"); + html5Entities.put("rsquo", "\u2019"); + html5Entities.put("rsquor", "\u2019"); + html5Entities.put("rthree", "\u22CC"); + html5Entities.put("rtimes", "\u22CA"); + html5Entities.put("rtri", "\u25B9"); + html5Entities.put("rtrie", "\u22B5"); + html5Entities.put("rtrif", "\u25B8"); + html5Entities.put("rtriltri", "\u29CE"); + html5Entities.put("RuleDelayed", "\u29F4"); + html5Entities.put("ruluhar", "\u2968"); + html5Entities.put("rx", "\u211E"); + html5Entities.put("Sacute", "\u015A"); + html5Entities.put("sacute", "\u015B"); + html5Entities.put("sbquo", "\u201A"); + html5Entities.put("scap", "\u2AB8"); + html5Entities.put("Scaron", "\u0160"); + html5Entities.put("scaron", "\u0161"); + html5Entities.put("Sc", "\u2ABC"); + html5Entities.put("sc", "\u227B"); + html5Entities.put("sccue", "\u227D"); + html5Entities.put("sce", "\u2AB0"); + html5Entities.put("scE", "\u2AB4"); + html5Entities.put("Scedil", "\u015E"); + html5Entities.put("scedil", "\u015F"); + html5Entities.put("Scirc", "\u015C"); + html5Entities.put("scirc", "\u015D"); + html5Entities.put("scnap", "\u2ABA"); + html5Entities.put("scnE", "\u2AB6"); + html5Entities.put("scnsim", "\u22E9"); + html5Entities.put("scpolint", "\u2A13"); + html5Entities.put("scsim", "\u227F"); + html5Entities.put("Scy", "\u0421"); + html5Entities.put("scy", "\u0441"); + html5Entities.put("sdotb", "\u22A1"); + html5Entities.put("sdot", "\u22C5"); + html5Entities.put("sdote", "\u2A66"); + html5Entities.put("searhk", "\u2925"); + html5Entities.put("searr", "\u2198"); + html5Entities.put("seArr", "\u21D8"); + html5Entities.put("searrow", "\u2198"); + html5Entities.put("sect", "\u00A7"); + html5Entities.put("semi", "\u003B"); + html5Entities.put("seswar", "\u2929"); + html5Entities.put("setminus", "\u2216"); + html5Entities.put("setmn", "\u2216"); + html5Entities.put("sext", "\u2736"); + html5Entities.put("Sfr", "\uD835\uDD16"); + html5Entities.put("sfr", "\uD835\uDD30"); + html5Entities.put("sfrown", "\u2322"); + html5Entities.put("sharp", "\u266F"); + html5Entities.put("SHCHcy", "\u0429"); + html5Entities.put("shchcy", "\u0449"); + html5Entities.put("SHcy", "\u0428"); + html5Entities.put("shcy", "\u0448"); + html5Entities.put("ShortDownArrow", "\u2193"); + html5Entities.put("ShortLeftArrow", "\u2190"); + html5Entities.put("shortmid", "\u2223"); + html5Entities.put("shortparallel", "\u2225"); + html5Entities.put("ShortRightArrow", "\u2192"); + html5Entities.put("ShortUpArrow", "\u2191"); + html5Entities.put("shy", "\u00AD"); + html5Entities.put("Sigma", "\u03A3"); + html5Entities.put("sigma", "\u03C3"); + html5Entities.put("sigmaf", "\u03C2"); + html5Entities.put("sigmav", "\u03C2"); + html5Entities.put("sim", "\u223C"); + html5Entities.put("simdot", "\u2A6A"); + html5Entities.put("sime", "\u2243"); + html5Entities.put("simeq", "\u2243"); + html5Entities.put("simg", "\u2A9E"); + html5Entities.put("simgE", "\u2AA0"); + html5Entities.put("siml", "\u2A9D"); + html5Entities.put("simlE", "\u2A9F"); + html5Entities.put("simne", "\u2246"); + html5Entities.put("simplus", "\u2A24"); + html5Entities.put("simrarr", "\u2972"); + html5Entities.put("slarr", "\u2190"); + html5Entities.put("SmallCircle", "\u2218"); + html5Entities.put("smallsetminus", "\u2216"); + html5Entities.put("smashp", "\u2A33"); + html5Entities.put("smeparsl", "\u29E4"); + html5Entities.put("smid", "\u2223"); + html5Entities.put("smile", "\u2323"); + html5Entities.put("smt", "\u2AAA"); + html5Entities.put("smte", "\u2AAC"); + html5Entities.put("smtes", "\u2AAC\uFE00"); + html5Entities.put("SOFTcy", "\u042C"); + html5Entities.put("softcy", "\u044C"); + html5Entities.put("solbar", "\u233F"); + html5Entities.put("solb", "\u29C4"); + html5Entities.put("sol", "\u002F"); + html5Entities.put("Sopf", "\uD835\uDD4A"); + html5Entities.put("sopf", "\uD835\uDD64"); + html5Entities.put("spades", "\u2660"); + html5Entities.put("spadesuit", "\u2660"); + html5Entities.put("spar", "\u2225"); + html5Entities.put("sqcap", "\u2293"); + html5Entities.put("sqcaps", "\u2293\uFE00"); + html5Entities.put("sqcup", "\u2294"); + html5Entities.put("sqcups", "\u2294\uFE00"); + html5Entities.put("Sqrt", "\u221A"); + html5Entities.put("sqsub", "\u228F"); + html5Entities.put("sqsube", "\u2291"); + html5Entities.put("sqsubset", "\u228F"); + html5Entities.put("sqsubseteq", "\u2291"); + html5Entities.put("sqsup", "\u2290"); + html5Entities.put("sqsupe", "\u2292"); + html5Entities.put("sqsupset", "\u2290"); + html5Entities.put("sqsupseteq", "\u2292"); + html5Entities.put("square", "\u25A1"); + html5Entities.put("Square", "\u25A1"); + html5Entities.put("SquareIntersection", "\u2293"); + html5Entities.put("SquareSubset", "\u228F"); + html5Entities.put("SquareSubsetEqual", "\u2291"); + html5Entities.put("SquareSuperset", "\u2290"); + html5Entities.put("SquareSupersetEqual", "\u2292"); + html5Entities.put("SquareUnion", "\u2294"); + html5Entities.put("squarf", "\u25AA"); + html5Entities.put("squ", "\u25A1"); + html5Entities.put("squf", "\u25AA"); + html5Entities.put("srarr", "\u2192"); + html5Entities.put("Sscr", "\uD835\uDCAE"); + html5Entities.put("sscr", "\uD835\uDCC8"); + html5Entities.put("ssetmn", "\u2216"); + html5Entities.put("ssmile", "\u2323"); + html5Entities.put("sstarf", "\u22C6"); + html5Entities.put("Star", "\u22C6"); + html5Entities.put("star", "\u2606"); + html5Entities.put("starf", "\u2605"); + html5Entities.put("straightepsilon", "\u03F5"); + html5Entities.put("straightphi", "\u03D5"); + html5Entities.put("strns", "\u00AF"); + html5Entities.put("sub", "\u2282"); + html5Entities.put("Sub", "\u22D0"); + html5Entities.put("subdot", "\u2ABD"); + html5Entities.put("subE", "\u2AC5"); + html5Entities.put("sube", "\u2286"); + html5Entities.put("subedot", "\u2AC3"); + html5Entities.put("submult", "\u2AC1"); + html5Entities.put("subnE", "\u2ACB"); + html5Entities.put("subne", "\u228A"); + html5Entities.put("subplus", "\u2ABF"); + html5Entities.put("subrarr", "\u2979"); + html5Entities.put("subset", "\u2282"); + html5Entities.put("Subset", "\u22D0"); + html5Entities.put("subseteq", "\u2286"); + html5Entities.put("subseteqq", "\u2AC5"); + html5Entities.put("SubsetEqual", "\u2286"); + html5Entities.put("subsetneq", "\u228A"); + html5Entities.put("subsetneqq", "\u2ACB"); + html5Entities.put("subsim", "\u2AC7"); + html5Entities.put("subsub", "\u2AD5"); + html5Entities.put("subsup", "\u2AD3"); + html5Entities.put("succapprox", "\u2AB8"); + html5Entities.put("succ", "\u227B"); + html5Entities.put("succcurlyeq", "\u227D"); + html5Entities.put("Succeeds", "\u227B"); + html5Entities.put("SucceedsEqual", "\u2AB0"); + html5Entities.put("SucceedsSlantEqual", "\u227D"); + html5Entities.put("SucceedsTilde", "\u227F"); + html5Entities.put("succeq", "\u2AB0"); + html5Entities.put("succnapprox", "\u2ABA"); + html5Entities.put("succneqq", "\u2AB6"); + html5Entities.put("succnsim", "\u22E9"); + html5Entities.put("succsim", "\u227F"); + html5Entities.put("SuchThat", "\u220B"); + html5Entities.put("sum", "\u2211"); + html5Entities.put("Sum", "\u2211"); + html5Entities.put("sung", "\u266A"); + html5Entities.put("sup1", "\u00B9"); + html5Entities.put("sup2", "\u00B2"); + html5Entities.put("sup3", "\u00B3"); + html5Entities.put("sup", "\u2283"); + html5Entities.put("Sup", "\u22D1"); + html5Entities.put("supdot", "\u2ABE"); + html5Entities.put("supdsub", "\u2AD8"); + html5Entities.put("supE", "\u2AC6"); + html5Entities.put("supe", "\u2287"); + html5Entities.put("supedot", "\u2AC4"); + html5Entities.put("Superset", "\u2283"); + html5Entities.put("SupersetEqual", "\u2287"); + html5Entities.put("suphsol", "\u27C9"); + html5Entities.put("suphsub", "\u2AD7"); + html5Entities.put("suplarr", "\u297B"); + html5Entities.put("supmult", "\u2AC2"); + html5Entities.put("supnE", "\u2ACC"); + html5Entities.put("supne", "\u228B"); + html5Entities.put("supplus", "\u2AC0"); + html5Entities.put("supset", "\u2283"); + html5Entities.put("Supset", "\u22D1"); + html5Entities.put("supseteq", "\u2287"); + html5Entities.put("supseteqq", "\u2AC6"); + html5Entities.put("supsetneq", "\u228B"); + html5Entities.put("supsetneqq", "\u2ACC"); + html5Entities.put("supsim", "\u2AC8"); + html5Entities.put("supsub", "\u2AD4"); + html5Entities.put("supsup", "\u2AD6"); + html5Entities.put("swarhk", "\u2926"); + html5Entities.put("swarr", "\u2199"); + html5Entities.put("swArr", "\u21D9"); + html5Entities.put("swarrow", "\u2199"); + html5Entities.put("swnwar", "\u292A"); + html5Entities.put("szlig", "\u00DF"); + html5Entities.put("Tab", "\u0009"); + html5Entities.put("target", "\u2316"); + html5Entities.put("Tau", "\u03A4"); + html5Entities.put("tau", "\u03C4"); + html5Entities.put("tbrk", "\u23B4"); + html5Entities.put("Tcaron", "\u0164"); + html5Entities.put("tcaron", "\u0165"); + html5Entities.put("Tcedil", "\u0162"); + html5Entities.put("tcedil", "\u0163"); + html5Entities.put("Tcy", "\u0422"); + html5Entities.put("tcy", "\u0442"); + html5Entities.put("tdot", "\u20DB"); + html5Entities.put("telrec", "\u2315"); + html5Entities.put("Tfr", "\uD835\uDD17"); + html5Entities.put("tfr", "\uD835\uDD31"); + html5Entities.put("there4", "\u2234"); + html5Entities.put("therefore", "\u2234"); + html5Entities.put("Therefore", "\u2234"); + html5Entities.put("Theta", "\u0398"); + html5Entities.put("theta", "\u03B8"); + html5Entities.put("thetasym", "\u03D1"); + html5Entities.put("thetav", "\u03D1"); + html5Entities.put("thickapprox", "\u2248"); + html5Entities.put("thicksim", "\u223C"); + html5Entities.put("ThickSpace", "\u205F\u200A"); + html5Entities.put("ThinSpace", "\u2009"); + html5Entities.put("thinsp", "\u2009"); + html5Entities.put("thkap", "\u2248"); + html5Entities.put("thksim", "\u223C"); + html5Entities.put("THORN", "\u00DE"); + html5Entities.put("thorn", "\u00FE"); + html5Entities.put("tilde", "\u02DC"); + html5Entities.put("Tilde", "\u223C"); + html5Entities.put("TildeEqual", "\u2243"); + html5Entities.put("TildeFullEqual", "\u2245"); + html5Entities.put("TildeTilde", "\u2248"); + html5Entities.put("timesbar", "\u2A31"); + html5Entities.put("timesb", "\u22A0"); + html5Entities.put("times", "\u00D7"); + html5Entities.put("timesd", "\u2A30"); + html5Entities.put("tint", "\u222D"); + html5Entities.put("toea", "\u2928"); + html5Entities.put("topbot", "\u2336"); + html5Entities.put("topcir", "\u2AF1"); + html5Entities.put("top", "\u22A4"); + html5Entities.put("Topf", "\uD835\uDD4B"); + html5Entities.put("topf", "\uD835\uDD65"); + html5Entities.put("topfork", "\u2ADA"); + html5Entities.put("tosa", "\u2929"); + html5Entities.put("tprime", "\u2034"); + html5Entities.put("trade", "\u2122"); + html5Entities.put("TRADE", "\u2122"); + html5Entities.put("triangle", "\u25B5"); + html5Entities.put("triangledown", "\u25BF"); + html5Entities.put("triangleleft", "\u25C3"); + html5Entities.put("trianglelefteq", "\u22B4"); + html5Entities.put("triangleq", "\u225C"); + html5Entities.put("triangleright", "\u25B9"); + html5Entities.put("trianglerighteq", "\u22B5"); + html5Entities.put("tridot", "\u25EC"); + html5Entities.put("trie", "\u225C"); + html5Entities.put("triminus", "\u2A3A"); + html5Entities.put("TripleDot", "\u20DB"); + html5Entities.put("triplus", "\u2A39"); + html5Entities.put("trisb", "\u29CD"); + html5Entities.put("tritime", "\u2A3B"); + html5Entities.put("trpezium", "\u23E2"); + html5Entities.put("Tscr", "\uD835\uDCAF"); + html5Entities.put("tscr", "\uD835\uDCC9"); + html5Entities.put("TScy", "\u0426"); + html5Entities.put("tscy", "\u0446"); + html5Entities.put("TSHcy", "\u040B"); + html5Entities.put("tshcy", "\u045B"); + html5Entities.put("Tstrok", "\u0166"); + html5Entities.put("tstrok", "\u0167"); + html5Entities.put("twixt", "\u226C"); + html5Entities.put("twoheadleftarrow", "\u219E"); + html5Entities.put("twoheadrightarrow", "\u21A0"); + html5Entities.put("Uacute", "\u00DA"); + html5Entities.put("uacute", "\u00FA"); + html5Entities.put("uarr", "\u2191"); + html5Entities.put("Uarr", "\u219F"); + html5Entities.put("uArr", "\u21D1"); + html5Entities.put("Uarrocir", "\u2949"); + html5Entities.put("Ubrcy", "\u040E"); + html5Entities.put("ubrcy", "\u045E"); + html5Entities.put("Ubreve", "\u016C"); + html5Entities.put("ubreve", "\u016D"); + html5Entities.put("Ucirc", "\u00DB"); + html5Entities.put("ucirc", "\u00FB"); + html5Entities.put("Ucy", "\u0423"); + html5Entities.put("ucy", "\u0443"); + html5Entities.put("udarr", "\u21C5"); + html5Entities.put("Udblac", "\u0170"); + html5Entities.put("udblac", "\u0171"); + html5Entities.put("udhar", "\u296E"); + html5Entities.put("ufisht", "\u297E"); + html5Entities.put("Ufr", "\uD835\uDD18"); + html5Entities.put("ufr", "\uD835\uDD32"); + html5Entities.put("Ugrave", "\u00D9"); + html5Entities.put("ugrave", "\u00F9"); + html5Entities.put("uHar", "\u2963"); + html5Entities.put("uharl", "\u21BF"); + html5Entities.put("uharr", "\u21BE"); + html5Entities.put("uhblk", "\u2580"); + html5Entities.put("ulcorn", "\u231C"); + html5Entities.put("ulcorner", "\u231C"); + html5Entities.put("ulcrop", "\u230F"); + html5Entities.put("ultri", "\u25F8"); + html5Entities.put("Umacr", "\u016A"); + html5Entities.put("umacr", "\u016B"); + html5Entities.put("uml", "\u00A8"); + html5Entities.put("UnderBar", "\u005F"); + html5Entities.put("UnderBrace", "\u23DF"); + html5Entities.put("UnderBracket", "\u23B5"); + html5Entities.put("UnderParenthesis", "\u23DD"); + html5Entities.put("Union", "\u22C3"); + html5Entities.put("UnionPlus", "\u228E"); + html5Entities.put("Uogon", "\u0172"); + html5Entities.put("uogon", "\u0173"); + html5Entities.put("Uopf", "\uD835\uDD4C"); + html5Entities.put("uopf", "\uD835\uDD66"); + html5Entities.put("UpArrowBar", "\u2912"); + html5Entities.put("uparrow", "\u2191"); + html5Entities.put("UpArrow", "\u2191"); + html5Entities.put("Uparrow", "\u21D1"); + html5Entities.put("UpArrowDownArrow", "\u21C5"); + html5Entities.put("updownarrow", "\u2195"); + html5Entities.put("UpDownArrow", "\u2195"); + html5Entities.put("Updownarrow", "\u21D5"); + html5Entities.put("UpEquilibrium", "\u296E"); + html5Entities.put("upharpoonleft", "\u21BF"); + html5Entities.put("upharpoonright", "\u21BE"); + html5Entities.put("uplus", "\u228E"); + html5Entities.put("UpperLeftArrow", "\u2196"); + html5Entities.put("UpperRightArrow", "\u2197"); + html5Entities.put("upsi", "\u03C5"); + html5Entities.put("Upsi", "\u03D2"); + html5Entities.put("upsih", "\u03D2"); + html5Entities.put("Upsilon", "\u03A5"); + html5Entities.put("upsilon", "\u03C5"); + html5Entities.put("UpTeeArrow", "\u21A5"); + html5Entities.put("UpTee", "\u22A5"); + html5Entities.put("upuparrows", "\u21C8"); + html5Entities.put("urcorn", "\u231D"); + html5Entities.put("urcorner", "\u231D"); + html5Entities.put("urcrop", "\u230E"); + html5Entities.put("Uring", "\u016E"); + html5Entities.put("uring", "\u016F"); + html5Entities.put("urtri", "\u25F9"); + html5Entities.put("Uscr", "\uD835\uDCB0"); + html5Entities.put("uscr", "\uD835\uDCCA"); + html5Entities.put("utdot", "\u22F0"); + html5Entities.put("Utilde", "\u0168"); + html5Entities.put("utilde", "\u0169"); + html5Entities.put("utri", "\u25B5"); + html5Entities.put("utrif", "\u25B4"); + html5Entities.put("uuarr", "\u21C8"); + html5Entities.put("Uuml", "\u00DC"); + html5Entities.put("uuml", "\u00FC"); + html5Entities.put("uwangle", "\u29A7"); + html5Entities.put("vangrt", "\u299C"); + html5Entities.put("varepsilon", "\u03F5"); + html5Entities.put("varkappa", "\u03F0"); + html5Entities.put("varnothing", "\u2205"); + html5Entities.put("varphi", "\u03D5"); + html5Entities.put("varpi", "\u03D6"); + html5Entities.put("varpropto", "\u221D"); + html5Entities.put("varr", "\u2195"); + html5Entities.put("vArr", "\u21D5"); + html5Entities.put("varrho", "\u03F1"); + html5Entities.put("varsigma", "\u03C2"); + html5Entities.put("varsubsetneq", "\u228A\uFE00"); + html5Entities.put("varsubsetneqq", "\u2ACB\uFE00"); + html5Entities.put("varsupsetneq", "\u228B\uFE00"); + html5Entities.put("varsupsetneqq", "\u2ACC\uFE00"); + html5Entities.put("vartheta", "\u03D1"); + html5Entities.put("vartriangleleft", "\u22B2"); + html5Entities.put("vartriangleright", "\u22B3"); + html5Entities.put("vBar", "\u2AE8"); + html5Entities.put("Vbar", "\u2AEB"); + html5Entities.put("vBarv", "\u2AE9"); + html5Entities.put("Vcy", "\u0412"); + html5Entities.put("vcy", "\u0432"); + html5Entities.put("vdash", "\u22A2"); + html5Entities.put("vDash", "\u22A8"); + html5Entities.put("Vdash", "\u22A9"); + html5Entities.put("VDash", "\u22AB"); + html5Entities.put("Vdashl", "\u2AE6"); + html5Entities.put("veebar", "\u22BB"); + html5Entities.put("vee", "\u2228"); + html5Entities.put("Vee", "\u22C1"); + html5Entities.put("veeeq", "\u225A"); + html5Entities.put("vellip", "\u22EE"); + html5Entities.put("verbar", "\u007C"); + html5Entities.put("Verbar", "\u2016"); + html5Entities.put("vert", "\u007C"); + html5Entities.put("Vert", "\u2016"); + html5Entities.put("VerticalBar", "\u2223"); + html5Entities.put("VerticalLine", "\u007C"); + html5Entities.put("VerticalSeparator", "\u2758"); + html5Entities.put("VerticalTilde", "\u2240"); + html5Entities.put("VeryThinSpace", "\u200A"); + html5Entities.put("Vfr", "\uD835\uDD19"); + html5Entities.put("vfr", "\uD835\uDD33"); + html5Entities.put("vltri", "\u22B2"); + html5Entities.put("vnsub", "\u2282\u20D2"); + html5Entities.put("vnsup", "\u2283\u20D2"); + html5Entities.put("Vopf", "\uD835\uDD4D"); + html5Entities.put("vopf", "\uD835\uDD67"); + html5Entities.put("vprop", "\u221D"); + html5Entities.put("vrtri", "\u22B3"); + html5Entities.put("Vscr", "\uD835\uDCB1"); + html5Entities.put("vscr", "\uD835\uDCCB"); + html5Entities.put("vsubnE", "\u2ACB\uFE00"); + html5Entities.put("vsubne", "\u228A\uFE00"); + html5Entities.put("vsupnE", "\u2ACC\uFE00"); + html5Entities.put("vsupne", "\u228B\uFE00"); + html5Entities.put("Vvdash", "\u22AA"); + html5Entities.put("vzigzag", "\u299A"); + html5Entities.put("Wcirc", "\u0174"); + html5Entities.put("wcirc", "\u0175"); + html5Entities.put("wedbar", "\u2A5F"); + html5Entities.put("wedge", "\u2227"); + html5Entities.put("Wedge", "\u22C0"); + html5Entities.put("wedgeq", "\u2259"); + html5Entities.put("weierp", "\u2118"); + html5Entities.put("Wfr", "\uD835\uDD1A"); + html5Entities.put("wfr", "\uD835\uDD34"); + html5Entities.put("Wopf", "\uD835\uDD4E"); + html5Entities.put("wopf", "\uD835\uDD68"); + html5Entities.put("wp", "\u2118"); + html5Entities.put("wr", "\u2240"); + html5Entities.put("wreath", "\u2240"); + html5Entities.put("Wscr", "\uD835\uDCB2"); + html5Entities.put("wscr", "\uD835\uDCCC"); + html5Entities.put("xcap", "\u22C2"); + html5Entities.put("xcirc", "\u25EF"); + html5Entities.put("xcup", "\u22C3"); + html5Entities.put("xdtri", "\u25BD"); + html5Entities.put("Xfr", "\uD835\uDD1B"); + html5Entities.put("xfr", "\uD835\uDD35"); + html5Entities.put("xharr", "\u27F7"); + html5Entities.put("xhArr", "\u27FA"); + html5Entities.put("Xi", "\u039E"); + html5Entities.put("xi", "\u03BE"); + html5Entities.put("xlarr", "\u27F5"); + html5Entities.put("xlArr", "\u27F8"); + html5Entities.put("xmap", "\u27FC"); + html5Entities.put("xnis", "\u22FB"); + html5Entities.put("xodot", "\u2A00"); + html5Entities.put("Xopf", "\uD835\uDD4F"); + html5Entities.put("xopf", "\uD835\uDD69"); + html5Entities.put("xoplus", "\u2A01"); + html5Entities.put("xotime", "\u2A02"); + html5Entities.put("xrarr", "\u27F6"); + html5Entities.put("xrArr", "\u27F9"); + html5Entities.put("Xscr", "\uD835\uDCB3"); + html5Entities.put("xscr", "\uD835\uDCCD"); + html5Entities.put("xsqcup", "\u2A06"); + html5Entities.put("xuplus", "\u2A04"); + html5Entities.put("xutri", "\u25B3"); + html5Entities.put("xvee", "\u22C1"); + html5Entities.put("xwedge", "\u22C0"); + html5Entities.put("Yacute", "\u00DD"); + html5Entities.put("yacute", "\u00FD"); + html5Entities.put("YAcy", "\u042F"); + html5Entities.put("yacy", "\u044F"); + html5Entities.put("Ycirc", "\u0176"); + html5Entities.put("ycirc", "\u0177"); + html5Entities.put("Ycy", "\u042B"); + html5Entities.put("ycy", "\u044B"); + html5Entities.put("yen", "\u00A5"); + html5Entities.put("Yfr", "\uD835\uDD1C"); + html5Entities.put("yfr", "\uD835\uDD36"); + html5Entities.put("YIcy", "\u0407"); + html5Entities.put("yicy", "\u0457"); + html5Entities.put("Yopf", "\uD835\uDD50"); + html5Entities.put("yopf", "\uD835\uDD6A"); + html5Entities.put("Yscr", "\uD835\uDCB4"); + html5Entities.put("yscr", "\uD835\uDCCE"); + html5Entities.put("YUcy", "\u042E"); + html5Entities.put("yucy", "\u044E"); + html5Entities.put("yuml", "\u00FF"); + html5Entities.put("Yuml", "\u0178"); + html5Entities.put("Zacute", "\u0179"); + html5Entities.put("zacute", "\u017A"); + html5Entities.put("Zcaron", "\u017D"); + html5Entities.put("zcaron", "\u017E"); + html5Entities.put("Zcy", "\u0417"); + html5Entities.put("zcy", "\u0437"); + html5Entities.put("Zdot", "\u017B"); + html5Entities.put("zdot", "\u017C"); + html5Entities.put("zeetrf", "\u2128"); + html5Entities.put("ZeroWidthSpace", "\u200B"); + html5Entities.put("Zeta", "\u0396"); + html5Entities.put("zeta", "\u03B6"); + html5Entities.put("zfr", "\uD835\uDD37"); + html5Entities.put("Zfr", "\u2128"); + html5Entities.put("ZHcy", "\u0416"); + html5Entities.put("zhcy", "\u0436"); + html5Entities.put("zigrarr", "\u21DD"); + html5Entities.put("zopf", "\uD835\uDD6B"); + html5Entities.put("Zopf", "\u2124"); + html5Entities.put("Zscr", "\uD835\uDCB5"); + html5Entities.put("zscr", "\uD835\uDCCF"); + html5Entities.put("zwj", "\u200D"); + html5Entities.put("zwnj", "\u200C"); } public static boolean isValid(String name) { - return names.containsKey(name); - } - - public static Entity get(String name) { - return names.get(name); + return html5Entities.containsKey(name); } public static boolean isValid(int code) { - // allow numeric codes for standard ANSI characters - return codes.containsKey(code) || ( 32 <= code && code < 2127); + // See https://www.w3.org/TR/html52/syntax.html#character-references + return Character.isDefined(code) + && (!Character.isISOControl(code) || Character.isSpaceChar(code)) + && (code < 0xd800 || code > 0xdfff); } - private static final Map names = new HashMap<>(); - private static final Map codes = new HashMap<>(); - static { - for (Entity e: values()) { - String name = e.name(); - int code = e.code; - if (name.startsWith("_")) name = name.substring(1); - names.put(name, e); - codes.put(code, e); - } + public static String getValue(String name) { + return html5Entities.get(name); } } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Attribute.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Attribute.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Attribute.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -247,7 +247,8 @@ buf.append('('); boolean first = true; for (Pair value : values) { - if (!first) buf.append(", "); + if (!first) + buf.append(", "); first = false; Name name = value.fst.name; @@ -368,7 +369,7 @@ public void accept(Visitor v) { v.visitEnum(this); } @DefinedBy(Api.LANGUAGE_MODEL) public String toString() { - return value.enclClass() + "." + value; // qualified name + return value.toString(); } @DefinedBy(Api.LANGUAGE_MODEL) public VarSymbol getValue() { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -84,11 +84,20 @@ /** 1.11 local-variable syntax for lambda parameters */ JDK11("11"), - /** 12 covers the to be determined language features that will be added in JDK 12. */ + /** 12, no language features; switch expression were in preview */ JDK12("12"), - /** 13 covers the to be determined language features that will be added in JDK 13. */ - JDK13("13"); + /** + * 13, no language features; text blocks and revised switch + * expressions in preview + */ + JDK13("13"), + + /** + * 14 covers the to be determined language features that will be + * added in JDK 14. + */ + JDK14("14"); private static final Context.Key sourceKey = new Context.Key<>(); @@ -139,6 +148,7 @@ } public Target requiredTarget() { + if (this.compareTo(JDK14) >= 0) return Target.JDK1_14; if (this.compareTo(JDK13) >= 0) return Target.JDK1_13; if (this.compareTo(JDK12) >= 0) return Target.JDK1_12; if (this.compareTo(JDK11) >= 0) return Target.JDK1_11; @@ -186,10 +196,10 @@ LOCAL_VARIABLE_TYPE_INFERENCE(JDK10), VAR_SYNTAX_IMPLICIT_LAMBDAS(JDK11, Fragments.FeatureVarSyntaxInImplicitLambda, DiagKind.PLURAL), IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES(JDK1_2, JDK8), - SWITCH_MULTIPLE_CASE_LABELS(JDK13, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL), - SWITCH_RULE(JDK13, Fragments.FeatureSwitchRules, DiagKind.PLURAL), - SWITCH_EXPRESSION(JDK13, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL), - TEXT_BLOCKS(JDK13, Fragments.FeatureTextBlocks, DiagKind.PLURAL); + SWITCH_MULTIPLE_CASE_LABELS(JDK14, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL), + SWITCH_RULE(JDK14, Fragments.FeatureSwitchRules, DiagKind.PLURAL), + SWITCH_EXPRESSION(JDK14, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL), + TEXT_BLOCKS(JDK14, Fragments.FeatureTextBlocks, DiagKind.PLURAL); enum DiagKind { NORMAL, @@ -276,6 +286,8 @@ return RELEASE_12; case JDK13: return RELEASE_13; + case JDK14: + return RELEASE_14; default: return null; } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Fri Jun 21 14:07:48 2019 +0530 @@ -2063,7 +2063,8 @@ @DefinedBy(Api.LANGUAGE_MODEL) public Type getReceiverType() { - return asType().getReceiverType(); + Type result = asType().getReceiverType(); + return (result == null) ? Type.noType : result; } @DefinedBy(Api.LANGUAGE_MODEL) diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Fri Jun 21 14:07:48 2019 +0530 @@ -2421,7 +2421,9 @@ List potentiallyAmbiguousList = List.nil(); boolean overridesAny = false; - for (Symbol m1 : types.membersClosure(site, false).getSymbolsByName(sym.name, cf)) { + ArrayList symbolsByName = new ArrayList<>(); + types.membersClosure(site, false).getSymbolsByName(sym.name, cf).forEach(symbolsByName::add); + for (Symbol m1 : symbolsByName) { if (!sym.overrides(m1, site.tsym, types, false)) { if (m1 == sym) { continue; @@ -2439,7 +2441,7 @@ } //...check each method m2 that is a member of 'site' - for (Symbol m2 : types.membersClosure(site, false).getSymbolsByName(sym.name, cf)) { + for (Symbol m2 : symbolsByName) { if (m2 == m1) continue; //if (i) the signature of 'sym' is not a subsignature of m1 (seen as //a member of 'site') and (ii) m1 has the same erasure as m2, issue an error diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -114,7 +114,8 @@ V54(54, 0), // JDK 10 V55(55, 0), // JDK 11: constant dynamic, nest mates V56(56, 0), // JDK 12 - V57(57, 0); // JDK 13 + V57(57, 0), // JDK 13 + V58(58, 0); // JDK 14 Version(int major, int minor) { this.major = major; this.minor = minor; diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Jun 21 14:07:48 2019 +0530 @@ -166,6 +166,7 @@ Chain switchExpressionTrueChain; Chain switchExpressionFalseChain; List stackBeforeSwitchExpression; + LocalItem switchResult; /** Generate code to load an integer constant. * @param n The integer to be loaded. @@ -1190,9 +1191,11 @@ private void doHandleSwitchExpression(JCSwitchExpression tree) { List prevStackBeforeSwitchExpression = stackBeforeSwitchExpression; + LocalItem prevSwitchResult = switchResult; int limit = code.nextreg; try { stackBeforeSwitchExpression = List.nil(); + switchResult = null; if (hasTry(tree)) { //if the switch expression contains try-catch, the catch handlers need to have //an empty stack. So stash whole stack to local variables, and restore it before @@ -1211,6 +1214,7 @@ stackBeforeSwitchExpression = stackBeforeSwitchExpression.prepend(item); item.store(); } + switchResult = makeTemp(tree.type); } int prevLetExprStart = code.setLetExprStackPos(code.state.stacksize); try { @@ -1220,6 +1224,7 @@ } } finally { stackBeforeSwitchExpression = prevStackBeforeSwitchExpression; + switchResult = prevSwitchResult; code.endScopes(limit); } } @@ -1725,16 +1730,22 @@ public void visitYield(JCYield tree) { Assert.check(code.isStatementStart()); final Env targetEnv; - //restore stack as it was before the switch expression: - for (LocalItem li : stackBeforeSwitchExpression) { - li.load(); - } if (inCondSwitchExpression) { CondItem value = genCond(tree.value, CRT_FLOW_TARGET); Chain falseJumps = value.jumpFalse(); - targetEnv = unwindBreak(tree.target); + code.resolve(value.trueJumps); + Env localEnv = unwindBreak(tree.target); + reloadStackBeforeSwitchExpr(); Chain trueJumps = code.branch(goto_); + + endFinalizerGaps(env, localEnv); + + code.resolve(falseJumps); + targetEnv = unwindBreak(tree.target); + reloadStackBeforeSwitchExpr(); + falseJumps = code.branch(goto_); + if (switchExpressionTrueChain == null) { switchExpressionTrueChain = trueJumps; } else { @@ -1749,13 +1760,26 @@ } } else { genExpr(tree.value, pt).load(); - code.state.forceStackTop(tree.target.type); + if (switchResult != null) + switchResult.store(); + targetEnv = unwindBreak(tree.target); - targetEnv.info.addExit(code.branch(goto_)); + + if (code.isAlive()) { + reloadStackBeforeSwitchExpr(); + if (switchResult != null) + switchResult.load(); + + code.state.forceStackTop(tree.target.type); + targetEnv.info.addExit(code.branch(goto_)); + code.markDead(); + } } endFinalizerGaps(env, targetEnv); } //where: + /** As side-effect, might mark code as dead disabling any further emission. + */ private Env unwindBreak(JCTree target) { int tmpPos = code.pendingStatPos; Env targetEnv = unwind(target, env); @@ -1763,6 +1787,11 @@ return targetEnv; } + private void reloadStackBeforeSwitchExpr() { + for (LocalItem li : stackBeforeSwitchExpression) + li.load(); + } + public void visitContinue(JCContinue tree) { int tmpPos = code.pendingStatPos; Env targetEnv = unwind(tree.target, env); diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -40,9 +40,9 @@ * deletion without notice. */ public enum Profile { - COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13), - COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13), - COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13), + COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13, Target.JDK1_14), + COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13, Target.JDK1_14), + COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13, Target.JDK1_14), DEFAULT { @Override diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -73,7 +73,10 @@ JDK1_12("12", 56, 0), /** JDK 13. */ - JDK1_13("13", 57, 0); + JDK1_13("13", 57, 0), + + /** JDK 14. */ + JDK1_14("14", 58, 0); private static final Context.Key targetKey = new Context.Key<>(); diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java Fri Jun 21 14:07:48 2019 +0530 @@ -477,7 +477,7 @@ } try (InputStream in = getClass().getResourceAsStream('/' + className.replace('.', '/') + ".class")) { - final String algorithm = "MD5"; + final String algorithm = "SHA-256"; byte[] digest; MessageDigest md = MessageDigest.getInstance(algorithm); try (DigestInputStream din = new DigestInputStream(in, md)) { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -32,6 +32,7 @@ import java.lang.reflect.Method; import java.util.LinkedHashMap; import java.util.Map; +import java.util.stream.Collectors; import sun.reflect.annotation.*; import javax.lang.model.type.MirroredTypeException; @@ -292,7 +293,7 @@ } public String toString() { - return typeString; + return typeString + ".class"; } public int hashCode() { @@ -335,7 +336,9 @@ } public String toString() { - return typeStrings; + return types.stream() + .map(t -> t.toString() + ".class") + .collect(Collectors.joining(", ", "{", "}")); } public int hashCode() { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -55,7 +55,7 @@ * deletion without notice. */ @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_13) +@SupportedSourceVersion(SourceVersion.RELEASE_14) public class PrintingProcessor extends AbstractProcessor { PrintWriter writer; diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Fri Jun 21 14:07:48 2019 +0530 @@ -80,11 +80,11 @@ javac.opt.profile=\ Check that API used is available in the specified profile javac.opt.target=\ - Generate class files for specific VM version. Supported versions: {0} + Generate class files suitable for the specified Java SE release. Supported releases: {0} javac.opt.release=\ - Compile for a specific release. Supported releases: {0} + Compile for the specified Java SE release. Supported releases: {0} javac.opt.source=\ - Provide source compatibility with specified release. Supported releases: {0} + Provide source compatibility with the specified Java SE release. Supported releases: {0} javac.opt.Werror=\ Terminate compilation if warnings occur javac.opt.A=\ diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java --- a/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java Fri Jun 21 14:07:48 2019 +0530 @@ -513,6 +513,7 @@ public Object visitEntity(EntityTree node, Object p) { String name = node.getName().toString(); int code = -1; + String value = null; if (name.startsWith("#")) { try { int v = StringUtils.toLowerCase(name).startsWith("#x") @@ -525,13 +526,12 @@ //ignore } } else { - Entity entity = Entity.get(name); - if (entity != null) { - code = entity.code; - } + value = Entity.getValue(name); } if (code != (-1)) { result.appendCodePoint(code); + } else if (value != null) { + result.append(value); } else { result.append(node.toString()); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11AEADCipher.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11AEADCipher.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,750 @@ +/* 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package sun.security.pkcs11; + +import java.io.ByteArrayOutputStream; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Locale; + +import java.security.*; +import java.security.spec.*; + +import javax.crypto.*; +import javax.crypto.spec.*; + +import sun.nio.ch.DirectBuffer; +import sun.security.jca.JCAUtil; +import sun.security.pkcs11.wrapper.*; +import static sun.security.pkcs11.wrapper.PKCS11Constants.*; + +/** + * P11 AEAD Cipher implementation class. This class currently supports + * AES with GCM mode. + * + * Note that AEAD modes do not use padding, so this class does not have + * its own padding impl. In addition, NSS CKM_AES_GCM only supports single-part + * encryption/decryption, thus the current impl uses PKCS#11 C_Encrypt/C_Decrypt + * calls and buffers data until doFinal is called. + * + * Note that PKCS#11 standard currently only supports GCM and CCM AEAD modes. + * There are no provisions for other AEAD modes yet. + * + * @since 13 + */ +final class P11AEADCipher extends CipherSpi { + + // mode constant for GCM mode + private static final int MODE_GCM = 10; + + // default constants for GCM + private static final int GCM_DEFAULT_TAG_LEN = 16; + private static final int GCM_DEFAULT_IV_LEN = 16; + + private static final String ALGO = "AES"; + + // token instance + private final Token token; + + // mechanism id + private final long mechanism; + + // mode, one of MODE_* above + private final int blockMode; + + // acceptable key size, -1 if more than 1 key sizes are accepted + private final int fixedKeySize; + + // associated session, if any + private Session session = null; + + // key, if init() was called + private P11Key p11Key = null; + + // flag indicating whether an operation is initialized + private boolean initialized = false; + + // falg indicating encrypt or decrypt mode + private boolean encrypt = true; + + // parameters + private byte[] iv = null; + private int tagLen = -1; + private SecureRandom random = JCAUtil.getSecureRandom(); + + // dataBuffer is cleared upon doFinal calls + private ByteArrayOutputStream dataBuffer = new ByteArrayOutputStream(); + // aadBuffer is cleared upon successful init calls + private ByteArrayOutputStream aadBuffer = new ByteArrayOutputStream(); + private boolean updateCalled = false; + + private boolean requireReinit = false; + private P11Key lastEncKey = null; + private byte[] lastEncIv = null; + + P11AEADCipher(Token token, String algorithm, long mechanism) + throws PKCS11Exception, NoSuchAlgorithmException { + super(); + this.token = token; + this.mechanism = mechanism; + + String[] algoParts = algorithm.split("/"); + if (algoParts.length != 3) { + throw new ProviderException("Unsupported Transformation format: " + + algorithm); + } + if (!algoParts[0].startsWith("AES")) { + throw new ProviderException("Only support AES for AEAD cipher mode"); + } + int index = algoParts[0].indexOf('_'); + if (index != -1) { + // should be well-formed since we specify what we support + fixedKeySize = Integer.parseInt(algoParts[0].substring(index+1)) >> 3; + } else { + fixedKeySize = -1; + } + this.blockMode = parseMode(algoParts[1]); + if (!algoParts[2].equals("NoPadding")) { + throw new ProviderException("Only NoPadding is supported for AEAD cipher mode"); + } + } + + protected void engineSetMode(String mode) throws NoSuchAlgorithmException { + // Disallow change of mode for now since currently it's explicitly + // defined in transformation strings + throw new NoSuchAlgorithmException("Unsupported mode " + mode); + } + + private int parseMode(String mode) throws NoSuchAlgorithmException { + mode = mode.toUpperCase(Locale.ENGLISH); + int result; + if (mode.equals("GCM")) { + result = MODE_GCM; + } else { + throw new NoSuchAlgorithmException("Unsupported mode " + mode); + } + return result; + } + + // see JCE spec + protected void engineSetPadding(String padding) + throws NoSuchPaddingException { + // Disallow change of padding for now since currently it's explicitly + // defined in transformation strings + throw new NoSuchPaddingException("Unsupported padding " + padding); + } + + // see JCE spec + protected int engineGetBlockSize() { + return 16; // constant; only AES is supported + } + + // see JCE spec + protected int engineGetOutputSize(int inputLen) { + return doFinalLength(inputLen); + } + + // see JCE spec + protected byte[] engineGetIV() { + return (iv == null) ? null : iv.clone(); + } + + // see JCE spec + protected AlgorithmParameters engineGetParameters() { + if (encrypt && iv == null && tagLen == -1) { + switch (blockMode) { + case MODE_GCM: + iv = new byte[GCM_DEFAULT_IV_LEN]; + tagLen = GCM_DEFAULT_TAG_LEN; + break; + default: + throw new ProviderException("Unsupported mode"); + } + random.nextBytes(iv); + } + try { + AlgorithmParameterSpec spec; + String apAlgo; + switch (blockMode) { + case MODE_GCM: + apAlgo = "GCM"; + spec = new GCMParameterSpec(tagLen << 3, iv); + break; + default: + throw new ProviderException("Unsupported mode"); + } + AlgorithmParameters params = + AlgorithmParameters.getInstance(apAlgo); + params.init(spec); + return params; + } catch (GeneralSecurityException e) { + // NoSuchAlgorithmException, NoSuchProviderException + // InvalidParameterSpecException + throw new ProviderException("Could not encode parameters", e); + } + } + + // see JCE spec + protected void engineInit(int opmode, Key key, SecureRandom sr) + throws InvalidKeyException { + if (opmode == Cipher.DECRYPT_MODE) { + throw new InvalidKeyException("Parameters required for decryption"); + } + updateCalled = false; + try { + implInit(opmode, key, null, -1, sr); + } catch (InvalidAlgorithmParameterException e) { + throw new InvalidKeyException("init() failed", e); + } + } + + // see JCE spec + protected void engineInit(int opmode, Key key, + AlgorithmParameterSpec params, SecureRandom sr) + throws InvalidKeyException, InvalidAlgorithmParameterException { + if (opmode == Cipher.DECRYPT_MODE && params == null) { + throw new InvalidAlgorithmParameterException + ("Parameters required for decryption"); + } + updateCalled = false; + byte[] ivValue = null; + int tagLen = -1; + if (params != null) { + switch (blockMode) { + case MODE_GCM: + if (!(params instanceof GCMParameterSpec)) { + throw new InvalidAlgorithmParameterException + ("Only GCMParameterSpec is supported"); + } + ivValue = ((GCMParameterSpec) params).getIV(); + tagLen = ((GCMParameterSpec) params).getTLen() >> 3; + break; + default: + throw new ProviderException("Unsupported mode"); + } + } + implInit(opmode, key, ivValue, tagLen, sr); + } + + // see JCE spec + protected void engineInit(int opmode, Key key, AlgorithmParameters params, + SecureRandom sr) + throws InvalidKeyException, InvalidAlgorithmParameterException { + if (opmode == Cipher.DECRYPT_MODE && params == null) { + throw new InvalidAlgorithmParameterException + ("Parameters required for decryption"); + } + updateCalled = false; + try { + AlgorithmParameterSpec paramSpec = null; + if (params != null) { + switch (blockMode) { + case MODE_GCM: + paramSpec = + params.getParameterSpec(GCMParameterSpec.class); + break; + default: + throw new ProviderException("Unsupported mode"); + } + } + engineInit(opmode, key, paramSpec, sr); + } catch (InvalidParameterSpecException ex) { + throw new InvalidAlgorithmParameterException(ex); + } + } + + // actual init() implementation + private void implInit(int opmode, Key key, byte[] iv, int tagLen, + SecureRandom sr) + throws InvalidKeyException, InvalidAlgorithmParameterException { + reset(true); + if (fixedKeySize != -1 && key.getEncoded().length != fixedKeySize) { + throw new InvalidKeyException("Key size is invalid"); + } + P11Key newKey = P11SecretKeyFactory.convertKey(token, key, ALGO); + switch (opmode) { + case Cipher.ENCRYPT_MODE: + encrypt = true; + requireReinit = Arrays.equals(iv, lastEncIv) && + (newKey == lastEncKey); + if (requireReinit) { + throw new InvalidAlgorithmParameterException + ("Cannot reuse iv for GCM encryption"); + } + break; + case Cipher.DECRYPT_MODE: + encrypt = false; + requireReinit = false; + break; + default: + throw new InvalidAlgorithmParameterException + ("Unsupported mode: " + opmode); + } + + // decryption without parameters is checked in all engineInit() calls + if (sr != null) { + this.random = sr; + } + if (iv == null && tagLen == -1) { + // generate default values + switch (blockMode) { + case MODE_GCM: + iv = new byte[GCM_DEFAULT_IV_LEN]; + this.random.nextBytes(iv); + tagLen = GCM_DEFAULT_TAG_LEN; + break; + default: + throw new ProviderException("Unsupported mode"); + } + } + this.iv = iv; + this.tagLen = tagLen; + this.p11Key = newKey; + try { + initialize(); + } catch (PKCS11Exception e) { + throw new InvalidKeyException("Could not initialize cipher", e); + } + } + + private void cancelOperation() { + try { + if (session.hasObjects() == false) { + session = token.killSession(session); + return; + } else { + // cancel operation by finishing it + int bufLen = doFinalLength(0); + byte[] buffer = new byte[bufLen]; + + if (encrypt) { + token.p11.C_Encrypt(session.id(), 0, buffer, 0, bufLen, + 0, buffer, 0, bufLen); + } else { + token.p11.C_Decrypt(session.id(), 0, buffer, 0, bufLen, + 0, buffer, 0, bufLen); + } + } + } catch (PKCS11Exception e) { + throw new ProviderException("Cancel failed", e); + } + } + + private void ensureInitialized() throws PKCS11Exception { + if (initialized && aadBuffer.size() > 0) { + // need to cancel first to avoid CKR_OPERATION_ACTIVE + reset(true); + } + if (!initialized) { + initialize(); + } + } + + private void initialize() throws PKCS11Exception { + if (p11Key == null) { + throw new ProviderException( + "Operation cannot be performed without" + + " calling engineInit first"); + } + if (requireReinit) { + throw new IllegalStateException + ("Must use either different key or iv for GCM encryption"); + } + + token.ensureValid(); + + byte[] aad = (aadBuffer.size() > 0? aadBuffer.toByteArray() : null); + + long p11KeyID = p11Key.getKeyID(); + try { + if (session == null) { + session = token.getOpSession(); + } + CK_MECHANISM mechWithParams; + switch (blockMode) { + case MODE_GCM: + mechWithParams = new CK_MECHANISM(mechanism, + new CK_GCM_PARAMS(tagLen << 3, iv, aad)); + break; + default: + throw new ProviderException("Unsupported mode: " + blockMode); + } + if (encrypt) { + token.p11.C_EncryptInit(session.id(), mechWithParams, + p11KeyID); + } else { + token.p11.C_DecryptInit(session.id(), mechWithParams, + p11KeyID); + } + } catch (PKCS11Exception e) { + //e.printStackTrace(); + p11Key.releaseKeyID(); + session = token.releaseSession(session); + throw e; + } finally { + dataBuffer.reset(); + aadBuffer.reset(); + } + initialized = true; + } + + // if doFinal(inLen) is called, how big does the output buffer have to be? + private int doFinalLength(int inLen) { + if (inLen < 0) { + throw new ProviderException("Invalid negative input length"); + } + + int result = inLen + dataBuffer.size(); + if (encrypt) { + result += tagLen; + } else { + // PKCS11Exception: CKR_BUFFER_TOO_SMALL + //result -= tagLen; + } + return result; + } + + // reset the states to the pre-initialized values + private void reset(boolean doCancel) { + if (!initialized) { + return; + } + try { + if (session == null) { + return; + } + if (doCancel && token.explicitCancel) { + cancelOperation(); + } + } finally { + p11Key.releaseKeyID(); + session = token.releaseSession(session); + } + initialized = false; + } + + // see JCE spec + protected byte[] engineUpdate(byte[] in, int inOfs, int inLen) { + updateCalled = true; + int n = implUpdate(in, inOfs, inLen); + return new byte[0]; + } + + // see JCE spec + protected int engineUpdate(byte[] in, int inOfs, int inLen, byte[] out, + int outOfs) throws ShortBufferException { + updateCalled = true; + implUpdate(in, inOfs, inLen); + return 0; + } + + // see JCE spec + @Override + protected int engineUpdate(ByteBuffer inBuffer, ByteBuffer outBuffer) + throws ShortBufferException { + updateCalled = true; + implUpdate(inBuffer); + return 0; + } + + // see JCE spec + @Override + protected synchronized void engineUpdateAAD(byte[] src, int srcOfs, int srcLen) + throws IllegalStateException { + if ((src == null) || (srcOfs < 0) || (srcOfs + srcLen > src.length)) { + throw new IllegalArgumentException("Invalid AAD"); + } + if (requireReinit) { + throw new IllegalStateException + ("Must use either different key or iv for GCM encryption"); + } + if (p11Key == null) { + throw new IllegalStateException("Need to initialize Cipher first"); + } + if (updateCalled) { + throw new IllegalStateException + ("Update has been called; no more AAD data"); + } + aadBuffer.write(src, srcOfs, srcLen); + } + + // see JCE spec + @Override + protected void engineUpdateAAD(ByteBuffer src) + throws IllegalStateException { + if (src == null) { + throw new IllegalArgumentException("Invalid AAD"); + } + byte[] srcBytes = new byte[src.remaining()]; + src.get(srcBytes); + engineUpdateAAD(srcBytes, 0, srcBytes.length); + } + + // see JCE spec + protected byte[] engineDoFinal(byte[] in, int inOfs, int inLen) + throws IllegalBlockSizeException, BadPaddingException { + int minOutLen = doFinalLength(inLen); + try { + byte[] out = new byte[minOutLen]; + int n = engineDoFinal(in, inOfs, inLen, out, 0); + return P11Util.convert(out, 0, n); + } catch (ShortBufferException e) { + // convert since the output length is calculated by doFinalLength() + throw new ProviderException(e); + } finally { + updateCalled = false; + } + } + // see JCE spec + protected int engineDoFinal(byte[] in, int inOfs, int inLen, byte[] out, + int outOfs) throws ShortBufferException, IllegalBlockSizeException, + BadPaddingException { + try { + return implDoFinal(in, inOfs, inLen, out, outOfs, out.length - outOfs); + } finally { + updateCalled = false; + } + } + + // see JCE spec + @Override + protected int engineDoFinal(ByteBuffer inBuffer, ByteBuffer outBuffer) + throws ShortBufferException, IllegalBlockSizeException, + BadPaddingException { + try { + return implDoFinal(inBuffer, outBuffer); + } finally { + updateCalled = false; + } + } + + private int implUpdate(byte[] in, int inOfs, int inLen) { + if (inLen > 0) { + updateCalled = true; + try { + ensureInitialized(); + } catch (PKCS11Exception e) { + //e.printStackTrace(); + reset(false); + throw new ProviderException("update() failed", e); + } + dataBuffer.write(in, inOfs, inLen); + } + // always 0 as NSS only supports single-part encryption/decryption + return 0; + } + + private int implUpdate(ByteBuffer inBuf) { + int inLen = inBuf.remaining(); + if (inLen > 0) { + try { + ensureInitialized(); + } catch (PKCS11Exception e) { + reset(false); + throw new ProviderException("update() failed", e); + } + byte[] data = new byte[inLen]; + inBuf.get(data); + dataBuffer.write(data, 0, data.length); + } + // always 0 as NSS only supports single-part encryption/decryption + return 0; + } + + private int implDoFinal(byte[] in, int inOfs, int inLen, + byte[] out, int outOfs, int outLen) + throws ShortBufferException, IllegalBlockSizeException, + BadPaddingException { + int requiredOutLen = doFinalLength(inLen); + if (outLen < requiredOutLen) { + throw new ShortBufferException(); + } + boolean doCancel = true; + try { + ensureInitialized(); + if (dataBuffer.size() > 0) { + if (in != null && inOfs > 0 && inLen > 0 && + inOfs < (in.length - inLen)) { + dataBuffer.write(in, inOfs, inLen); + } + in = dataBuffer.toByteArray(); + inOfs = 0; + inLen = in.length; + } + int k = 0; + if (encrypt) { + k = token.p11.C_Encrypt(session.id(), 0, in, inOfs, inLen, + 0, out, outOfs, outLen); + doCancel = false; + } else { + // Special handling to match SunJCE provider behavior + if (inLen == 0) { + return 0; + } + k = token.p11.C_Decrypt(session.id(), 0, in, inOfs, inLen, + 0, out, outOfs, outLen); + doCancel = false; + } + return k; + } catch (PKCS11Exception e) { + doCancel = false; + handleException(e); + throw new ProviderException("doFinal() failed", e); + } finally { + if (encrypt) { + lastEncKey = this.p11Key; + lastEncIv = this.iv; + requireReinit = true; + } + reset(doCancel); + } + } + + private int implDoFinal(ByteBuffer inBuffer, ByteBuffer outBuffer) + throws ShortBufferException, IllegalBlockSizeException, + BadPaddingException { + int outLen = outBuffer.remaining(); + int inLen = inBuffer.remaining(); + + int requiredOutLen = doFinalLength(inLen); + if (outLen < requiredOutLen) { + throw new ShortBufferException(); + } + + boolean doCancel = true; + try { + ensureInitialized(); + + long inAddr = 0; + byte[] in = null; + int inOfs = 0; + if (dataBuffer.size() > 0) { + if (inLen > 0) { + byte[] temp = new byte[inLen]; + inBuffer.get(temp); + dataBuffer.write(temp, 0, temp.length); + } + in = dataBuffer.toByteArray(); + inOfs = 0; + inLen = in.length; + } else { + if (inBuffer instanceof DirectBuffer) { + inAddr = ((DirectBuffer) inBuffer).address(); + inOfs = inBuffer.position(); + } else { + if (inBuffer.hasArray()) { + in = inBuffer.array(); + inOfs = inBuffer.position() + inBuffer.arrayOffset(); + } else { + in = new byte[inLen]; + inBuffer.get(in); + } + } + } + long outAddr = 0; + byte[] outArray = null; + int outOfs = 0; + if (outBuffer instanceof DirectBuffer) { + outAddr = ((DirectBuffer) outBuffer).address(); + outOfs = outBuffer.position(); + } else { + if (outBuffer.hasArray()) { + outArray = outBuffer.array(); + outOfs = outBuffer.position() + outBuffer.arrayOffset(); + } else { + outArray = new byte[outLen]; + } + } + + int k = 0; + if (encrypt) { + k = token.p11.C_Encrypt(session.id(), inAddr, in, inOfs, inLen, + outAddr, outArray, outOfs, outLen); + doCancel = false; + } else { + // Special handling to match SunJCE provider behavior + if (inLen == 0) { + return 0; + } + k = token.p11.C_Decrypt(session.id(), inAddr, in, inOfs, inLen, + outAddr, outArray, outOfs, outLen); + doCancel = false; + } + outBuffer.position(outBuffer.position() + k); + return k; + } catch (PKCS11Exception e) { + doCancel = false; + handleException(e); + throw new ProviderException("doFinal() failed", e); + } finally { + if (encrypt) { + lastEncKey = this.p11Key; + lastEncIv = this.iv; + requireReinit = true; + } + reset(doCancel); + } + } + + private void handleException(PKCS11Exception e) + throws ShortBufferException, IllegalBlockSizeException, + BadPaddingException { + long errorCode = e.getErrorCode(); + if (errorCode == CKR_BUFFER_TOO_SMALL) { + throw (ShortBufferException) + (new ShortBufferException().initCause(e)); + } else if (errorCode == CKR_DATA_LEN_RANGE || + errorCode == CKR_ENCRYPTED_DATA_LEN_RANGE) { + throw (IllegalBlockSizeException) + (new IllegalBlockSizeException(e.toString()).initCause(e)); + } else if (errorCode == CKR_ENCRYPTED_DATA_INVALID) { + throw (BadPaddingException) + (new BadPaddingException(e.toString()).initCause(e)); + } + } + + // see JCE spec + protected byte[] engineWrap(Key key) throws IllegalBlockSizeException, + InvalidKeyException { + // XXX key wrapping + throw new UnsupportedOperationException("engineWrap()"); + } + + // see JCE spec + protected Key engineUnwrap(byte[] wrappedKey, String wrappedKeyAlgorithm, + int wrappedKeyType) + throws InvalidKeyException, NoSuchAlgorithmException { + // XXX key unwrapping + throw new UnsupportedOperationException("engineUnwrap()"); + } + + // see JCE spec + @Override + protected int engineGetKeySize(Key key) throws InvalidKeyException { + int n = P11SecretKeyFactory.convertKey + (token, key, ALGO).length(); + return n; + } +} + diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,701 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.security.pkcs11; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.ByteBuffer; +import sun.nio.ch.DirectBuffer; + +import java.util.Hashtable; +import java.util.Arrays; +import java.security.*; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.MGF1ParameterSpec; +import java.security.spec.PSSParameterSpec; +import java.security.interfaces.*; +import sun.security.pkcs11.wrapper.*; +import static sun.security.pkcs11.wrapper.PKCS11Constants.*; + + +/** + * RSASSA-PSS Signature implementation class. This class currently supports the + * following algorithms: + * + * . RSA-PSS: + * . RSASSA-PSS + * . SHA1withRSASSA-PSS + * . SHA224withRSASSA-PSS + * . SHA256withRSASSA-PSS + * . SHA384withRSASSA-PSS + * . SHA512withRSASSA-PSS + * + * Note that the underlying PKCS#11 token may support complete signature + * algorithm (e.g. CKM__RSA_PKCS_PSS), or it may just + * implement the signature algorithm without hashing (i.e. CKM_RSA_PKCS_PSS). + * This class uses what is available and adds whatever extra processing + * is needed. + * + * @since 13 + */ +final class P11PSSSignature extends SignatureSpi { + + private final static boolean DEBUG = false; + + // mappings of digest algorithms and their output length in bytes + private static final Hashtable DIGEST_LENGTHS = + new Hashtable(); + + static { + DIGEST_LENGTHS.put("SHA-1", 20); + DIGEST_LENGTHS.put("SHA", 20); + DIGEST_LENGTHS.put("SHA1", 20); + DIGEST_LENGTHS.put("SHA-224", 28); + DIGEST_LENGTHS.put("SHA224", 28); + DIGEST_LENGTHS.put("SHA-256", 32); + DIGEST_LENGTHS.put("SHA256", 32); + DIGEST_LENGTHS.put("SHA-384", 48); + DIGEST_LENGTHS.put("SHA384", 48); + DIGEST_LENGTHS.put("SHA-512", 64); + DIGEST_LENGTHS.put("SHA512", 64); + DIGEST_LENGTHS.put("SHA-512/224", 28); + DIGEST_LENGTHS.put("SHA512/224", 28); + DIGEST_LENGTHS.put("SHA-512/256", 32); + DIGEST_LENGTHS.put("SHA512/256", 32); + } + + // utility method for comparing digest algorithms + // NOTE that first argument is assumed to be standard digest name + private static boolean isDigestEqual(String stdAlg, String givenAlg) { + if (stdAlg == null || givenAlg == null) return false; + + if (givenAlg.indexOf("-") != -1) { + return stdAlg.equalsIgnoreCase(givenAlg); + } else { + if (stdAlg.equals("SHA-1")) { + return (givenAlg.equalsIgnoreCase("SHA") + || givenAlg.equalsIgnoreCase("SHA1")); + } else { + StringBuilder sb = new StringBuilder(givenAlg); + // case-insensitive check + if (givenAlg.regionMatches(true, 0, "SHA", 0, 3)) { + givenAlg = sb.insert(3, "-").toString(); + return stdAlg.equalsIgnoreCase(givenAlg); + } else { + throw new ProviderException("Unsupported digest algorithm " + + givenAlg); + } + } + } + } + + // token instance + private final Token token; + + // algorithm name + private final String algorithm; + + // name of the key algorithm, currently just RSA + private static final String KEY_ALGO = "RSA"; + + // mechanism id + private final CK_MECHANISM mechanism; + + // type, one of T_* below + private final int type; + + // key instance used, if init*() was called + private P11Key p11Key = null; + + // PSS parameters and the flag controlling its access + private PSSParameterSpec sigParams = null; + private boolean isActive = false; + + // message digest alg, if implied by the algorithm name + private final String mdAlg; + + // message digest, if we do the digesting ourselves + private MessageDigest md = null; + + // associated session, if any + private Session session; + + // mode, one of M_* below + private int mode; + + // flag indicating whether an operation is initialized + private boolean initialized = false; + + // buffer, for update(byte) + private final byte[] buffer = new byte[1]; + + // total number of bytes processed in current operation + private int bytesProcessed = 0; + + // constant for signing mode + private final static int M_SIGN = 1; + // constant for verification mode + private final static int M_VERIFY = 2; + + // constant for type digesting, we do the hashing ourselves + private final static int T_DIGEST = 1; + // constant for type update, token does everything + private final static int T_UPDATE = 2; + + P11PSSSignature(Token token, String algorithm, long mechId) + throws NoSuchAlgorithmException, PKCS11Exception { + super(); + this.token = token; + this.algorithm = algorithm; + this.mechanism = new CK_MECHANISM(mechId); + int idx = algorithm.indexOf("with"); + this.mdAlg = (idx == -1? null : algorithm.substring(0, idx)); + switch ((int)mechId) { + case (int)CKM_SHA1_RSA_PKCS_PSS: + case (int)CKM_SHA224_RSA_PKCS_PSS: + case (int)CKM_SHA256_RSA_PKCS_PSS: + case (int)CKM_SHA384_RSA_PKCS_PSS: + case (int)CKM_SHA512_RSA_PKCS_PSS: + type = T_UPDATE; + break; + case (int)CKM_RSA_PKCS_PSS: + type = T_DIGEST; + break; + default: + throw new ProviderException("Unsupported mechanism: " + mechId); + } + this.md = null; + } + + private void ensureInitialized() throws SignatureException { + token.ensureValid(); + if (this.p11Key == null) { + throw new SignatureException("Missing key"); + } + if (this.sigParams == null) { + if (this.mdAlg == null) { + // PSS Parameters are required for signature verification + throw new SignatureException + ("Parameters required for RSASSA-PSS signature"); + } else { + int saltLen = DIGEST_LENGTHS.get(this.mdAlg).intValue(); + // generate default params for both sign and verify? + this.sigParams = new PSSParameterSpec(this.mdAlg, + "MGF1", new MGF1ParameterSpec(this.mdAlg), + saltLen, PSSParameterSpec.TRAILER_FIELD_BC); + this.mechanism.setParameter(new CK_RSA_PKCS_PSS_PARAMS( + this.mdAlg, "MGF1", this.mdAlg, + DIGEST_LENGTHS.get(this.mdAlg).intValue())); + } + } + + if (initialized == false) { + initialize(); + } + } + + // reset the states to the pre-initialized values + private void reset(boolean doCancel) { + if (!initialized) { + return; + } + initialized = false; + try { + if (session == null) { + return; + } + if (doCancel && token.explicitCancel) { + cancelOperation(); + } + } finally { + p11Key.releaseKeyID(); + mechanism.freeHandle(); + session = token.releaseSession(session); + isActive = false; + } + } + + private void cancelOperation() { + token.ensureValid(); + if (DEBUG) System.out.print("Cancelling operation"); + + if (session.hasObjects() == false) { + if (DEBUG) System.out.println(" by killing session"); + session = token.killSession(session); + return; + } + // "cancel" operation by finishing it + if (mode == M_SIGN) { + try { + if (type == T_UPDATE) { + if (DEBUG) System.out.println(" by C_SignFinal"); + token.p11.C_SignFinal(session.id(), 0); + } else { + byte[] digest = + (md == null? new byte[0] : md.digest()); + if (DEBUG) System.out.println(" by C_Sign"); + token.p11.C_Sign(session.id(), digest); + } + } catch (PKCS11Exception e) { + throw new ProviderException("cancel failed", e); + } + } else { // M_VERIFY + try { + byte[] signature = + new byte[(p11Key.length() + 7) >> 3]; + if (type == T_UPDATE) { + if (DEBUG) System.out.println(" by C_VerifyFinal"); + token.p11.C_VerifyFinal(session.id(), signature); + } else { + byte[] digest = + (md == null? new byte[0] : md.digest()); + if (DEBUG) System.out.println(" by C_Verify"); + token.p11.C_Verify(session.id(), digest, signature); + } + } catch (PKCS11Exception e) { + // will fail since the signature is incorrect + // XXX check error code + } + } + } + + // assumes current state is initialized == false + private void initialize() { + if (DEBUG) System.out.println("Initializing"); + + if (p11Key == null) { + throw new ProviderException( + "No Key found, call initSign/initVerify first"); + } + + long keyID = p11Key.getKeyID(); + try { + if (session == null) { + session = token.getOpSession(); + } + if (mode == M_SIGN) { + token.p11.C_SignInit(session.id(), mechanism, keyID); + } else { + token.p11.C_VerifyInit(session.id(), mechanism, keyID); + } + } catch (PKCS11Exception e) { + p11Key.releaseKeyID(); + session = token.releaseSession(session); + throw new ProviderException("Initialization failed", e); + } + if (bytesProcessed != 0) { + bytesProcessed = 0; + if (md != null) { + md.reset(); + } + } + initialized = true; + isActive = false; + if (DEBUG) System.out.println("Initialized"); + } + + private void checkKeySize(Key key) throws InvalidKeyException { + if (DEBUG) System.out.print("Checking Key"); + + if (!key.getAlgorithm().equals(KEY_ALGO)) { + throw new InvalidKeyException("Only " + KEY_ALGO + + " keys are supported"); + } + + CK_MECHANISM_INFO mechInfo = null; + try { + mechInfo = token.getMechanismInfo(mechanism.mechanism); + } catch (PKCS11Exception e) { + // should not happen, ignore for now + if (DEBUG) { + System.out.println("Unexpected exception"); + e.printStackTrace(); + } + } + + int keySize = 0; // in bytes + if (mechInfo != null) { + // check against available native info + int minKeySize = (int) mechInfo.ulMinKeySize; + int maxKeySize = (int) mechInfo.ulMaxKeySize; + if (key instanceof P11Key) { + keySize = (((P11Key) key).length() + 7) >> 3; + } else if (key instanceof RSAKey) { + keySize = ((RSAKey) key).getModulus().bitLength() >> 3; + } else { + throw new InvalidKeyException("Unrecognized key type " + key); + } + if ((minKeySize != -1) && (keySize < minKeySize)) { + throw new InvalidKeyException(KEY_ALGO + + " key must be at least " + minKeySize + " bytes"); + } + if ((maxKeySize != -1) && (keySize > maxKeySize)) { + throw new InvalidKeyException(KEY_ALGO + + " key must be at most " + maxKeySize + " bytes"); + } + } + if (this.sigParams != null) { + String digestAlg = this.sigParams.getDigestAlgorithm(); + int sLen = this.sigParams.getSaltLength(); + int hLen = DIGEST_LENGTHS.get(digestAlg).intValue(); + int minKeyLen = Math.addExact(Math.addExact(sLen, hLen), 2); + + if (keySize < minKeyLen) { + throw new InvalidKeyException + ("Key is too short for current params, need min " + minKeyLen); + } + } + } + + private void setSigParams(AlgorithmParameterSpec p) + throws InvalidAlgorithmParameterException { + if (p == null) { + throw new InvalidAlgorithmParameterException("PSS Parameter required"); + } + if (!(p instanceof PSSParameterSpec)) { + throw new InvalidAlgorithmParameterException + ("Only PSSParameterSpec is supported"); + } + // no need to validate again if same as current signature parameters + PSSParameterSpec params = (PSSParameterSpec) p; + if (params == this.sigParams) return; + + String digestAlgorithm = params.getDigestAlgorithm(); + if (this.mdAlg != null && !isDigestEqual(digestAlgorithm, this.mdAlg)) { + throw new InvalidAlgorithmParameterException + ("Digest algorithm in Signature parameters must be " + + this.mdAlg); + } + Integer digestLen = DIGEST_LENGTHS.get(digestAlgorithm); + if (digestLen == null) { + throw new InvalidAlgorithmParameterException + ("Unsupported digest algorithm in Signature parameters: " + + digestAlgorithm); + } + if (!(params.getMGFAlgorithm().equalsIgnoreCase("MGF1"))) { + throw new InvalidAlgorithmParameterException("Only supports MGF1"); + } + if (params.getTrailerField() != PSSParameterSpec.TRAILER_FIELD_BC) { + throw new InvalidAlgorithmParameterException + ("Only supports TrailerFieldBC(1)"); + } + int saltLen = params.getSaltLength(); + if (this.p11Key != null) { + int maxSaltLen = ((this.p11Key.length() + 7) >> 3) - digestLen.intValue() - 2; + + if (DEBUG) { + System.out.println("Max saltLen = " + maxSaltLen); + System.out.println("Curr saltLen = " + saltLen); + } + if (maxSaltLen < 0 || saltLen > maxSaltLen) { + throw new InvalidAlgorithmParameterException("Invalid with current key size"); + } + } else { + if (DEBUG) System.out.println("No key available for validating saltLen"); + } + + // validated, now try to store the parameter internally + try { + this.mechanism.setParameter( + new CK_RSA_PKCS_PSS_PARAMS(digestAlgorithm, "MGF1", + digestAlgorithm, saltLen)); + this.sigParams = params; + } catch (IllegalArgumentException iae) { + throw new InvalidAlgorithmParameterException(iae); + } + } + + // see JCA spec + @Override + protected void engineInitVerify(PublicKey publicKey) + throws InvalidKeyException { + + if (publicKey == null) { + throw new InvalidKeyException("Key must not be null"); + } + + // Need to check key length whenever a new key is set + if (publicKey != p11Key) { + checkKeySize(publicKey); + } + + reset(true); + mode = M_VERIFY; + p11Key = P11KeyFactory.convertKey(token, publicKey, KEY_ALGO); + + // For PSS, defer PKCS11 initialization calls to update/doFinal as it + // needs both key and params + } + + // see JCA spec + @Override + protected void engineInitSign(PrivateKey privateKey) + throws InvalidKeyException { + + if (privateKey == null) { + throw new InvalidKeyException("Key must not be null"); + } + + // Need to check RSA key length whenever a new key is set + if (privateKey != p11Key) { + checkKeySize(privateKey); + } + + reset(true); + mode = M_SIGN; + p11Key = P11KeyFactory.convertKey(token, privateKey, KEY_ALGO); + + // For PSS, defer PKCS11 initialization calls to update/doFinal as it + // needs both key and params + } + + // see JCA spec + @Override + protected void engineUpdate(byte b) throws SignatureException { + ensureInitialized(); + isActive = true; + buffer[0] = b; + engineUpdate(buffer, 0, 1); + } + + // see JCA spec + @Override + protected void engineUpdate(byte[] b, int ofs, int len) + throws SignatureException { + ensureInitialized(); + if (len == 0) { + return; + } + // check for overflow + if (len + bytesProcessed < 0) { + throw new ProviderException("Processed bytes limits exceeded."); + } + isActive = true; + switch (type) { + case T_UPDATE: + try { + if (mode == M_SIGN) { + System.out.println(this + ": Calling C_SignUpdate"); + token.p11.C_SignUpdate(session.id(), 0, b, ofs, len); + } else { + System.out.println(this + ": Calling C_VerfifyUpdate"); + token.p11.C_VerifyUpdate(session.id(), 0, b, ofs, len); + } + bytesProcessed += len; + } catch (PKCS11Exception e) { + reset(false); + throw new ProviderException(e); + } + break; + case T_DIGEST: + // should not happen as this should be covered by earlier checks + if (md == null) { + throw new ProviderException("PSS Parameters required"); + } + md.update(b, ofs, len); + bytesProcessed += len; + break; + default: + throw new ProviderException("Internal error"); + } + } + + // see JCA spec + @Override + protected void engineUpdate(ByteBuffer byteBuffer) { + try { + ensureInitialized(); + } catch (SignatureException se) { + throw new ProviderException(se); + } + int len = byteBuffer.remaining(); + if (len <= 0) { + return; + } + isActive = true; + switch (type) { + case T_UPDATE: + if (byteBuffer instanceof DirectBuffer == false) { + // cannot do better than default impl + super.engineUpdate(byteBuffer); + return; + } + long addr = ((DirectBuffer)byteBuffer).address(); + int ofs = byteBuffer.position(); + try { + if (mode == M_SIGN) { + System.out.println(this + ": Calling C_SignUpdate"); + token.p11.C_SignUpdate + (session.id(), addr + ofs, null, 0, len); + } else { + System.out.println(this + ": Calling C_VerifyUpdate"); + token.p11.C_VerifyUpdate + (session.id(), addr + ofs, null, 0, len); + } + bytesProcessed += len; + byteBuffer.position(ofs + len); + } catch (PKCS11Exception e) { + reset(false); + throw new ProviderException("Update failed", e); + } + break; + case T_DIGEST: + // should not happen as this should be covered by earlier checks + if (md == null) { + throw new ProviderException("PSS Parameters required"); + } + md.update(byteBuffer); + bytesProcessed += len; + break; + default: + reset(false); + throw new ProviderException("Internal error"); + } + } + + // see JCA spec + @Override + protected byte[] engineSign() throws SignatureException { + ensureInitialized(); + boolean doCancel = true; + if (DEBUG) System.out.print("Generating signature"); + try { + byte[] signature; + if (type == T_UPDATE) { + if (DEBUG) System.out.println(" by C_SignFinal"); + signature = token.p11.C_SignFinal(session.id(), 0); + } else { + if (md == null) { + throw new ProviderException("PSS Parameters required"); + } + byte[] digest = md.digest(); + if (DEBUG) System.out.println(" by C_Sign"); + signature = token.p11.C_Sign(session.id(), digest); + } + doCancel = false; + return signature; + } catch (PKCS11Exception pe) { + doCancel = false; + throw new ProviderException(pe); + } catch (ProviderException e) { + throw e; + } finally { + reset(doCancel); + } + } + + // see JCA spec + @Override + protected boolean engineVerify(byte[] signature) throws SignatureException { + ensureInitialized(); + boolean doCancel = true; + if (DEBUG) System.out.print("Verifying signature"); + try { + if (type == T_UPDATE) { + if (DEBUG) System.out.println(" by C_VerifyFinal"); + token.p11.C_VerifyFinal(session.id(), signature); + } else { + if (md == null) { + throw new ProviderException("PSS Parameters required"); + } + byte[] digest = md.digest(); + if (DEBUG) System.out.println(" by C_Verify"); + token.p11.C_Verify(session.id(), digest, signature); + } + doCancel = false; + return true; + } catch (PKCS11Exception pe) { + doCancel = false; + long errorCode = pe.getErrorCode(); + if (errorCode == CKR_SIGNATURE_INVALID) { + return false; + } + if (errorCode == CKR_SIGNATURE_LEN_RANGE) { + // return false rather than throwing an exception + return false; + } + // ECF bug? + if (errorCode == CKR_DATA_LEN_RANGE) { + return false; + } + throw new ProviderException(pe); + } catch (ProviderException e) { + throw e; + } finally { + reset(doCancel); + } + } + + // see JCA spec + @SuppressWarnings("deprecation") + @Override + protected void engineSetParameter(String param, Object value) + throws InvalidParameterException { + throw new UnsupportedOperationException("setParameter() not supported"); + } + + // see JCA spec + @Override + protected void engineSetParameter(AlgorithmParameterSpec params) + throws InvalidAlgorithmParameterException { + // disallow changing parameters when update has been called + if (isActive) { + throw new ProviderException + ("Cannot set parameters during operations"); + } + setSigParams(params); + if (type == T_DIGEST) { + try { + this.md = MessageDigest.getInstance(sigParams.getDigestAlgorithm()); + } catch (NoSuchAlgorithmException nsae) { + throw new InvalidAlgorithmParameterException(nsae); + } + } + } + + // see JCA spec + @SuppressWarnings("deprecation") + @Override + protected Object engineGetParameter(String param) + throws InvalidParameterException { + throw new UnsupportedOperationException("getParameter() not supported"); + } + + // see JCA spec + @Override + protected AlgorithmParameters engineGetParameters() { + if (this.sigParams != null) { + try { + AlgorithmParameters ap = AlgorithmParameters.getInstance("RSASSA-PSS"); + ap.init(this.sigParams); + return ap; + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + return null; + } +} diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11RSACipher.java --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11RSACipher.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11RSACipher.java Fri Jun 21 14:07:48 2019 +0530 @@ -275,10 +275,10 @@ long sessId = session.id(); switch (mode) { case MODE_ENCRYPT: - p11.C_Encrypt(sessId, buffer, 0, inLen, buffer, 0, outLen); + p11.C_Encrypt(sessId, 0, buffer, 0, inLen, 0, buffer, 0, outLen); break; case MODE_DECRYPT: - p11.C_Decrypt(sessId, buffer, 0, inLen, buffer, 0, outLen); + p11.C_Decrypt(sessId, 0, buffer, 0, inLen, 0, buffer, 0, outLen); break; case MODE_SIGN: byte[] tmpBuffer = new byte[maxInputSize]; @@ -372,11 +372,11 @@ switch (mode) { case MODE_ENCRYPT: n = p11.C_Encrypt - (session.id(), buffer, 0, bufOfs, out, outOfs, outLen); + (session.id(), 0, buffer, 0, bufOfs, 0, out, outOfs, outLen); break; case MODE_DECRYPT: n = p11.C_Decrypt - (session.id(), buffer, 0, bufOfs, out, outOfs, outLen); + (session.id(), 0, buffer, 0, bufOfs, 0, out, outOfs, outLen); break; case MODE_SIGN: byte[] tmpBuffer = new byte[bufOfs]; @@ -552,6 +552,7 @@ s = token.getObjSession(); long p11KeyType = P11SecretKeyFactory.getPKCS11KeyType(algorithm); + CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_CLASS, CKO_SECRET_KEY), new CK_ATTRIBUTE(CKA_KEY_TYPE, p11KeyType), diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -516,7 +516,9 @@ String P11SecretKeyFactory = "sun.security.pkcs11.P11SecretKeyFactory"; String P11Cipher = "sun.security.pkcs11.P11Cipher"; String P11RSACipher = "sun.security.pkcs11.P11RSACipher"; + String P11AEADCipher = "sun.security.pkcs11.P11AEADCipher"; String P11Signature = "sun.security.pkcs11.P11Signature"; + String P11PSSSignature = "sun.security.pkcs11.P11PSSSignature"; // XXX register all aliases @@ -540,6 +542,12 @@ d(MD, "SHA-512", P11Digest, s("2.16.840.1.101.3.4.2.3", "OID.2.16.840.1.101.3.4.2.3"), m(CKM_SHA512)); + d(MD, "SHA-512/224", P11Digest, + s("2.16.840.1.101.3.4.2.5", "OID.2.16.840.1.101.3.4.2.5"), + m(CKM_SHA512_224)); + d(MD, "SHA-512/256", P11Digest, + s("2.16.840.1.101.3.4.2.6", "OID.2.16.840.1.101.3.4.2.6"), + m(CKM_SHA512_256)); d(MAC, "HmacMD5", P11MAC, m(CKM_MD5_HMAC)); @@ -558,13 +566,22 @@ d(MAC, "HmacSHA512", P11MAC, s("1.2.840.113549.2.11", "OID.1.2.840.113549.2.11"), m(CKM_SHA512_HMAC)); + d(MAC, "HmacSHA512/224", P11MAC, + s("1.2.840.113549.2.12", "OID.1.2.840.113549.2.12"), + m(CKM_SHA512_224_HMAC)); + d(MAC, "HmacSHA512/256", P11MAC, + s("1.2.840.113549.2.13", "OID.1.2.840.113549.2.13"), + m(CKM_SHA512_256_HMAC)); + d(MAC, "SslMacMD5", P11MAC, m(CKM_SSL3_MD5_MAC)); d(MAC, "SslMacSHA1", P11MAC, m(CKM_SSL3_SHA1_MAC)); d(KPG, "RSA", P11KeyPairGenerator, + s("1.2.840.113549.1.1", "OID.1.2.840.113549.1.1"), m(CKM_RSA_PKCS_KEY_PAIR_GEN)); + d(KPG, "DSA", P11KeyPairGenerator, s("1.3.14.3.2.12", "1.2.840.10040.4.1", "OID.1.2.840.10040.4.1"), m(CKM_DSA_KEY_PAIR_GEN)); @@ -587,6 +604,7 @@ // register (Secret)KeyFactories if there are any mechanisms // for a particular algorithm that we support d(KF, "RSA", P11RSAKeyFactory, + s("1.2.840.113549.1.1", "OID.1.2.840.113549.1.1"), m(CKM_RSA_PKCS_KEY_PAIR_GEN, CKM_RSA_PKCS, CKM_RSA_X_509)); d(KF, "DSA", P11DSAKeyFactory, s("1.3.14.3.2.12", "1.2.840.10040.4.1", "OID.1.2.840.10040.4.1"), @@ -600,10 +618,14 @@ // AlgorithmParameters for EC. // Only needed until we have an EC implementation in the SUN provider. d(AGP, "EC", "sun.security.util.ECParameters", - s("1.2.840.10045.2.1"), + s("1.2.840.10045.2.1"), m(CKM_EC_KEY_PAIR_GEN, CKM_ECDH1_DERIVE, CKM_ECDSA, CKM_ECDSA_SHA1)); + + d(AGP, "GCM", "sun.security.util.GCMParameters", + m(CKM_AES_GCM)); + d(KA, "DH", P11KeyAgreement, s("DiffieHellman"), m(CKM_DH_PKCS_DERIVE)); d(KA, "ECDH", "sun.security.pkcs11.P11ECDHKeyAgreement", @@ -669,12 +691,24 @@ m(CKM_AES_ECB)); d(CIP, "AES/CTR/NoPadding", P11Cipher, m(CKM_AES_CTR)); + + d(CIP, "AES/GCM/NoPadding", P11AEADCipher, + m(CKM_AES_GCM)); + d(CIP, "AES_128/GCM/NoPadding", P11AEADCipher, + s("2.16.840.1.101.3.4.1.6", "OID.2.16.840.1.101.3.4.1.6"), + m(CKM_AES_GCM)); + d(CIP, "AES_192/GCM/NoPadding", P11AEADCipher, + s("2.16.840.1.101.3.4.1.26", "OID.2.16.840.1.101.3.4.1.26"), + m(CKM_AES_GCM)); + d(CIP, "AES_256/GCM/NoPadding", P11AEADCipher, + s("2.16.840.1.101.3.4.1.46", "OID.2.16.840.1.101.3.4.1.46"), + m(CKM_AES_GCM)); + d(CIP, "Blowfish/CBC/NoPadding", P11Cipher, m(CKM_BLOWFISH_CBC)); d(CIP, "Blowfish/CBC/PKCS5Padding", P11Cipher, m(CKM_BLOWFISH_CBC)); - // XXX RSA_X_509, RSA_OAEP not yet supported d(CIP, "RSA/ECB/PKCS1Padding", P11RSACipher, s("RSA"), m(CKM_RSA_PKCS)); d(CIP, "RSA/ECB/NoPadding", P11RSACipher, @@ -686,12 +720,25 @@ s("SHA1withDSA", "1.3.14.3.2.13", "1.3.14.3.2.27", "1.2.840.10040.4.3", "OID.1.2.840.10040.4.3"), m(CKM_DSA_SHA1, CKM_DSA)); + d(SIG, "SHA224withDSA", P11Signature, + s("2.16.840.1.101.3.4.3.1", "OID.2.16.840.1.101.3.4.3.1"), + m(CKM_DSA_SHA224)); + d(SIG, "SHA256withDSA", P11Signature, + s("2.16.840.1.101.3.4.3.2", "OID.2.16.840.1.101.3.4.3.2"), + m(CKM_DSA_SHA256)); + d(SIG, "SHA384withDSA", P11Signature, + s("2.16.840.1.101.3.4.3.3", "OID.2.16.840.1.101.3.4.3.3"), + m(CKM_DSA_SHA384)); + d(SIG, "SHA512withDSA", P11Signature, + s("2.16.840.1.101.3.4.3.4", "OID.2.16.840.1.101.3.4.3.4"), + m(CKM_DSA_SHA512)); d(SIG, "RawDSAinP1363Format", P11Signature, s("NONEwithDSAinP1363Format"), m(CKM_DSA)); d(SIG, "DSAinP1363Format", P11Signature, s("SHA1withDSAinP1363Format"), m(CKM_DSA_SHA1, CKM_DSA)); + d(SIG, "NONEwithECDSA", P11Signature, m(CKM_ECDSA)); d(SIG, "SHA1withECDSA", P11Signature, @@ -743,6 +790,19 @@ d(SIG, "SHA512withRSA", P11Signature, s("1.2.840.113549.1.1.13", "OID.1.2.840.113549.1.1.13"), m(CKM_SHA512_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509)); + d(SIG, "RSASSA-PSS", P11PSSSignature, + s("1.2.840.113549.1.1.10", "OID.1.2.840.113549.1.1.10"), + m(CKM_RSA_PKCS_PSS)); + d(SIG, "SHA1withRSASSA-PSS", P11PSSSignature, + m(CKM_SHA1_RSA_PKCS_PSS)); + d(SIG, "SHA224withRSASSA-PSS", P11PSSSignature, + m(CKM_SHA224_RSA_PKCS_PSS)); + d(SIG, "SHA256withRSASSA-PSS", P11PSSSignature, + m(CKM_SHA256_RSA_PKCS_PSS)); + d(SIG, "SHA384withRSASSA-PSS", P11PSSSignature, + m(CKM_SHA384_RSA_PKCS_PSS)); + d(SIG, "SHA512withRSASSA-PSS", P11PSSSignature, + m(CKM_SHA512_RSA_PKCS_PSS)); d(KG, "SunTlsRsaPremasterSecret", "sun.security.pkcs11.P11TlsRsaPremasterSecretGenerator", @@ -1008,11 +1068,17 @@ } else if (type == CIP) { if (algorithm.startsWith("RSA")) { return new P11RSACipher(token, algorithm, mechanism); + } else if (algorithm.endsWith("GCM/NoPadding")) { + return new P11AEADCipher(token, algorithm, mechanism); } else { return new P11Cipher(token, algorithm, mechanism); } } else if (type == SIG) { - return new P11Signature(token, algorithm, mechanism); + if (algorithm.indexOf("RSASSA-PSS") != -1) { + return new P11PSSSignature(token, algorithm, mechanism); + } else { + return new P11Signature(token, algorithm, mechanism); + } } else if (type == MAC) { return new P11Mac(token, algorithm, mechanism); } else if (type == KPG) { @@ -1051,7 +1117,14 @@ } else if (type == KS) { return token.getKeyStore(); } else if (type == AGP) { - return new sun.security.util.ECParameters(); + if (algorithm == "EC") { + return new sun.security.util.ECParameters(); + } else if (algorithm == "GCM") { + return new sun.security.util.GCMParameters(); + } else { + throw new NoSuchAlgorithmException("Unsupported algorithm: " + + algorithm); + } } else { throw new NoSuchAlgorithmException("Unknown type: " + type); } @@ -1070,7 +1143,7 @@ String keyAlgorithm = key.getAlgorithm(); // RSA signatures and cipher if (((type == CIP) && algorithm.startsWith("RSA")) - || (type == SIG) && algorithm.endsWith("RSA")) { + || (type == SIG) && (algorithm.indexOf("RSA") != -1)) { if (keyAlgorithm.equals("RSA") == false) { return false; } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_CCM_PARAMS.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_CCM_PARAMS.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2018, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.security.pkcs11.wrapper; + +/** + * This class represents the necessary parameters required by + * the CKM_AES_CCM mechanism as defined in CK_CCM_PARAMS structure.

    + * PKCS#11 structure: + *

    + * typedef struct CK_CCM_PARAMS {
    + *   CK_ULONG ulDataLen;
    + *   CK_BYTE_PTR pNonce;
    + *   CK_ULONG ulNonceLen;
    + *   CK_BYTE_PTR pAAD;
    + *   CK_ULONG ulAADLen;
    + *   CK_ULONG ulMACLen;
    + * } CK_CCM_PARAMS;
    + * 
    + * + * @since 13 + */ +public class CK_CCM_PARAMS { + + private final long dataLen; + private final byte[] nonce; + private final byte[] aad; + private final long macLen; + + public CK_CCM_PARAMS(int tagLen, byte[] iv, byte[] aad, int dataLen) { + this.dataLen = dataLen; + this.nonce = iv; + this.aad = aad; + this.macLen = tagLen; + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + + sb.append(Constants.INDENT); + sb.append("ulDataLen: "); + sb.append(dataLen); + sb.append(Constants.NEWLINE); + + sb.append(Constants.INDENT); + sb.append("iv: "); + sb.append(Functions.toHexString(nonce)); + sb.append(Constants.NEWLINE); + + sb.append(Constants.INDENT); + sb.append("aad: "); + sb.append(Functions.toHexString(aad)); + sb.append(Constants.NEWLINE); + + sb.append(Constants.INDENT); + sb.append("tagLen: "); + sb.append(macLen); + + return sb.toString(); + } +} diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_GCM_PARAMS.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_GCM_PARAMS.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,75 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.security.pkcs11.wrapper; + +/** + * This class represents the necessary parameters required by + * the CKM_AES_GCM mechanism as defined in CK_GCM_PARAMS structure.

    + * PKCS#11 structure: + *

    + * typedef struct CK_GCM_PARAMS {
    + *    CK_BYTE_PTR       pIv;
    + *    CK_ULONG          ulIvLen;
    + *    CK_BYTE_PTR       pAAD;
    + *    CK_ULONG          ulAADLen;
    + *    CK_ULONG          ulTagBits;
    + * } CK_GCM_PARAMS;
    + * 
    + * + * @since 10 + */ +public class CK_GCM_PARAMS { + + private final byte[] iv; + private final byte[] aad; + private final long tagBits; + + public CK_GCM_PARAMS(int tagLenInBits, byte[] iv, byte[] aad) { + this.iv = iv; + this.aad = aad; + this.tagBits = tagLenInBits; + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + + sb.append(Constants.INDENT); + sb.append("iv: "); + sb.append(Functions.toHexString(iv)); + sb.append(Constants.NEWLINE); + + sb.append(Constants.INDENT); + sb.append("aad: "); + sb.append(Functions.toHexString(aad)); + sb.append(Constants.NEWLINE); + + sb.append(Constants.INDENT); + sb.append("tagLen(in bits): "); + sb.append(tagBits); + + return sb.toString(); + } +} diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -82,11 +82,15 @@ * CK_ULONG ulParameterLen; * */ - public Object pParameter; + public Object pParameter = null; - public CK_MECHANISM() { - // empty - } + // pointer to native CK_MECHANISM structure + // For mechanisms which have only mechanism id, the native structure + // can be freed right after init and this field will not be used. However, + // for mechanisms which have both mechanism id and parameters, it can + // only be freed after operation is finished. Thus, the native pointer + // will be stored here and then be explicitly freed by caller. + private long pHandle = 0L; public CK_MECHANISM(long mechanism) { this.mechanism = mechanism; @@ -95,7 +99,6 @@ // We don't have a (long,Object) constructor to force type checking. // This makes sure we don't accidentally pass a class that the native // code cannot handle. - public CK_MECHANISM(long mechanism, byte[] pParameter) { init(mechanism, pParameter); } @@ -144,6 +147,33 @@ init(mechanism, params); } + public CK_MECHANISM(long mechanism, CK_GCM_PARAMS params) { + init(mechanism, params); + } + + public CK_MECHANISM(long mechanism, CK_CCM_PARAMS params) { + init(mechanism, params); + } + + // For PSS. the parameter may be set multiple times, use the + // CK_MECHANISM(long) constructor and setParameter(CK_RSA_PKCS_PSS_PARAMS) + // methods instead of creating yet another constructor + public void setParameter(CK_RSA_PKCS_PSS_PARAMS params) { + assert(this.mechanism == CKM_RSA_PKCS_PSS); + assert(params != null); + if (this.pParameter != null && this.pParameter.equals(params)) { + return; + } + freeHandle(); + this.pParameter = params; + } + + public void freeHandle() { + if (this.pHandle != 0L) { + this.pHandle = PKCS11.freeMechanism(pHandle); + } + } + private void init(long mechanism, Object pParameter) { this.mechanism = mechanism; this.pParameter = pParameter; @@ -167,12 +197,17 @@ sb.append(pParameter.toString()); sb.append(Constants.NEWLINE); + /* sb.append(Constants.INDENT); sb.append("ulParameterLen: ??"); - //buffer.append(pParameter.length); - //buffer.append(Constants.NEWLINE); - + sb.append(Constants.NEWLINE); + */ + if (pHandle != 0L) { + sb.append(Constants.INDENT); + sb.append("pHandle: "); + sb.append(pHandle); + sb.append(Constants.NEWLINE); + } return sb.toString() ; } - } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,118 +1,105 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ -/* Copyright (c) 2002 Graz University of Technology. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: - * - * "This product includes software developed by IAIK of Graz University of - * Technology." + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Graz University of Technology" and "IAIK of Graz University of - * Technology" must not be used to endorse or promote products derived from - * this software without prior written permission. - * - * 5. Products derived from this software may not be called - * "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior - * written permission of Graz University of Technology. + * 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). * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * 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. */ package sun.security.pkcs11.wrapper; +import java.security.ProviderException; +import java.security.spec.PSSParameterSpec; +import java.security.spec.MGF1ParameterSpec; /** - * class CK_RSA_PKCS_PSS_PARAMS provides the parameters to the CKM_RSA_PKCS_OAEP - * mechanism.

    + * This class represents the necessary parameters required by the + * CKM_RSA_PKCS_PSS mechanism as defined in CK_RSA_PKCS_PSS_PARAMS structure.

    * PKCS#11 structure: *

      * typedef struct CK_RSA_PKCS_PSS_PARAMS {
    - *   CK_MECHANISM_TYPE hashAlg;
    - *   CK_RSA_PKCS_MGF_TYPE mgf;
    - *   CK_ULONG sLen;
    + *    CK_MECHANISM_TYPE    hashAlg;
    + *    CK_RSA_PKCS_MGF_TYPE mgf;
    + *    CK_ULONG             sLen;
      * } CK_RSA_PKCS_PSS_PARAMS;
      * 
    * - * @author Karl Scheibelhofer + * @since 13 */ public class CK_RSA_PKCS_PSS_PARAMS { - /** - * PKCS#11: - *
    -     *   CK_MECHANISM_TYPE hashAlg;
    -     * 
    - */ - public long hashAlg; + private final long hashAlg; + private final long mgf; + private final long sLen; + + public CK_RSA_PKCS_PSS_PARAMS(String hashAlg, String mgfAlg, + String mgfHash, int sLen) { + this.hashAlg = Functions.getHashMechId(hashAlg); + if (!mgfAlg.equals("MGF1")) { + throw new ProviderException("Only MGF1 is supported"); + } + // no dash in PKCS#11 mechanism names + this.mgf = Functions.getMGFId("CKG_MGF1_" + hashAlg.replaceFirst("-", "")); + this.sLen = sLen; + } - /** - * PKCS#11: - *
    -     *   CK_RSA_PKCS_MGF_TYPE mgf;
    -     * 
    - */ - public long mgf; + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + + if (!(o instanceof CK_RSA_PKCS_PSS_PARAMS)) { + return false; + } - /** - * PKCS#11: - *
    -     *   CK_ULONG sLen;
    -     * 
    - */ - public long sLen; + CK_RSA_PKCS_PSS_PARAMS other = (CK_RSA_PKCS_PSS_PARAMS) o; + return ((other.hashAlg == hashAlg) && + (other.mgf == mgf) && + (other.sLen == sLen)); + } - /** - * Returns the string representation of CK_PKCS5_PBKD2_PARAMS. - * - * @return the string representation of CK_PKCS5_PBKD2_PARAMS - */ + @Override + public int hashCode() { + return (int)(hashAlg << 2 + mgf << 1 + sLen); + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(Constants.INDENT); - sb.append("hashAlg: 0x"); + sb.append("hashAlg: "); sb.append(Functions.toFullHexString(hashAlg)); sb.append(Constants.NEWLINE); sb.append(Constants.INDENT); - sb.append("mgf: 0x"); + sb.append("mgf: "); sb.append(Functions.toFullHexString(mgf)); sb.append(Constants.NEWLINE); sb.append(Constants.INDENT); - sb.append("sLen: "); + sb.append("sLen(in bytes): "); sb.append(sLen); - //buffer.append(Constants.NEWLINE); return sb.toString(); } - } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/Functions.java --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/Functions.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/Functions.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -97,6 +97,13 @@ private static final Map objectClassIds = new HashMap(); + // MGFs (CKG_*) + private static final Map mgfNames = + new HashMap(); + + private static final Map mgfIds = + new HashMap(); + /** * For converting numbers to their hex presentation. */ @@ -401,7 +408,11 @@ name = nameMap.get(Integer.valueOf((int)id)); } if (name == null) { - name = "Unknown 0x" + toFullHexString(id); + if ((id & CKM_VENDOR_DEFINED) != 0) { + name = "(Vendor-Specific) 0x" + toFullHexString(id); + } else { + name = "(Unknown) 0x" + toFullHexString(id); + } } return name; } @@ -450,6 +461,14 @@ return hashMechIds.get(name); } + public static String getMGFName(long id) { + return getName(mgfNames, id); + } + + public static long getMGFId(String name) { + return getId(mgfIds, name); + } + /** * Check the given arrays for equalitiy. This method considers both arrays as * equal, if both are null or both have the same length and @@ -595,8 +614,14 @@ addMapping(objectClassNames, objectClassIds, id, name); } - private static void addHashMech(long id, String name) { - hashMechIds.put(name, id); + private static void addHashMech(long id, String... names) { + for (String n : names) { + hashMechIds.put(n, id); + } + } + + private static void addMGF(long id, String name) { + addMapping(mgfNames, mgfIds, id, name); } static { @@ -618,16 +643,27 @@ addMech(CKM_DSA_KEY_PAIR_GEN, "CKM_DSA_KEY_PAIR_GEN"); addMech(CKM_DSA, "CKM_DSA"); addMech(CKM_DSA_SHA1, "CKM_DSA_SHA1"); + addMech(CKM_DSA_SHA224, "CKM_DSA_SHA224"); + addMech(CKM_DSA_SHA256, "CKM_DSA_SHA256"); + addMech(CKM_DSA_SHA384, "CKM_DSA_SHA384"); + addMech(CKM_DSA_SHA512, "CKM_DSA_SHA512"); + addMech(CKM_DH_PKCS_KEY_PAIR_GEN, "CKM_DH_PKCS_KEY_PAIR_GEN"); addMech(CKM_DH_PKCS_DERIVE, "CKM_DH_PKCS_DERIVE"); addMech(CKM_X9_42_DH_KEY_PAIR_GEN, "CKM_X9_42_DH_KEY_PAIR_GEN"); addMech(CKM_X9_42_DH_DERIVE, "CKM_X9_42_DH_DERIVE"); addMech(CKM_X9_42_DH_HYBRID_DERIVE, "CKM_X9_42_DH_HYBRID_DERIVE"); addMech(CKM_X9_42_MQV_DERIVE, "CKM_X9_42_MQV_DERIVE"); - addMech(CKM_SHA224_RSA_PKCS, "CKM_SHA224_RSA_PKCS"); + addMech(CKM_SHA256_RSA_PKCS, "CKM_SHA256_RSA_PKCS"); addMech(CKM_SHA384_RSA_PKCS, "CKM_SHA384_RSA_PKCS"); addMech(CKM_SHA512_RSA_PKCS, "CKM_SHA512_RSA_PKCS"); + addMech(CKM_SHA256_RSA_PKCS_PSS, "CKM_SHA256_RSA_PKCS_PSS"); + addMech(CKM_SHA384_RSA_PKCS_PSS, "CKM_SHA384_RSA_PKCS_PSS"); + addMech(CKM_SHA512_RSA_PKCS_PSS, "CKM_SHA512_RSA_PKCS_PSS"); + addMech(CKM_SHA224_RSA_PKCS, "CKM_SHA224_RSA_PKCS"); + addMech(CKM_SHA224_RSA_PKCS_PSS, "CKM_SHA224_RSA_PKCS_PSS"); + addMech(CKM_RC2_KEY_GEN, "CKM_RC2_KEY_GEN"); addMech(CKM_RC2_ECB, "CKM_RC2_ECB"); addMech(CKM_RC2_CBC, "CKM_RC2_CBC"); @@ -649,12 +685,21 @@ addMech(CKM_DES3_MAC, "CKM_DES3_MAC"); addMech(CKM_DES3_MAC_GENERAL, "CKM_DES3_MAC_GENERAL"); addMech(CKM_DES3_CBC_PAD, "CKM_DES3_CBC_PAD"); + addMech(CKM_DES3_CMAC_GENERAL, "CKM_DES3_CMAC_GENERAL"); + addMech(CKM_DES3_CMAC, "CKM_DES3_CMAC"); + addMech(CKM_CDMF_KEY_GEN, "CKM_CDMF_KEY_GEN"); addMech(CKM_CDMF_ECB, "CKM_CDMF_ECB"); addMech(CKM_CDMF_CBC, "CKM_CDMF_CBC"); addMech(CKM_CDMF_MAC, "CKM_CDMF_MAC"); addMech(CKM_CDMF_MAC_GENERAL, "CKM_CDMF_MAC_GENERAL"); addMech(CKM_CDMF_CBC_PAD, "CKM_CDMF_CBC_PAD"); + + addMech(CKM_DES_OFB64, "CKM_DES_OFB64"); + addMech(CKM_DES_OFB8, "CKM_DES_OFB8"); + addMech(CKM_DES_CFB64, "CKM_DES_CFB64"); + addMech(CKM_DES_CFB8, "CKM_DES_CFB8"); + addMech(CKM_MD2, "CKM_MD2"); addMech(CKM_MD2_HMAC, "CKM_MD2_HMAC"); addMech(CKM_MD2_HMAC_GENERAL, "CKM_MD2_HMAC_GENERAL"); @@ -682,6 +727,26 @@ addMech(CKM_SHA512, "CKM_SHA512"); addMech(CKM_SHA512_HMAC, "CKM_SHA512_HMAC"); addMech(CKM_SHA512_HMAC_GENERAL, "CKM_SHA512_HMAC_GENERAL"); + addMech(CKM_SHA512_224, "CKM_SHA512_224"); + addMech(CKM_SHA512_224_HMAC, "CKM_SHA512_224_HMAC"); + addMech(CKM_SHA512_224_HMAC_GENERAL, "CKM_SHA512_224_HMAC_GENERAL"); + addMech(CKM_SHA512_224_KEY_DERIVATION, "CKM_SHA512_224_KEY_DERIVATION"); + addMech(CKM_SHA512_256, "CKM_SHA512_256"); + addMech(CKM_SHA512_256_HMAC, "CKM_SHA512_256_HMAC"); + addMech(CKM_SHA512_256_HMAC_GENERAL, "CKM_SHA512_256_HMAC_GENERAL"); + addMech(CKM_SHA512_256_KEY_DERIVATION, "CKM_SHA512_256_KEY_DERIVATION"); + addMech(CKM_SHA512_T, "CKM_SHA512_T"); + addMech(CKM_SHA512_T_HMAC, "CKM_SHA512_T_HMAC"); + addMech(CKM_SHA512_T_HMAC_GENERAL, "CKM_SHA512_T_HMAC_GENERAL"); + addMech(CKM_SHA512_T_KEY_DERIVATION, "CKM_SHA512_T_KEY_DERIVATION"); + + addMech(CKM_SECURID_KEY_GEN, "CKM_SECURID_KEY_GEN"); + addMech(CKM_SECURID, "CKM_SECURID"); + addMech(CKM_HOTP_KEY_GEN, "CKM_HOTP_KEY_GEN"); + addMech(CKM_HOTP, "CKM_HOTP"); + addMech(CKM_ACTI, "CKM_ACTI"); + addMech(CKM_ACTI_KEY_GEN, "CKM_ACTI_KEY_GEN"); + addMech(CKM_CAST_KEY_GEN, "CKM_CAST_KEY_GEN"); addMech(CKM_CAST_ECB, "CKM_CAST_ECB"); addMech(CKM_CAST_CBC, "CKM_CAST_CBC"); @@ -729,10 +794,7 @@ addMech(CKM_TLS_PRF, "CKM_TLS_PRF"); addMech(CKM_SSL3_MD5_MAC, "CKM_SSL3_MD5_MAC"); addMech(CKM_SSL3_SHA1_MAC, "CKM_SSL3_SHA1_MAC"); - addMech(CKM_TLS12_MASTER_KEY_DERIVE, "CKM_TLS12_MASTER_KEY_DERIVE"); - addMech(CKM_TLS12_KEY_AND_MAC_DERIVE, "CKM_TLS12_KEY_AND_MAC_DERIVE"); - addMech(CKM_TLS12_MASTER_KEY_DERIVE_DH, "CKM_TLS12_MASTER_KEY_DERIVE_DH"); - addMech(CKM_TLS_MAC, "CKM_TLS_MAC"); + addMech(CKM_MD5_KEY_DERIVATION, "CKM_MD5_KEY_DERIVATION"); addMech(CKM_MD2_KEY_DERIVATION, "CKM_MD2_KEY_DERIVATION"); addMech(CKM_SHA1_KEY_DERIVATION, "CKM_SHA1_KEY_DERIVATION"); @@ -754,8 +816,62 @@ addMech(CKM_PBE_SHA1_RC2_40_CBC, "CKM_PBE_SHA1_RC2_40_CBC"); addMech(CKM_PKCS5_PBKD2, "CKM_PKCS5_PBKD2"); addMech(CKM_PBA_SHA1_WITH_SHA1_HMAC, "CKM_PBA_SHA1_WITH_SHA1_HMAC"); + + addMech(CKM_WTLS_PRE_MASTER_KEY_GEN, "CKM_WTLS_PRE_MASTER_KEY_GEN"); + addMech(CKM_WTLS_MASTER_KEY_DERIVE, "CKM_WTLS_MASTER_KEY_DERIVE"); + addMech(CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC, + "CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC"); + addMech(CKM_WTLS_PRF, "CKM_WTLS_PRF"); + addMech(CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE, + "CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE"); + addMech(CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE, + "CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE"); + addMech(CKM_TLS10_MAC_SERVER, "CKM_TLS10_MAC_SERVER"); + addMech(CKM_TLS10_MAC_CLIENT, "CKM_TLS10_MAC_CLIENT"); + addMech(CKM_TLS12_MAC, "CKM_TLS12_MAC"); + addMech(CKM_TLS12_KDF, "CKM_TLS12_KDF"); + addMech(CKM_TLS12_MASTER_KEY_DERIVE, "CKM_TLS12_MASTER_KEY_DERIVE"); + addMech(CKM_TLS12_KEY_AND_MAC_DERIVE, "CKM_TLS12_KEY_AND_MAC_DERIVE"); + addMech(CKM_TLS12_MASTER_KEY_DERIVE_DH, "CKM_TLS12_MASTER_KEY_DERIVE_DH"); + addMech(CKM_TLS12_KEY_SAFE_DERIVE, "CKM_TLS12_KEY_SAFE_DERIVE"); + addMech(CKM_TLS_MAC, "CKM_TLS_MAC"); + addMech(CKM_TLS_KDF, "CKM_TLS_KDF"); + addMech(CKM_KEY_WRAP_LYNKS, "CKM_KEY_WRAP_LYNKS"); addMech(CKM_KEY_WRAP_SET_OAEP, "CKM_KEY_WRAP_SET_OAEP"); + + addMech(CKM_CMS_SIG, "CKM_CMS_SIG"); + addMech(CKM_KIP_DERIVE, "CKM_KIP_DERIVE"); + addMech(CKM_KIP_WRAP, "CKM_KIP_WRAP"); + addMech(CKM_KIP_MAC, "CKM_KIP_MAC"); + addMech(CKM_CAMELLIA_KEY_GEN, "CKM_CAMELLIA_KEY_GEN"); + addMech(CKM_CAMELLIA_ECB, "CKM_CAMELLIA_ECB"); + addMech(CKM_CAMELLIA_CBC, "CKM_CAMELLIA_CBC"); + addMech(CKM_CAMELLIA_MAC, "CKM_CAMELLIA_MAC"); + addMech(CKM_CAMELLIA_MAC_GENERAL, "CKM_CAMELLIA_MAC_GENERAL"); + addMech(CKM_CAMELLIA_CBC_PAD, "CKM_CAMELLIA_CBC_PAD"); + addMech(CKM_CAMELLIA_ECB_ENCRYPT_DATA, "CKM_CAMELLIA_ECB_ENCRYPT_DATA"); + addMech(CKM_CAMELLIA_CBC_ENCRYPT_DATA, "CKM_CAMELLIA_CBC_ENCRYPT_DATA"); + addMech(CKM_CAMELLIA_CTR, "CKM_CAMELLIA_CTR"); + + addMech(CKM_ARIA_KEY_GEN, "CKM_ARIA_KEY_GEN"); + addMech(CKM_ARIA_ECB, "CKM_ARIA_ECB"); + addMech(CKM_ARIA_CBC, "CKM_ARIA_CBC"); + addMech(CKM_ARIA_MAC, "CKM_ARIA_MAC"); + addMech(CKM_ARIA_MAC_GENERAL, "CKM_ARIA_MAC_GENERAL"); + addMech(CKM_ARIA_CBC_PAD, "CKM_ARIA_CBC_PAD"); + addMech(CKM_ARIA_ECB_ENCRYPT_DATA, "CKM_ARIA_ECB_ENCRYPT_DATA"); + addMech(CKM_ARIA_CBC_ENCRYPT_DATA, "CKM_ARIA_CBC_ENCRYPT_DATA"); + + addMech(CKM_SEED_KEY_GEN, "CKM_SEED_KEY_GEN"); + addMech(CKM_SEED_ECB, "CKM_SEED_ECB"); + addMech(CKM_SEED_CBC, "CKM_SEED_CBC"); + addMech(CKM_SEED_MAC, "CKM_SEED_MAC"); + addMech(CKM_SEED_MAC_GENERAL, "CKM_SEED_MAC_GENERAL"); + addMech(CKM_SEED_CBC_PAD, "CKM_SEED_CBC_PAD"); + addMech(CKM_SEED_ECB_ENCRYPT_DATA, "CKM_SEED_ECB_ENCRYPT_DATA"); + addMech(CKM_SEED_CBC_ENCRYPT_DATA, "CKM_SEED_CBC_ENCRYPT_DATA"); + addMech(CKM_SKIPJACK_KEY_GEN, "CKM_SKIPJACK_KEY_GEN"); addMech(CKM_SKIPJACK_ECB64, "CKM_SKIPJACK_ECB64"); addMech(CKM_SKIPJACK_CBC64, "CKM_SKIPJACK_CBC64"); @@ -780,9 +896,17 @@ addMech(CKM_EC_KEY_PAIR_GEN, "CKM_EC_KEY_PAIR_GEN"); addMech(CKM_ECDSA, "CKM_ECDSA"); addMech(CKM_ECDSA_SHA1, "CKM_ECDSA_SHA1"); + addMech(CKM_ECDSA_SHA224, "CKM_ECDSA_SHA224"); + addMech(CKM_ECDSA_SHA256, "CKM_ECDSA_SHA256"); + addMech(CKM_ECDSA_SHA384, "CKM_ECDSA_SHA384"); + addMech(CKM_ECDSA_SHA512, "CKM_ECDSA_SHA512"); + addMech(CKM_ECDH1_DERIVE, "CKM_ECDH1_DERIVE"); addMech(CKM_ECDH1_COFACTOR_DERIVE, "CKM_ECDH1_COFACTOR_DERIVE"); addMech(CKM_ECMQV_DERIVE, "CKM_ECMQV_DERIVE"); + addMech(CKM_ECDH_AES_KEY_WRAP, "CKM_ECDH_AES_KEY_WRAP"); + addMech(CKM_RSA_AES_KEY_WRAP, "CKM_RSA_AES_KEY_WRAP"); + addMech(CKM_JUNIPER_KEY_GEN, "CKM_JUNIPER_KEY_GEN"); addMech(CKM_JUNIPER_ECB128, "CKM_JUNIPER_ECB128"); addMech(CKM_JUNIPER_CBC128, "CKM_JUNIPER_CBC128"); @@ -796,11 +920,61 @@ addMech(CKM_AES_MAC, "CKM_AES_MAC"); addMech(CKM_AES_MAC_GENERAL, "CKM_AES_MAC_GENERAL"); addMech(CKM_AES_CBC_PAD, "CKM_AES_CBC_PAD"); + addMech(CKM_AES_CTR, "CKM_AES_CTR"); + addMech(CKM_AES_GCM, "CKM_AES_GCM"); + addMech(CKM_AES_CCM, "CKM_AES_CCM"); + addMech(CKM_AES_CTS, "CKM_AES_CTS"); + addMech(CKM_AES_CMAC, "CKM_AES_CMAC"); + addMech(CKM_AES_CMAC_GENERAL, "CKM_AES_CMAC_GENERAL"); + addMech(CKM_AES_XCBC_MAC, "CKM_AES_XCBC_MAC"); + addMech(CKM_AES_XCBC_MAC_96, "CKM_AES_XCBC_MAC_96"); + addMech(CKM_AES_GMAC, "CKM_AES_GMAC"); + addMech(CKM_BLOWFISH_KEY_GEN, "CKM_BLOWFISH_KEY_GEN"); addMech(CKM_BLOWFISH_CBC, "CKM_BLOWFISH_CBC"); + addMech(CKM_TWOFISH_KEY_GEN, "CKM_TWOFISH_KEY_GEN"); + addMech(CKM_TWOFISH_CBC, "CKM_TWOFISH_CBC"); + addMech(CKM_BLOWFISH_CBC_PAD, "CKM_BLOWFISH_CBC_PAD"); + addMech(CKM_TWOFISH_CBC_PAD, "CKM_TWOFISH_CBC_PAD"); + + addMech(CKM_DES_ECB_ENCRYPT_DATA, "CKM_DES_ECB_ENCRYPT_DATA"); + addMech(CKM_DES_CBC_ENCRYPT_DATA, "CKM_DES_CBC_ENCRYPT_DATA"); + addMech(CKM_DES3_ECB_ENCRYPT_DATA, "CKM_DES3_ECB_ENCRYPT_DATA"); + addMech(CKM_DES3_CBC_ENCRYPT_DATA, "CKM_DES3_CBC_ENCRYPT_DATA"); + addMech(CKM_AES_ECB_ENCRYPT_DATA, "CKM_AES_ECB_ENCRYPT_DATA"); + addMech(CKM_AES_CBC_ENCRYPT_DATA, "CKM_AES_CBC_ENCRYPT_DATA"); + + addMech(CKM_GOSTR3410_KEY_PAIR_GEN, "CKM_GOSTR3410_KEY_PAIR_GEN"); + addMech(CKM_GOSTR3410, "CKM_GOSTR3410"); + addMech(CKM_GOSTR3410_WITH_GOSTR3411, "CKM_GOSTR3410_WITH_GOSTR3411"); + addMech(CKM_GOSTR3410_KEY_WRAP, "CKM_GOSTR3410_KEY_WRAP"); + addMech(CKM_GOSTR3410_DERIVE, "CKM_GOSTR3410_DERIVE"); + addMech(CKM_GOSTR3411, "CKM_GOSTR3411"); + addMech(CKM_GOSTR3411_HMAC, "CKM_GOSTR3411_HMAC"); + addMech(CKM_GOST28147_KEY_GEN, "CKM_GOST28147_KEY_GEN"); + addMech(CKM_GOST28147_ECB, "CKM_GOST28147_ECB"); + addMech(CKM_GOST28147, "CKM_GOST28147"); + addMech(CKM_GOST28147_MAC, "CKM_GOST28147_MAC"); + addMech(CKM_GOST28147_KEY_WRAP, "CKM_GOST28147_KEY_WRAP"); + addMech(CKM_DSA_PARAMETER_GEN, "CKM_DSA_PARAMETER_GEN"); addMech(CKM_DH_PKCS_PARAMETER_GEN, "CKM_DH_PKCS_PARAMETER_GEN"); addMech(CKM_X9_42_DH_PARAMETER_GEN, "CKM_X9_42_DH_PARAMETER_GEN"); + addMech(CKM_DSA_PROBABLISTIC_PARAMETER_GEN, + "CKM_DSA_PROBABLISTIC_PARAMETER_GEN"); + addMech(CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN, + "CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN"); + addMech(CKM_AES_OFB, "CKM_AES_OFB"); + addMech(CKM_AES_CFB64, "CKM_AES_CFB64"); + addMech(CKM_AES_CFB8, "CKM_AES_CFB8"); + addMech(CKM_AES_CFB128, "CKM_AES_CFB128"); + addMech(CKM_AES_CFB1, "CKM_AES_CFB1"); + addMech(CKM_AES_KEY_WRAP, "CKM_AES_KEY_WRAP"); + addMech(CKM_AES_KEY_WRAP_PAD, "CKM_AES_KEY_WRAP_PAD"); + + addMech(CKM_RSA_PKCS_TPM_1_1, "CKM_RSA_PKCS_TPM_1_1"); + addMech(CKM_RSA_PKCS_OAEP_TPM_1_1, "CKM_RSA_PKCS_OAEP_TPM_1_1"); + addMech(CKM_VENDOR_DEFINED, "CKM_VENDOR_DEFINED"); addMech(CKM_NSS_TLS_PRF_GENERAL, "CKM_NSS_TLS_PRF_GENERAL"); @@ -808,11 +982,13 @@ addMech(PCKM_SECURERANDOM, "SecureRandom"); addMech(PCKM_KEYSTORE, "KeyStore"); - addHashMech(CKM_SHA_1, "SHA-1"); - addHashMech(CKM_SHA224, "SHA-224"); - addHashMech(CKM_SHA256, "SHA-256"); - addHashMech(CKM_SHA384, "SHA-384"); - addHashMech(CKM_SHA512, "SHA-512"); + addHashMech(CKM_SHA_1, "SHA-1", "SHA", "SHA1"); + addHashMech(CKM_SHA224, "SHA-224", "SHA224"); + addHashMech(CKM_SHA256, "SHA-256", "SHA256"); + addHashMech(CKM_SHA384, "SHA-384", "SHA384"); + addHashMech(CKM_SHA512, "SHA-512", "SHA512"); + addHashMech(CKM_SHA512_224, "SHA-512/224", "SHA512/224"); + addHashMech(CKM_SHA512_256, "SHA-512/256", "SHA512/256"); addKeyType(CKK_RSA, "CKK_RSA"); addKeyType(CKK_DSA, "CKK_DSA"); @@ -837,6 +1013,25 @@ addKeyType(CKK_CDMF, "CKK_CDMF"); addKeyType(CKK_AES, "CKK_AES"); addKeyType(CKK_BLOWFISH, "CKK_BLOWFISH"); + addKeyType(CKK_TWOFISH, "CKK_TWOFISH"); + addKeyType(CKK_SECURID, "CKK_SECURID"); + addKeyType(CKK_HOTP, "CKK_HOTP"); + addKeyType(CKK_ACTI, "CKK_ACTI"); + addKeyType(CKK_CAMELLIA, "CKK_CAMELLIA"); + addKeyType(CKK_ARIA, "CKK_ARIA"); + addKeyType(CKK_MD5_HMAC, "CKK_MD5_HMAC"); + addKeyType(CKK_SHA_1_HMAC, "CKK_SHA_1_HMAC"); + addKeyType(CKK_RIPEMD128_HMAC, "CKK_RIPEMD128_HMAC"); + addKeyType(CKK_RIPEMD160_HMAC, "CKK_RIPEMD160_HMAC"); + addKeyType(CKK_SHA256_HMAC, "CKK_SHA256_HMAC"); + addKeyType(CKK_SHA384_HMAC, "CKK_SHA384_HMAC"); + addKeyType(CKK_SHA512_HMAC, "CKK_SHA512_HMAC"); + addKeyType(CKK_SHA224_HMAC, "CKK_SHA224_HMAC"); + addKeyType(CKK_SEED, "CKK_SEED"); + addKeyType(CKK_GOSTR3410, "CKK_GOSTR3410"); + addKeyType(CKK_GOSTR3411, "CKK_GOSTR3411"); + addKeyType(CKK_GOST28147, "CKK_GOST28147"); + addKeyType(CKK_VENDOR_DEFINED, "CKK_VENDOR_DEFINED"); addKeyType(PCKK_ANY, "*"); @@ -855,6 +1050,16 @@ addAttribute(CKA_OWNER, "CKA_OWNER"); addAttribute(CKA_ATTR_TYPES, "CKA_ATTR_TYPES"); addAttribute(CKA_TRUSTED, "CKA_TRUSTED"); + addAttribute(CKA_CERTIFICATE_CATEGORY, "CKA_CERTIFICATE_CATEGORY"); + addAttribute(CKA_JAVA_MIDP_SECURITY_DOMAIN, + "CKA_JAVA_MIDP_SECURITY_DOMAIN"); + addAttribute(CKA_URL, "CKA_URL"); + addAttribute(CKA_HASH_OF_SUBJECT_PUBLIC_KEY, + "CKA_HASH_OF_SUBJECT_PUBLIC_KEY"); + addAttribute(CKA_HASH_OF_ISSUER_PUBLIC_KEY, + "CKA_HASH_OF_ISSUER_PUBLIC_KEY"); + addAttribute(CKA_NAME_HASH_ALGORITHM, "CKA_NAME_HASH_ALGORITHM"); + addAttribute(CKA_CHECK_VALUE, "CKA_CHECK_VALUE"); addAttribute(CKA_KEY_TYPE, "CKA_KEY_TYPE"); addAttribute(CKA_SUBJECT, "CKA_SUBJECT"); addAttribute(CKA_ID, "CKA_ID"); @@ -879,6 +1084,7 @@ addAttribute(CKA_EXPONENT_1, "CKA_EXPONENT_1"); addAttribute(CKA_EXPONENT_2, "CKA_EXPONENT_2"); addAttribute(CKA_COEFFICIENT, "CKA_COEFFICIENT"); + addAttribute(CKA_PUBLIC_KEY_INFO, "CKA_PUBLIC_KEY_INFO"); addAttribute(CKA_PRIME, "CKA_PRIME"); addAttribute(CKA_SUBPRIME, "CKA_SUBPRIME"); addAttribute(CKA_BASE, "CKA_BASE"); @@ -886,19 +1092,69 @@ addAttribute(CKA_SUB_PRIME_BITS, "CKA_SUB_PRIME_BITS"); addAttribute(CKA_VALUE_BITS, "CKA_VALUE_BITS"); addAttribute(CKA_VALUE_LEN, "CKA_VALUE_LEN"); + addAttribute(CKA_EXTRACTABLE, "CKA_EXTRACTABLE"); addAttribute(CKA_LOCAL, "CKA_LOCAL"); addAttribute(CKA_NEVER_EXTRACTABLE, "CKA_NEVER_EXTRACTABLE"); addAttribute(CKA_ALWAYS_SENSITIVE, "CKA_ALWAYS_SENSITIVE"); + addAttribute(CKA_KEY_GEN_MECHANISM, "CKA_KEY_GEN_MECHANISM"); addAttribute(CKA_MODIFIABLE, "CKA_MODIFIABLE"); + addAttribute(CKA_COPYABLE, "CKA_COPYABLE"); + addAttribute(CKA_DESTROYABLE, "CKA_DESTROYABLE"); + addAttribute(CKA_EC_PARAMS, "CKA_EC_PARAMS"); addAttribute(CKA_EC_POINT, "CKA_EC_POINT"); + addAttribute(CKA_SECONDARY_AUTH, "CKA_SECONDARY_AUTH"); addAttribute(CKA_AUTH_PIN_FLAGS, "CKA_AUTH_PIN_FLAGS"); + addAttribute(CKA_ALWAYS_AUTHENTICATE, "CKA_ALWAYS_AUTHENTICATE"); + addAttribute(CKA_WRAP_WITH_TRUSTED, "CKA_WRAP_WITH_TRUSTED"); + addAttribute(CKA_WRAP_TEMPLATE, "CKA_WRAP_TEMPLATE"); + addAttribute(CKA_UNWRAP_TEMPLATE, "CKA_UNWRAP_TEMPLATE"); + addAttribute(CKA_DERIVE_TEMPLATE, "CKA_DERIVE_TEMPLATE"); + addAttribute(CKA_OTP_FORMAT, "CKA_OTP_FORMAT"); + addAttribute(CKA_OTP_LENGTH, "CKA_OTP_LENGTH"); + addAttribute(CKA_OTP_TIME_INTERVAL, "CKA_OTP_TIME_INTERVAL"); + addAttribute(CKA_OTP_USER_FRIENDLY_MODE,"CKA_OTP_USER_FRIENDLY_MODE"); + addAttribute(CKA_OTP_CHALLENGE_REQUIREMENT, + "CKA_OTP_CHALLENGE_REQUIREMENT"); + addAttribute(CKA_OTP_TIME_REQUIREMENT, "CKA_OTP_TIME_REQUIREMENT"); + addAttribute(CKA_OTP_COUNTER_REQUIREMENT, + "CKA_OTP_COUNTER_REQUIREMENT"); + addAttribute(CKA_OTP_PIN_REQUIREMENT, "CKA_OTP_PIN_REQUIREMENT"); + addAttribute(CKA_OTP_COUNTER, "CKA_OTP_COUNTER"); + addAttribute(CKA_OTP_TIME, "CKA_OTP_TIME"); + addAttribute(CKA_OTP_USER_IDENTIFIER, "CKA_OTP_USER_IDENTIFIER"); + addAttribute(CKA_OTP_SERVICE_IDENTIFIER,"CKA_OTP_SERVICE_IDENTIFIER"); + addAttribute(CKA_OTP_SERVICE_LOGO, "CKA_OTP_SERVICE_LOGO"); + addAttribute(CKA_OTP_SERVICE_LOGO_TYPE, "CKA_OTP_SERVICE_LOGO_TYPE"); + addAttribute(CKA_GOSTR3410_PARAMS, "CKA_GOSTR3410_PARAMS"); + addAttribute(CKA_GOSTR3411_PARAMS, "CKA_GOSTR3411_PARAMS"); + addAttribute(CKA_GOST28147_PARAMS, "CKA_GOST28147_PARAMS"); + addAttribute(CKA_HW_FEATURE_TYPE, "CKA_HW_FEATURE_TYPE"); addAttribute(CKA_RESET_ON_INIT, "CKA_RESET_ON_INIT"); addAttribute(CKA_HAS_RESET, "CKA_HAS_RESET"); + + addAttribute(CKA_PIXEL_X, "CKA_PIXEL_X"); + addAttribute(CKA_PIXEL_Y, "CKA_PIXEL_Y"); + addAttribute(CKA_RESOLUTION, "CKA_RESOLUTION"); + addAttribute(CKA_CHAR_ROWS, "CKA_CHAR_ROWS"); + addAttribute(CKA_CHAR_COLUMNS, "CKA_CHAR_COLUMNS"); + addAttribute(CKA_COLOR, "CKA_COLOR"); + addAttribute(CKA_BITS_PER_PIXEL, "CKA_BITS_PER_PIXEL"); + addAttribute(CKA_CHAR_SETS, "CKA_CHAR_SETS"); + addAttribute(CKA_ENCODING_METHODS, "CKA_ENCODING_METHODS"); + addAttribute(CKA_MIME_TYPES, "CKA_MIME_TYPES"); + addAttribute(CKA_MECHANISM_TYPE, "CKA_MECHANISM_TYPE"); + addAttribute(CKA_REQUIRED_CMS_ATTRIBUTES, + "CKA_REQUIRED_CMS_ATTRIBUTES"); + addAttribute(CKA_DEFAULT_CMS_ATTRIBUTES,"CKA_DEFAULT_CMS_ATTRIBUTES"); + addAttribute(CKA_SUPPORTED_CMS_ATTRIBUTES, + "CKA_SUPPORTED_CMS_ATTRIBUTES"); + addAttribute(CKA_ALLOWED_MECHANISMS, "CKA_ALLOWED_MECHANISMS"); + addAttribute(CKA_VENDOR_DEFINED, "CKA_VENDOR_DEFINED"); addAttribute(CKA_NETSCAPE_DB, "CKA_NETSCAPE_DB"); @@ -920,6 +1176,11 @@ addObjectClass(PCKO_ANY, "*"); + addMGF(CKG_MGF1_SHA1, "CKG_MGF1_SHA1"); + addMGF(CKG_MGF1_SHA256, "CKG_MGF1_SHA256"); + addMGF(CKG_MGF1_SHA384, "CKG_MGF1_SHA384"); + addMGF(CKG_MGF1_SHA512, "CKG_MGF1_SHA512"); + addMGF(CKG_MGF1_SHA224, "CKG_MGF1_SHA224"); } } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -97,6 +97,12 @@ // static initializer, hence this method is empty. } + /* ***************************************************************************** + * Utility, Resource Clean up + ******************************************************************************/ + // always return 0L + public static native long freeMechanism(long hMechanism); + /** * The PKCS#11 module to connect to. This is the PKCS#11 driver of the token; * e.g. pk2priv.dll. @@ -729,17 +735,25 @@ * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) - * @param pData the data to get encrypted and the data's length + * @param directIn the address of the to-be-encrypted data + * @param in buffer containing the to-be-encrypted data + * @param inOfs buffer offset of the to-be-encrypted data + * @param inLen length of the to-be-encrypted data * (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen) - * @return the encrypted data and the encrypted data's length + * @param directOut the address for the encrypted data + * @param out buffer for the encrypted data + * @param outOfs buffer offset for the encrypted data + * @param outLen buffer size for the encrypted data + * @return the length of encrypted data * (PKCS#11 param: CK_BYTE_PTR pEncryptedData, * CK_ULONG_PTR pulEncryptedDataLen) * @exception PKCS11Exception If function returns other value than CKR_OK. - * @preconditions (pData <> null) - * @postconditions (result <> null) + * @preconditions + * @postconditions */ - public native int C_Encrypt(long hSession, byte[] in, int inOfs, int inLen, - byte[] out, int outOfs, int outLen) throws PKCS11Exception; + public native int C_Encrypt(long hSession, long directIn, byte[] in, + int inOfs, int inLen, long directOut, byte[] out, int outOfs, + int outLen) throws PKCS11Exception; /** @@ -749,13 +763,20 @@ * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) - * @param pPart the data part to get encrypted and the data part's length + * @param directIn the address of the to-be-encrypted data + * @param in buffer containing the to-be-encrypted data + * @param inOfs buffer offset of the to-be-encrypted data + * @param inLen length of the to-be-encrypted data * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen) - * @return the encrypted data part and the encrypted data part's length + * @param directOut the address for the encrypted data + * @param out buffer for the encrypted data + * @param outOfs buffer offset for the encrypted data + * @param outLen buffer size for the encrypted data + * @return the length of encrypted data for this update * (PKCS#11 param: CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen) * @exception PKCS11Exception If function returns other value than CKR_OK. - * @preconditions (pPart <> null) + * @preconditions * @postconditions */ public native int C_EncryptUpdate(long hSession, long directIn, byte[] in, @@ -770,12 +791,16 @@ * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) - * @return the last encrypted data part and the last data part's length + * @param directOut the address for the encrypted data + * @param out buffer for the encrypted data + * @param outOfs buffer offset for the encrypted data + * @param outLen buffer size for the encrypted data + * @return the length of the last part of the encrypted data * (PKCS#11 param: CK_BYTE_PTR pLastEncryptedPart, CK_ULONG_PTR pulLastEncryptedPartLen) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions - * @postconditions (result <> null) + * @postconditions */ public native int C_EncryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception; @@ -805,18 +830,25 @@ * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) - * @param pEncryptedData the encrypted data to get decrypted and the - * encrypted data's length - * (PKCS#11 param: CK_BYTE_PTR pEncryptedData, - * CK_ULONG ulEncryptedDataLen) - * @return the decrypted data and the data's length + * @param directIn the address of the to-be-decrypted data + * @param in buffer containing the to-be-decrypted data + * @param inOfs buffer offset of the to-be-decrypted data + * @param inLen length of the to-be-decrypted data + * (PKCS#11 param: CK_BYTE_PTR pDecryptedData, + * CK_ULONG ulDecryptedDataLen) + * @param directOut the address for the decrypted data + * @param out buffer for the decrypted data + * @param outOfs buffer offset for the decrypted data + * @param outLen buffer size for the decrypted data + * @return the length of decrypted data * (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen) * @exception PKCS11Exception If function returns other value than CKR_OK. - * @preconditions (pEncryptedPart <> null) - * @postconditions (result <> null) + * @preconditions + * @postconditions */ - public native int C_Decrypt(long hSession, byte[] in, int inOfs, int inLen, - byte[] out, int outOfs, int outLen) throws PKCS11Exception; + public native int C_Decrypt(long hSession, long directIn, byte[] in, + int inOfs, int inLen, long directOut, byte[] out, int outOfs, + int outLen) throws PKCS11Exception; /** @@ -826,14 +858,20 @@ * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) - * @param pEncryptedPart the encrypted data part to get decrypted and the - * encrypted data part's length - * (PKCS#11 param: CK_BYTE_PTR pEncryptedPart, - * CK_ULONG ulEncryptedPartLen) - * @return the decrypted data part and the data part's length + * @param directIn the address of the to-be-decrypted data + * @param in buffer containing the to-be-decrypted data + * @param inOfs buffer offset of the to-be-decrypted data + * @param inLen length of the to-be-decrypted data + * (PKCS#11 param: CK_BYTE_PTR pDecryptedPart, + * CK_ULONG ulDecryptedPartLen) + * @param directOut the address for the decrypted data + * @param out buffer for the decrypted data + * @param outOfs buffer offset for the decrypted data + * @param outLen buffer size for the decrypted data + * @return the length of decrypted data for this update * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) * @exception PKCS11Exception If function returns other value than CKR_OK. - * @preconditions (pEncryptedPart <> null) + * @preconditions * @postconditions */ public native int C_DecryptUpdate(long hSession, long directIn, byte[] in, @@ -848,12 +886,16 @@ * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) - * @return the last decrypted data part and the last data part's length + * @param directOut the address for the decrypted data + * @param out buffer for the decrypted data + * @param outOfs buffer offset for the decrypted data + * @param outLen buffer size for the decrypted data + * @return the length of this last part of decrypted data * (PKCS#11 param: CK_BYTE_PTR pLastPart, * CK_ULONG_PTR pulLastPartLen) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions - * @postconditions (result <> null) + * @postconditions */ public native int C_DecryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception; @@ -1027,6 +1069,7 @@ * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) + * @param expectedLen expected signature length, can be 0 if unknown * @return the signature and the signature's length * (PKCS#11 param: CK_BYTE_PTR pSignature, * CK_ULONG_PTR pulSignatureLen) @@ -1285,7 +1328,6 @@ // byte[] pEncryptedPart) throws PKCS11Exception; - /* ***************************************************************************** * Key management ******************************************************************************/ @@ -1692,10 +1734,11 @@ super.C_EncryptInit(hSession, pMechanism, hKey); } - public synchronized int C_Encrypt(long hSession, byte[] in, int inOfs, - int inLen, byte[] out, int outOfs, int outLen) + public synchronized int C_Encrypt(long hSession, long directIn, byte[] in, + int inOfs, int inLen, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception { - return super.C_Encrypt(hSession, in, inOfs, inLen, out, outOfs, outLen); + return super.C_Encrypt(hSession, directIn, in, inOfs, inLen, + directOut, out, outOfs, outLen); } public synchronized int C_EncryptUpdate(long hSession, long directIn, @@ -1715,10 +1758,11 @@ super.C_DecryptInit(hSession, pMechanism, hKey); } - public synchronized int C_Decrypt(long hSession, byte[] in, int inOfs, - int inLen, byte[] out, int outOfs, int outLen) - throws PKCS11Exception { - return super.C_Decrypt(hSession, in, inOfs, inLen, out, outOfs, outLen); + public synchronized int C_Decrypt(long hSession, long directIn, + byte[] in, int inOfs, int inLen, long directOut, byte[] out, + int outOfs, int outLen) throws PKCS11Exception { + return super.C_Decrypt(hSession, directIn, in, inOfs, inLen, + directOut, out, outOfs, outLen); } public synchronized int C_DecryptUpdate(long hSession, long directIn, diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -144,98 +144,46 @@ /* normal user's PIN is set */ public static final long CKF_USER_PIN_INITIALIZED = 0x00000008L; - /* CKF_RESTORE_KEY_NOT_NEEDED is new for v2.0. If it is set, - * that means that *every* time the state of cryptographic - * operations of a session is successfully saved, all keys - * needed to continue those operations are stored in the state */ public static final long CKF_RESTORE_KEY_NOT_NEEDED = 0x00000020L; - /* CKF_CLOCK_ON_TOKEN is new for v2.0. If it is set, that means - * that the token has some sort of clock. The time on that - * clock is returned in the token info structure */ public static final long CKF_CLOCK_ON_TOKEN = 0x00000040L; - /* CKF_PROTECTED_AUTHENTICATION_PATH is new for v2.0. If it is - * set, that means that there is some way for the user to login - * without sending a PIN through the Cryptoki library itself */ public static final long CKF_PROTECTED_AUTHENTICATION_PATH = 0x00000100L; - /* CKF_DUAL_CRYPTO_OPERATIONS is new for v2.0. If it is true, - * that means that a single session with the token can perform - * dual simultaneous cryptographic operations (digest and - * encrypt; decrypt and digest; sign and encrypt; and decrypt - * and sign) */ public static final long CKF_DUAL_CRYPTO_OPERATIONS = 0x00000200L; - /* CKF_TOKEN_INITIALIZED if new for v2.10. If it is true, the - * token has been initialized using C_InitializeToken or an - * equivalent mechanism outside the scope of PKCS #11. - * Calling C_InitializeToken when this flag is set will cause - * the token to be reinitialized. */ public static final long CKF_TOKEN_INITIALIZED = 0x00000400L; - /* CKF_SECONDARY_AUTHENTICATION if new for v2.10. If it is - * true, the token supports secondary authentication for - * private key objects. */ public static final long CKF_SECONDARY_AUTHENTICATION = 0x00000800L; - /* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an - * incorrect user login PIN has been entered at least once - * since the last successful authentication. */ public static final long CKF_USER_PIN_COUNT_LOW = 0x00010000L; - /* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true, - * supplying an incorrect user PIN will it to become locked. */ public static final long CKF_USER_PIN_FINAL_TRY = 0x00020000L; - /* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the - * user PIN has been locked. User login to the token is not - * possible. */ public static final long CKF_USER_PIN_LOCKED = 0x00040000L; - /* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true, - * the user PIN value is the default value set by token - * initialization or manufacturing. */ public static final long CKF_USER_PIN_TO_BE_CHANGED = 0x00080000L; - /* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an - * incorrect SO login PIN has been entered at least once since - * the last successful authentication. */ public static final long CKF_SO_PIN_COUNT_LOW = 0x00100000L; - /* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true, - * supplying an incorrect SO PIN will it to become locked. */ public static final long CKF_SO_PIN_FINAL_TRY = 0x00200000L; - /* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO - * PIN has been locked. SO login to the token is not possible. - */ public static final long CKF_SO_PIN_LOCKED = 0x00400000L; - /* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true, - * the SO PIN value is the default value set by token - * initialization or manufacturing. */ public static final long CKF_SO_PIN_TO_BE_CHANGED = 0x00800000L; - - /* CK_USER_TYPE enumerates the types of Cryptoki users */ - /* CK_USER_TYPE has been changed from an enum to a CK_ULONG for - * v2.0 */ /* Security Officer */ public static final long CKU_SO = 0L; /* Normal user */ public static final long CKU_USER = 1L; /* CK_STATE enumerates the session states */ - /* CK_STATE has been changed from an enum to a CK_ULONG for - * v2.0 */ public static final long CKS_RO_PUBLIC_SESSION = 0L; public static final long CKS_RO_USER_FUNCTIONS = 1L; public static final long CKS_RW_PUBLIC_SESSION = 2L; public static final long CKS_RW_USER_FUNCTIONS = 3L; public static final long CKS_RW_SO_FUNCTIONS = 4L; - /* The flags are defined in the following table: * Bit Flag Mask Meaning */ @@ -246,8 +194,6 @@ /* The following classes of objects are defined: */ - /* CKO_HW_FEATURE is new for v2.10 */ - /* CKO_DOMAIN_PARAMETERS is new for v2.11 */ public static final long CKO_DATA = 0x00000000L; public static final long CKO_CERTIFICATE = 0x00000001L; public static final long CKO_PUBLIC_KEY = 0x00000002L; @@ -267,62 +213,73 @@ public static final long CKH_VENDOR_DEFINED = 0x80000000L; /* the following key types are defined: */ - public static final long CKK_RSA = 0x00000000L; - public static final long CKK_DSA = 0x00000001L; - public static final long CKK_DH = 0x00000002L; - - /* CKK_ECDSA and CKK_KEA are new for v2.0 */ - /* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */ - public static final long CKK_ECDSA = 0x00000003L; - public static final long CKK_EC = 0x00000003L; - public static final long CKK_X9_42_DH = 0x00000004L; - public static final long CKK_KEA = 0x00000005L; - - public static final long CKK_GENERIC_SECRET = 0x00000010L; - public static final long CKK_RC2 = 0x00000011L; - public static final long CKK_RC4 = 0x00000012L; - public static final long CKK_DES = 0x00000013L; - public static final long CKK_DES2 = 0x00000014L; - public static final long CKK_DES3 = 0x00000015L; + public static final long CKK_RSA = 0x00000000L; + public static final long CKK_DSA = 0x00000001L; + public static final long CKK_DH = 0x00000002L; + public static final long CKK_ECDSA /*deprecated*/ = 0x00000003L; + public static final long CKK_EC = 0x00000003L; + public static final long CKK_X9_42_DH = 0x00000004L; + public static final long CKK_KEA = 0x00000005L; + public static final long CKK_GENERIC_SECRET = 0x00000010L; + public static final long CKK_RC2 = 0x00000011L; + public static final long CKK_RC4 = 0x00000012L; + public static final long CKK_DES = 0x00000013L; + public static final long CKK_DES2 = 0x00000014L; + public static final long CKK_DES3 = 0x00000015L; - /* all these key types are new for v2.0 */ - public static final long CKK_CAST = 0x00000016L; - public static final long CKK_CAST3 = 0x00000017L; - /* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */ - public static final long CKK_CAST5 = 0x00000018L; - /* CAST128=CAST5 */ - public static final long CKK_CAST128 = 0x00000018L; - public static final long CKK_RC5 = 0x00000019L; - public static final long CKK_IDEA = 0x0000001AL; - public static final long CKK_SKIPJACK = 0x0000001BL; - public static final long CKK_BATON = 0x0000001CL; - public static final long CKK_JUNIPER = 0x0000001DL; - public static final long CKK_CDMF = 0x0000001EL; - public static final long CKK_AES = 0x0000001FL; - // v2.20 - public static final long CKK_BLOWFISH = 0x00000020L; + public static final long CKK_CAST = 0x00000016L; + public static final long CKK_CAST3 = 0x00000017L; + public static final long CKK_CAST5 /*deprecated*/ = 0x00000018L; + public static final long CKK_CAST128 = 0x00000018L; + public static final long CKK_RC5 = 0x00000019L; + public static final long CKK_IDEA = 0x0000001AL; + public static final long CKK_SKIPJACK = 0x0000001BL; + public static final long CKK_BATON = 0x0000001CL; + public static final long CKK_JUNIPER = 0x0000001DL; + public static final long CKK_CDMF = 0x0000001EL; + public static final long CKK_AES = 0x0000001FL; + public static final long CKK_BLOWFISH = 0x00000020L; + public static final long CKK_TWOFISH = 0x00000021L; + public static final long CKK_SECURID = 0x00000022L; + public static final long CKK_HOTP = 0x00000023L; + public static final long CKK_ACTI = 0x00000024L; + public static final long CKK_CAMELLIA = 0x00000025L; + public static final long CKK_ARIA = 0x00000026L; - public static final long CKK_VENDOR_DEFINED = 0x80000000L; + public static final long CKK_MD5_HMAC = 0x00000027L; + public static final long CKK_SHA_1_HMAC = 0x00000028L; + public static final long CKK_RIPEMD128_HMAC = 0x00000029L; + public static final long CKK_RIPEMD160_HMAC = 0x0000002AL; + public static final long CKK_SHA256_HMAC = 0x0000002BL; + public static final long CKK_SHA384_HMAC = 0x0000002CL; + public static final long CKK_SHA512_HMAC = 0x0000002DL; + public static final long CKK_SHA224_HMAC = 0x0000002EL; - // new for v2.20 amendment 3 - //public static final long CKK_CAMELLIA = 0x00000025L; - //public static final long CKK_ARIA = 0x00000026L; + public static final long CKK_SEED = 0x0000002FL; + public static final long CKK_GOSTR3410 = 0x00000030L; + public static final long CKK_GOSTR3411 = 0x00000031L; + public static final long CKK_GOST28147 = 0x00000032L; +; + public static final long CKK_VENDOR_DEFINED = 0x80000000L; // pseudo key type ANY (for template manager) - public static final long PCKK_ANY = 0x7FFFFF22L; + public static final long PCKK_ANY = 0x7FFFFF22L; - public static final long PCKK_HMAC = 0x7FFFFF23L; - public static final long PCKK_SSLMAC = 0x7FFFFF24L; - public static final long PCKK_TLSPREMASTER = 0x7FFFFF25L; - public static final long PCKK_TLSRSAPREMASTER = 0x7FFFFF26L; - public static final long PCKK_TLSMASTER = 0x7FFFFF27L; + public static final long PCKK_HMAC = 0x7FFFFF23L; + public static final long PCKK_SSLMAC = 0x7FFFFF24L; + public static final long PCKK_TLSPREMASTER = 0x7FFFFF25L; + public static final long PCKK_TLSRSAPREMASTER = 0x7FFFFF26L; + public static final long PCKK_TLSMASTER = 0x7FFFFF27L; /* The following certificate types are defined: */ - /* CKC_X_509_ATTR_CERT is new for v2.10 */ - public static final long CKC_X_509 = 0x00000000L; - public static final long CKC_X_509_ATTR_CERT = 0x00000001L; - public static final long CKC_VENDOR_DEFINED = 0x80000000L; + public static final long CKC_X_509 = 0x00000000L; + public static final long CKC_X_509_ATTR_CERT = 0x00000001L; + public static final long CKC_VENDOR_DEFINED = 0x80000000L; + /* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which + * consists of an array of values. + */ + public static final long CKF_ARRAY_ATTRIBUTE = 0x40000000L; /* The following attribute types are defined: */ public static final long CKA_CLASS = 0x00000000L; @@ -331,22 +288,26 @@ public static final long CKA_LABEL = 0x00000003L; public static final long CKA_APPLICATION = 0x00000010L; public static final long CKA_VALUE = 0x00000011L; - - /* CKA_OBJECT_ID is new for v2.10 */ public static final long CKA_OBJECT_ID = 0x00000012L; - public static final long CKA_CERTIFICATE_TYPE = 0x00000080L; public static final long CKA_ISSUER = 0x00000081L; public static final long CKA_SERIAL_NUMBER = 0x00000082L; - - /* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new L; - * for v2.10 */ public static final long CKA_AC_ISSUER = 0x00000083L; public static final long CKA_OWNER = 0x00000084L; public static final long CKA_ATTR_TYPES = 0x00000085L; - - /* CKA_TRUSTED is new for v2.11 */ public static final long CKA_TRUSTED = 0x00000086L; + public static final long CKA_CERTIFICATE_CATEGORY + = 0x00000087L; + public static final long CKA_JAVA_MIDP_SECURITY_DOMAIN + = 0x00000088L; + public static final long CKA_URL = 0x00000089L; + public static final long CKA_HASH_OF_SUBJECT_PUBLIC_KEY + = 0x0000008AL; + public static final long CKA_HASH_OF_ISSUER_PUBLIC_KEY + = 0x0000008BL; + public static final long CKA_NAME_HASH_ALGORITHM + = 0x0000008CL; + public static final long CKA_CHECK_VALUE = 0x00000090L; public static final long CKA_KEY_TYPE = 0x00000100L; public static final long CKA_SUBJECT = 0x00000101L; @@ -372,45 +333,79 @@ public static final long CKA_EXPONENT_1 = 0x00000126L; public static final long CKA_EXPONENT_2 = 0x00000127L; public static final long CKA_COEFFICIENT = 0x00000128L; + public static final long CKA_PUBLIC_KEY_INFO = 0x00000129L; public static final long CKA_PRIME = 0x00000130L; public static final long CKA_SUBPRIME = 0x00000131L; public static final long CKA_BASE = 0x00000132L; - /* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */ public static final long CKA_PRIME_BITS = 0x00000133L; public static final long CKA_SUB_PRIME_BITS = 0x00000134L; public static final long CKA_VALUE_BITS = 0x00000160L; public static final long CKA_VALUE_LEN = 0x00000161L; - /* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE, - * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS, - * and CKA_EC_POINT are new for v2.0 */ public static final long CKA_EXTRACTABLE = 0x00000162L; public static final long CKA_LOCAL = 0x00000163L; public static final long CKA_NEVER_EXTRACTABLE = 0x00000164L; public static final long CKA_ALWAYS_SENSITIVE = 0x00000165L; - /* CKA_KEY_GEN_MECHANISM is new for v2.11 */ public static final long CKA_KEY_GEN_MECHANISM = 0x00000166L; public static final long CKA_MODIFIABLE = 0x00000170L; + public static final long CKA_COPYABLE = 0x00000171L; + public static final long CKA_DESTROYABLE = 0x00000172L; - /* CKA_ECDSA_PARAMS is deprecated in v2.11, - * CKA_EC_PARAMS is preferred. */ - public static final long CKA_ECDSA_PARAMS = 0x00000180L; - public static final long CKA_EC_PARAMS = 0x00000180L; - public static final long CKA_EC_POINT = 0x00000181L; + public static final long CKA_ECDSA_PARAMS /*deprecated*/ = 0x00000180L; + public static final long CKA_EC_PARAMS = 0x00000180L; + public static final long CKA_EC_POINT = 0x00000181L; + + public static final long CKA_SECONDARY_AUTH /*deprecated*/= 0x00000200L; + public static final long CKA_AUTH_PIN_FLAGS /*deprecated*/= 0x00000201L; + public static final long CKA_ALWAYS_AUTHENTICATE = 0x00000202L; + public static final long CKA_WRAP_WITH_TRUSTED = 0x00000210L; + public static final long CKA_WRAP_TEMPLATE = (CKF_ARRAY_ATTRIBUTE|0x00000211L); + public static final long CKA_UNWRAP_TEMPLATE = (CKF_ARRAY_ATTRIBUTE|0x00000212L); + public static final long CKA_DERIVE_TEMPLATE = (CKF_ARRAY_ATTRIBUTE|0x00000213L); - /* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS, - * CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET - * are new for v2.10 */ - public static final long CKA_SECONDARY_AUTH = 0x00000200L; - public static final long CKA_AUTH_PIN_FLAGS = 0x00000201L; + public static final long CKA_OTP_FORMAT = 0x00000220L; + public static final long CKA_OTP_LENGTH = 0x00000221L; + public static final long CKA_OTP_TIME_INTERVAL = 0x00000222L; + public static final long CKA_OTP_USER_FRIENDLY_MODE = 0x00000223L; + public static final long CKA_OTP_CHALLENGE_REQUIREMENT = 0x00000224L; + public static final long CKA_OTP_TIME_REQUIREMENT = 0x00000225L; + public static final long CKA_OTP_COUNTER_REQUIREMENT = 0x00000226L; + public static final long CKA_OTP_PIN_REQUIREMENT = 0x00000227L; + public static final long CKA_OTP_COUNTER = 0x0000022EL; + public static final long CKA_OTP_TIME = 0x0000022FL; + public static final long CKA_OTP_USER_IDENTIFIER = 0x0000022AL; + public static final long CKA_OTP_SERVICE_IDENTIFIER = 0x0000022BL; + public static final long CKA_OTP_SERVICE_LOGO = 0x0000022CL; + public static final long CKA_OTP_SERVICE_LOGO_TYPE = 0x0000022DL; + + public static final long CKA_GOSTR3410_PARAMS = 0x00000250L; + public static final long CKA_GOSTR3411_PARAMS = 0x00000251L; + public static final long CKA_GOST28147_PARAMS = 0x00000252L; + public static final long CKA_HW_FEATURE_TYPE = 0x00000300L; public static final long CKA_RESET_ON_INIT = 0x00000301L; public static final long CKA_HAS_RESET = 0x00000302L; + public static final long CKA_PIXEL_X = 0x00000400L; + public static final long CKA_PIXEL_Y = 0x00000401L; + public static final long CKA_RESOLUTION = 0x00000402L; + public static final long CKA_CHAR_ROWS = 0x00000403L; + public static final long CKA_CHAR_COLUMNS = 0x00000404L; + public static final long CKA_COLOR = 0x00000405L; + public static final long CKA_BITS_PER_PIXEL = 0x00000406L; + public static final long CKA_CHAR_SETS = 0x00000480L; + public static final long CKA_ENCODING_METHODS = 0x00000481L; + public static final long CKA_MIME_TYPES = 0x00000482L; + public static final long CKA_MECHANISM_TYPE = 0x00000500L; + public static final long CKA_REQUIRED_CMS_ATTRIBUTES = 0x00000501L; + public static final long CKA_DEFAULT_CMS_ATTRIBUTES = 0x00000502L; + public static final long CKA_SUPPORTED_CMS_ATTRIBUTES = 0x00000503L; + public static final long CKA_ALLOWED_MECHANISMS = (CKF_ARRAY_ATTRIBUTE|0x00000600L); + public static final long CKA_VENDOR_DEFINED = 0x80000000L; /* the following mechanism types are defined: */ @@ -419,20 +414,14 @@ public static final long CKM_RSA_9796 = 0x00000002L; public static final long CKM_RSA_X_509 = 0x00000003L; - /* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS - * are new for v2.0. They are mechanisms which hash and sign */ public static final long CKM_MD2_RSA_PKCS = 0x00000004L; public static final long CKM_MD5_RSA_PKCS = 0x00000005L; public static final long CKM_SHA1_RSA_PKCS = 0x00000006L; - /* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and - * CKM_RSA_PKCS_OAEP are new for v2.10 */ public static final long CKM_RIPEMD128_RSA_PKCS = 0x00000007L; public static final long CKM_RIPEMD160_RSA_PKCS = 0x00000008L; public static final long CKM_RSA_PKCS_OAEP = 0x00000009L; - /* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31, - * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */ public static final long CKM_RSA_X9_31_KEY_PAIR_GEN = 0x0000000AL; public static final long CKM_RSA_X9_31 = 0x0000000BL; public static final long CKM_SHA1_RSA_X9_31 = 0x0000000CL; @@ -442,28 +431,48 @@ public static final long CKM_DSA_KEY_PAIR_GEN = 0x00000010L; public static final long CKM_DSA = 0x00000011L; public static final long CKM_DSA_SHA1 = 0x00000012L; + public static final long CKM_DSA_SHA224 = 0x00000013L; + public static final long CKM_DSA_SHA256 = 0x00000014L; + public static final long CKM_DSA_SHA384 = 0x00000015L; + public static final long CKM_DSA_SHA512 = 0x00000016L; + public static final long CKM_DH_PKCS_KEY_PAIR_GEN = 0x00000020L; public static final long CKM_DH_PKCS_DERIVE = 0x00000021L; - /* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE, - * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for - * v2.11 */ public static final long CKM_X9_42_DH_KEY_PAIR_GEN = 0x00000030L; public static final long CKM_X9_42_DH_DERIVE = 0x00000031L; public static final long CKM_X9_42_DH_HYBRID_DERIVE = 0x00000032L; public static final long CKM_X9_42_MQV_DERIVE = 0x00000033L; - // v2.20 public static final long CKM_SHA256_RSA_PKCS = 0x00000040L; public static final long CKM_SHA384_RSA_PKCS = 0x00000041L; public static final long CKM_SHA512_RSA_PKCS = 0x00000042L; + public static final long CKM_SHA256_RSA_PKCS_PSS = 0x00000043L; + public static final long CKM_SHA384_RSA_PKCS_PSS = 0x00000044L; + public static final long CKM_SHA512_RSA_PKCS_PSS = 0x00000045L; + + public static final long CKM_SHA224_RSA_PKCS = 0x00000046L; + public static final long CKM_SHA224_RSA_PKCS_PSS = 0x00000047L; + + public static final long CKM_SHA512_224 = 0x00000048L; + public static final long CKM_SHA512_224_HMAC = 0x00000049L; + public static final long CKM_SHA512_224_HMAC_GENERAL = 0x0000004AL; + public static final long CKM_SHA512_224_KEY_DERIVATION = 0x0000004BL; + public static final long CKM_SHA512_256 = 0x0000004CL; + public static final long CKM_SHA512_256_HMAC = 0x0000004DL; + public static final long CKM_SHA512_256_HMAC_GENERAL = 0x0000004EL; + public static final long CKM_SHA512_256_KEY_DERIVATION = 0x0000004FL; + + public static final long CKM_SHA512_T = 0x00000050L; + public static final long CKM_SHA512_T_HMAC = 0x00000051L; + public static final long CKM_SHA512_T_HMAC_GENERAL = 0x00000052L; + public static final long CKM_SHA512_T_KEY_DERIVATION = 0x00000053L; public static final long CKM_RC2_KEY_GEN = 0x00000100L; public static final long CKM_RC2_ECB = 0x00000101L; public static final long CKM_RC2_CBC = 0x00000102L; public static final long CKM_RC2_MAC = 0x00000103L; - /* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */ public static final long CKM_RC2_MAC_GENERAL = 0x00000104L; public static final long CKM_RC2_CBC_PAD = 0x00000105L; @@ -474,7 +483,6 @@ public static final long CKM_DES_CBC = 0x00000122L; public static final long CKM_DES_MAC = 0x00000123L; - /* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */ public static final long CKM_DES_MAC_GENERAL = 0x00000124L; public static final long CKM_DES_CBC_PAD = 0x00000125L; @@ -484,11 +492,10 @@ public static final long CKM_DES3_CBC = 0x00000133L; public static final long CKM_DES3_MAC = 0x00000134L; - /* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN, - * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC, - * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */ public static final long CKM_DES3_MAC_GENERAL = 0x00000135L; public static final long CKM_DES3_CBC_PAD = 0x00000136L; + public static final long CKM_DES3_CMAC_GENERAL = 0x00000137L; + public static final long CKM_DES3_CMAC = 0x00000138L; public static final long CKM_CDMF_KEY_GEN = 0x00000140L; public static final long CKM_CDMF_ECB = 0x00000141L; public static final long CKM_CDMF_CBC = 0x00000142L; @@ -496,27 +503,26 @@ public static final long CKM_CDMF_MAC_GENERAL = 0x00000144L; public static final long CKM_CDMF_CBC_PAD = 0x00000145L; + public static final long CKM_DES_OFB64 = 0x00000150L; + public static final long CKM_DES_OFB8 = 0x00000151L; + public static final long CKM_DES_CFB64 = 0x00000152L; + public static final long CKM_DES_CFB8 = 0x00000153L; + public static final long CKM_MD2 = 0x00000200L; - /* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */ public static final long CKM_MD2_HMAC = 0x00000201L; public static final long CKM_MD2_HMAC_GENERAL = 0x00000202L; public static final long CKM_MD5 = 0x00000210L; - /* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */ public static final long CKM_MD5_HMAC = 0x00000211L; public static final long CKM_MD5_HMAC_GENERAL = 0x00000212L; public static final long CKM_SHA_1 = 0x00000220L; - /* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */ public static final long CKM_SHA_1_HMAC = 0x00000221L; public static final long CKM_SHA_1_HMAC_GENERAL = 0x00000222L; - /* CKM_RIPEMD128, CKM_RIPEMD128_HMAC, - * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC, - * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */ public static final long CKM_RIPEMD128 = 0x00000230L; public static final long CKM_RIPEMD128_HMAC = 0x00000231L; public static final long CKM_RIPEMD128_HMAC_GENERAL = 0x00000232L; @@ -524,11 +530,12 @@ public static final long CKM_RIPEMD160_HMAC = 0x00000241L; public static final long CKM_RIPEMD160_HMAC_GENERAL = 0x00000242L; - // v2.20 public static final long CKM_SHA256 = 0x00000250L; public static final long CKM_SHA256_HMAC = 0x00000251L; public static final long CKM_SHA256_HMAC_GENERAL = 0x00000252L; - + public static final long CKM_SHA224 = 0x00000255L; + public static final long CKM_SHA224_HMAC = 0x00000256L; + public static final long CKM_SHA224_HMAC_GENERAL = 0x00000257L; public static final long CKM_SHA384 = 0x00000260L; public static final long CKM_SHA384_HMAC = 0x00000261L; public static final long CKM_SHA384_HMAC_GENERAL = 0x00000262L; @@ -537,8 +544,13 @@ public static final long CKM_SHA512_HMAC = 0x00000271L; public static final long CKM_SHA512_HMAC_GENERAL = 0x00000272L; - /* All of the following mechanisms are new for v2.0 */ - /* Note that CAST128 and CAST5 are the same algorithm */ + public static final long CKM_SECURID_KEY_GEN = 0x00000280L; + public static final long CKM_SECURID = 0x00000282L; + public static final long CKM_HOTP_KEY_GEN = 0x00000290L; + public static final long CKM_HOTP = 0x00000291L; + public static final long CKM_ACTI = 0x000002A0L; + public static final long CKM_ACTI_KEY_GEN = 0x000002A1L; + public static final long CKM_CAST_KEY_GEN = 0x00000300L; public static final long CKM_CAST_ECB = 0x00000301L; public static final long CKM_CAST_CBC = 0x00000302L; @@ -551,18 +563,20 @@ public static final long CKM_CAST3_MAC = 0x00000313L; public static final long CKM_CAST3_MAC_GENERAL = 0x00000314L; public static final long CKM_CAST3_CBC_PAD = 0x00000315L; - public static final long CKM_CAST5_KEY_GEN = 0x00000320L; - public static final long CKM_CAST128_KEY_GEN = 0x00000320L; - public static final long CKM_CAST5_ECB = 0x00000321L; - public static final long CKM_CAST128_ECB = 0x00000321L; - public static final long CKM_CAST5_CBC = 0x00000322L; - public static final long CKM_CAST128_CBC = 0x00000322L; - public static final long CKM_CAST5_MAC = 0x00000323L; - public static final long CKM_CAST128_MAC = 0x00000323L; - public static final long CKM_CAST5_MAC_GENERAL = 0x00000324L; - public static final long CKM_CAST128_MAC_GENERAL = 0x00000324L; - public static final long CKM_CAST5_CBC_PAD = 0x00000325L; - public static final long CKM_CAST128_CBC_PAD = 0x00000325L; + /* Note that CAST128 and CAST5 are the same algorithm */ + public static final long CKM_CAST5_KEY_GEN = 0x00000320L; + public static final long CKM_CAST128_KEY_GEN = 0x00000320L; + public static final long CKM_CAST5_ECB = 0x00000321L; + public static final long CKM_CAST128_ECB = 0x00000321L; + public static final long CKM_CAST5_CBC /*deprecated*/ = 0x00000322L; + public static final long CKM_CAST128_CBC = 0x00000322L; + public static final long CKM_CAST5_MAC /*deprecated*/ = 0x00000323L; + public static final long CKM_CAST128_MAC = 0x00000323L; + public static final long CKM_CAST5_MAC_GENERAL /*deprecated*/ + = 0x00000324L; + public static final long CKM_CAST128_MAC_GENERAL = 0x00000324L; + public static final long CKM_CAST5_CBC_PAD /*deprecated*/ = 0x00000325L; + public static final long CKM_CAST128_CBC_PAD = 0x00000325L; public static final long CKM_RC5_KEY_GEN = 0x00000330L; public static final long CKM_RC5_ECB = 0x00000331L; public static final long CKM_RC5_CBC = 0x00000332L; @@ -585,9 +599,6 @@ public static final long CKM_SSL3_MASTER_KEY_DERIVE = 0x00000371L; public static final long CKM_SSL3_KEY_AND_MAC_DERIVE = 0x00000372L; - /* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN, - * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and - * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */ public static final long CKM_SSL3_MASTER_KEY_DERIVE_DH = 0x00000373L; public static final long CKM_TLS_PRE_MASTER_KEY_GEN = 0x00000374L; public static final long CKM_TLS_MASTER_KEY_DERIVE = 0x00000375L; @@ -601,10 +612,10 @@ public static final long CKM_MD2_KEY_DERIVATION = 0x00000391L; public static final long CKM_SHA1_KEY_DERIVATION = 0x00000392L; - // v2.20 public static final long CKM_SHA256_KEY_DERIVATION = 0x00000393L; public static final long CKM_SHA384_KEY_DERIVATION = 0x00000394L; public static final long CKM_SHA512_KEY_DERIVATION = 0x00000395L; + public static final long CKM_SHA224_KEY_DERIVATION = 0x00000396L; public static final long CKM_PBE_MD2_DES_CBC = 0x000003A0L; public static final long CKM_PBE_MD5_DES_CBC = 0x000003A1L; @@ -621,22 +632,65 @@ public static final long CKM_PBE_SHA1_RC2_128_CBC = 0x000003AAL; public static final long CKM_PBE_SHA1_RC2_40_CBC = 0x000003ABL; - /* CKM_PKCS5_PBKD2 is new for v2.10 */ public static final long CKM_PKCS5_PBKD2 = 0x000003B0L; public static final long CKM_PBA_SHA1_WITH_SHA1_HMAC = 0x000003C0L; - /* CKM_TLS12_MASTER_KEY_DERIVE, CKM_TLS12_KEY_AND_MAC_DERIVE, - * CKM_TLS12_MASTER_KEY_DERIVE_DH and CKM_TLS_MAC are new for v2.40 */ + public static final long CKM_WTLS_PRE_MASTER_KEY_GEN = 0x000003D0L; + public static final long CKM_WTLS_MASTER_KEY_DERIVE = 0x000003D1L; + public static final long CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC = 0x000003D2L; + public static final long CKM_WTLS_PRF = 0x000003D3L; + public static final long CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE = 0x000003D4L; + public static final long CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE = 0x000003D5L; + + public static final long CKM_TLS10_MAC_SERVER = 0x000003D6L; + public static final long CKM_TLS10_MAC_CLIENT = 0x000003D7L; + public static final long CKM_TLS12_MAC = 0x000003D8L; + public static final long CKM_TLS12_KDF = 0x000003D9L; + public static final long CKM_TLS12_MASTER_KEY_DERIVE = 0x000003E0L; public static final long CKM_TLS12_KEY_AND_MAC_DERIVE = 0x000003E1L; public static final long CKM_TLS12_MASTER_KEY_DERIVE_DH = 0x000003E2L; + public static final long CKM_TLS12_KEY_SAFE_DERIVE = 0x000003E3L; public static final long CKM_TLS_MAC = 0x000003E4L; + public static final long CKM_TLS_KDF = 0x000003E5L; public static final long CKM_KEY_WRAP_LYNKS = 0x00000400L; public static final long CKM_KEY_WRAP_SET_OAEP = 0x00000401L; - /* Fortezza mechanisms */ + public static final long CKM_CMS_SIG = 0x00000500L; + public static final long CKM_KIP_DERIVE = 0x00000510L; + public static final long CKM_KIP_WRAP = 0x00000511L; + public static final long CKM_KIP_MAC = 0x00000512L; + + public static final long CKM_CAMELLIA_KEY_GEN = 0x00000550L; + public static final long CKM_CAMELLIA_ECB = 0x00000551L; + public static final long CKM_CAMELLIA_CBC = 0x00000552L; + public static final long CKM_CAMELLIA_MAC = 0x00000553L; + public static final long CKM_CAMELLIA_MAC_GENERAL = 0x00000554L; + public static final long CKM_CAMELLIA_CBC_PAD = 0x00000555L; + public static final long CKM_CAMELLIA_ECB_ENCRYPT_DATA = 0x00000556L; + public static final long CKM_CAMELLIA_CBC_ENCRYPT_DATA = 0x00000557L; + public static final long CKM_CAMELLIA_CTR = 0x00000558L; + + public static final long CKM_ARIA_KEY_GEN = 0x00000560L; + public static final long CKM_ARIA_ECB = 0x00000561L; + public static final long CKM_ARIA_CBC = 0x00000562L; + public static final long CKM_ARIA_MAC = 0x00000563L; + public static final long CKM_ARIA_MAC_GENERAL = 0x00000564L; + public static final long CKM_ARIA_CBC_PAD = 0x00000565L; + public static final long CKM_ARIA_ECB_ENCRYPT_DATA = 0x00000566L; + public static final long CKM_ARIA_CBC_ENCRYPT_DATA = 0x00000567L; + + public static final long CKM_SEED_KEY_GEN = 0x00000650L; + public static final long CKM_SEED_ECB = 0x00000651L; + public static final long CKM_SEED_CBC = 0x00000652L; + public static final long CKM_SEED_MAC = 0x00000653L; + public static final long CKM_SEED_MAC_GENERAL = 0x00000654L; + public static final long CKM_SEED_CBC_PAD = 0x00000655L; + public static final long CKM_SEED_ECB_ENCRYPT_DATA = 0x00000656L; + public static final long CKM_SEED_CBC_ENCRYPT_DATA = 0x00000657L; + public static final long CKM_SKIPJACK_KEY_GEN = 0x00001000L; public static final long CKM_SKIPJACK_ECB64 = 0x00001001L; public static final long CKM_SKIPJACK_CBC64 = 0x00001002L; @@ -650,6 +704,7 @@ public static final long CKM_SKIPJACK_RELAYX = 0x0000100AL; public static final long CKM_KEA_KEY_PAIR_GEN = 0x00001010L; public static final long CKM_KEA_KEY_DERIVE = 0x00001011L; + public static final long CKM_KEA_DERIVE = 0x00001012L; public static final long CKM_FORTEZZA_TIMESTAMP = 0x00001020L; public static final long CKM_BATON_KEY_GEN = 0x00001030L; public static final long CKM_BATON_ECB128 = 0x00001031L; @@ -659,20 +714,24 @@ public static final long CKM_BATON_SHUFFLE = 0x00001035L; public static final long CKM_BATON_WRAP = 0x00001036L; - /* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11, - * CKM_EC_KEY_PAIR_GEN is preferred */ - public static final long CKM_ECDSA_KEY_PAIR_GEN = 0x00001040L; + public static final long CKM_ECDSA_KEY_PAIR_GEN /*deprecated*/ + = 0x00001040L; public static final long CKM_EC_KEY_PAIR_GEN = 0x00001040L; public static final long CKM_ECDSA = 0x00001041L; public static final long CKM_ECDSA_SHA1 = 0x00001042L; + public static final long CKM_ECDSA_SHA224 = 0x00001043L; + public static final long CKM_ECDSA_SHA256 = 0x00001044L; + public static final long CKM_ECDSA_SHA384 = 0x00001045L; + public static final long CKM_ECDSA_SHA512 = 0x00001046L; - /* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE - * are new for v2.11 */ public static final long CKM_ECDH1_DERIVE = 0x00001050L; public static final long CKM_ECDH1_COFACTOR_DERIVE = 0x00001051L; public static final long CKM_ECMQV_DERIVE = 0x00001052L; + public static final long CKM_ECDH_AES_KEY_WRAP = 0x00001053L; + public static final long CKM_RSA_AES_KEY_WRAP = 0x00001054L; + public static final long CKM_JUNIPER_KEY_GEN = 0x00001060L; public static final long CKM_JUNIPER_ECB128 = 0x00001061L; public static final long CKM_JUNIPER_CBC128 = 0x00001062L; @@ -681,70 +740,79 @@ public static final long CKM_JUNIPER_WRAP = 0x00001065L; public static final long CKM_FASTHASH = 0x00001070L; - /* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC, - * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN, - * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are - * new for v2.11 */ public static final long CKM_AES_KEY_GEN = 0x00001080L; public static final long CKM_AES_ECB = 0x00001081L; public static final long CKM_AES_CBC = 0x00001082L; public static final long CKM_AES_MAC = 0x00001083L; public static final long CKM_AES_MAC_GENERAL = 0x00001084L; public static final long CKM_AES_CBC_PAD = 0x00001085L; - // v2.20 + public static final long CKM_AES_CTR = 0x00001086L; + public static final long CKM_AES_GCM = 0x00001087L; + public static final long CKM_AES_CCM = 0x00001088L; + public static final long CKM_AES_CTS = 0x00001089L; + public static final long CKM_AES_CMAC = 0x0000108AL; + public static final long CKM_AES_CMAC_GENERAL = 0x0000108BL; + + public static final long CKM_AES_XCBC_MAC = 0x0000108CL; + public static final long CKM_AES_XCBC_MAC_96 = 0x0000108DL; + public static final long CKM_AES_GMAC = 0x0000108EL; + public static final long CKM_BLOWFISH_KEY_GEN = 0x00001090L; public static final long CKM_BLOWFISH_CBC = 0x00001091L; + public static final long CKM_TWOFISH_KEY_GEN = 0x00001092L; + public static final long CKM_TWOFISH_CBC = 0x00001093L; + public static final long CKM_BLOWFISH_CBC_PAD = 0x00001094L; + public static final long CKM_TWOFISH_CBC_PAD = 0x00001095L; + + public static final long CKM_DES_ECB_ENCRYPT_DATA = 0x00001100L; + public static final long CKM_DES_CBC_ENCRYPT_DATA = 0x00001101L; + public static final long CKM_DES3_ECB_ENCRYPT_DATA = 0x00001102L; + public static final long CKM_DES3_CBC_ENCRYPT_DATA = 0x00001103L; + public static final long CKM_AES_ECB_ENCRYPT_DATA = 0x00001104L; + public static final long CKM_AES_CBC_ENCRYPT_DATA = 0x00001105L; + + public static final long CKM_GOSTR3410_KEY_PAIR_GEN = 0x00001200L; + public static final long CKM_GOSTR3410 = 0x00001201L; + public static final long CKM_GOSTR3410_WITH_GOSTR3411 = 0x00001202L; + public static final long CKM_GOSTR3410_KEY_WRAP = 0x00001203L; + public static final long CKM_GOSTR3410_DERIVE = 0x00001204L; + public static final long CKM_GOSTR3411 = 0x00001210L; + public static final long CKM_GOSTR3411_HMAC = 0x00001211L; + public static final long CKM_GOST28147_KEY_GEN = 0x00001220L; + public static final long CKM_GOST28147_ECB = 0x00001221L; + public static final long CKM_GOST28147 = 0x00001222L; + public static final long CKM_GOST28147_MAC = 0x00001223L; + public static final long CKM_GOST28147_KEY_WRAP = 0x00001224L; + public static final long CKM_DSA_PARAMETER_GEN = 0x00002000L; public static final long CKM_DH_PKCS_PARAMETER_GEN = 0x00002001L; public static final long CKM_X9_42_DH_PARAMETER_GEN = 0x00002002L; + public static final long CKM_DSA_PROBABLISTIC_PARAMETER_GEN = 0x00002003L; + public static final long CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN = 0x00002004L; + + public static final long CKM_AES_OFB = 0x00002104L; + public static final long CKM_AES_CFB64 = 0x00002105L; + public static final long CKM_AES_CFB8 = 0x00002106L; + public static final long CKM_AES_CFB128 = 0x00002107L; + public static final long CKM_AES_CFB1 = 0x00002108L; + public static final long CKM_AES_KEY_WRAP = 0x00002109L; + public static final long CKM_AES_KEY_WRAP_PAD = 0x0000210AL; + + public static final long CKM_RSA_PKCS_TPM_1_1 = 0x00004001L; + public static final long CKM_RSA_PKCS_OAEP_TPM_1_1 = 0x00004002L; public static final long CKM_VENDOR_DEFINED = 0x80000000L; - // new for v2.20 amendment 3 - public static final long CKM_SHA224 = 0x00000255L; - public static final long CKM_SHA224_HMAC = 0x00000256L; - public static final long CKM_SHA224_HMAC_GENERAL = 0x00000257L; - public static final long CKM_SHA224_KEY_DERIVATION = 0x00000396L; - public static final long CKM_SHA224_RSA_PKCS = 0x00000046L; - public static final long CKM_SHA224_RSA_PKCS_PSS = 0x00000047L; - public static final long CKM_AES_CTR = 0x00001086L; - /* - public static final long CKM_CAMELLIA_KEY_GEN = 0x00000550L; - public static final long CKM_CAMELLIA_ECB = 0x00000551L; - public static final long CKM_CAMELLIA_CBC = 0x00000552L; - public static final long CKM_CAMELLIA_MAC = 0x00000553L; - public static final long CKM_CAMELLIA_MAC_GENERAL = 0x00000554L; - public static final long CKM_CAMELLIA_CBC_PAD = 0x00000555L; - public static final long CKM_CAMELLIA_ECB_ENCRYPT_DATA = 0x00000556L; - public static final long CKM_CAMELLIA_CBC_ENCRYPT_DATA = 0x00000557L; - public static final long CKM_CAMELLIA_CTR = 0x00000558L; - public static final long CKM_ARIA_KEY_GEN = 0x00000560L; - public static final long CKM_ARIA_ECB = 0x00000561L; - public static final long CKM_ARIA_CBC = 0x00000562L; - public static final long CKM_ARIA_MAC = 0x00000563L; - public static final long CKM_ARIA_MAC_GENERAL = 0x00000564L; - public static final long CKM_ARIA_CBC_PAD = 0x00000565L; - public static final long CKM_ARIA_ECB_ENCRYPT_DATA = 0x00000566L; - public static final long CKM_ARIA_CBC_ENCRYPT_DATA = 0x00000567L; - */ - // NSS private public static final long CKM_NSS_TLS_PRF_GENERAL = 0x80000373L; - // ids for our pseudo mechanisms SecureRandom and KeyStore + // internal ids for our pseudo mechanisms SecureRandom and KeyStore public static final long PCKM_SECURERANDOM = 0x7FFFFF20L; public static final long PCKM_KEYSTORE = 0x7FFFFF21L; - /* The flags are defined as follows: - * Bit Flag Mask Meaning */ - /* performed by HW */ + /* The flags specify whether or not a mechanism can be used for a + * particular task */ public static final long CKF_HW = 0x00000001L; - - /* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN, - * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER, - * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP, - * and CKF_DERIVE are new for v2.0. They specify whether or not - * a mechanism can be used for a particular task */ public static final long CKF_ENCRYPT = 0x00000100L; public static final long CKF_DECRYPT = 0x00000200L; public static final long CKF_DIGEST = 0x00000400L; @@ -758,152 +826,141 @@ public static final long CKF_UNWRAP = 0x00040000L; public static final long CKF_DERIVE = 0x00080000L; - /* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE, - * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They - * describe a token's EC capabilities not available in mechanism - * information. */ - public static final long CKF_EC_F_P = 0x00100000L; - public static final long CKF_EC_F_2M = 0x00200000L; - public static final long CKF_EC_ECPARAMETERS = 0x00400000L; - public static final long CKF_EC_NAMEDCURVE = 0x00800000L; - public static final long CKF_EC_UNCOMPRESS = 0x01000000L; - public static final long CKF_EC_COMPRESS = 0x02000000L; + /* Describe a token's EC capabilities not available in mechanism + * information. + */ + public static final long CKF_EC_F_P = 0x00100000L; + public static final long CKF_EC_F_2M = 0x00200000L; + public static final long CKF_EC_ECPARAMETERS = 0x00400000L; + public static final long CKF_EC_NAMEDCURVE = 0x00800000L; + public static final long CKF_EC_UNCOMPRESS = 0x01000000L; + public static final long CKF_EC_COMPRESS = 0x02000000L; - /* FALSE for 2.01 */ public static final long CKF_EXTENSION = 0x80000000L; - /* CK_RV is a value that identifies the return value of a - * Cryptoki function */ - /* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */ - public static final long CKR_OK = 0x00000000L; - public static final long CKR_CANCEL = 0x00000001L; - public static final long CKR_HOST_MEMORY = 0x00000002L; - public static final long CKR_SLOT_ID_INVALID = 0x00000003L; + /* Identifies the return value of a Cryptoki function */ + public static final long CKR_OK = 0x00000000L; + public static final long CKR_CANCEL = 0x00000001L; + public static final long CKR_HOST_MEMORY = 0x00000002L; + public static final long CKR_SLOT_ID_INVALID = 0x00000003L; - /* CKR_FLAGS_INVALID was removed for v2.0 */ + public static final long CKR_GENERAL_ERROR = 0x00000005L; + public static final long CKR_FUNCTION_FAILED = 0x00000006L; - /* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */ - public static final long CKR_GENERAL_ERROR = 0x00000005L; - public static final long CKR_FUNCTION_FAILED = 0x00000006L; + public static final long CKR_ARGUMENTS_BAD = 0x00000007L; + public static final long CKR_NO_EVENT = 0x00000008L; + public static final long CKR_NEED_TO_CREATE_THREADS + = 0x00000009L; + public static final long CKR_CANT_LOCK = 0x0000000AL; - /* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS, - * and CKR_CANT_LOCK are new for v2.01 */ - public static final long CKR_ARGUMENTS_BAD = 0x00000007L; - public static final long CKR_NO_EVENT = 0x00000008L; - public static final long CKR_NEED_TO_CREATE_THREADS = 0x00000009L; - public static final long CKR_CANT_LOCK = 0x0000000AL; + public static final long CKR_ATTRIBUTE_READ_ONLY = 0x00000010L; + public static final long CKR_ATTRIBUTE_SENSITIVE = 0x00000011L; + public static final long CKR_ATTRIBUTE_TYPE_INVALID = 0x00000012L; + public static final long CKR_ATTRIBUTE_VALUE_INVALID = 0x00000013L; + public static final long CKR_ACTION_PROHIBITED = 0x0000001BL; - public static final long CKR_ATTRIBUTE_READ_ONLY = 0x00000010L; - public static final long CKR_ATTRIBUTE_SENSITIVE = 0x00000011L; - public static final long CKR_ATTRIBUTE_TYPE_INVALID = 0x00000012L; - public static final long CKR_ATTRIBUTE_VALUE_INVALID = 0x00000013L; - public static final long CKR_DATA_INVALID = 0x00000020L; - public static final long CKR_DATA_LEN_RANGE = 0x00000021L; - public static final long CKR_DEVICE_ERROR = 0x00000030L; - public static final long CKR_DEVICE_MEMORY = 0x00000031L; - public static final long CKR_DEVICE_REMOVED = 0x00000032L; - public static final long CKR_ENCRYPTED_DATA_INVALID = 0x00000040L; - public static final long CKR_ENCRYPTED_DATA_LEN_RANGE = 0x00000041L; - public static final long CKR_FUNCTION_CANCELED = 0x00000050L; - public static final long CKR_FUNCTION_NOT_PARALLEL = 0x00000051L; + public static final long CKR_DATA_INVALID = 0x00000020L; + public static final long CKR_DATA_LEN_RANGE = 0x00000021L; + public static final long CKR_DEVICE_ERROR = 0x00000030L; + public static final long CKR_DEVICE_MEMORY = 0x00000031L; + public static final long CKR_DEVICE_REMOVED = 0x00000032L; + public static final long CKR_ENCRYPTED_DATA_INVALID = 0x00000040L; + public static final long CKR_ENCRYPTED_DATA_LEN_RANGE = 0x00000041L; + public static final long CKR_FUNCTION_CANCELED = 0x00000050L; + public static final long CKR_FUNCTION_NOT_PARALLEL = 0x00000051L; - /* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */ - public static final long CKR_FUNCTION_NOT_SUPPORTED = 0x00000054L; + public static final long CKR_FUNCTION_NOT_SUPPORTED = 0x00000054L; - public static final long CKR_KEY_HANDLE_INVALID = 0x00000060L; + public static final long CKR_KEY_HANDLE_INVALID = 0x00000060L; + + public static final long CKR_KEY_SIZE_RANGE = 0x00000062L; + public static final long CKR_KEY_TYPE_INCONSISTENT = 0x00000063L; - /* CKR_KEY_SENSITIVE was removed for v2.0 */ - - public static final long CKR_KEY_SIZE_RANGE = 0x00000062L; - public static final long CKR_KEY_TYPE_INCONSISTENT = 0x00000063L; + public static final long CKR_KEY_NOT_NEEDED = 0x00000064L; + public static final long CKR_KEY_CHANGED = 0x00000065L; + public static final long CKR_KEY_NEEDED = 0x00000066L; + public static final long CKR_KEY_INDIGESTIBLE = 0x00000067L; + public static final long CKR_KEY_FUNCTION_NOT_PERMITTED = 0x00000068L; + public static final long CKR_KEY_NOT_WRAPPABLE = 0x00000069L; + public static final long CKR_KEY_UNEXTRACTABLE = 0x0000006AL; - /* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED, - * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED, - * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for - * v2.0 */ - public static final long CKR_KEY_NOT_NEEDED = 0x00000064L; - public static final long CKR_KEY_CHANGED = 0x00000065L; - public static final long CKR_KEY_NEEDED = 0x00000066L; - public static final long CKR_KEY_INDIGESTIBLE = 0x00000067L; - public static final long CKR_KEY_FUNCTION_NOT_PERMITTED = 0x00000068L; - public static final long CKR_KEY_NOT_WRAPPABLE = 0x00000069L; - public static final long CKR_KEY_UNEXTRACTABLE = 0x0000006AL; + public static final long CKR_MECHANISM_INVALID = 0x00000070L; + public static final long CKR_MECHANISM_PARAM_INVALID = 0x00000071L; - public static final long CKR_MECHANISM_INVALID = 0x00000070L; - public static final long CKR_MECHANISM_PARAM_INVALID = 0x00000071L; + public static final long CKR_OBJECT_HANDLE_INVALID = 0x00000082L; + public static final long CKR_OPERATION_ACTIVE = 0x00000090L; + public static final long CKR_OPERATION_NOT_INITIALIZED = 0x00000091L; + public static final long CKR_PIN_INCORRECT = 0x000000A0L; + public static final long CKR_PIN_INVALID = 0x000000A1L; + public static final long CKR_PIN_LEN_RANGE = 0x000000A2L; + + public static final long CKR_PIN_EXPIRED = 0x000000A3L; + public static final long CKR_PIN_LOCKED = 0x000000A4L; - /* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID - * were removed for v2.0 */ - public static final long CKR_OBJECT_HANDLE_INVALID = 0x00000082L; - public static final long CKR_OPERATION_ACTIVE = 0x00000090L; - public static final long CKR_OPERATION_NOT_INITIALIZED = 0x00000091L; - public static final long CKR_PIN_INCORRECT = 0x000000A0L; - public static final long CKR_PIN_INVALID = 0x000000A1L; - public static final long CKR_PIN_LEN_RANGE = 0x000000A2L; + public static final long CKR_SESSION_CLOSED = 0x000000B0L; + public static final long CKR_SESSION_COUNT = 0x000000B1L; + public static final long CKR_SESSION_HANDLE_INVALID = 0x000000B3L; + public static final long CKR_SESSION_PARALLEL_NOT_SUPPORTED = 0x000000B4L; + public static final long CKR_SESSION_READ_ONLY = 0x000000B5L; + public static final long CKR_SESSION_EXISTS = 0x000000B6L; + + public static final long CKR_SESSION_READ_ONLY_EXISTS = 0x000000B7L; + public static final long CKR_SESSION_READ_WRITE_SO_EXISTS = 0x000000B8L; - /* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */ - public static final long CKR_PIN_EXPIRED = 0x000000A3L; - public static final long CKR_PIN_LOCKED = 0x000000A4L; + public static final long CKR_SIGNATURE_INVALID = 0x000000C0L; + public static final long CKR_SIGNATURE_LEN_RANGE = 0x000000C1L; + public static final long CKR_TEMPLATE_INCOMPLETE = 0x000000D0L; + public static final long CKR_TEMPLATE_INCONSISTENT = 0x000000D1L; + public static final long CKR_TOKEN_NOT_PRESENT = 0x000000E0L; + public static final long CKR_TOKEN_NOT_RECOGNIZED = 0x000000E1L; + public static final long CKR_TOKEN_WRITE_PROTECTED = 0x000000E2L; + public static final long CKR_UNWRAPPING_KEY_HANDLE_INVALID = 0x000000F0L; + public static final long CKR_UNWRAPPING_KEY_SIZE_RANGE = 0x000000F1L; + public static final long CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT + = 0x000000F2L; + public static final long CKR_USER_ALREADY_LOGGED_IN = 0x00000100L; + public static final long CKR_USER_NOT_LOGGED_IN = 0x00000101L; + public static final long CKR_USER_PIN_NOT_INITIALIZED = 0x00000102L; + public static final long CKR_USER_TYPE_INVALID = 0x00000103L; - public static final long CKR_SESSION_CLOSED = 0x000000B0L; - public static final long CKR_SESSION_COUNT = 0x000000B1L; - public static final long CKR_SESSION_HANDLE_INVALID = 0x000000B3L; - public static final long CKR_SESSION_PARALLEL_NOT_SUPPORTED = 0x000000B4L; - public static final long CKR_SESSION_READ_ONLY = 0x000000B5L; - public static final long CKR_SESSION_EXISTS = 0x000000B6L; - - /* CKR_SESSION_READ_ONLY_EXISTS and - * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */ - public static final long CKR_SESSION_READ_ONLY_EXISTS = 0x000000B7L; - public static final long CKR_SESSION_READ_WRITE_SO_EXISTS = 0x000000B8L; + public static final long CKR_USER_ANOTHER_ALREADY_LOGGED_IN = 0x00000104L; + public static final long CKR_USER_TOO_MANY_TYPES = 0x00000105L; - public static final long CKR_SIGNATURE_INVALID = 0x000000C0L; - public static final long CKR_SIGNATURE_LEN_RANGE = 0x000000C1L; - public static final long CKR_TEMPLATE_INCOMPLETE = 0x000000D0L; - public static final long CKR_TEMPLATE_INCONSISTENT = 0x000000D1L; - public static final long CKR_TOKEN_NOT_PRESENT = 0x000000E0L; - public static final long CKR_TOKEN_NOT_RECOGNIZED = 0x000000E1L; - public static final long CKR_TOKEN_WRITE_PROTECTED = 0x000000E2L; - public static final long CKR_UNWRAPPING_KEY_HANDLE_INVALID = 0x000000F0L; - public static final long CKR_UNWRAPPING_KEY_SIZE_RANGE = 0x000000F1L; - public static final long CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT = 0x000000F2L; - public static final long CKR_USER_ALREADY_LOGGED_IN = 0x00000100L; - public static final long CKR_USER_NOT_LOGGED_IN = 0x00000101L; - public static final long CKR_USER_PIN_NOT_INITIALIZED = 0x00000102L; - public static final long CKR_USER_TYPE_INVALID = 0x00000103L; + public static final long CKR_WRAPPED_KEY_INVALID = 0x00000110L; + public static final long CKR_WRAPPED_KEY_LEN_RANGE = 0x00000112L; + public static final long CKR_WRAPPING_KEY_HANDLE_INVALID = 0x00000113L; + public static final long CKR_WRAPPING_KEY_SIZE_RANGE = 0x00000114L; + public static final long CKR_WRAPPING_KEY_TYPE_INCONSISTENT = 0x00000115L; + public static final long CKR_RANDOM_SEED_NOT_SUPPORTED = 0x00000120L; - /* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES - * are new to v2.01 */ - public static final long CKR_USER_ANOTHER_ALREADY_LOGGED_IN = 0x00000104L; - public static final long CKR_USER_TOO_MANY_TYPES = 0x00000105L; + public static final long CKR_RANDOM_NO_RNG = 0x00000121L; + + public static final long CKR_DOMAIN_PARAMS_INVALID = 0x00000130L; + + public static final long CKR_CURVE_NOT_SUPPORTED = 0x00000140L; - public static final long CKR_WRAPPED_KEY_INVALID = 0x00000110L; - public static final long CKR_WRAPPED_KEY_LEN_RANGE = 0x00000112L; - public static final long CKR_WRAPPING_KEY_HANDLE_INVALID = 0x00000113L; - public static final long CKR_WRAPPING_KEY_SIZE_RANGE = 0x00000114L; - public static final long CKR_WRAPPING_KEY_TYPE_INCONSISTENT = 0x00000115L; - public static final long CKR_RANDOM_SEED_NOT_SUPPORTED = 0x00000120L; + public static final long CKR_BUFFER_TOO_SMALL = 0x00000150L; + public static final long CKR_SAVED_STATE_INVALID = 0x00000160L; + public static final long CKR_INFORMATION_SENSITIVE = 0x00000170L; + public static final long CKR_STATE_UNSAVEABLE = 0x00000180L; - /* These are new to v2.0 */ - public static final long CKR_RANDOM_NO_RNG = 0x00000121L; - - /* These are new to v2.11 */ - public static final long CKR_DOMAIN_PARAMS_INVALID = 0x00000130L; + public static final long CKR_CRYPTOKI_NOT_INITIALIZED = 0x00000190L; + public static final long CKR_CRYPTOKI_ALREADY_INITIALIZED = 0x00000191L; + public static final long CKR_MUTEX_BAD = 0x000001A0L; + public static final long CKR_MUTEX_NOT_LOCKED = 0x000001A1L; - /* These are new to v2.0 */ - public static final long CKR_BUFFER_TOO_SMALL = 0x00000150L; - public static final long CKR_SAVED_STATE_INVALID = 0x00000160L; - public static final long CKR_INFORMATION_SENSITIVE = 0x00000170L; - public static final long CKR_STATE_UNSAVEABLE = 0x00000180L; + public static final long CKR_NEW_PIN_MODE = 0x000001B0L; + public static final long CKR_NEXT_OTP = 0x000001B1L; - /* These are new to v2.01 */ - public static final long CKR_CRYPTOKI_NOT_INITIALIZED = 0x00000190L; - public static final long CKR_CRYPTOKI_ALREADY_INITIALIZED = 0x00000191L; - public static final long CKR_MUTEX_BAD = 0x000001A0L; - public static final long CKR_MUTEX_NOT_LOCKED = 0x000001A1L; + public static final long CKR_EXCEEDED_MAX_ITERATIONS = 0x000001B5L; + public static final long CKR_FIPS_SELF_TEST_FAILED = 0x000001B6L; + public static final long CKR_LIBRARY_LOAD_FAILED = 0x000001B7L; + public static final long CKR_PIN_TOO_WEAK = 0x000001B8L; + public static final long CKR_PUBLIC_KEY_INVALID = 0x000001B9L; + public static final long CKR_FUNCTION_REJECTED = 0x00000200L; - public static final long CKR_VENDOR_DEFINED = 0x80000000L; + public static final long CKR_VENDOR_DEFINED = 0x80000000L; /* flags: bit flags that provide capabilities of the slot @@ -916,31 +973,56 @@ /* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */ public static final long CKF_DONT_BLOCK = 1L; - /* The following MGFs are defined */ - public static final long CKG_MGF1_SHA1 = 0x00000001L; - // new for v2.20 amendment 3 + public static final long CKG_MGF1_SHA1 = 0x00000001L; + public static final long CKG_MGF1_SHA256 = 0x00000002L; + public static final long CKG_MGF1_SHA384 = 0x00000003L; + public static final long CKG_MGF1_SHA512 = 0x00000004L; public static final long CKG_MGF1_SHA224 = 0x00000005L; /* The following encoding parameter sources are defined */ public static final long CKZ_DATA_SPECIFIED = 0x00000001L; - /* The following PRFs are defined in PKCS #5 v2.0. */ - public static final long CKP_PKCS5_PBKD2_HMAC_SHA1 = 0x00000001L; - - - /* The following salt value sources are defined in PKCS #5 v2.0. */ - public static final long CKZ_SALT_SPECIFIED = 0x00000001L; - /* the following EC Key Derivation Functions are defined */ - public static final long CKD_NULL = 0x00000001L; - public static final long CKD_SHA1_KDF = 0x00000002L; + public static final long CKD_NULL = 0x00000001L; + public static final long CKD_SHA1_KDF = 0x00000002L; /* the following X9.42 Diffie-Hellman Key Derivation Functions are defined */ - public static final long CKD_SHA1_KDF_ASN1 = 0x00000003L; - public static final long CKD_SHA1_KDF_CONCATENATE = 0x00000004L; + public static final long CKD_SHA1_KDF_ASN1 = 0x00000003L; + public static final long CKD_SHA1_KDF_CONCATENATE = 0x00000004L; + public static final long CKD_SHA224_KDF = 0x00000005L; + public static final long CKD_SHA256_KDF = 0x00000006L; + public static final long CKD_SHA384_KDF = 0x00000007L; + public static final long CKD_SHA512_KDF = 0x00000008L; + public static final long CKD_CPDIVERSIFY_KDF = 0x00000009L; + + public static final long CKP_PKCS5_PBKD2_HMAC_SHA1 = 0x00000001L; + public static final long CKP_PKCS5_PBKD2_HMAC_GOSTR3411 = 0x00000002L; + public static final long CKP_PKCS5_PBKD2_HMAC_SHA224 = 0x00000003L; + public static final long CKP_PKCS5_PBKD2_HMAC_SHA256 = 0x00000004L; + public static final long CKP_PKCS5_PBKD2_HMAC_SHA384 = 0x00000005L; + public static final long CKP_PKCS5_PBKD2_HMAC_SHA512 = 0x00000006L; + public static final long CKP_PKCS5_PBKD2_HMAC_SHA512_224 = 0x00000007L; + public static final long CKP_PKCS5_PBKD2_HMAC_SHA512_256 = 0x00000008L; + public static final long CKZ_SALT_SPECIFIED = 0x00000001L; + + public static final long CK_OTP_VALUE = 0x00000000L; + public static final long CK_OTP_PIN = 0x00000001L; + public static final long CK_OTP_CHALLENGE = 0x00000002L; + public static final long CK_OTP_TIME = 0x00000003L; + public static final long CK_OTP_COUNTER = 0x00000004L; + public static final long CK_OTP_FLAGS = 0x00000005L; + public static final long CK_OTP_OUTPUT_LENGTH = 0x00000006L; + public static final long CK_OTP_OUTPUT_FORMAT = 0x00000007L; + + public static final long CKF_NEXT_OTP = 0x00000001L; + public static final long CKF_EXCLUDE_TIME = 0x00000002L; + public static final long CKF_EXCLUDE_COUNTER = 0x00000004L; + public static final long CKF_EXCLUDE_CHALLENGE = 0x00000008L; + public static final long CKF_EXCLUDE_PIN = 0x00000010L; + public static final long CKF_USER_FRIENDLY_OTP = 0x00000020L; // private NSS attribute (for DSA and DH private keys) public static final long CKA_NETSCAPE_DB = 0xD5A0DB00L; diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java Fri Jun 21 14:07:48 2019 +0530 @@ -88,6 +88,7 @@ 0x00000011, 0x00000012, 0x00000013, + 0x0000001B, 0x00000020, 0x00000021, 0x00000030, @@ -158,6 +159,13 @@ 0x00000191, 0x000001A0, 0x000001A1, + 0x000001B0, + 0x000001B1, + 0x000001B5, + 0x000001B6, + 0x000001B7, + 0x000001B8, + 0x000001B9, 0x00000200, 0x80000000, }; @@ -176,6 +184,7 @@ "CKR_ATTRIBUTE_SENSITIVE", "CKR_ATTRIBUTE_TYPE_INVALID", "CKR_ATTRIBUTE_VALUE_INVALID", + "CKR_ACTION_PROHIBITED", "CKR_DATA_INVALID", "CKR_DATA_LEN_RANGE", "CKR_DEVICE_ERROR", @@ -246,6 +255,13 @@ "CKR_CRYPTOKI_ALREADY_INITIALIZED", "CKR_MUTEX_BAD", "CKR_MUTEX_NOT_LOCKED", + "CKR_NEW_PIN_MODE", + "CKR_NEXT_OTP", + "CKR_EXCEEDED_MAX_ITERATIONS", + "CKR_FIPS_SELF_TEST_FAILED", + "CKR_LIBRARY_LOAD_FAILED", + "CKR_PIN_TOO_WEAK", + "CKR_PUBLIC_KEY_INVALID", "CKR_FUNCTION_REJECTED", "CKR_VENDOR_DEFINED", }; diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/legal/pkcs11cryptotoken.md --- a/src/jdk.crypto.cryptoki/share/legal/pkcs11cryptotoken.md Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/legal/pkcs11cryptotoken.md Fri Jun 21 14:07:48 2019 +0530 @@ -1,20 +1,32 @@ -## PKCS #11 Cryptographic Token Interface v2.20 Amendment 3 Header Files +ASIS PKCS #11 Cryptographic Token Interface v2.40 + +### OASIS PKCS #11 Cryptographic Token Interface License +``` -### PKCS #11 Cryptographic Token Interface License -
    +Copyright (c) OASIS Open 2016. All Rights Reserved.
     
    -License to copy and use this software is granted provided that it is
    -identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
    -(Cryptoki)" in all material mentioning or referencing this software.
    +All capitalized terms in the following text have the meanings assigned to them in the OASIS
    +Intellectual Property Rights Policy (the "OASIS IPR Policy"). The full Policy may be found at the
    +OASIS website: [http://www.oasis-open.org/policies-guidelines/ipr]
     
    -License is also granted to make and use derivative works provided that
    -such works are identified as "derived from the RSA Security Inc. PKCS #11
    -Cryptographic Token Interface (Cryptoki)" in all material mentioning or
    -referencing the derived work.
    +This document and translations of it may be copied and furnished to others, and derivative works
    +that comment on or otherwise explain it or assist in its implementation may be prepared, copied,
    +published, and distributed, in whole or in part, without restriction of any kind, provided that
    +the above copyright notice and this section are included on all such copies and derivative works.
    +However, this document itself may not be modified in any way, including by removing the copyright
    +notice or references to OASIS, except as needed for the purpose of developing any document or
    +deliverable produced by an OASIS Technical Committee (in which case the rules applicable to
    +copyrights, as set forth in the OASIS IPR Policy, must be followed) or as required to translate it
    +into languages other than English.
     
    -RSA Security Inc. makes no representations concerning either the
    -merchantability of this software or the suitability of this software for
    -any particular purpose. It is provided "as is" without express or implied
    -warranty of any kind.
    +The limited permissions granted above are perpetual and will not be revoked by OASIS or its
    +successors or assigns.
     
    -
    +This document and the information contained herein is provided on an "AS IS" basis and OASIS +DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE +USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. OASIS AND ITS MEMBERS WILL NOT BE LIABLE FOR +ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THIS DOCUMENT OR +ANY PART THEREOF. + +``` diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_convert.c --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_convert.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_convert.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -68,7 +68,8 @@ /* declare file private functions */ -void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam, CK_VOID_PTR *ckpParamPtr, CK_ULONG *ckpLength); +CK_VOID_PTR jMechParamToCKMechParamPtrSlow(JNIEnv *env, jobject jParam, + CK_MECHANISM_TYPE ckMech, CK_ULONG *ckpLength); /* @@ -425,8 +426,8 @@ memset(&ckAttribute, 0, sizeof(CK_ATTRIBUTE)); // TBD: what if jAttribute == NULL?! + TRACE0("\nDEBUG: jAttributeToCKAttribute"); - TRACE0("\nDEBUG: jAttributeToCKAttribute"); /* get CK_ATTRIBUTE class */ TRACE0(", getting attribute object class"); jAttributeClass = (*env)->GetObjectClass(env, jAttribute); @@ -437,7 +438,7 @@ jFieldID = (*env)->GetFieldID(env, jAttributeClass, "type", "J"); if (jFieldID == NULL) { return ckAttribute; } jType = (*env)->GetLongField(env, jAttribute, jFieldID); - TRACE1(", type=0x%X", jType); + TRACE1(", type=0x%lX", jType); /* get pValue */ TRACE0(", getting pValue field"); @@ -450,9 +451,9 @@ TRACE0(", converting pValue to primitive object"); /* convert the Java pValue object to a CK-type pValue pointer */ - jObjectToPrimitiveCKObjectPtrPtr(env, jPValue, &(ckAttribute.pValue), &(ckAttribute.ulValueLen)); + ckAttribute.pValue = jObjectToPrimitiveCKObjectPtr(env, jPValue, &(ckAttribute.ulValueLen)); - TRACE0("\nFINISHED\n"); + TRACE0("\nDEBUG: jAttributeToCKAttribute FINISHED\n"); return ckAttribute ; } @@ -515,22 +516,19 @@ * * @param env - used to call JNI functions to get the Java classes and objects * @param jParam - the Java CK_SSL3_MASTER_KEY_DERIVE_PARAMS object to convert - * @return - the new CK_SSL3_MASTER_KEY_DERIVE_PARAMS structure + * @param ckParamPtr - pointer to the new CK_SSL3_MASTER_KEY_DERIVE_PARAMS structure */ -CK_SSL3_MASTER_KEY_DERIVE_PARAMS -jSsl3MasterKeyDeriveParamToCKSsl3MasterKeyDeriveParam(JNIEnv *env, - jobject jParam) +void jSsl3MasterKeyDeriveParamToCKSsl3MasterKeyDeriveParam(JNIEnv *env, + jobject jParam, CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR ckParamPtr) { - CK_SSL3_MASTER_KEY_DERIVE_PARAMS ckParam; jclass jSsl3MasterKeyDeriveParamsClass; - memset(&ckParam, 0, sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS)); jSsl3MasterKeyDeriveParamsClass = (*env)->FindClass(env, CLASS_SSL3_MASTER_KEY_DERIVE_PARAMS); - if (jSsl3MasterKeyDeriveParamsClass == NULL) { return ckParam; } + if (jSsl3MasterKeyDeriveParamsClass == NULL) { return; } masterKeyDeriveParamToCKMasterKeyDeriveParam(env, jParam, jSsl3MasterKeyDeriveParamsClass, - &ckParam.pVersion, &ckParam.RandomInfo); - return ckParam; + &(ckParamPtr->pVersion), &(ckParamPtr->RandomInfo)); } /* @@ -539,123 +537,116 @@ * * @param env - used to call JNI functions to get the Java classes and objects * @param jParam - the Java CK_TLS12_MASTER_KEY_DERIVE_PARAMS object to convert - * @return - the new CK_TLS12_MASTER_KEY_DERIVE_PARAMS structure + * @param ckParamPtr - pointer to the new CK_TLS12_MASTER_KEY_DERIVE_PARAMS structure */ -CK_TLS12_MASTER_KEY_DERIVE_PARAMS -jTls12MasterKeyDeriveParamToCKTls12MasterKeyDeriveParam(JNIEnv *env, - jobject jParam) +void jTls12MasterKeyDeriveParamToCKTls12MasterKeyDeriveParam(JNIEnv *env, + jobject jParam, CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR ckParamPtr) { - CK_TLS12_MASTER_KEY_DERIVE_PARAMS ckParam; jclass jTls12MasterKeyDeriveParamsClass; jfieldID fieldID; - memset(&ckParam, 0, sizeof(CK_TLS12_MASTER_KEY_DERIVE_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_TLS12_MASTER_KEY_DERIVE_PARAMS)); jTls12MasterKeyDeriveParamsClass = (*env)->FindClass(env, CLASS_TLS12_MASTER_KEY_DERIVE_PARAMS); - if (jTls12MasterKeyDeriveParamsClass == NULL) { return ckParam; } + if (jTls12MasterKeyDeriveParamsClass == NULL) { return; } masterKeyDeriveParamToCKMasterKeyDeriveParam(env, jParam, - jTls12MasterKeyDeriveParamsClass, &ckParam.pVersion, - &ckParam.RandomInfo); + jTls12MasterKeyDeriveParamsClass, &ckParamPtr->pVersion, + &ckParamPtr->RandomInfo); fieldID = (*env)->GetFieldID(env, jTls12MasterKeyDeriveParamsClass, "prfHashMechanism", "J"); if (fieldID != NULL) { jlong prfHashMechanism = (*env)->GetLongField(env, jParam, fieldID); - ckParam.prfHashMechanism = (CK_MECHANISM_TYPE)prfHashMechanism; + ckParamPtr->prfHashMechanism = (CK_MECHANISM_TYPE)prfHashMechanism; } - return ckParam; } /* * converts the Java CK_TLS_PRF_PARAMS object to a CK_TLS_PRF_PARAMS structure */ -CK_TLS_PRF_PARAMS jTlsPrfParamsToCKTlsPrfParam(JNIEnv *env, jobject jParam) +void jTlsPrfParamsToCKTlsPrfParam(JNIEnv *env, jobject jParam, +CK_TLS_PRF_PARAMS_PTR ckParamPtr) { jclass jTlsPrfParamsClass; - CK_TLS_PRF_PARAMS ckParam; jfieldID fieldID; jobject jSeed, jLabel, jOutput; - memset(&ckParam, 0, sizeof(CK_TLS_PRF_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_TLS_PRF_PARAMS)); // TBD: what if jParam == NULL?! /* get pSeed */ jTlsPrfParamsClass = (*env)->FindClass(env, CLASS_TLS_PRF_PARAMS); - if (jTlsPrfParamsClass == NULL) { return ckParam; } + if (jTlsPrfParamsClass == NULL) { return; } fieldID = (*env)->GetFieldID(env, jTlsPrfParamsClass, "pSeed", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jSeed = (*env)->GetObjectField(env, jParam, fieldID); /* get pLabel */ fieldID = (*env)->GetFieldID(env, jTlsPrfParamsClass, "pLabel", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jLabel = (*env)->GetObjectField(env, jParam, fieldID); /* get pOutput */ fieldID = (*env)->GetFieldID(env, jTlsPrfParamsClass, "pOutput", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jOutput = (*env)->GetObjectField(env, jParam, fieldID); /* populate java values */ - jByteArrayToCKByteArray(env, jSeed, &(ckParam.pSeed), &(ckParam.ulSeedLen)); - if ((*env)->ExceptionCheck(env)) { return ckParam; } - jByteArrayToCKByteArray(env, jLabel, &(ckParam.pLabel), &(ckParam.ulLabelLen)); + jByteArrayToCKByteArray(env, jSeed, &(ckParamPtr->pSeed), &(ckParamPtr->ulSeedLen)); + if ((*env)->ExceptionCheck(env)) { return; } + jByteArrayToCKByteArray(env, jLabel, &(ckParamPtr->pLabel), &(ckParamPtr->ulLabelLen)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pSeed); - return ckParam; + free(ckParamPtr->pSeed); + return; } - ckParam.pulOutputLen = malloc(sizeof(CK_ULONG)); - if (ckParam.pulOutputLen == NULL) { - free(ckParam.pSeed); - free(ckParam.pLabel); + ckParamPtr->pulOutputLen = malloc(sizeof(CK_ULONG)); + if (ckParamPtr->pulOutputLen == NULL) { + free(ckParamPtr->pSeed); + free(ckParamPtr->pLabel); throwOutOfMemoryError(env, 0); - return ckParam; + return; } - jByteArrayToCKByteArray(env, jOutput, &(ckParam.pOutput), ckParam.pulOutputLen); + jByteArrayToCKByteArray(env, jOutput, &(ckParamPtr->pOutput), ckParamPtr->pulOutputLen); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pSeed); - free(ckParam.pLabel); - free(ckParam.pulOutputLen); - return ckParam; + free(ckParamPtr->pSeed); + free(ckParamPtr->pLabel); + free(ckParamPtr->pOutput); + return; } - - return ckParam ; } /* * converts the Java CK_TLS_MAC_PARAMS object to a CK_TLS_MAC_PARAMS structure */ -CK_TLS_MAC_PARAMS jTlsMacParamsToCKTlsMacParam(JNIEnv *env, jobject jParam) +void jTlsMacParamsToCKTlsMacParam(JNIEnv *env, jobject jParam, + CK_TLS_MAC_PARAMS_PTR ckParamPtr) { jclass jTlsMacParamsClass; - CK_TLS_MAC_PARAMS ckParam; jfieldID fieldID; jlong jPrfMechanism, jUlMacLength, jUlServerOrClient; - memset(&ckParam, 0, sizeof(CK_TLS_MAC_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_TLS_MAC_PARAMS)); jTlsMacParamsClass = (*env)->FindClass(env, CLASS_TLS_MAC_PARAMS); - if (jTlsMacParamsClass == NULL) { return ckParam; } + if (jTlsMacParamsClass == NULL) { return; } /* get prfMechanism */ fieldID = (*env)->GetFieldID(env, jTlsMacParamsClass, "prfMechanism", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPrfMechanism = (*env)->GetLongField(env, jParam, fieldID); /* get ulMacLength */ fieldID = (*env)->GetFieldID(env, jTlsMacParamsClass, "ulMacLength", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jUlMacLength = (*env)->GetLongField(env, jParam, fieldID); /* get ulServerOrClient */ fieldID = (*env)->GetFieldID(env, jTlsMacParamsClass, "ulServerOrClient", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jUlServerOrClient = (*env)->GetLongField(env, jParam, fieldID); /* populate java values */ - ckParam.prfMechanism = jLongToCKULong(jPrfMechanism); - ckParam.ulMacLength = jLongToCKULong(jUlMacLength); - ckParam.ulServerOrClient = jLongToCKULong(jUlServerOrClient); - - return ckParam; + ckParamPtr->prfMechanism = jLongToCKULong(jPrfMechanism); + ckParamPtr->ulMacLength = jLongToCKULong(jUlMacLength); + ckParamPtr->ulServerOrClient = jLongToCKULong(jUlServerOrClient); } void keyMatParamToCKKeyMatParam(JNIEnv *env, jobject jParam, @@ -747,7 +738,7 @@ free(cKKeyMatParamRandomInfo->pClientRandom); return; } - /* allocate memory for pRetrunedKeyMaterial */ + /* allocate memory for pReturnedKeyMaterial */ *cKKeyMatParamPReturnedKeyMaterial = (CK_SSL3_KEY_MAT_OUT_PTR)malloc(sizeof(CK_SSL3_KEY_MAT_OUT)); if (*cKKeyMatParamPReturnedKeyMaterial == NULL) { @@ -789,22 +780,20 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java CK_SSL3_KEY_MAT_PARAMS object to convert - * @return - the new CK_SSL3_KEY_MAT_PARAMS structure + * @param ckParamPtr - pointer to the new CK_SSL3_KEY_MAT_PARAMS structure */ -CK_SSL3_KEY_MAT_PARAMS -jSsl3KeyMatParamToCKSsl3KeyMatParam(JNIEnv *env, jobject jParam) +void jSsl3KeyMatParamToCKSsl3KeyMatParam(JNIEnv *env, jobject jParam, + CK_SSL3_KEY_MAT_PARAMS_PTR ckParamPtr) { - CK_SSL3_KEY_MAT_PARAMS ckParam; jclass jSsl3KeyMatParamsClass; - memset(&ckParam, 0, sizeof(CK_SSL3_KEY_MAT_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_SSL3_KEY_MAT_PARAMS)); jSsl3KeyMatParamsClass = (*env)->FindClass(env, CLASS_SSL3_KEY_MAT_PARAMS); - if (jSsl3KeyMatParamsClass == NULL) { return ckParam; } + if (jSsl3KeyMatParamsClass == NULL) { return; } keyMatParamToCKKeyMatParam(env, jParam, jSsl3KeyMatParamsClass, - &ckParam.ulMacSizeInBits, &ckParam.ulKeySizeInBits, - &ckParam.ulIVSizeInBits, &ckParam.bIsExport, - &ckParam.RandomInfo, &ckParam.pReturnedKeyMaterial); - return ckParam; + &(ckParamPtr->ulMacSizeInBits), &(ckParamPtr->ulKeySizeInBits), + &(ckParamPtr->ulIVSizeInBits), &(ckParamPtr->bIsExport), + &(ckParamPtr->RandomInfo), &(ckParamPtr->pReturnedKeyMaterial)); } /* @@ -813,29 +802,27 @@ * * @param env - used to call JNI functions to get the Java classes and objects * @param jParam - the Java CK_TLS12_KEY_MAT_PARAMS object to convert - * @return - the new CK_TLS12_KEY_MAT_PARAMS structure + * @param ckParamPtr - pointer to the new CK_TLS12_KEY_MAT_PARAMS structure */ -CK_TLS12_KEY_MAT_PARAMS jTls12KeyMatParamToCKTls12KeyMatParam(JNIEnv *env, - jobject jParam) +void jTls12KeyMatParamToCKTls12KeyMatParam(JNIEnv *env, + jobject jParam, CK_TLS12_KEY_MAT_PARAMS_PTR ckParamPtr) { - CK_TLS12_KEY_MAT_PARAMS ckParam; jclass jTls12KeyMatParamsClass; jfieldID fieldID; - memset(&ckParam, 0, sizeof(CK_TLS12_KEY_MAT_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_TLS12_KEY_MAT_PARAMS)); jTls12KeyMatParamsClass = (*env)->FindClass(env, CLASS_TLS12_KEY_MAT_PARAMS); - if (jTls12KeyMatParamsClass == NULL) { return ckParam; } + if (jTls12KeyMatParamsClass == NULL) { return; } keyMatParamToCKKeyMatParam(env, jParam, jTls12KeyMatParamsClass, - &ckParam.ulMacSizeInBits, &ckParam.ulKeySizeInBits, - &ckParam.ulIVSizeInBits, &ckParam.bIsExport, - &ckParam.RandomInfo, &ckParam.pReturnedKeyMaterial); + &(ckParamPtr->ulMacSizeInBits), &(ckParamPtr->ulKeySizeInBits), + &(ckParamPtr->ulIVSizeInBits), &(ckParamPtr->bIsExport), + &(ckParamPtr->RandomInfo), &(ckParamPtr->pReturnedKeyMaterial)); fieldID = (*env)->GetFieldID(env, jTls12KeyMatParamsClass, "prfHashMechanism", "J"); if (fieldID != NULL) { jlong prfHashMechanism = (*env)->GetLongField(env, jParam, fieldID); - ckParam.prfHashMechanism = (CK_MECHANISM_TYPE)prfHashMechanism; + ckParamPtr->prfHashMechanism = (CK_MECHANISM_TYPE)prfHashMechanism; } - return ckParam; } /* @@ -843,10 +830,10 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java CK_AES_CTR_PARAMS object to convert - * @param ckpParam - pointer to the new CK_AES_CTR_PARAMS structure + * @param ckParamPtr - pointer to the new CK_AES_CTR_PARAMS structure */ void jAesCtrParamsToCKAesCtrParam(JNIEnv *env, jobject jParam, - CK_AES_CTR_PARAMS_PTR ckpParam) { + CK_AES_CTR_PARAMS_PTR ckParamPtr) { jclass jAesCtrParamsClass; jfieldID fieldID; jlong jCounterBits; @@ -857,6 +844,9 @@ /* get ulCounterBits */ jAesCtrParamsClass = (*env)->FindClass(env, CLASS_AES_CTR_PARAMS); if (jAesCtrParamsClass == NULL) { return; } + if (!(*env)->IsInstanceOf(env, jParam, jAesCtrParamsClass)) { + return; + } fieldID = (*env)->GetFieldID(env, jAesCtrParamsClass, "ulCounterBits", "J"); if (fieldID == NULL) { return; } jCounterBits = (*env)->GetLongField(env, jParam, fieldID); @@ -867,40 +857,147 @@ jCb = (*env)->GetObjectField(env, jParam, fieldID); /* populate java values */ - ckpParam->ulCounterBits = jLongToCKULong(jCounterBits); + ckParamPtr->ulCounterBits = jLongToCKULong(jCounterBits); jByteArrayToCKByteArray(env, jCb, &ckBytes, &ckTemp); if ((*env)->ExceptionCheck(env)) { return; } if (ckTemp != 16) { - TRACE1("ERROR: WRONG CTR IV LENGTH %d", ckTemp); + TRACE1("\nERROR: WRONG CTR IV LENGTH %lu", ckTemp); } else { - memcpy(ckpParam->cb, ckBytes, ckTemp); + memcpy(ckParamPtr->cb, ckBytes, ckTemp); free(ckBytes); } } /* - * converts a Java CK_MECHANISM object into a CK_MECHANISM structure + * converts the Java CK_GCM_PARAMS object to a CK_GCM_PARAMS structure + * + * @param env - used to call JNI funktions to get the Java classes and objects + * @param jParam - the Java CK_GCM_PARAMS object to convert + * @param ckpParam - pointer to the new CK_GCM_PARAMS structure + */ +void jGCMParamsToCKGCMParam(JNIEnv *env, jobject jParam, + CK_GCM_PARAMS_PTR ckpParam) { + jclass jGcmParamsClass; + jfieldID fieldID; + jobject jIv, jAad; + jlong jTagLen; + + /* get iv */ + jGcmParamsClass = (*env)->FindClass(env, CLASS_GCM_PARAMS); + if (jGcmParamsClass == NULL) { return; } + if (!(*env)->IsInstanceOf(env, jParam, jGcmParamsClass)) { + return; + } + + fieldID = (*env)->GetFieldID(env, jGcmParamsClass, "iv", "[B"); + if (fieldID == NULL) { return; } + jIv = (*env)->GetObjectField(env, jParam, fieldID); + + /* get aad */ + fieldID = (*env)->GetFieldID(env, jGcmParamsClass, "aad", "[B"); + if (fieldID == NULL) { return; } + jAad = (*env)->GetObjectField(env, jParam, fieldID); + + /* get tagLength */ + fieldID = (*env)->GetFieldID(env, jGcmParamsClass, "tagBits", "J"); + if (fieldID == NULL) { return; } + jTagLen = (*env)->GetLongField(env, jParam, fieldID); + + + /* populate java values */ + jByteArrayToCKByteArray(env, jIv, &(ckpParam->pIv), &(ckpParam->ulIvLen)); + if ((*env)->ExceptionCheck(env)) { return; } + + jByteArrayToCKByteArray(env, jAad, &(ckpParam->pAAD), &(ckpParam->ulAADLen)); + if ((*env)->ExceptionCheck(env)) { return; } + + ckpParam->ulTagBits = jLongToCKULong(jTagLen); +} + +/* + * converts the Java CK_CCM_PARAMS object to a CK_CCM_PARAMS structure + * + * @param env - used to call JNI functions to get the Java classes and objects + * @param jParam - the Java CK_CCM_PARAMS object to convert + * @param ckpParam - pointer to the new CK_CCM_PARAMS structure + */ +void jCCMParamsToCKCCMParam(JNIEnv *env, jobject jParam, + CK_CCM_PARAMS_PTR ckpParam) { + jclass jCcmParamsClass; + jfieldID fieldID; + jobject jNonce, jAad; + jlong jDataLen, jMacLen; + + /* get iv */ + jCcmParamsClass = (*env)->FindClass(env, CLASS_CCM_PARAMS); + if (jCcmParamsClass == NULL) { return; } + + if (!(*env)->IsInstanceOf(env, jParam, jCcmParamsClass)) { + return; + } + fieldID = (*env)->GetFieldID(env, jCcmParamsClass, "dataLen", "J"); + if (fieldID == NULL) { return; } + jDataLen = (*env)->GetLongField(env, jParam, fieldID); + + fieldID = (*env)->GetFieldID(env, jCcmParamsClass, "nonce", "[B"); + if (fieldID == NULL) { return; } + jNonce = (*env)->GetObjectField(env, jParam, fieldID); + + /* get aad */ + fieldID = (*env)->GetFieldID(env, jCcmParamsClass, "aad", "[B"); + if (fieldID == NULL) { return; } + jAad = (*env)->GetObjectField(env, jParam, fieldID); + + /* get macLen */ + fieldID = (*env)->GetFieldID(env, jCcmParamsClass, "macLen", "J"); + if (fieldID == NULL) { return; } + jMacLen = (*env)->GetLongField(env, jParam, fieldID); + + /* populate java values */ + ckpParam->ulDataLen = jLongToCKULong(jDataLen); + jByteArrayToCKByteArray(env, jNonce, &(ckpParam->pNonce), + &(ckpParam->ulNonceLen)); + jByteArrayToCKByteArray(env, jAad, &(ckpParam->pAAD), + &(ckpParam->ulAADLen)); + ckpParam->ulMACLen = jLongToCKULong(jMacLen); + if ((*env)->ExceptionCheck(env)) { return; } +} + +/* + * converts a Java CK_MECHANISM object into a pointer to a CK_MECHANISM + * structure. NOTE: CALLER IS RESPONSIBLE FOR FREEING THE RETURNED POINTER * * @param env - used to call JNI funktions to get the values out of the Java object * @param jMechanism - the Java CK_MECHANISM object to convert - * @return - the new CK_MECHANISM structure + * @return - pointer to the new CK_MECHANISM structure */ -void jMechanismToCKMechanism(JNIEnv *env, jobject jMechanism, CK_MECHANISM_PTR ckMechanismPtr) +CK_MECHANISM_PTR jMechanismToCKMechanismPtr(JNIEnv *env, jobject jMech) { - jlong jMechanismType = (*env)->GetLongField(env, jMechanism, mech_mechanismID); - jobject jParameter = (*env)->GetObjectField(env, jMechanism, mech_pParameterID); - - (*ckMechanismPtr).mechanism = jLongToCKULong(jMechanismType); + CK_MECHANISM_PTR ckpMech; + jlong jMechType = (*env)->GetLongField(env, jMech, mech_mechanismID); + jobject jParam = (*env)->GetObjectField(env, jMech, mech_pParameterID); - /* convert the specific Java mechanism parameter object to a pointer to a CK-type mechanism - * structure + /* allocate memory for CK_MECHANISM_PTR */ + ckpMech = (CK_MECHANISM_PTR) malloc(sizeof(CK_MECHANISM)); + if (ckpMech == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + TRACE1("DEBUG jMechanismToCKMechanismPtr: allocated mech 0x%lX\n", ckpMech); + + ckpMech->mechanism = jLongToCKULong(jMechType); + + /* convert the specific Java mechanism parameter object to a pointer to a + * CK-type mechanism structure */ - if (jParameter == NULL) { - (*ckMechanismPtr).pParameter = NULL; - (*ckMechanismPtr).ulParameterLen = 0; + if (jParam == NULL) { + ckpMech->pParameter = NULL; + ckpMech->ulParameterLen = 0; } else { - jMechanismParameterToCKMechanismParameter(env, jParameter, &(*ckMechanismPtr).pParameter, &(*ckMechanismPtr).ulParameterLen); + ckpMech->pParameter = jMechParamToCKMechParamPtr(env, jParam, + ckpMech->mechanism, &(ckpMech->ulParameterLen)); } + return ckpMech; } /* @@ -909,15 +1006,14 @@ * jobject ckAttributeValueToJObject(JNIEnv *env, * const CK_ATTRIBUTE_PTR ckpAttribute); * - * void jObjectToPrimitiveCKObjectPtrPtr(JNIEnv *env, + * CK_VOID_PTR jObjectToPrimitiveCKObjectPtr(JNIEnv *env, * jobject jObject, - * CK_VOID_PTR *ckpObjectPtr, * CK_ULONG *pLength); * - * void jMechanismParameterToCKMechanismParameter(JNIEnv *env, - * jobject jParam, - * CK_VOID_PTR *ckpParamPtr, - * CK_ULONG *ckpLength); + * CK_VOID_PTR jMechParamToCKMechParamPtr(JNIEnv *env, + * jobject jParam, + * CK_MECHANISM_TYPE ckMech, + * CK_ULONG *ckpLength); * * These functions are used if a PKCS#11 mechanism or attribute structure gets * convertet to a Java attribute or mechanism object or vice versa. @@ -927,22 +1023,21 @@ * be a CK_ULONG, CK_BYTE[], CK_CHAR[], big integer, CK_BBOOL, CK_UTF8CHAR[], * CK_DATE or CK_FLAGS that gets converted to a corresponding Java object. * - * jObjectToPrimitiveCKObjectPtrPtr is used by jAttributeToCKAttributePtr for + * jObjectToPrimitiveCKObjectPtr is used by jAttributeToCKAttributePtr for * converting the Java attribute value to a PKCS#11 attribute value pointer. * For now only primitive datatypes and arrays of primitive datatypes can get * converted. Otherwise this function throws a PKCS#11Exception with the * errorcode CKR_VENDOR_DEFINED. * - * jMechanismParameterToCKMechanismParameter converts a Java mechanism parameter - * to a PKCS#11 mechanism parameter. First this function determines what mechanism - * parameter the Java object is, then it allocates the memory for the new PKCS#11 - * structure and calls the corresponding function to convert the Java object to - * a PKCS#11 mechanism parameter structure. + * jMechParamToCKMechParamPtr converts a Java mechanism parameter to a PKCS#11 + * mechanism parameter. Based on the specified PKCS#11 mechanism type, this + * function will allocate memory for a PKCS#11 parameter structure and + * populate its field using the Java object. */ /* - * converts the pValue of a CK_ATTRIBUTE structure into a Java Object by checking the type - * of the attribute. + * converts the pValue of a CK_ATTRIBUTE structure into a Java Object by + * checking the type of the attribute. * * @param env - used to call JNI funktions to create the new Java object * @param ckpAttribute - the pointer to the CK_ATTRIBUTE structure that contains the type @@ -1096,474 +1191,283 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java mechanism parameter object to convert - * @param ckpParamPtr - the reference of the new pointer to the new CK mechanism parameter - * structure + * @param ckMech - the PKCS#11 mechanism type * @param ckpLength - the reference of the length in bytes of the new CK mechanism parameter * structure + * @return pointer to the new CK mechanism parameter structure */ -void jMechanismParameterToCKMechanismParameter(JNIEnv *env, jobject jParam, CK_VOID_PTR *ckpParamPtr, CK_ULONG *ckpLength) +CK_VOID_PTR jMechParamToCKMechParamPtr(JNIEnv *env, jobject jParam, + CK_MECHANISM_TYPE ckMech, CK_ULONG *ckpLength) { + CK_VOID_PTR ckpParamPtr; if (jParam == NULL) { - *ckpParamPtr = NULL; + ckpParamPtr = NULL; *ckpLength = 0; } else if ((*env)->IsInstanceOf(env, jParam, jByteArrayClass)) { - jByteArrayToCKByteArray(env, jParam, (CK_BYTE_PTR *)ckpParamPtr, ckpLength); + jByteArrayToCKByteArray(env, jParam, (CK_BYTE_PTR *) &ckpParamPtr, ckpLength); } else if ((*env)->IsInstanceOf(env, jParam, jLongClass)) { - *ckpParamPtr = jLongObjectToCKULongPtr(env, jParam); + ckpParamPtr = jLongObjectToCKULongPtr(env, jParam); *ckpLength = sizeof(CK_ULONG); } else { - TRACE0("\nSLOW PATH jMechanismParameterToCKMechanismParameter\n"); - jMechanismParameterToCKMechanismParameterSlow(env, jParam, ckpParamPtr, ckpLength); + ckpParamPtr = jMechParamToCKMechParamPtrSlow(env, jParam, ckMech, ckpLength); } + return ckpParamPtr; } -void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam, CK_VOID_PTR *ckpParamPtr, CK_ULONG *ckpLength) +CK_VOID_PTR jMechParamToCKMechParamPtrSlow(JNIEnv *env, jobject jParam, + CK_MECHANISM_TYPE ckMech, CK_ULONG *ckpLength) { - /* get all Java mechanism parameter classes */ - jclass jVersionClass, jSsl3MasterKeyDeriveParamsClass; - jclass jTls12MasterKeyDeriveParamsClass, jSsl3KeyMatParamsClass; - jclass jTls12KeyMatParamsClass; - jclass jTlsPrfParamsClass, jTlsMacParamsClass, jAesCtrParamsClass; - jclass jRsaPkcsOaepParamsClass; - jclass jPbeParamsClass, jPkcs5Pbkd2ParamsClass, jRsaPkcsPssParamsClass; - jclass jEcdh1DeriveParamsClass, jEcdh2DeriveParamsClass; - jclass jX942Dh1DeriveParamsClass, jX942Dh2DeriveParamsClass; - TRACE0("\nDEBUG: jMechanismParameterToCKMechanismParameter"); + CK_VOID_PTR ckpParamPtr = NULL; - /* most common cases, i.e. NULL/byte[]/long, are already handled by - * jMechanismParameterToCKMechanismParameter before calling this method. + /* + * Most common cases, i.e. NULL/byte[]/long, are already handled by + * jMechParamToCKMechParam before calling this method. */ - jVersionClass = (*env)->FindClass(env, CLASS_VERSION); - if (jVersionClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jVersionClass)) { - /* - * CK_VERSION used by CKM_SSL3_PRE_MASTER_KEY_GEN - */ - CK_VERSION_PTR ckpParam; + TRACE1("\nDEBUG: jMechParamToCKMechParamPtrSlow, mech=0x%lX", ckMech); - /* convert jParameter to CKParameter */ - ckpParam = jVersionToCKVersionPtr(env, jParam); + switch (ckMech) { + case CKM_SSL3_PRE_MASTER_KEY_GEN: + case CKM_TLS_PRE_MASTER_KEY_GEN: + *ckpLength = sizeof(CK_VERSION); + ckpParamPtr = jVersionToCKVersionPtr(env, jParam); + break; + case CKM_SSL3_MASTER_KEY_DERIVE: + case CKM_TLS_MASTER_KEY_DERIVE: + case CKM_SSL3_MASTER_KEY_DERIVE_DH: + case CKM_TLS_MASTER_KEY_DERIVE_DH: + ckpParamPtr = + malloc(sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS); - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_VERSION); - *ckpParamPtr = ckpParam; - return; - } + jSsl3MasterKeyDeriveParamToCKSsl3MasterKeyDeriveParam(env, jParam, + (CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR) ckpParamPtr); + break; + case CKM_SSL3_KEY_AND_MAC_DERIVE: + case CKM_TLS_KEY_AND_MAC_DERIVE: + ckpParamPtr = + malloc(sizeof(CK_SSL3_KEY_MAT_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_SSL3_KEY_MAT_PARAMS); - jSsl3MasterKeyDeriveParamsClass = (*env)->FindClass(env, CLASS_SSL3_MASTER_KEY_DERIVE_PARAMS); - if (jSsl3MasterKeyDeriveParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jSsl3MasterKeyDeriveParamsClass)) { - /* - * CK_SSL3_MASTER_KEY_DERIVE_PARAMS - */ - CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR ckpParam; - - ckpParam = (CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR) malloc(sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } + jSsl3KeyMatParamToCKSsl3KeyMatParam(env, jParam, + (CK_SSL3_KEY_MAT_PARAMS_PTR) ckpParamPtr); + break; + case CKM_TLS12_KEY_AND_MAC_DERIVE: + ckpParamPtr = + malloc(sizeof(CK_TLS12_KEY_MAT_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_TLS12_KEY_MAT_PARAMS); - /* convert jParameter to CKParameter */ - *ckpParam = jSsl3MasterKeyDeriveParamToCKSsl3MasterKeyDeriveParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } + jTls12KeyMatParamToCKTls12KeyMatParam(env, jParam, + (CK_TLS12_KEY_MAT_PARAMS_PTR) ckpParamPtr); + break; + case CKM_TLS12_MASTER_KEY_DERIVE: + case CKM_TLS12_MASTER_KEY_DERIVE_DH: + ckpParamPtr = + malloc(sizeof(CK_TLS12_MASTER_KEY_DERIVE_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_TLS12_MASTER_KEY_DERIVE_PARAMS); - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jSsl3KeyMatParamsClass = (*env)->FindClass(env, CLASS_SSL3_KEY_MAT_PARAMS); - if (jSsl3KeyMatParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jSsl3KeyMatParamsClass)) { - /* - * CK_SSL3_KEY_MAT_PARAMS - */ - CK_SSL3_KEY_MAT_PARAMS_PTR ckpParam; + jTls12MasterKeyDeriveParamToCKTls12MasterKeyDeriveParam(env, jParam, + (CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR) ckpParamPtr); + break; + case CKM_TLS_PRF: + case CKM_NSS_TLS_PRF_GENERAL: + ckpParamPtr = malloc(sizeof(CK_TLS_PRF_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_TLS_PRF_PARAMS); - ckpParam = (CK_SSL3_KEY_MAT_PARAMS_PTR) malloc(sizeof(CK_SSL3_KEY_MAT_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jSsl3KeyMatParamToCKSsl3KeyMatParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } + jTlsPrfParamsToCKTlsPrfParam(env, jParam, + (CK_TLS_PRF_PARAMS_PTR) ckpParamPtr); + break; + case CKM_TLS_MAC: + ckpParamPtr = malloc(sizeof(CK_TLS_MAC_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_TLS_MAC_PARAMS); - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_SSL3_KEY_MAT_PARAMS); - *ckpParamPtr = ckpParam; - return; - } + jTlsMacParamsToCKTlsMacParam(env, jParam, + (CK_TLS_MAC_PARAMS_PTR) ckpParamPtr); + break; + case CKM_AES_CTR: + ckpParamPtr = malloc(sizeof(CK_AES_CTR_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_AES_CTR_PARAMS); - jTls12KeyMatParamsClass = (*env)->FindClass(env, CLASS_TLS12_KEY_MAT_PARAMS); - if (jTls12KeyMatParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jTls12KeyMatParamsClass)) { - /* - * CK_TLS12_KEY_MAT_PARAMS - */ - CK_TLS12_KEY_MAT_PARAMS_PTR ckpParam; + jAesCtrParamsToCKAesCtrParam(env, jParam, + (CK_AES_CTR_PARAMS_PTR) ckpParamPtr); + break; + case CKM_AES_GCM: + ckpParamPtr = malloc(sizeof(CK_GCM_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_GCM_PARAMS); + + jGCMParamsToCKGCMParam(env, jParam, (CK_GCM_PARAMS_PTR) ckpParamPtr); + break; + case CKM_AES_CCM: + ckpParamPtr = malloc(sizeof(CK_CCM_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_CCM_PARAMS); - ckpParam = (CK_TLS12_KEY_MAT_PARAMS_PTR) malloc(sizeof(CK_TLS12_KEY_MAT_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } + jCCMParamsToCKCCMParam(env, jParam, + (CK_CCM_PARAMS_PTR) ckpParamPtr); + break; + case CKM_RSA_PKCS_OAEP: + ckpParamPtr = malloc(sizeof(CK_RSA_PKCS_OAEP_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_RSA_PKCS_OAEP_PARAMS); - /* convert jParameter to CKParameter */ - *ckpParam = jTls12KeyMatParamToCKTls12KeyMatParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } + jRsaPkcsOaepParamToCKRsaPkcsOaepParam(env, jParam, + (CK_RSA_PKCS_OAEP_PARAMS_PTR) ckpParamPtr); + break; + case CKM_PBE_SHA1_DES3_EDE_CBC: + case CKM_PBE_SHA1_DES2_EDE_CBC: + case CKM_PBA_SHA1_WITH_SHA1_HMAC: + ckpParamPtr = malloc(sizeof(CK_PBE_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_TLS12_KEY_MAT_PARAMS); - *ckpParamPtr = ckpParam; - return; - } + *ckpLength = sizeof(CK_PBE_PARAMS); - jTls12MasterKeyDeriveParamsClass = - (*env)->FindClass(env, CLASS_TLS12_MASTER_KEY_DERIVE_PARAMS); - if (jTls12MasterKeyDeriveParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jTls12MasterKeyDeriveParamsClass)) { - /* - * CK_TLS12_MASTER_KEY_DERIVE_PARAMS - */ - CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR ckpParam; + jPbeParamToCKPbeParam(env, jParam, (CK_PBE_PARAMS_PTR) ckpParamPtr); + break; + case CKM_PKCS5_PBKD2: + ckpParamPtr = malloc(sizeof(CK_PKCS5_PBKD2_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_PKCS5_PBKD2_PARAMS); - ckpParam = (CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR)malloc( - sizeof(CK_TLS12_MASTER_KEY_DERIVE_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } + jPkcs5Pbkd2ParamToCKPkcs5Pbkd2Param(env, jParam, + (CK_PKCS5_PBKD2_PARAMS_PTR) ckpParamPtr); + break; + case CKM_RSA_PKCS_PSS: + case CKM_SHA1_RSA_PKCS_PSS: + case CKM_SHA256_RSA_PKCS_PSS: + case CKM_SHA384_RSA_PKCS_PSS: + case CKM_SHA512_RSA_PKCS_PSS: + case CKM_SHA224_RSA_PKCS_PSS: + ckpParamPtr = malloc(sizeof(CK_RSA_PKCS_PSS_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_RSA_PKCS_PSS_PARAMS); - /* convert jParameter to CKParameter */ - *ckpParam = jTls12MasterKeyDeriveParamToCKTls12MasterKeyDeriveParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_TLS12_MASTER_KEY_DERIVE_PARAMS); - *ckpParamPtr = ckpParam; - return; - } + jRsaPkcsPssParamToCKRsaPkcsPssParam(env, jParam, + (CK_RSA_PKCS_PSS_PARAMS_PTR) ckpParamPtr); + break; + case CKM_ECDH1_DERIVE: + case CKM_ECDH1_COFACTOR_DERIVE: + ckpParamPtr = malloc(sizeof(CK_ECDH1_DERIVE_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_ECDH1_DERIVE_PARAMS); - jTlsPrfParamsClass = (*env)->FindClass(env, CLASS_TLS_PRF_PARAMS); - if (jTlsPrfParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jTlsPrfParamsClass)) { - /* - * CK_TLS_PRF_PARAMS - */ - CK_TLS_PRF_PARAMS_PTR ckpParam; + jEcdh1DeriveParamToCKEcdh1DeriveParam(env, jParam, + (CK_ECDH1_DERIVE_PARAMS_PTR) ckpParamPtr); + break; + case CKM_ECMQV_DERIVE: + ckpParamPtr = malloc(sizeof(CK_ECDH2_DERIVE_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_ECDH2_DERIVE_PARAMS); - ckpParam = (CK_TLS_PRF_PARAMS_PTR) malloc(sizeof(CK_TLS_PRF_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jTlsPrfParamsToCKTlsPrfParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } + jEcdh2DeriveParamToCKEcdh2DeriveParam(env, jParam, + (CK_ECDH2_DERIVE_PARAMS_PTR) ckpParamPtr); + break; + case CKM_X9_42_DH_DERIVE: + ckpParamPtr = malloc(sizeof(CK_X9_42_DH1_DERIVE_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_X9_42_DH1_DERIVE_PARAMS); - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_TLS_PRF_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jTlsMacParamsClass = (*env)->FindClass(env, CLASS_TLS_MAC_PARAMS); - if (jTlsMacParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jTlsMacParamsClass)) { - CK_TLS_MAC_PARAMS_PTR ckpParam; + /* convert jParameter to CKParameter */ + jX942Dh1DeriveParamToCKX942Dh1DeriveParam(env, jParam, + (CK_X9_42_DH1_DERIVE_PARAMS_PTR) ckpParamPtr); + break; + case CKM_X9_42_DH_HYBRID_DERIVE: + case CKM_X9_42_MQV_DERIVE: + ckpParamPtr = malloc(sizeof(CK_X9_42_DH2_DERIVE_PARAMS)); + if (ckpParamPtr == NULL) { + throwOutOfMemoryError(env, 0); + return NULL; + } + *ckpLength = sizeof(CK_X9_42_DH2_DERIVE_PARAMS); - ckpParam = (CK_TLS_MAC_PARAMS_PTR) malloc(sizeof(CK_TLS_MAC_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } + jX942Dh2DeriveParamToCKX942Dh2DeriveParam(env, jParam, + (CK_X9_42_DH2_DERIVE_PARAMS_PTR) ckpParamPtr); + break; + // defined by pkcs11.h but we don't support + case CKM_KEA_DERIVE: // CK_KEA_DERIVE_PARAMS + case CKM_RC2_CBC: // CK_RC2_CBC_PARAMS + case CKM_RC2_MAC_GENERAL: // CK_RC2_MAC_GENERAL_PARAMS + case CKM_RC5_ECB: // CK_RC5_PARAMS + case CKM_RC5_MAC: // CK_RC5_PARAMS + case CKM_RC5_CBC: // CK_RC5_CBC_PARAMS + case CKM_RC5_MAC_GENERAL: // CK_RC5_MAC_GENERAL_PARAMS + case CKM_SKIPJACK_PRIVATE_WRAP: // CK_SKIPJACK_PRIVATE_WRAP_PARAMS + case CKM_SKIPJACK_RELAYX: // CK_SKIPJACK_RELAYX_PARAMS + case CKM_KEY_WRAP_SET_OAEP: // CK_KEY_WRAP_SET_OAEP_PARAMS + throwPKCS11RuntimeException(env, "No parameter support for this mchanism"); + break; + default: + /* if everything faild up to here */ + /* try if the parameter is a primitive Java type */ + ckpParamPtr = jObjectToPrimitiveCKObjectPtr(env, jParam, ckpLength); + /* *ckpParamPtr = jObjectToCKVoidPtr(jParam); */ + /* *ckpLength = 1; */ + } + TRACE0("\nDEBUG: jMechParamToCKMechParamPtrSlow FINISHED\n"); - /* convert jParameter to CKParameter */ - *ckpParam = jTlsMacParamsToCKTlsMacParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_TLS_MAC_PARAMS); - *ckpParamPtr = ckpParam; - return; + if ((*env)->ExceptionCheck(env)) { + free(ckpParamPtr); + *ckpLength = 0; + return NULL; } - jAesCtrParamsClass = (*env)->FindClass(env, CLASS_AES_CTR_PARAMS); - if (jAesCtrParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jAesCtrParamsClass)) { - /* - * CK_AES_CTR_PARAMS - */ - CK_AES_CTR_PARAMS_PTR ckpParam; - - ckpParam = (CK_AES_CTR_PARAMS_PTR) malloc(sizeof(CK_AES_CTR_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - jAesCtrParamsToCKAesCtrParam(env, jParam, ckpParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_AES_CTR_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jRsaPkcsOaepParamsClass = (*env)->FindClass(env, CLASS_RSA_PKCS_OAEP_PARAMS); - if (jRsaPkcsOaepParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jRsaPkcsOaepParamsClass)) { - /* - * CK_RSA_PKCS_OAEP_PARAMS - */ - CK_RSA_PKCS_OAEP_PARAMS_PTR ckpParam; - - ckpParam = (CK_RSA_PKCS_OAEP_PARAMS_PTR) malloc(sizeof(CK_RSA_PKCS_OAEP_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jRsaPkcsOaepParamToCKRsaPkcsOaepParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_RSA_PKCS_OAEP_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jPbeParamsClass = (*env)->FindClass(env, CLASS_PBE_PARAMS); - if (jPbeParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jPbeParamsClass)) { - /* - * CK_PBE_PARAMS - */ - CK_PBE_PARAMS_PTR ckpParam; - - ckpParam = (CK_PBE_PARAMS_PTR) malloc(sizeof(CK_PBE_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jPbeParamToCKPbeParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_PBE_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jPkcs5Pbkd2ParamsClass = (*env)->FindClass(env, CLASS_PKCS5_PBKD2_PARAMS); - if (jPkcs5Pbkd2ParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jPkcs5Pbkd2ParamsClass)) { - /* - * CK_PKCS5_PBKD2_PARAMS - */ - CK_PKCS5_PBKD2_PARAMS_PTR ckpParam; - - ckpParam = (CK_PKCS5_PBKD2_PARAMS_PTR) malloc(sizeof(CK_PKCS5_PBKD2_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jPkcs5Pbkd2ParamToCKPkcs5Pbkd2Param(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_PKCS5_PBKD2_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jRsaPkcsPssParamsClass = (*env)->FindClass(env, CLASS_RSA_PKCS_PSS_PARAMS); - if (jRsaPkcsPssParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jRsaPkcsPssParamsClass)) { - /* - * CK_RSA_PKCS_PSS_PARAMS - */ - CK_RSA_PKCS_PSS_PARAMS_PTR ckpParam; - - ckpParam = (CK_RSA_PKCS_PSS_PARAMS_PTR) malloc(sizeof(CK_RSA_PKCS_PSS_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jRsaPkcsPssParamToCKRsaPkcsPssParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_RSA_PKCS_PSS_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jEcdh1DeriveParamsClass = (*env)->FindClass(env, CLASS_ECDH1_DERIVE_PARAMS); - if (jEcdh1DeriveParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jEcdh1DeriveParamsClass)) { - /* - * CK_ECDH1_DERIVE_PARAMS - */ - CK_ECDH1_DERIVE_PARAMS_PTR ckpParam; - - ckpParam = (CK_ECDH1_DERIVE_PARAMS_PTR) malloc(sizeof(CK_ECDH1_DERIVE_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jEcdh1DeriveParamToCKEcdh1DeriveParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_ECDH1_DERIVE_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jEcdh2DeriveParamsClass = (*env)->FindClass(env, CLASS_ECDH2_DERIVE_PARAMS); - if (jEcdh2DeriveParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jEcdh2DeriveParamsClass)) { - /* - * CK_ECDH2_DERIVE_PARAMS - */ - CK_ECDH2_DERIVE_PARAMS_PTR ckpParam; - - ckpParam = (CK_ECDH2_DERIVE_PARAMS_PTR) malloc(sizeof(CK_ECDH2_DERIVE_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jEcdh2DeriveParamToCKEcdh2DeriveParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_ECDH2_DERIVE_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jX942Dh1DeriveParamsClass = (*env)->FindClass(env, CLASS_X9_42_DH1_DERIVE_PARAMS); - if (jX942Dh1DeriveParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jX942Dh1DeriveParamsClass)) { - /* - * CK_X9_42_DH1_DERIVE_PARAMS - */ - CK_X9_42_DH1_DERIVE_PARAMS_PTR ckpParam; - - ckpParam = (CK_X9_42_DH1_DERIVE_PARAMS_PTR) malloc(sizeof(CK_X9_42_DH1_DERIVE_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jX942Dh1DeriveParamToCKX942Dh1DeriveParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_X9_42_DH1_DERIVE_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - jX942Dh2DeriveParamsClass = (*env)->FindClass(env, CLASS_X9_42_DH2_DERIVE_PARAMS); - if (jX942Dh2DeriveParamsClass == NULL) { return; } - if ((*env)->IsInstanceOf(env, jParam, jX942Dh2DeriveParamsClass)) { - /* - * CK_X9_42_DH2_DERIVE_PARAMS - */ - CK_X9_42_DH2_DERIVE_PARAMS_PTR ckpParam; - - ckpParam = (CK_X9_42_DH2_DERIVE_PARAMS_PTR) malloc(sizeof(CK_X9_42_DH2_DERIVE_PARAMS)); - if (ckpParam == NULL) { - throwOutOfMemoryError(env, 0); - return; - } - - /* convert jParameter to CKParameter */ - *ckpParam = jX942Dh2DeriveParamToCKX942Dh2DeriveParam(env, jParam); - if ((*env)->ExceptionCheck(env)) { - free(ckpParam); - return; - } - - /* get length and pointer of parameter */ - *ckpLength = sizeof(CK_X9_42_DH2_DERIVE_PARAMS); - *ckpParamPtr = ckpParam; - return; - } - - /* if everything faild up to here */ - /* try if the parameter is a primitive Java type */ - jObjectToPrimitiveCKObjectPtrPtr(env, jParam, ckpParamPtr, ckpLength); - /* *ckpParamPtr = jObjectToCKVoidPtr(jParam); */ - /* *ckpLength = 1; */ - - TRACE0("FINISHED\n"); + return ckpParamPtr; } - /* the mechanism parameter convertion functions: */ /* @@ -1573,47 +1477,45 @@ * @param jParam - the Java CK_RSA_PKCS_OAEP_PARAMS object to convert * @return - the new CK_RSA_PKCS_OAEP_PARAMS structure */ -CK_RSA_PKCS_OAEP_PARAMS jRsaPkcsOaepParamToCKRsaPkcsOaepParam(JNIEnv *env, jobject jParam) +void jRsaPkcsOaepParamToCKRsaPkcsOaepParam(JNIEnv *env, jobject jParam, +CK_RSA_PKCS_OAEP_PARAMS_PTR ckParamPtr) { jclass jRsaPkcsOaepParamsClass; - CK_RSA_PKCS_OAEP_PARAMS ckParam; jfieldID fieldID; jlong jHashAlg, jMgf, jSource; jobject jSourceData; CK_BYTE_PTR ckpByte; - memset(&ckParam, 0, sizeof(CK_RSA_PKCS_OAEP_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_RSA_PKCS_OAEP_PARAMS)); /* get hashAlg */ jRsaPkcsOaepParamsClass = (*env)->FindClass(env, CLASS_RSA_PKCS_OAEP_PARAMS); - if (jRsaPkcsOaepParamsClass == NULL) { return ckParam; } + if (jRsaPkcsOaepParamsClass == NULL) { return; } fieldID = (*env)->GetFieldID(env, jRsaPkcsOaepParamsClass, "hashAlg", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jHashAlg = (*env)->GetLongField(env, jParam, fieldID); /* get mgf */ fieldID = (*env)->GetFieldID(env, jRsaPkcsOaepParamsClass, "mgf", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jMgf = (*env)->GetLongField(env, jParam, fieldID); /* get source */ fieldID = (*env)->GetFieldID(env, jRsaPkcsOaepParamsClass, "source", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jSource = (*env)->GetLongField(env, jParam, fieldID); /* get sourceData and sourceDataLength */ fieldID = (*env)->GetFieldID(env, jRsaPkcsOaepParamsClass, "pSourceData", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jSourceData = (*env)->GetObjectField(env, jParam, fieldID); /* populate java values */ - ckParam.hashAlg = jLongToCKULong(jHashAlg); - ckParam.mgf = jLongToCKULong(jMgf); - ckParam.source = jLongToCKULong(jSource); - jByteArrayToCKByteArray(env, jSourceData, & ckpByte, &(ckParam.ulSourceDataLen)); - if ((*env)->ExceptionCheck(env)) { return ckParam; } - ckParam.pSourceData = (CK_VOID_PTR) ckpByte; - - return ckParam ; + ckParamPtr->hashAlg = jLongToCKULong(jHashAlg); + ckParamPtr->mgf = jLongToCKULong(jMgf); + ckParamPtr->source = jLongToCKULong(jSource); + jByteArrayToCKByteArray(env, jSourceData, & ckpByte, &(ckParamPtr->ulSourceDataLen)); + if ((*env)->ExceptionCheck(env)) { return; } + ckParamPtr->pSourceData = (CK_VOID_PTR) ckpByte; } /* @@ -1621,57 +1523,55 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java CK_PBE_PARAMS object to convert - * @return - the new CK_PBE_PARAMS structure + * @param ckParamPtr pointer to the new CK_PBE_PARAMS structure */ -CK_PBE_PARAMS jPbeParamToCKPbeParam(JNIEnv *env, jobject jParam) +void jPbeParamToCKPbeParam(JNIEnv *env, jobject jParam, +CK_PBE_PARAMS_PTR ckParamPtr) { jclass jPbeParamsClass; - CK_PBE_PARAMS ckParam; jfieldID fieldID; jlong jIteration; jobject jInitVector, jPassword, jSalt; CK_ULONG ckTemp; - memset(&ckParam, 0, sizeof(CK_PBE_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_PBE_PARAMS)); /* get pInitVector */ jPbeParamsClass = (*env)->FindClass(env, CLASS_PBE_PARAMS); - if (jPbeParamsClass == NULL) { return ckParam; } + if (jPbeParamsClass == NULL) { return; } fieldID = (*env)->GetFieldID(env, jPbeParamsClass, "pInitVector", "[C"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jInitVector = (*env)->GetObjectField(env, jParam, fieldID); /* get pPassword and ulPasswordLength */ fieldID = (*env)->GetFieldID(env, jPbeParamsClass, "pPassword", "[C"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPassword = (*env)->GetObjectField(env, jParam, fieldID); /* get pSalt and ulSaltLength */ fieldID = (*env)->GetFieldID(env, jPbeParamsClass, "pSalt", "[C"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jSalt = (*env)->GetObjectField(env, jParam, fieldID); /* get ulIteration */ fieldID = (*env)->GetFieldID(env, jPbeParamsClass, "ulIteration", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jIteration = (*env)->GetLongField(env, jParam, fieldID); /* populate java values */ - ckParam.ulIteration = jLongToCKULong(jIteration); - jCharArrayToCKCharArray(env, jInitVector, &(ckParam.pInitVector), &ckTemp); - if ((*env)->ExceptionCheck(env)) { return ckParam; } - jCharArrayToCKCharArray(env, jPassword, &(ckParam.pPassword), &(ckParam.ulPasswordLen)); + ckParamPtr->ulIteration = jLongToCKULong(jIteration); + jCharArrayToCKCharArray(env, jInitVector, &(ckParamPtr->pInitVector), &ckTemp); + if ((*env)->ExceptionCheck(env)) { return; } + jCharArrayToCKCharArray(env, jPassword, &(ckParamPtr->pPassword), &(ckParamPtr->ulPasswordLen)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pInitVector); - return ckParam; + free(ckParamPtr->pInitVector); + return; } - jCharArrayToCKCharArray(env, jSalt, &(ckParam.pSalt), &(ckParam.ulSaltLen)); + jCharArrayToCKCharArray(env, jSalt, &(ckParamPtr->pSalt), &(ckParamPtr->ulSaltLen)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pInitVector); - free(ckParam.pPassword); - return ckParam; + free(ckParamPtr->pInitVector); + free(ckParamPtr->pPassword); + return; } - - return ckParam ; } /* @@ -1741,57 +1641,55 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java CK_PKCS5_PBKD2_PARAMS object to convert - * @return - the new CK_PKCS5_PBKD2_PARAMS structure + * @param ckParamPtr - pointer to the new CK_PKCS5_PBKD2_PARAMS structure */ -CK_PKCS5_PBKD2_PARAMS jPkcs5Pbkd2ParamToCKPkcs5Pbkd2Param(JNIEnv *env, jobject jParam) +void jPkcs5Pbkd2ParamToCKPkcs5Pbkd2Param(JNIEnv *env, jobject jParam, +CK_PKCS5_PBKD2_PARAMS_PTR ckParamPtr) { jclass jPkcs5Pbkd2ParamsClass; - CK_PKCS5_PBKD2_PARAMS ckParam; jfieldID fieldID; jlong jSaltSource, jIteration, jPrf; jobject jSaltSourceData, jPrfData; - memset(&ckParam, 0, sizeof(CK_PKCS5_PBKD2_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_PKCS5_PBKD2_PARAMS)); /* get saltSource */ jPkcs5Pbkd2ParamsClass = (*env)->FindClass(env, CLASS_PKCS5_PBKD2_PARAMS); - if (jPkcs5Pbkd2ParamsClass == NULL) { return ckParam; } + if (jPkcs5Pbkd2ParamsClass == NULL) { return; } fieldID = (*env)->GetFieldID(env, jPkcs5Pbkd2ParamsClass, "saltSource", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jSaltSource = (*env)->GetLongField(env, jParam, fieldID); /* get pSaltSourceData */ fieldID = (*env)->GetFieldID(env, jPkcs5Pbkd2ParamsClass, "pSaltSourceData", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jSaltSourceData = (*env)->GetObjectField(env, jParam, fieldID); /* get iterations */ fieldID = (*env)->GetFieldID(env, jPkcs5Pbkd2ParamsClass, "iterations", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jIteration = (*env)->GetLongField(env, jParam, fieldID); /* get prf */ fieldID = (*env)->GetFieldID(env, jPkcs5Pbkd2ParamsClass, "prf", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPrf = (*env)->GetLongField(env, jParam, fieldID); /* get pPrfData and ulPrfDataLength in byte */ fieldID = (*env)->GetFieldID(env, jPkcs5Pbkd2ParamsClass, "pPrfData", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPrfData = (*env)->GetObjectField(env, jParam, fieldID); /* populate java values */ - ckParam.saltSource = jLongToCKULong(jSaltSource); - jByteArrayToCKByteArray(env, jSaltSourceData, (CK_BYTE_PTR *) &(ckParam.pSaltSourceData), &(ckParam.ulSaltSourceDataLen)); - if ((*env)->ExceptionCheck(env)) { return ckParam; } - ckParam.iterations = jLongToCKULong(jIteration); - ckParam.prf = jLongToCKULong(jPrf); - jByteArrayToCKByteArray(env, jPrfData, (CK_BYTE_PTR *) &(ckParam.pPrfData), &(ckParam.ulPrfDataLen)); + ckParamPtr->saltSource = jLongToCKULong(jSaltSource); + jByteArrayToCKByteArray(env, jSaltSourceData, (CK_BYTE_PTR *) &(ckParamPtr->pSaltSourceData), &(ckParamPtr->ulSaltSourceDataLen)); + if ((*env)->ExceptionCheck(env)) { return; } + ckParamPtr->iterations = jLongToCKULong(jIteration); + ckParamPtr->prf = jLongToCKULong(jPrf); + jByteArrayToCKByteArray(env, jPrfData, (CK_BYTE_PTR *) &(ckParamPtr->pPrfData), &(ckParamPtr->ulPrfDataLen)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pSaltSourceData); - return ckParam; + free(ckParamPtr->pSaltSourceData); + return; } - - return ckParam ; } /* @@ -1799,39 +1697,40 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java CK_RSA_PKCS_PSS_PARAMS object to convert - * @return - the new CK_RSA_PKCS_PSS_PARAMS structure + * @param ckParamPtr - pointer to the new CK_RSA_PKCS_PSS_PARAMS structure */ -CK_RSA_PKCS_PSS_PARAMS jRsaPkcsPssParamToCKRsaPkcsPssParam(JNIEnv *env, jobject jParam) +void jRsaPkcsPssParamToCKRsaPkcsPssParam(JNIEnv *env, jobject jParam, +CK_RSA_PKCS_PSS_PARAMS_PTR ckParamPtr) { jclass jRsaPkcsPssParamsClass; - CK_RSA_PKCS_PSS_PARAMS ckParam; jfieldID fieldID; jlong jHashAlg, jMgf, jSLen; - memset(&ckParam, 0, sizeof(CK_RSA_PKCS_PSS_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_RSA_PKCS_PSS_PARAMS)); /* get hashAlg */ jRsaPkcsPssParamsClass = (*env)->FindClass(env, CLASS_RSA_PKCS_PSS_PARAMS); - if (jRsaPkcsPssParamsClass == NULL) { return ckParam; } + if (jRsaPkcsPssParamsClass == NULL) { return; } fieldID = (*env)->GetFieldID(env, jRsaPkcsPssParamsClass, "hashAlg", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jHashAlg = (*env)->GetLongField(env, jParam, fieldID); /* get mgf */ fieldID = (*env)->GetFieldID(env, jRsaPkcsPssParamsClass, "mgf", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jMgf = (*env)->GetLongField(env, jParam, fieldID); /* get sLen */ fieldID = (*env)->GetFieldID(env, jRsaPkcsPssParamsClass, "sLen", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jSLen = (*env)->GetLongField(env, jParam, fieldID); /* populate java values */ - ckParam.hashAlg = jLongToCKULong(jHashAlg); - ckParam.mgf = jLongToCKULong(jMgf); - ckParam.sLen = jLongToCKULong(jSLen); - - return ckParam ; + ckParamPtr->hashAlg = jLongToCKULong(jHashAlg); + ckParamPtr->mgf = jLongToCKULong(jMgf); + ckParamPtr->sLen = jLongToCKULong(jSLen); + TRACE1("DEBUG: jRsaPkcsPssParamToCKRsaPkcsPssParam, hashAlg=0x%lX\n", ckParamPtr->hashAlg); + TRACE1("DEBUG: jRsaPkcsPssParamToCKRsaPkcsPssParam, mgf=0x%lX\n", ckParamPtr->mgf); + TRACE1("DEBUG: jRsaPkcsPssParamToCKRsaPkcsPssParam, sLen=%lu\n", ckParamPtr->sLen); } /* @@ -1839,46 +1738,44 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java CK_ECDH1_DERIVE_PARAMS object to convert - * @return - the new CK_ECDH1_DERIVE_PARAMS structure + * @param ckParamPtr - the new CK_ECDH1_DERIVE_PARAMS structure */ -CK_ECDH1_DERIVE_PARAMS jEcdh1DeriveParamToCKEcdh1DeriveParam(JNIEnv *env, jobject jParam) +void jEcdh1DeriveParamToCKEcdh1DeriveParam(JNIEnv *env, jobject jParam, +CK_ECDH1_DERIVE_PARAMS_PTR ckParamPtr) { jclass jEcdh1DeriveParamsClass; - CK_ECDH1_DERIVE_PARAMS ckParam; jfieldID fieldID; jlong jLong; jobject jSharedData, jPublicData; - memset(&ckParam, 0, sizeof(CK_ECDH1_DERIVE_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_ECDH1_DERIVE_PARAMS)); /* get kdf */ jEcdh1DeriveParamsClass = (*env)->FindClass(env, CLASS_ECDH1_DERIVE_PARAMS); - if (jEcdh1DeriveParamsClass == NULL) { return ckParam; } + if (jEcdh1DeriveParamsClass == NULL) { return; } fieldID = (*env)->GetFieldID(env, jEcdh1DeriveParamsClass, "kdf", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jLong = (*env)->GetLongField(env, jParam, fieldID); - ckParam.kdf = jLongToCKULong(jLong); + ckParamPtr->kdf = jLongToCKULong(jLong); /* get pSharedData and ulSharedDataLen */ fieldID = (*env)->GetFieldID(env, jEcdh1DeriveParamsClass, "pSharedData", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jSharedData = (*env)->GetObjectField(env, jParam, fieldID); /* get pPublicData and ulPublicDataLen */ fieldID = (*env)->GetFieldID(env, jEcdh1DeriveParamsClass, "pPublicData", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPublicData = (*env)->GetObjectField(env, jParam, fieldID); /* populate java values */ - ckParam.kdf = jLongToCKULong(jLong); - jByteArrayToCKByteArray(env, jSharedData, &(ckParam.pSharedData), &(ckParam.ulSharedDataLen)); - if ((*env)->ExceptionCheck(env)) { return ckParam; } - jByteArrayToCKByteArray(env, jPublicData, &(ckParam.pPublicData), &(ckParam.ulPublicDataLen)); + ckParamPtr->kdf = jLongToCKULong(jLong); + jByteArrayToCKByteArray(env, jSharedData, &(ckParamPtr->pSharedData), &(ckParamPtr->ulSharedDataLen)); + if ((*env)->ExceptionCheck(env)) { return; } + jByteArrayToCKByteArray(env, jPublicData, &(ckParamPtr->pPublicData), &(ckParamPtr->ulPublicDataLen)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pSharedData); - return ckParam; + free(ckParamPtr->pSharedData); + return; } - - return ckParam ; } /* @@ -1886,67 +1783,66 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java CK_ECDH2_DERIVE_PARAMS object to convert - * @return - the new CK_ECDH2_DERIVE_PARAMS structure + * @param ckParamPtr - pointer to the new CK_ECDH2_DERIVE_PARAMS structure */ -CK_ECDH2_DERIVE_PARAMS jEcdh2DeriveParamToCKEcdh2DeriveParam(JNIEnv *env, jobject jParam) +void jEcdh2DeriveParamToCKEcdh2DeriveParam(JNIEnv *env, jobject jParam, +CK_ECDH2_DERIVE_PARAMS_PTR ckParamPtr) { jclass jEcdh2DeriveParamsClass; - CK_ECDH2_DERIVE_PARAMS ckParam; jfieldID fieldID; jlong jKdf, jPrivateDataLen, jPrivateData; jobject jSharedData, jPublicData, jPublicData2; - memset(&ckParam, 0, sizeof(CK_ECDH2_DERIVE_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_ECDH2_DERIVE_PARAMS)); /* get kdf */ jEcdh2DeriveParamsClass = (*env)->FindClass(env, CLASS_ECDH2_DERIVE_PARAMS); - if (jEcdh2DeriveParamsClass == NULL) { return ckParam; } + if (jEcdh2DeriveParamsClass == NULL) { return; } fieldID = (*env)->GetFieldID(env, jEcdh2DeriveParamsClass, "kdf", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jKdf = (*env)->GetLongField(env, jParam, fieldID); /* get pSharedData and ulSharedDataLen */ fieldID = (*env)->GetFieldID(env, jEcdh2DeriveParamsClass, "pSharedData", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jSharedData = (*env)->GetObjectField(env, jParam, fieldID); /* get pPublicData and ulPublicDataLen */ fieldID = (*env)->GetFieldID(env, jEcdh2DeriveParamsClass, "pPublicData", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPublicData = (*env)->GetObjectField(env, jParam, fieldID); /* get ulPrivateDataLen */ fieldID = (*env)->GetFieldID(env, jEcdh2DeriveParamsClass, "ulPrivateDataLen", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPrivateDataLen = (*env)->GetLongField(env, jParam, fieldID); /* get hPrivateData */ fieldID = (*env)->GetFieldID(env, jEcdh2DeriveParamsClass, "hPrivateData", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPrivateData = (*env)->GetLongField(env, jParam, fieldID); /* get pPublicData2 and ulPublicDataLen2 */ fieldID = (*env)->GetFieldID(env, jEcdh2DeriveParamsClass, "pPublicData2", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPublicData2 = (*env)->GetObjectField(env, jParam, fieldID); /* populate java values */ - ckParam.kdf = jLongToCKULong(jKdf); - jByteArrayToCKByteArray(env, jSharedData, &(ckParam.pSharedData), &(ckParam.ulSharedDataLen)); - if ((*env)->ExceptionCheck(env)) { return ckParam; } - jByteArrayToCKByteArray(env, jPublicData, &(ckParam.pPublicData), &(ckParam.ulPublicDataLen)); + ckParamPtr->kdf = jLongToCKULong(jKdf); + jByteArrayToCKByteArray(env, jSharedData, &(ckParamPtr->pSharedData), &(ckParamPtr->ulSharedDataLen)); + if ((*env)->ExceptionCheck(env)) { return; } + jByteArrayToCKByteArray(env, jPublicData, &(ckParamPtr->pPublicData), &(ckParamPtr->ulPublicDataLen)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pSharedData); - return ckParam; + free(ckParamPtr->pSharedData); + return; } - ckParam.ulPrivateDataLen = jLongToCKULong(jPrivateDataLen); - ckParam.hPrivateData = jLongToCKULong(jPrivateData); - jByteArrayToCKByteArray(env, jPublicData2, &(ckParam.pPublicData2), &(ckParam.ulPublicDataLen2)); + ckParamPtr->ulPrivateDataLen = jLongToCKULong(jPrivateDataLen); + ckParamPtr->hPrivateData = jLongToCKULong(jPrivateData); + jByteArrayToCKByteArray(env, jPublicData2, &(ckParamPtr->pPublicData2), &(ckParamPtr->ulPublicDataLen2)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pSharedData); - free(ckParam.pPublicData); - return ckParam; + free(ckParamPtr->pSharedData); + free(ckParamPtr->pPublicData); + return; } - return ckParam ; } /* @@ -1954,45 +1850,43 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java CK_X9_42_DH1_DERIVE_PARAMS object to convert - * @return - the new CK_X9_42_DH1_DERIVE_PARAMS structure + * @param ckParamPtr - pointer to the new CK_X9_42_DH1_DERIVE_PARAMS structure */ -CK_X9_42_DH1_DERIVE_PARAMS jX942Dh1DeriveParamToCKX942Dh1DeriveParam(JNIEnv *env, jobject jParam) +void jX942Dh1DeriveParamToCKX942Dh1DeriveParam(JNIEnv *env, jobject jParam, + CK_X9_42_DH1_DERIVE_PARAMS_PTR ckParamPtr) { jclass jX942Dh1DeriveParamsClass; - CK_X9_42_DH1_DERIVE_PARAMS ckParam; jfieldID fieldID; jlong jKdf; jobject jOtherInfo, jPublicData; - memset(&ckParam, 0, sizeof(CK_X9_42_DH1_DERIVE_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_X9_42_DH1_DERIVE_PARAMS)); /* get kdf */ jX942Dh1DeriveParamsClass = (*env)->FindClass(env, CLASS_X9_42_DH1_DERIVE_PARAMS); - if (jX942Dh1DeriveParamsClass == NULL) { return ckParam; } + if (jX942Dh1DeriveParamsClass == NULL) { return; } fieldID = (*env)->GetFieldID(env, jX942Dh1DeriveParamsClass, "kdf", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jKdf = (*env)->GetLongField(env, jParam, fieldID); /* get pOtherInfo and ulOtherInfoLen */ fieldID = (*env)->GetFieldID(env, jX942Dh1DeriveParamsClass, "pOtherInfo", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jOtherInfo = (*env)->GetObjectField(env, jParam, fieldID); /* get pPublicData and ulPublicDataLen */ fieldID = (*env)->GetFieldID(env, jX942Dh1DeriveParamsClass, "pPublicData", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPublicData = (*env)->GetObjectField(env, jParam, fieldID); /* populate java values */ - ckParam.kdf = jLongToCKULong(jKdf); - jByteArrayToCKByteArray(env, jOtherInfo, &(ckParam.pOtherInfo), &(ckParam.ulOtherInfoLen)); - if ((*env)->ExceptionCheck(env)) { return ckParam; } - jByteArrayToCKByteArray(env, jPublicData, &(ckParam.pPublicData), &(ckParam.ulPublicDataLen)); + ckParamPtr->kdf = jLongToCKULong(jKdf); + jByteArrayToCKByteArray(env, jOtherInfo, &(ckParamPtr->pOtherInfo), &(ckParamPtr->ulOtherInfoLen)); + if ((*env)->ExceptionCheck(env)) { return; } + jByteArrayToCKByteArray(env, jPublicData, &(ckParamPtr->pPublicData), &(ckParamPtr->ulPublicDataLen)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pOtherInfo); - return ckParam; + free(ckParamPtr->pOtherInfo); + return; } - - return ckParam ; } /* @@ -2000,66 +1894,64 @@ * * @param env - used to call JNI funktions to get the Java classes and objects * @param jParam - the Java CK_X9_42_DH2_DERIVE_PARAMS object to convert - * @return - the new CK_X9_42_DH2_DERIVE_PARAMS structure + * @param ckParamPtr - pointer to the new CK_X9_42_DH2_DERIVE_PARAMS structure */ -CK_X9_42_DH2_DERIVE_PARAMS jX942Dh2DeriveParamToCKX942Dh2DeriveParam(JNIEnv *env, jobject jParam) +void jX942Dh2DeriveParamToCKX942Dh2DeriveParam(JNIEnv *env, jobject jParam, + CK_X9_42_DH2_DERIVE_PARAMS_PTR ckParamPtr) { jclass jX942Dh2DeriveParamsClass; - CK_X9_42_DH2_DERIVE_PARAMS ckParam; jfieldID fieldID; jlong jKdf, jPrivateDataLen, jPrivateData; jobject jOtherInfo, jPublicData, jPublicData2; - memset(&ckParam, 0, sizeof(CK_X9_42_DH2_DERIVE_PARAMS)); + memset(ckParamPtr, 0, sizeof(CK_X9_42_DH2_DERIVE_PARAMS)); /* get kdf */ jX942Dh2DeriveParamsClass = (*env)->FindClass(env, CLASS_X9_42_DH2_DERIVE_PARAMS); - if (jX942Dh2DeriveParamsClass == NULL) { return ckParam; } + if (jX942Dh2DeriveParamsClass == NULL) { return; } fieldID = (*env)->GetFieldID(env, jX942Dh2DeriveParamsClass, "kdf", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jKdf = (*env)->GetLongField(env, jParam, fieldID); /* get pOtherInfo and ulOtherInfoLen */ fieldID = (*env)->GetFieldID(env, jX942Dh2DeriveParamsClass, "pOtherInfo", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jOtherInfo = (*env)->GetObjectField(env, jParam, fieldID); /* get pPublicData and ulPublicDataLen */ fieldID = (*env)->GetFieldID(env, jX942Dh2DeriveParamsClass, "pPublicData", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPublicData = (*env)->GetObjectField(env, jParam, fieldID); /* get ulPrivateDataLen */ fieldID = (*env)->GetFieldID(env, jX942Dh2DeriveParamsClass, "ulPrivateDataLen", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPrivateDataLen = (*env)->GetLongField(env, jParam, fieldID); /* get hPrivateData */ fieldID = (*env)->GetFieldID(env, jX942Dh2DeriveParamsClass, "hPrivateData", "J"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPrivateData = (*env)->GetLongField(env, jParam, fieldID); /* get pPublicData2 and ulPublicDataLen2 */ fieldID = (*env)->GetFieldID(env, jX942Dh2DeriveParamsClass, "pPublicData2", "[B"); - if (fieldID == NULL) { return ckParam; } + if (fieldID == NULL) { return; } jPublicData2 = (*env)->GetObjectField(env, jParam, fieldID); /* populate java values */ - ckParam.kdf = jLongToCKULong(jKdf); - jByteArrayToCKByteArray(env, jOtherInfo, &(ckParam.pOtherInfo), &(ckParam.ulOtherInfoLen)); - if ((*env)->ExceptionCheck(env)) { return ckParam; } - jByteArrayToCKByteArray(env, jPublicData, &(ckParam.pPublicData), &(ckParam.ulPublicDataLen)); + ckParamPtr->kdf = jLongToCKULong(jKdf); + jByteArrayToCKByteArray(env, jOtherInfo, &(ckParamPtr->pOtherInfo), &(ckParamPtr->ulOtherInfoLen)); + if ((*env)->ExceptionCheck(env)) { return; } + jByteArrayToCKByteArray(env, jPublicData, &(ckParamPtr->pPublicData), &(ckParamPtr->ulPublicDataLen)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pOtherInfo); - return ckParam; + free(ckParamPtr->pOtherInfo); + return; } - ckParam.ulPrivateDataLen = jLongToCKULong(jPrivateDataLen); - ckParam.hPrivateData = jLongToCKULong(jPrivateData); - jByteArrayToCKByteArray(env, jPublicData2, &(ckParam.pPublicData2), &(ckParam.ulPublicDataLen2)); + ckParamPtr->ulPrivateDataLen = jLongToCKULong(jPrivateDataLen); + ckParamPtr->hPrivateData = jLongToCKULong(jPrivateData); + jByteArrayToCKByteArray(env, jPublicData2, &(ckParamPtr->pPublicData2), &(ckParamPtr->ulPublicDataLen2)); if ((*env)->ExceptionCheck(env)) { - free(ckParam.pOtherInfo); - free(ckParam.pPublicData); - return ckParam; + free(ckParamPtr->pOtherInfo); + free(ckParamPtr->pPublicData); + return; } - - return ckParam ; } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -71,7 +71,7 @@ jobject jMechanism, jlong jKeyHandle) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_OBJECT_HANDLE ckKeyHandle; CK_RV rv; @@ -80,15 +80,14 @@ ckSessionHandle = jLongToCKULong(jSessionHandle); ckKeyHandle = jLongToCKULong(jKeyHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return; } - rv = (*ckpFunctions->C_EncryptInit)(ckSessionHandle, &ckMechanism, + rv = (*ckpFunctions->C_EncryptInit)(ckSessionHandle, ckpMechanism, ckKeyHandle); - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } + // if OAEP, then cannot free here + freeCKMechanismPtr(ckpMechanism); if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } } @@ -98,54 +97,67 @@ /* * Class: sun_security_pkcs11_wrapper_PKCS11 * Method: C_Encrypt - * Signature: (J[BII[BII)I + * Signature: (JJ[BIIJ[BII)I * Parametermapping: *PKCS11* * @param jlong jSessionHandle CK_SESSION_HANDLE hSession + * @param jlong directIn CK_BYTE_PTR pData * @param jbyteArray jData CK_BYTE_PTR pData * CK_ULONG ulDataLen - * @return jbyteArray jEncryptedData CK_BYTE_PTR pEncryptedData + * @param jlong directOut CK_BYTE_PTR pEncryptedData + * @return jint encryptedDataLen CK_BYTE_PTR pEncryptedData * CK_ULONG_PTR pulEncryptedDataLen */ JNIEXPORT jint JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1Encrypt (JNIEnv *env, jobject obj, jlong jSessionHandle, - jbyteArray jIn, jint jInOfs, jint jInLen, - jbyteArray jOut, jint jOutOfs, jint jOutLen) + jlong directIn, jbyteArray jIn, jint jInOfs, jint jInLen, + jlong directOut, jbyteArray jOut, jint jOutOfs, jint jOutLen) { CK_SESSION_HANDLE ckSessionHandle; CK_RV rv; CK_BYTE_PTR inBufP; CK_BYTE_PTR outBufP; - CK_ULONG ckEncryptedPartLen; + CK_ULONG ckEncryptedLen = 0; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return 0; } ckSessionHandle = jLongToCKULong(jSessionHandle); - inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL); - if (inBufP == NULL) { return 0; } - - outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); - if (outBufP == NULL) { - // Make sure to release inBufP - (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); - return 0; + if (directIn != 0) { + inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn); + } else { + inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL); + if (inBufP == NULL) { return 0; } } - ckEncryptedPartLen = jOutLen; + if (directOut != 0) { + outBufP = (CK_BYTE_PTR) jlong_to_ptr(directOut); + } else { + outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); + if (outBufP == NULL) { + goto cleanup; + } + } + + ckEncryptedLen = jOutLen; rv = (*ckpFunctions->C_Encrypt)(ckSessionHandle, (CK_BYTE_PTR)(inBufP + jInOfs), jInLen, (CK_BYTE_PTR)(outBufP + jOutOfs), - &ckEncryptedPartLen); - - (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); - (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); + &ckEncryptedLen); ckAssertReturnValueOK(env, rv); - return ckEncryptedPartLen; + +cleanup: + if (directIn == 0 && inBufP != NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); + } + if (directOut == 0 && outBufP != NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); + } + return ckEncryptedLen; } #endif @@ -172,7 +184,7 @@ CK_BYTE_PTR inBufP; CK_BYTE_PTR outBufP; - CK_ULONG ckEncryptedPartLen; + CK_ULONG ckEncryptedPartLen = 0; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return 0; } @@ -191,34 +203,26 @@ } else { outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); if (outBufP == NULL) { - // Make sure to release inBufP - (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); - return 0; + goto cleanup; } } ckEncryptedPartLen = jOutLen; - //printf("EU: inBufP=%i, jInOfs=%i, jInLen=%i, outBufP=%i\n", - // inBufP, jInOfs, jInLen, outBufP); - rv = (*ckpFunctions->C_EncryptUpdate)(ckSessionHandle, (CK_BYTE_PTR)(inBufP + jInOfs), jInLen, (CK_BYTE_PTR)(outBufP + jOutOfs), &ckEncryptedPartLen); - //printf("EU: ckEncryptedPartLen=%i\n", ckEncryptedPartLen); + ckAssertReturnValueOK(env, rv); - if (directIn == 0) { +cleanup: + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } - - if (directOut == 0) { + if (directOut == 0 && outBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); } - - ckAssertReturnValueOK(env, rv); - return ckEncryptedPartLen; } #endif @@ -257,14 +261,10 @@ ckLastEncryptedPartLen = jOutLen; - //printf("EF: outBufP=%i\n", outBufP); - rv = (*ckpFunctions->C_EncryptFinal)(ckSessionHandle, (CK_BYTE_PTR)(outBufP + jOutOfs), &ckLastEncryptedPartLen); - //printf("EF: ckLastEncryptedPartLen=%i", ckLastEncryptedPartLen); - if (directOut == 0) { (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); } @@ -291,7 +291,7 @@ jobject jMechanism, jlong jKeyHandle) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_OBJECT_HANDLE ckKeyHandle; CK_RV rv; @@ -300,15 +300,14 @@ ckSessionHandle = jLongToCKULong(jSessionHandle); ckKeyHandle = jLongToCKULong(jKeyHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return; } - rv = (*ckpFunctions->C_DecryptInit)(ckSessionHandle, &ckMechanism, + rv = (*ckpFunctions->C_DecryptInit)(ckSessionHandle, ckpMechanism, ckKeyHandle); - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } + // if OAEP, then cannot free here + freeCKMechanismPtr(ckpMechanism); if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } } @@ -318,7 +317,7 @@ /* * Class: sun_security_pkcs11_wrapper_PKCS11 * Method: C_Decrypt - * Signature: (J[BII[BII)I + * Signature: (JJ[BIIJ[BII)I * Parametermapping: *PKCS11* * @param jlong jSessionHandle CK_SESSION_HANDLE hSession * @param jbyteArray jEncryptedData CK_BYTE_PTR pEncryptedData @@ -329,44 +328,53 @@ JNIEXPORT jint JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1Decrypt (JNIEnv *env, jobject obj, jlong jSessionHandle, - jbyteArray jIn, jint jInOfs, jint jInLen, - jbyteArray jOut, jint jOutOfs, jint jOutLen) + jlong directIn, jbyteArray jIn, jint jInOfs, jint jInLen, + jlong directOut, jbyteArray jOut, jint jOutOfs, jint jOutLen) { CK_SESSION_HANDLE ckSessionHandle; CK_RV rv; CK_BYTE_PTR inBufP; CK_BYTE_PTR outBufP; - CK_ULONG ckPartLen; + CK_ULONG ckOutLen = 0; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return 0; } ckSessionHandle = jLongToCKULong(jSessionHandle); - inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL); - if (inBufP == NULL) { return 0; } - - outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); - if (outBufP == NULL) { - // Make sure to release inBufP - (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); - return 0; + if (directIn != 0) { + inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn); + } else { + inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL); + if (inBufP == NULL) { return 0; } } - ckPartLen = jOutLen; + if (directOut != 0) { + outBufP = (CK_BYTE_PTR) jlong_to_ptr(directOut); + } else { + outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); + if (outBufP == NULL) { + goto cleanup; + } + } + ckOutLen = jOutLen; rv = (*ckpFunctions->C_Decrypt)(ckSessionHandle, (CK_BYTE_PTR)(inBufP + jInOfs), jInLen, (CK_BYTE_PTR)(outBufP + jOutOfs), - &ckPartLen); - - (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); - (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); + &ckOutLen); ckAssertReturnValueOK(env, rv); - return ckPartLen; +cleanup: + if (directIn == 0 && inBufP != NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); + } + if (directOut == 0 && outBufP != NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); + } + return ckOutLen; } #endif @@ -393,7 +401,7 @@ CK_BYTE_PTR inBufP; CK_BYTE_PTR outBufP; - CK_ULONG ckDecryptedPartLen; + CK_ULONG ckDecryptedPartLen = 0; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return 0; } @@ -412,28 +420,24 @@ } else { outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); if (outBufP == NULL) { - // Make sure to release inBufP - (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); - return 0; + goto cleanup; } } ckDecryptedPartLen = jOutLen; - rv = (*ckpFunctions->C_DecryptUpdate)(ckSessionHandle, (CK_BYTE_PTR)(inBufP + jInOfs), jInLen, (CK_BYTE_PTR)(outBufP + jOutOfs), &ckDecryptedPartLen); - if (directIn == 0) { + ckAssertReturnValueOK(env, rv); + +cleanup: + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } - - if (directOut == 0) { + if (directOut == 0 && outBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); } - - ckAssertReturnValueOK(env, rv); - return ckDecryptedPartLen; } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_digest.c --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_digest.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_digest.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -68,21 +68,19 @@ (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_RV rv; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return; } ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return; } - rv = (*ckpFunctions->C_DigestInit)(ckSessionHandle, &ckMechanism); + rv = (*ckpFunctions->C_DigestInit)(ckSessionHandle, ckpMechanism); - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } + freeCKMechanismPtr(ckpMechanism); if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } } @@ -101,53 +99,50 @@ * CK_ULONG_PTR pulDigestLen */ JNIEXPORT jint JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DigestSingle - (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, jbyteArray jIn, jint jInOfs, jint jInLen, jbyteArray jDigest, jint jDigestOfs, jint jDigestLen) + (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, + jbyteArray jIn, jint jInOfs, jint jInLen, jbyteArray jDigest, + jint jDigestOfs, jint jDigestLen) { CK_SESSION_HANDLE ckSessionHandle; CK_RV rv; - CK_BYTE_PTR bufP; CK_BYTE BUF[MAX_STACK_BUFFER_LEN]; + CK_BYTE_PTR bufP = BUF; CK_BYTE DIGESTBUF[MAX_DIGEST_LEN]; - CK_ULONG ckDigestLength = min(MAX_DIGEST_LEN, jDigestLen); - CK_MECHANISM ckMechanism; + CK_ULONG ckDigestLength = 0; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return 0; } ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return 0; } - rv = (*ckpFunctions->C_DigestInit)(ckSessionHandle, &ckMechanism); - - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } + rv = (*ckpFunctions->C_DigestInit)(ckSessionHandle, ckpMechanism); + if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { goto cleanup; } - if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return 0; } - - if (jInLen <= MAX_STACK_BUFFER_LEN) { - bufP = BUF; - } else { + if (jInLen > MAX_STACK_BUFFER_LEN) { /* always use single part op, even for large data */ bufP = (CK_BYTE_PTR) malloc((size_t)jInLen); if (bufP == NULL) { throwOutOfMemoryError(env, 0); - return 0; + goto cleanup; } } (*env)->GetByteArrayRegion(env, jIn, jInOfs, jInLen, (jbyte *)bufP); if ((*env)->ExceptionCheck(env)) { - if (bufP != BUF) { free(bufP); } - return 0; + goto cleanup; } + ckDigestLength = min(MAX_DIGEST_LEN, jDigestLen); + rv = (*ckpFunctions->C_Digest)(ckSessionHandle, bufP, jInLen, DIGESTBUF, &ckDigestLength); if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { (*env)->SetByteArrayRegion(env, jDigest, jDigestOfs, ckDigestLength, (jbyte *)DIGESTBUF); } - +cleanup: + freeCKMechanismPtr(ckpMechanism); if (bufP != BUF) { free(bufP); } return ckDigestLength; @@ -165,7 +160,8 @@ * CK_ULONG ulDataLen */ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DigestUpdate - (JNIEnv *env, jobject obj, jlong jSessionHandle, jlong directIn, jbyteArray jIn, jint jInOfs, jint jInLen) + (JNIEnv *env, jobject obj, jlong jSessionHandle, jlong directIn, jbyteArray jIn, + jint jInOfs, jint jInLen) { CK_SESSION_HANDLE ckSessionHandle; CK_RV rv; @@ -256,7 +252,8 @@ * CK_ULONG_PTR pulDigestLen */ JNIEXPORT jint JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DigestFinal - (JNIEnv *env, jobject obj, jlong jSessionHandle, jbyteArray jDigest, jint jDigestOfs, jint jDigestLen) + (JNIEnv *env, jobject obj, jlong jSessionHandle, jbyteArray jDigest, + jint jDigestOfs, jint jDigestLen) { CK_SESSION_HANDLE ckSessionHandle; CK_RV rv; diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c Fri Jun 21 14:07:48 2019 +0530 @@ -51,6 +51,7 @@ #include #include #include +#include "jlong.h" #include "sun_security_pkcs11_wrapper_PKCS11.h" @@ -67,6 +68,7 @@ jfieldID pNativeDataID; jfieldID mech_mechanismID; jfieldID mech_pParameterID; +jfieldID mech_pHandleID; jclass jByteArrayClass; jclass jLongClass; @@ -85,6 +87,23 @@ /* ************************************************************************** */ /* + * This method is used to do free the memory allocated for CK_MECHANISM structure. + * + * Class: sun_security_pkcs11_wrapper_PKCS11 + * Method: freeMechanism + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_sun_security_pkcs11_wrapper_PKCS11_freeMechanism +(JNIEnv *env, jclass thisClass, jlong ckpMechanism) { + if (ckpMechanism != 0L) { + freeCKMechanismPtr(jlong_to_ptr(ckpMechanism)); + TRACE1("DEBUG PKCS11_freeMechanism: free pMech = %x\n", ckpMechanism); + } + return 0L; +} + +/* * This method is used to do static initialization. This method is static and * synchronized. Summary: use this method like a static initialization block. * @@ -115,11 +134,11 @@ void prefetchFields(JNIEnv *env, jclass thisClass) { jclass tmpClass; - /* PKCS11 */ + /* PKCS11 - pNativeData */ pNativeDataID = (*env)->GetFieldID(env, thisClass, "pNativeData", "J"); if (pNativeDataID == NULL) { return; } - /* CK_MECHANISM */ + /* CK_MECHANISM - mechanism, pParameter, pHandle */ tmpClass = (*env)->FindClass(env, CLASS_MECHANISM); if (tmpClass == NULL) { return; } mech_mechanismID = (*env)->GetFieldID(env, tmpClass, "mechanism", "J"); @@ -127,6 +146,10 @@ mech_pParameterID = (*env)->GetFieldID(env, tmpClass, "pParameter", "Ljava/lang/Object;"); if (mech_pParameterID == NULL) { return; } + mech_pHandleID = (*env)->GetFieldID(env, tmpClass, "pHandle", "J"); + if (mech_pHandleID == NULL) { return; } + + /* java classes for primitive types - byte[], long */ jByteArrayClass = fetchClass(env, "[B"); if (jByteArrayClass == NULL) { return; } jLongClass = fetchClass(env, "java/lang/Long"); diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c Fri Jun 21 14:07:48 2019 +0530 @@ -155,7 +155,7 @@ jbyte* nativeKeyInfoArrayRawCkAttributes = NULL; jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL; jbyte* nativeKeyInfoArrayRawDataPtr = NULL; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; char iv[16] = {0x0}; CK_ULONG ckWrappedKeyLength = 0U; jbyte* wrappedKeySizeWrappedKeyArrayPtr = NULL; @@ -310,8 +310,8 @@ // Key is sensitive. Need to extract it wrapped. if (jWrappingKeyHandle != 0) { - jMechanismToCKMechanism(env, jWrappingMech, &ckMechanism); - rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism, + ckpMechanism = jMechanismToCKMechanismPtr(env, jWrappingMech); + rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, ckpMechanism, jLongToCKULong(jWrappingKeyHandle), ckObjectHandle, NULL_PTR, &ckWrappedKeyLength); if (ckWrappedKeyLength != 0) { @@ -339,7 +339,7 @@ wrappedKeyBufferPtr = (CK_BYTE_PTR) (wrappedKeySizeWrappedKeyArrayPtr + sizeof(unsigned long)); - rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism, + rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, ckpMechanism, jLongToCKULong(jWrappingKeyHandle),ckObjectHandle, wrappedKeyBufferPtr, &ckWrappedKeyLength); if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { @@ -382,6 +382,7 @@ && returnValue != nativeKeyInfoWrappedKeyArray) { (*env)->DeleteLocalRef(env, nativeKeyInfoWrappedKeyArray); } + freeCKMechanismPtr(ckpMechanism); return returnValue; } @@ -417,7 +418,7 @@ unsigned long totalDataSize = 0UL; jbyte* wrappedKeySizePtr = NULL; unsigned int i = 0U; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; char iv[16] = {0x0}; CK_ULONG ckWrappedKeyLength = 0UL; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); @@ -468,8 +469,8 @@ jLongToCKULong(nativeKeyInfoCkAttributesCount), &ckObjectHandle); } else { // Wrapped key - jMechanismToCKMechanism(env, jWrappingMech, &ckMechanism); - rv = (*ckpFunctions->C_UnwrapKey)(ckSessionHandle, &ckMechanism, + ckpMechanism = jMechanismToCKMechanismPtr(env, jWrappingMech); + rv = (*ckpFunctions->C_UnwrapKey)(ckSessionHandle, ckpMechanism, jLongToCKULong(jWrappingKeyHandle), (CK_BYTE_PTR)(wrappedKeySizePtr + sizeof(unsigned long)), ckWrappedKeyLength, @@ -490,6 +491,7 @@ nativeKeyInfoArrayRaw, JNI_ABORT); } + freeCKMechanismPtr(ckpMechanism); return jObjectHandle; } #endif @@ -510,9 +512,9 @@ (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, jobjectArray jTemplate) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_ATTRIBUTE_PTR ckpAttributes = NULL_PTR; - CK_ULONG ckAttributesLength; + CK_ULONG ckAttributesLength = 0; CK_OBJECT_HANDLE ckKeyHandle = 0; jlong jKeyHandle = 0L; CK_RV rv; @@ -521,24 +523,21 @@ if (ckpFunctions == NULL) { return 0L; } ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return 0L ; } jAttributeArrayToCKAttributeArray(env, jTemplate, &ckpAttributes, &ckAttributesLength); if ((*env)->ExceptionCheck(env)) { - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } - return 0L; + goto cleanup; } - rv = (*ckpFunctions->C_GenerateKey)(ckSessionHandle, &ckMechanism, ckpAttributes, ckAttributesLength, &ckKeyHandle); + rv = (*ckpFunctions->C_GenerateKey)(ckSessionHandle, ckpMechanism, ckpAttributes, ckAttributesLength, &ckKeyHandle); if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { jKeyHandle = ckULongToJLong(ckKeyHandle); /* cheack, if we must give a initialization vector back to Java */ - switch (ckMechanism.mechanism) { + switch (ckpMechanism->mechanism) { case CKM_PBE_MD2_DES_CBC: case CKM_PBE_MD5_DES_CBC: case CKM_PBE_MD5_CAST_CBC: @@ -548,14 +547,12 @@ case CKM_PBE_SHA1_CAST128_CBC: /* case CKM_PBE_SHA1_CAST5_CBC: the same as CKM_PBE_SHA1_CAST128_CBC */ /* we must copy back the initialization vector to the jMechanism object */ - copyBackPBEInitializationVector(env, &ckMechanism, jMechanism); + copyBackPBEInitializationVector(env, ckpMechanism, jMechanism); break; } } - - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } +cleanup: + freeCKMechanismPtr(ckpMechanism); freeCKAttributeArray(ckpAttributes, ckAttributesLength); return jKeyHandle ; @@ -582,14 +579,14 @@ jobjectArray jPublicKeyTemplate, jobjectArray jPrivateKeyTemplate) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_ATTRIBUTE_PTR ckpPublicKeyAttributes = NULL_PTR; CK_ATTRIBUTE_PTR ckpPrivateKeyAttributes = NULL_PTR; - CK_ULONG ckPublicKeyAttributesLength; - CK_ULONG ckPrivateKeyAttributesLength; + CK_ULONG ckPublicKeyAttributesLength = 0; + CK_ULONG ckPrivateKeyAttributesLength = 0; CK_OBJECT_HANDLE_PTR ckpPublicKeyHandle; /* pointer to Public Key */ CK_OBJECT_HANDLE_PTR ckpPrivateKeyHandle; /* pointer to Private Key */ - CK_OBJECT_HANDLE_PTR ckpKeyHandles; /* pointer to array with Public and Private Key */ + CK_OBJECT_HANDLE_PTR ckpKeyHandles = NULL; /* pointer to array with Public and Private Key */ jlongArray jKeyHandles = NULL; CK_RV rv; int attempts; @@ -599,37 +596,25 @@ if (ckpFunctions == NULL) { return NULL; } ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return NULL; } ckpKeyHandles = (CK_OBJECT_HANDLE_PTR) malloc(2 * sizeof(CK_OBJECT_HANDLE)); if (ckpKeyHandles == NULL) { - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } throwOutOfMemoryError(env, 0); - return NULL; + goto cleanup; } ckpPublicKeyHandle = ckpKeyHandles; /* first element of array is Public Key */ ckpPrivateKeyHandle = (ckpKeyHandles + 1); /* second element of array is Private Key */ jAttributeArrayToCKAttributeArray(env, jPublicKeyTemplate, &ckpPublicKeyAttributes, &ckPublicKeyAttributesLength); if ((*env)->ExceptionCheck(env)) { - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } - free(ckpKeyHandles); - return NULL; + goto cleanup; } jAttributeArrayToCKAttributeArray(env, jPrivateKeyTemplate, &ckpPrivateKeyAttributes, &ckPrivateKeyAttributesLength); if ((*env)->ExceptionCheck(env)) { - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } - free(ckpKeyHandles); - freeCKAttributeArray(ckpPublicKeyAttributes, ckPublicKeyAttributesLength); - return NULL; + goto cleanup; } /* @@ -650,7 +635,7 @@ * Call C_GenerateKeyPair() several times if CKR_FUNCTION_FAILED occurs. */ for (attempts = 0; attempts < MAX_ATTEMPTS; attempts++) { - rv = (*ckpFunctions->C_GenerateKeyPair)(ckSessionHandle, &ckMechanism, + rv = (*ckpFunctions->C_GenerateKeyPair)(ckSessionHandle, ckpMechanism, ckpPublicKeyAttributes, ckPublicKeyAttributesLength, ckpPrivateKeyAttributes, ckPrivateKeyAttributesLength, ckpPublicKeyHandle, ckpPrivateKeyHandle); @@ -666,13 +651,11 @@ jKeyHandles = ckULongArrayToJLongArray(env, ckpKeyHandles, 2); } - if(ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } +cleanup: + freeCKMechanismPtr(ckpMechanism); free(ckpKeyHandles); freeCKAttributeArray(ckpPublicKeyAttributes, ckPublicKeyAttributesLength); freeCKAttributeArray(ckpPrivateKeyAttributes, ckPrivateKeyAttributesLength); - return jKeyHandles ; } #endif @@ -694,7 +677,7 @@ (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, jlong jWrappingKeyHandle, jlong jKeyHandle) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_OBJECT_HANDLE ckWrappingKeyHandle; CK_OBJECT_HANDLE ckKeyHandle; jbyteArray jWrappedKey = NULL; @@ -707,33 +690,30 @@ if (ckpFunctions == NULL) { return NULL; } ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return NULL; } ckWrappingKeyHandle = jLongToCKULong(jWrappingKeyHandle); ckKeyHandle = jLongToCKULong(jKeyHandle); - rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism, ckWrappingKeyHandle, ckKeyHandle, ckpWrappedKey, &ckWrappedKeyLength); + rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, ckpMechanism, ckWrappingKeyHandle, ckKeyHandle, ckpWrappedKey, &ckWrappedKeyLength); if (rv == CKR_BUFFER_TOO_SMALL) { ckpWrappedKey = (CK_BYTE_PTR) malloc(ckWrappedKeyLength); if (ckpWrappedKey == NULL) { - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } throwOutOfMemoryError(env, 0); - return NULL; + goto cleanup; } - rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism, ckWrappingKeyHandle, ckKeyHandle, ckpWrappedKey, &ckWrappedKeyLength); + rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, ckpMechanism, ckWrappingKeyHandle, ckKeyHandle, ckpWrappedKey, &ckWrappedKeyLength); } if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { jWrappedKey = ckByteArrayToJByteArray(env, ckpWrappedKey, ckWrappedKeyLength); } +cleanup: if (ckpWrappedKey != BUF) { free(ckpWrappedKey); } - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } + freeCKMechanismPtr(ckpMechanism); + return jWrappedKey ; } #endif @@ -758,12 +738,12 @@ jbyteArray jWrappedKey, jobjectArray jTemplate) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_OBJECT_HANDLE ckUnwrappingKeyHandle; CK_BYTE_PTR ckpWrappedKey = NULL_PTR; CK_ULONG ckWrappedKeyLength; CK_ATTRIBUTE_PTR ckpAttributes = NULL_PTR; - CK_ULONG ckAttributesLength; + CK_ULONG ckAttributesLength = 0; CK_OBJECT_HANDLE ckKeyHandle = 0; jlong jKeyHandle = 0L; CK_RV rv; @@ -772,29 +752,22 @@ if (ckpFunctions == NULL) { return 0L; } ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return 0L; } ckUnwrappingKeyHandle = jLongToCKULong(jUnwrappingKeyHandle); jByteArrayToCKByteArray(env, jWrappedKey, &ckpWrappedKey, &ckWrappedKeyLength); if ((*env)->ExceptionCheck(env)) { - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } - return 0L; + goto cleanup; } jAttributeArrayToCKAttributeArray(env, jTemplate, &ckpAttributes, &ckAttributesLength); if ((*env)->ExceptionCheck(env)) { - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } - free(ckpWrappedKey); - return 0L; + goto cleanup; } - rv = (*ckpFunctions->C_UnwrapKey)(ckSessionHandle, &ckMechanism, ckUnwrappingKeyHandle, + rv = (*ckpFunctions->C_UnwrapKey)(ckSessionHandle, ckpMechanism, ckUnwrappingKeyHandle, ckpWrappedKey, ckWrappedKeyLength, ckpAttributes, ckAttributesLength, &ckKeyHandle); @@ -803,16 +776,14 @@ #if 0 /* cheack, if we must give a initialization vector back to Java */ - if (ckMechanism.mechanism == CKM_KEY_WRAP_SET_OAEP) { + if (ckpMechanism->mechanism == CKM_KEY_WRAP_SET_OAEP) { /* we must copy back the unwrapped key info to the jMechanism object */ - copyBackSetUnwrappedKey(env, &ckMechanism, jMechanism); + copyBackSetUnwrappedKey(env, ckpMechanism, jMechanism); } #endif } - - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } +cleanup: + freeCKMechanismPtr(ckpMechanism); freeCKAttributeArray(ckpAttributes, ckAttributesLength); free(ckpWrappedKey); @@ -834,26 +805,27 @@ } } -void ssl3FreeMasterKeyDeriveParams(CK_MECHANISM_PTR ckMechanism) { - CK_SSL3_MASTER_KEY_DERIVE_PARAMS *params = (CK_SSL3_MASTER_KEY_DERIVE_PARAMS *) ckMechanism->pParameter; +void ssl3FreeMasterKeyDeriveParams(CK_MECHANISM_PTR ckpMechanism) { + CK_SSL3_MASTER_KEY_DERIVE_PARAMS *params = + (CK_SSL3_MASTER_KEY_DERIVE_PARAMS *) ckpMechanism->pParameter; if (params == NULL) { return; } freeMasterKeyDeriveParams(&(params->RandomInfo), params->pVersion); } -void tls12FreeMasterKeyDeriveParams(CK_MECHANISM_PTR ckMechanism) { +void tls12FreeMasterKeyDeriveParams(CK_MECHANISM_PTR ckpMechanism) { CK_TLS12_MASTER_KEY_DERIVE_PARAMS *params = - (CK_TLS12_MASTER_KEY_DERIVE_PARAMS *)ckMechanism->pParameter; + (CK_TLS12_MASTER_KEY_DERIVE_PARAMS *)ckpMechanism->pParameter; if (params == NULL) { return; } freeMasterKeyDeriveParams(&(params->RandomInfo), params->pVersion); } -void freeEcdh1DeriveParams(CK_MECHANISM_PTR ckMechanism) { +void freeEcdh1DeriveParams(CK_MECHANISM_PTR ckpMechanism) { CK_ECDH1_DERIVE_PARAMS *params = - (CK_ECDH1_DERIVE_PARAMS *)ckMechanism->pParameter; + (CK_ECDH1_DERIVE_PARAMS *)ckpMechanism->pParameter; if (params == NULL) { return; } @@ -869,7 +841,7 @@ /* * Copy back the PRF output to Java. */ -void copyBackTLSPrfParams(JNIEnv *env, CK_MECHANISM *ckMechanism, jobject jMechanism) +void copyBackTLSPrfParams(JNIEnv *env, CK_MECHANISM_PTR ckpMechanism, jobject jMechanism) { jclass jMechanismClass, jTLSPrfParamsClass; CK_TLS_PRF_PARAMS *ckTLSPrfParams; @@ -890,13 +862,13 @@ if (fieldID == NULL) { return; } jMechanismType = (*env)->GetLongField(env, jMechanism, fieldID); ckMechanismType = jLongToCKULong(jMechanismType); - if (ckMechanismType != ckMechanism->mechanism) { + if (ckMechanismType != ckpMechanism->mechanism) { /* we do not have maching types, this should not occur */ return; } /* get the native CK_TLS_PRF_PARAMS */ - ckTLSPrfParams = (CK_TLS_PRF_PARAMS *) ckMechanism->pParameter; + ckTLSPrfParams = (CK_TLS_PRF_PARAMS *) ckpMechanism->pParameter; if (ckTLSPrfParams != NULL_PTR) { /* get the Java CK_TLS_PRF_PARAMS object (pParameter) */ fieldID = (*env)->GetFieldID(env, jMechanismClass, "pParameter", "Ljava/lang/Object;"); @@ -950,10 +922,10 @@ (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, jlong jBaseKeyHandle, jobjectArray jTemplate) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_OBJECT_HANDLE ckBaseKeyHandle; CK_ATTRIBUTE_PTR ckpAttributes = NULL_PTR; - CK_ULONG ckAttributesLength; + CK_ULONG ckAttributesLength = 0; CK_OBJECT_HANDLE ckKeyHandle = 0; jlong jKeyHandle = 0L; CK_RV rv; @@ -963,19 +935,16 @@ if (ckpFunctions == NULL) { return 0L; } ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return 0L; } ckBaseKeyHandle = jLongToCKULong(jBaseKeyHandle); jAttributeArrayToCKAttributeArray(env, jTemplate, &ckpAttributes, &ckAttributesLength); if ((*env)->ExceptionCheck(env)) { - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } - return 0L; + goto cleanup; } - switch (ckMechanism.mechanism) { + switch (ckpMechanism->mechanism) { case CKM_SSL3_KEY_AND_MAC_DERIVE: case CKM_TLS_KEY_AND_MAC_DERIVE: case CKM_TLS12_KEY_AND_MAC_DERIVE: @@ -989,60 +958,60 @@ break; } - rv = (*ckpFunctions->C_DeriveKey)(ckSessionHandle, &ckMechanism, ckBaseKeyHandle, + rv = (*ckpFunctions->C_DeriveKey)(ckSessionHandle, ckpMechanism, ckBaseKeyHandle, ckpAttributes, ckAttributesLength, phKey); jKeyHandle = ckLongToJLong(ckKeyHandle); - freeCKAttributeArray(ckpAttributes, ckAttributesLength); - - switch (ckMechanism.mechanism) { + switch (ckpMechanism->mechanism) { case CKM_SSL3_MASTER_KEY_DERIVE: case CKM_TLS_MASTER_KEY_DERIVE: /* we must copy back the client version */ - ssl3CopyBackClientVersion(env, &ckMechanism, jMechanism); - ssl3FreeMasterKeyDeriveParams(&ckMechanism); + ssl3CopyBackClientVersion(env, ckpMechanism, jMechanism); + ssl3FreeMasterKeyDeriveParams(ckpMechanism); break; case CKM_TLS12_MASTER_KEY_DERIVE: - tls12CopyBackClientVersion(env, &ckMechanism, jMechanism); - tls12FreeMasterKeyDeriveParams(&ckMechanism); + tls12CopyBackClientVersion(env, ckpMechanism, jMechanism); + tls12FreeMasterKeyDeriveParams(ckpMechanism); break; case CKM_SSL3_MASTER_KEY_DERIVE_DH: case CKM_TLS_MASTER_KEY_DERIVE_DH: - ssl3FreeMasterKeyDeriveParams(&ckMechanism); + ssl3FreeMasterKeyDeriveParams(ckpMechanism); break; case CKM_TLS12_MASTER_KEY_DERIVE_DH: - tls12FreeMasterKeyDeriveParams(&ckMechanism); + tls12FreeMasterKeyDeriveParams(ckpMechanism); break; case CKM_SSL3_KEY_AND_MAC_DERIVE: case CKM_TLS_KEY_AND_MAC_DERIVE: /* we must copy back the unwrapped key info to the jMechanism object */ - ssl3CopyBackKeyMatParams(env, &ckMechanism, jMechanism); + ssl3CopyBackKeyMatParams(env, ckpMechanism, jMechanism); break; case CKM_TLS12_KEY_AND_MAC_DERIVE: /* we must copy back the unwrapped key info to the jMechanism object */ - tls12CopyBackKeyMatParams(env, &ckMechanism, jMechanism); + tls12CopyBackKeyMatParams(env, ckpMechanism, jMechanism); break; case CKM_TLS_PRF: - copyBackTLSPrfParams(env, &ckMechanism, jMechanism); + copyBackTLSPrfParams(env, ckpMechanism, jMechanism); break; case CKM_ECDH1_DERIVE: - freeEcdh1DeriveParams(&ckMechanism); + freeEcdh1DeriveParams(ckpMechanism); break; default: // empty break; } + if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { + jKeyHandle =0L; + } - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); - } - if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return 0L ; } +cleanup: + freeCKMechanismPtr(ckpMechanism); + freeCKAttributeArray(ckpAttributes, ckAttributesLength); return jKeyHandle ; } -static void copyBackClientVersion(JNIEnv *env, CK_MECHANISM *ckMechanism, jobject jMechanism, +static void copyBackClientVersion(JNIEnv *env, CK_MECHANISM_PTR ckpMechanism, jobject jMechanism, CK_VERSION *ckVersion, const char *class_master_key_derive_params) { jclass jMasterKeyDeriveParamsClass, jMechanismClass, jVersionClass; @@ -1059,7 +1028,7 @@ if (fieldID == NULL) { return; } jMechanismType = (*env)->GetLongField(env, jMechanism, fieldID); ckMechanismType = jLongToCKULong(jMechanismType); - if (ckMechanismType != ckMechanism->mechanism) { + if (ckMechanismType != ckpMechanism->mechanism) { /* we do not have maching types, this should not occur */ return; } @@ -1102,14 +1071,14 @@ * mechanisms when used for deriving a key. * */ -void ssl3CopyBackClientVersion(JNIEnv *env, CK_MECHANISM *ckMechanism, +void ssl3CopyBackClientVersion(JNIEnv *env, CK_MECHANISM_PTR ckpMechanism, jobject jMechanism) { CK_SSL3_MASTER_KEY_DERIVE_PARAMS *ckSSL3MasterKeyDeriveParams; ckSSL3MasterKeyDeriveParams = - (CK_SSL3_MASTER_KEY_DERIVE_PARAMS *)ckMechanism->pParameter; + (CK_SSL3_MASTER_KEY_DERIVE_PARAMS *)ckpMechanism->pParameter; if (ckSSL3MasterKeyDeriveParams != NULL_PTR) { - copyBackClientVersion(env, ckMechanism, jMechanism, + copyBackClientVersion(env, ckpMechanism, jMechanism, ckSSL3MasterKeyDeriveParams->pVersion, CLASS_SSL3_MASTER_KEY_DERIVE_PARAMS); } @@ -1121,20 +1090,20 @@ * CKM_TLS12_MASTER_KEY_DERIVE mechanism when used for deriving a key. * */ -void tls12CopyBackClientVersion(JNIEnv *env, CK_MECHANISM *ckMechanism, +void tls12CopyBackClientVersion(JNIEnv *env, CK_MECHANISM_PTR ckpMechanism, jobject jMechanism) { CK_TLS12_MASTER_KEY_DERIVE_PARAMS *ckTLS12MasterKeyDeriveParams; ckTLS12MasterKeyDeriveParams = - (CK_TLS12_MASTER_KEY_DERIVE_PARAMS *)ckMechanism->pParameter; + (CK_TLS12_MASTER_KEY_DERIVE_PARAMS *)ckpMechanism->pParameter; if (ckTLS12MasterKeyDeriveParams != NULL_PTR) { - copyBackClientVersion(env, ckMechanism, jMechanism, + copyBackClientVersion(env, ckpMechanism, jMechanism, ckTLS12MasterKeyDeriveParams->pVersion, CLASS_TLS12_MASTER_KEY_DERIVE_PARAMS); } } -static void copyBackKeyMatParams(JNIEnv *env, CK_MECHANISM *ckMechanism, +static void copyBackKeyMatParams(JNIEnv *env, CK_MECHANISM_PTR ckpMechanism, jobject jMechanism, CK_SSL3_RANDOM_DATA *RandomInfo, CK_SSL3_KEY_MAT_OUT_PTR ckSSL3KeyMatOut, const char *class_key_mat_params) { @@ -1157,7 +1126,7 @@ if (fieldID == NULL) { return; } jMechanismType = (*env)->GetLongField(env, jMechanism, fieldID); ckMechanismType = jLongToCKULong(jMechanismType); - if (ckMechanismType != ckMechanism->mechanism) { + if (ckMechanismType != ckpMechanism->mechanism) { /* we do not have maching types, this should not occur */ return; } @@ -1264,13 +1233,13 @@ * when used for deriving a key. * */ -void ssl3CopyBackKeyMatParams(JNIEnv *env, CK_MECHANISM *ckMechanism, +void ssl3CopyBackKeyMatParams(JNIEnv *env, CK_MECHANISM_PTR ckpMechanism, jobject jMechanism) { CK_SSL3_KEY_MAT_PARAMS *ckSSL3KeyMatParam; - ckSSL3KeyMatParam = (CK_SSL3_KEY_MAT_PARAMS *)ckMechanism->pParameter; + ckSSL3KeyMatParam = (CK_SSL3_KEY_MAT_PARAMS *)ckpMechanism->pParameter; if (ckSSL3KeyMatParam != NULL_PTR) { - copyBackKeyMatParams(env, ckMechanism, jMechanism, + copyBackKeyMatParams(env, ckpMechanism, jMechanism, &(ckSSL3KeyMatParam->RandomInfo), ckSSL3KeyMatParam->pReturnedKeyMaterial, CLASS_SSL3_KEY_MAT_PARAMS); @@ -1283,13 +1252,13 @@ * CKM_TLS12_KEY_AND_MAC_DERIVE mechanism when used for deriving a key. * */ -void tls12CopyBackKeyMatParams(JNIEnv *env, CK_MECHANISM *ckMechanism, +void tls12CopyBackKeyMatParams(JNIEnv *env, CK_MECHANISM_PTR ckpMechanism, jobject jMechanism) { CK_TLS12_KEY_MAT_PARAMS *ckTLS12KeyMatParam; - ckTLS12KeyMatParam = (CK_TLS12_KEY_MAT_PARAMS *) ckMechanism->pParameter; + ckTLS12KeyMatParam = (CK_TLS12_KEY_MAT_PARAMS *)ckpMechanism->pParameter; if (ckTLS12KeyMatParam != NULL_PTR) { - copyBackKeyMatParams(env, ckMechanism, jMechanism, + copyBackKeyMatParams(env, ckpMechanism, jMechanism, &(ckTLS12KeyMatParam->RandomInfo), ckTLS12KeyMatParam->pReturnedKeyMaterial, CLASS_TLS12_KEY_MAT_PARAMS); diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_mutex.c --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_mutex.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_mutex.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -181,7 +181,7 @@ jReserved = (*env)->GetObjectField(env, jInitArgs, fieldID); /* we try to convert the reserved parameter also */ - jObjectToPrimitiveCKObjectPtrPtr(env, jReserved, &(ckpInitArgs->pReserved), &ckReservedLength); + ckpInitArgs->pReserved = jObjectToPrimitiveCKObjectPtr(env, jReserved, &ckReservedLength); return ckpInitArgs ; } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -63,31 +63,38 @@ * Parametermapping: *PKCS11* * @param jlong jSessionHandle CK_SESSION_HANDLE hSession * @param jobject jMechanism CK_MECHANISM_PTR pMechanism - * @return jlong jKeyHandle CK_OBJECT_HANDLE hKey + * @param jlong jKeyHandle CK_OBJECT_HANDLE hKey */ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1SignInit (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, jlong jKeyHandle) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_OBJECT_HANDLE ckKeyHandle; CK_RV rv; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return; } + TRACE0("DEBUG: C_SignInit\n"); + ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return; } + ckKeyHandle = jLongToCKULong(jKeyHandle); - rv = (*ckpFunctions->C_SignInit)(ckSessionHandle, &ckMechanism, ckKeyHandle); + rv = (*ckpFunctions->C_SignInit)(ckSessionHandle, ckpMechanism, ckKeyHandle); - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); + if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK || + (ckpMechanism->pParameter == NULL)) { + freeCKMechanismPtr(ckpMechanism); + } else { + (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism)); + TRACE1("DEBUG C_SignInit: stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism)); } - - if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } + TRACE0("FINISHED\n"); } #endif @@ -95,7 +102,7 @@ /* * Class: sun_security_pkcs11_wrapper_PKCS11 * Method: C_Sign - * Signature: (J[B)[B + * Signature: (J[BI)[B * Parametermapping: *PKCS11* * @param jlong jSessionHandle CK_SESSION_HANDLE hSession * @param jbyteArray jData CK_BYTE_PTR pData @@ -108,69 +115,45 @@ { CK_SESSION_HANDLE ckSessionHandle; CK_BYTE_PTR ckpData = NULL_PTR; - CK_BYTE_PTR ckpSignature; CK_ULONG ckDataLength; - CK_ULONG ckSignatureLength = 0; + CK_BYTE_PTR bufP; + CK_ULONG ckSignatureLength; + CK_BYTE BUF[MAX_STACK_BUFFER_LEN]; jbyteArray jSignature = NULL; CK_RV rv; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return NULL; } + TRACE0("DEBUG: C_Sign\n"); + ckSessionHandle = jLongToCKULong(jSessionHandle); jByteArrayToCKByteArray(env, jData, &ckpData, &ckDataLength); - if ((*env)->ExceptionCheck(env)) { return NULL; } - - /* START standard code */ - - /* first determine the length of the signature */ - rv = (*ckpFunctions->C_Sign)(ckSessionHandle, ckpData, ckDataLength, NULL_PTR, &ckSignatureLength); - if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { - free(ckpData); - return NULL; - } - - ckpSignature = (CK_BYTE_PTR) malloc(ckSignatureLength * sizeof(CK_BYTE)); - if (ckpSignature == NULL) { - free(ckpData); - throwOutOfMemoryError(env, 0); + if ((*env)->ExceptionCheck(env)) { return NULL; } - /* now get the signature */ - rv = (*ckpFunctions->C_Sign)(ckSessionHandle, ckpData, ckDataLength, ckpSignature, &ckSignatureLength); - /* END standard code */ - + TRACE1("DEBUG C_Sign: data length = %lu\n", ckDataLength); - /* START workaround code for operation abort bug in pkcs#11 of Datakey and iButton */ -/* - ckpSignature = (CK_BYTE_PTR) malloc(256 * sizeof(CK_BYTE)); - if (ckpSignature == NULL) { - free(ckpData); - throwOutOfMemoryError(env, 0); - return NULL; - } - rv = (*ckpFunctions->C_Sign)(ckSessionHandle, ckpData, ckDataLength, ckpSignature, &ckSignatureLength); + // unknown signature length + bufP = BUF; + ckSignatureLength = MAX_STACK_BUFFER_LEN; + + rv = (*ckpFunctions->C_Sign)(ckSessionHandle, ckpData, ckDataLength, + bufP, &ckSignatureLength); + + TRACE1("DEBUG C_Sign: ret rv=0x%lX\n", rv); - if (rv == CKR_BUFFER_TOO_SMALL) { - free(ckpSignature); - ckpSignature = (CK_BYTE_PTR) malloc(ckSignatureLength * sizeof(CK_BYTE)); - if (ckpSignature == NULL) { - free(ckpData); - throwOutOfMemoryError(env, 0); - return NULL; - } - rv = (*ckpFunctions->C_Sign)(ckSessionHandle, ckpData, ckDataLength, ckpSignature, &ckSignatureLength); + if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { + jSignature = ckByteArrayToJByteArray(env, bufP, ckSignatureLength); + TRACE1("DEBUG C_Sign: signature length = %lu\n", ckSignatureLength); } - */ - /* END workaround code */ - if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { - jSignature = ckByteArrayToJByteArray(env, ckpSignature, ckSignatureLength); - } + free(ckpData); - free(ckpSignature); + if (bufP != BUF) { free(bufP); } - return jSignature ; + TRACE0("FINISHED\n"); + return jSignature; } #endif @@ -220,21 +203,20 @@ jsize chunkLen = min(bufLen, jInLen); (*env)->GetByteArrayRegion(env, jIn, jInOfs, chunkLen, (jbyte *)bufP); if ((*env)->ExceptionCheck(env)) { - if (bufP != BUF) { free(bufP); } - return; + goto cleanup; } rv = (*ckpFunctions->C_SignUpdate)(ckSessionHandle, bufP, chunkLen); if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { - if (bufP != BUF) { - free(bufP); - } - return; + goto cleanup; } jInOfs += chunkLen; jInLen -= chunkLen; } +cleanup: if (bufP != BUF) { free(bufP); } + + return; } #endif @@ -294,32 +276,37 @@ * Parametermapping: *PKCS11* * @param jlong jSessionHandle CK_SESSION_HANDLE hSession * @param jobject jMechanism CK_MECHANISM_PTR pMechanism - * @return jlong jKeyHandle CK_OBJECT_HANDLE hKey + * @param jlong jKeyHandle CK_OBJECT_HANDLE hKey */ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1SignRecoverInit (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, jlong jKeyHandle) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_OBJECT_HANDLE ckKeyHandle; CK_RV rv; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return; } + TRACE0("DEBUG: C_SignRecoverInit\n"); + ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return; } ckKeyHandle = jLongToCKULong(jKeyHandle); - rv = (*ckpFunctions->C_SignRecoverInit)(ckSessionHandle, &ckMechanism, ckKeyHandle); + rv = (*ckpFunctions->C_SignRecoverInit)(ckSessionHandle, ckpMechanism, ckKeyHandle); - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); + if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK || + (ckpMechanism->pParameter == NULL)) { + freeCKMechanismPtr(ckpMechanism); + } else { + (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism)); + TRACE1("DEBUG C_SignRecoverInit, stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism)); } - - if(ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } + TRACE0("FINISHED\n"); } #endif @@ -344,7 +331,7 @@ CK_BYTE OUTBUF[MAX_STACK_BUFFER_LEN]; CK_BYTE_PTR inBufP; CK_BYTE_PTR outBufP = OUTBUF; - CK_ULONG ckSignatureLength = MAX_STACK_BUFFER_LEN; + CK_ULONG ckSignatureLength = 0; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return 0; } @@ -353,36 +340,35 @@ if (jInLen <= MAX_STACK_BUFFER_LEN) { inBufP = INBUF; + ckSignatureLength = MAX_STACK_BUFFER_LEN; } else { inBufP = (CK_BYTE_PTR) malloc((size_t)jInLen); if (inBufP == NULL) { throwOutOfMemoryError(env, 0); return 0; } + ckSignatureLength = jInLen; } (*env)->GetByteArrayRegion(env, jIn, jInOfs, jInLen, (jbyte *)inBufP); if ((*env)->ExceptionCheck(env)) { - if (inBufP != INBUF) { free(inBufP); } - return 0; + goto cleanup; } + rv = (*ckpFunctions->C_SignRecover)(ckSessionHandle, inBufP, jInLen, outBufP, &ckSignatureLength); /* re-alloc larger buffer if it fits into our Java buffer */ if ((rv == CKR_BUFFER_TOO_SMALL) && (ckSignatureLength <= jIntToCKULong(jOutLen))) { outBufP = (CK_BYTE_PTR) malloc(ckSignatureLength); if (outBufP == NULL) { - if (inBufP != INBUF) { - free(inBufP); - } throwOutOfMemoryError(env, 0); - return 0; + goto cleanup; } rv = (*ckpFunctions->C_SignRecover)(ckSessionHandle, inBufP, jInLen, outBufP, &ckSignatureLength); } if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) { (*env)->SetByteArrayRegion(env, jOut, jOutOfs, ckSignatureLength, (jbyte *)outBufP); } - +cleanup: if (inBufP != INBUF) { free(inBufP); } if (outBufP != OUTBUF) { free(outBufP); } @@ -398,32 +384,39 @@ * Parametermapping: *PKCS11* * @param jlong jSessionHandle CK_SESSION_HANDLE hSession * @param jobject jMechanism CK_MECHANISM_PTR pMechanism - * @return jlong jKeyHandle CK_OBJECT_HANDLE hKey + * @param jlong jKeyHandle CK_OBJECT_HANDLE hKey */ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1VerifyInit (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, jlong jKeyHandle) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_OBJECT_HANDLE ckKeyHandle; CK_RV rv; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return; } + TRACE0("DEBUG: C_VerifyInit\n"); + ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); - if ((*env)->ExceptionCheck(env)) { return; } + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); + if ((*env)->ExceptionCheck(env)) { + return; + } ckKeyHandle = jLongToCKULong(jKeyHandle); - rv = (*ckpFunctions->C_VerifyInit)(ckSessionHandle, &ckMechanism, ckKeyHandle); + rv = (*ckpFunctions->C_VerifyInit)(ckSessionHandle, ckpMechanism, ckKeyHandle); - if(ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); + if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK || + (ckpMechanism->pParameter == NULL)) { + freeCKMechanismPtr(ckpMechanism); + } else { + (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism)); + TRACE1("DEBUG C_VerifyInit: stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism)); } - - if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } + TRACE0("FINISHED\n"); } #endif @@ -447,28 +440,31 @@ CK_BYTE_PTR ckpSignature = NULL_PTR; CK_ULONG ckDataLength; CK_ULONG ckSignatureLength; - CK_RV rv; + CK_RV rv = 0; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return; } ckSessionHandle = jLongToCKULong(jSessionHandle); + jByteArrayToCKByteArray(env, jData, &ckpData, &ckDataLength); - if ((*env)->ExceptionCheck(env)) { return; } + if ((*env)->ExceptionCheck(env)) { + return; + } jByteArrayToCKByteArray(env, jSignature, &ckpSignature, &ckSignatureLength); if ((*env)->ExceptionCheck(env)) { - free(ckpData); - return; + goto cleanup; } /* verify the signature */ rv = (*ckpFunctions->C_Verify)(ckSessionHandle, ckpData, ckDataLength, ckpSignature, ckSignatureLength); +cleanup: free(ckpData); free(ckpSignature); - if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } + ckAssertReturnValueOK(env, rv); } #endif @@ -510,7 +506,7 @@ bufP = (CK_BYTE_PTR) malloc((size_t)bufLen); if (bufP == NULL) { throwOutOfMemoryError(env, 0); - return; + goto cleanup; } } @@ -518,19 +514,18 @@ jsize chunkLen = min(bufLen, jInLen); (*env)->GetByteArrayRegion(env, jIn, jInOfs, chunkLen, (jbyte *)bufP); if ((*env)->ExceptionCheck(env)) { - if (bufP != BUF) { free(bufP); } - return; + goto cleanup; } rv = (*ckpFunctions->C_VerifyUpdate)(ckSessionHandle, bufP, chunkLen); if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { - if (bufP != BUF) { free(bufP); } - return; + goto cleanup; } jInOfs += chunkLen; jInLen -= chunkLen; } +cleanup: if (bufP != BUF) { free(bufP); } } #endif @@ -558,14 +553,16 @@ ckSessionHandle = jLongToCKULong(jSessionHandle); jByteArrayToCKByteArray(env, jSignature, &ckpSignature, &ckSignatureLength); - if ((*env)->ExceptionCheck(env)) { return; } + if ((*env)->ExceptionCheck(env)) { + return; + } /* verify the signature */ rv = (*ckpFunctions->C_VerifyFinal)(ckSessionHandle, ckpSignature, ckSignatureLength); free(ckpSignature); - if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } + ckAssertReturnValueOK(env, rv); } #endif @@ -583,26 +580,31 @@ (JNIEnv *env, jobject obj, jlong jSessionHandle, jobject jMechanism, jlong jKeyHandle) { CK_SESSION_HANDLE ckSessionHandle; - CK_MECHANISM ckMechanism; + CK_MECHANISM_PTR ckpMechanism = NULL; CK_OBJECT_HANDLE ckKeyHandle; CK_RV rv; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return; } + TRACE0("DEBUG: C_VerifyRecoverInit\n"); + ckSessionHandle = jLongToCKULong(jSessionHandle); - jMechanismToCKMechanism(env, jMechanism, &ckMechanism); + ckpMechanism = jMechanismToCKMechanismPtr(env, jMechanism); if ((*env)->ExceptionCheck(env)) { return; } ckKeyHandle = jLongToCKULong(jKeyHandle); - rv = (*ckpFunctions->C_VerifyRecoverInit)(ckSessionHandle, &ckMechanism, ckKeyHandle); + rv = (*ckpFunctions->C_VerifyRecoverInit)(ckSessionHandle, ckpMechanism, ckKeyHandle); - if (ckMechanism.pParameter != NULL_PTR) { - free(ckMechanism.pParameter); + if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK || + (ckpMechanism->pParameter == NULL)) { + freeCKMechanismPtr(ckpMechanism); + } else { + (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism)); + TRACE1("DEBUG C_VerifyRecoverInit: stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism)); } - - if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } + TRACE0("FINISHED\n"); } #endif @@ -627,7 +629,7 @@ CK_BYTE OUTBUF[MAX_STACK_BUFFER_LEN]; CK_BYTE_PTR inBufP; CK_BYTE_PTR outBufP = OUTBUF; - CK_ULONG ckDataLength = MAX_STACK_BUFFER_LEN; + CK_ULONG ckDataLength = 0; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); if (ckpFunctions == NULL) { return 0; } @@ -636,18 +638,19 @@ if (jInLen <= MAX_STACK_BUFFER_LEN) { inBufP = INBUF; + ckDataLength = MAX_STACK_BUFFER_LEN; } else { inBufP = (CK_BYTE_PTR) malloc((size_t)jInLen); if (inBufP == NULL) { throwOutOfMemoryError(env, 0); return 0; } + ckDataLength = jInLen; } (*env)->GetByteArrayRegion(env, jIn, jInOfs, jInLen, (jbyte *)inBufP); if ((*env)->ExceptionCheck(env)) { - if (inBufP != INBUF) { free(inBufP); } - return 0; + goto cleanup; } rv = (*ckpFunctions->C_VerifyRecover)(ckSessionHandle, inBufP, jInLen, outBufP, &ckDataLength); @@ -656,9 +659,8 @@ if ((rv == CKR_BUFFER_TOO_SMALL) && (ckDataLength <= jIntToCKULong(jOutLen))) { outBufP = (CK_BYTE_PTR) malloc(ckDataLength); if (outBufP == NULL) { - if (inBufP != INBUF) { free(inBufP); } throwOutOfMemoryError(env, 0); - return 0; + goto cleanup; } rv = (*ckpFunctions->C_VerifyRecover)(ckSessionHandle, inBufP, jInLen, outBufP, &ckDataLength); } @@ -666,6 +668,7 @@ (*env)->SetByteArrayRegion(env, jOut, jOutOfs, ckDataLength, (jbyte *)outBufP); } +cleanup: if (inBufP != INBUF) { free(inBufP); } if (outBufP != OUTBUF) { free(outBufP); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -277,16 +277,32 @@ * @param attrPtr pointer to the to-be-freed CK_ATTRIBUTE array. * @param len the length of the array */ -void freeCKAttributeArray(CK_ATTRIBUTE_PTR attrPtr, int len) -{ - int i; +void freeCKAttributeArray(CK_ATTRIBUTE_PTR attrPtr, int len) { + if (attrPtr != NULL) { + int i; + for (i=0; ipParameter); + free(mechPtr); + } } /* @@ -964,165 +980,164 @@ /* * converts a Java object into a pointer to CK-type or a CK-structure with the length in Bytes. - * The memory of *ckpObjectPtr to be freed after use! This function is only used by - * jAttributeToCKAttribute by now. + * The memory of the returned pointer MUST BE FREED BY CALLER! * * @param env - used to call JNI funktions to get the Java classes and objects * @param jObject - the Java object to convert - * @param ckpObjectPtr - the reference of the new pointer to the new CK-value or CK-structure - * @param ckpLength - the reference of the length in bytes of the new CK-value or CK-structure + * @param ckpLength - pointer to the length (bytes) of the newly-allocated CK-value or CK-structure + * @return ckpObject - pointer to the newly-allocated CK-value or CK-structure */ -void jObjectToPrimitiveCKObjectPtrPtr(JNIEnv *env, jobject jObject, CK_VOID_PTR *ckpObjectPtr, CK_ULONG *ckpLength) +CK_VOID_PTR jObjectToPrimitiveCKObjectPtr(JNIEnv *env, jobject jObject, CK_ULONG *ckpLength) { jclass jLongClass, jBooleanClass, jByteArrayClass, jCharArrayClass; jclass jByteClass, jDateClass, jCharacterClass, jIntegerClass; jclass jBooleanArrayClass, jIntArrayClass, jLongArrayClass; jclass jStringClass; jclass jObjectClass, jClassClass; - CK_VOID_PTR ckpVoid = *ckpObjectPtr; + CK_VOID_PTR ckpObject; jmethodID jMethod; jobject jClassObject; jstring jClassNameString; char *classNameString, *exceptionMsgPrefix, *exceptionMsg; - TRACE0("\nDEBUG: jObjectToPrimitiveCKObjectPtrPtr"); + TRACE0("\nDEBUG: jObjectToPrimitiveCKObjectPtr"); if (jObject == NULL) { - *ckpObjectPtr = NULL; *ckpLength = 0; - return; + return NULL; } jLongClass = (*env)->FindClass(env, "java/lang/Long"); - if (jLongClass == NULL) { return; } + if (jLongClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jLongClass)) { - *ckpObjectPtr = jLongObjectToCKULongPtr(env, jObject); + ckpObject = jLongObjectToCKULongPtr(env, jObject); *ckpLength = sizeof(CK_ULONG); - TRACE1("", *((CK_ULONG *) *ckpObjectPtr)); - return; + TRACE1("", *((CK_ULONG *) ckpObject)); + return ckpObject; } jBooleanClass = (*env)->FindClass(env, "java/lang/Boolean"); - if (jBooleanClass == NULL) { return; } + if (jBooleanClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jBooleanClass)) { - *ckpObjectPtr = jBooleanObjectToCKBBoolPtr(env, jObject); + ckpObject = jBooleanObjectToCKBBoolPtr(env, jObject); *ckpLength = sizeof(CK_BBOOL); TRACE0(" " : "FALSE>"); - return; + TRACE0((*((CK_BBOOL *) ckpObjectPtr) == TRUE) ? "TRUE>" : "FALSE>"); + return ckpObject; } jByteArrayClass = (*env)->FindClass(env, "[B"); - if (jByteArrayClass == NULL) { return; } + if (jByteArrayClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jByteArrayClass)) { - jByteArrayToCKByteArray(env, jObject, (CK_BYTE_PTR*)ckpObjectPtr, ckpLength); - return; + jByteArrayToCKByteArray(env, jObject, (CK_BYTE_PTR*) &ckpObject, ckpLength); + return ckpObject; } jCharArrayClass = (*env)->FindClass(env, "[C"); - if (jCharArrayClass == NULL) { return; } + if (jCharArrayClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jCharArrayClass)) { - jCharArrayToCKUTF8CharArray(env, jObject, (CK_UTF8CHAR_PTR*)ckpObjectPtr, ckpLength); - return; + jCharArrayToCKUTF8CharArray(env, jObject, (CK_UTF8CHAR_PTR*) &ckpObject, ckpLength); + return ckpObject; } jByteClass = (*env)->FindClass(env, "java/lang/Byte"); - if (jByteClass == NULL) { return; } + if (jByteClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jByteClass)) { - *ckpObjectPtr = jByteObjectToCKBytePtr(env, jObject); + ckpObject = jByteObjectToCKBytePtr(env, jObject); *ckpLength = sizeof(CK_BYTE); - TRACE1("", *((CK_BYTE *) *ckpObjectPtr)); - return; + TRACE1("", *((CK_BYTE *) ckpObject)); + return ckpObject; } jDateClass = (*env)->FindClass(env, CLASS_DATE); - if (jDateClass == NULL) { return; } + if (jDateClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jDateClass)) { - *ckpObjectPtr = jDateObjectPtrToCKDatePtr(env, jObject); + ckpObject = jDateObjectPtrToCKDatePtr(env, jObject); *ckpLength = sizeof(CK_DATE); - TRACE3("", (*((CK_DATE *) *ckpObjectPtr)).year, (*((CK_DATE *) *ckpObjectPtr)).month, (*((CK_DATE *) *ckpObjectPtr)).day); - return; + TRACE3("", ((CK_DATE *) ckpObject)->year, + ((CK_DATE *) ckpObject)->month, ((CK_DATE *) ckpObject)->day); + return ckpObject; } jCharacterClass = (*env)->FindClass(env, "java/lang/Character"); - if (jCharacterClass == NULL) { return; } + if (jCharacterClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jCharacterClass)) { - *ckpObjectPtr = jCharObjectToCKCharPtr(env, jObject); + ckpObject = jCharObjectToCKCharPtr(env, jObject); *ckpLength = sizeof(CK_UTF8CHAR); - TRACE1("", *((CK_CHAR *) *ckpObjectPtr)); - return; + TRACE1("", *((CK_CHAR *) ckpObject)); + return ckpObject; } jIntegerClass = (*env)->FindClass(env, "java/lang/Integer"); - if (jIntegerClass == NULL) { return; } + if (jIntegerClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jIntegerClass)) { - *ckpObjectPtr = jIntegerObjectToCKULongPtr(env, jObject); + ckpObject = jIntegerObjectToCKULongPtr(env, jObject); *ckpLength = sizeof(CK_ULONG); - TRACE1("", *((CK_ULONG *) *ckpObjectPtr)); - return; + TRACE1("", *((CK_ULONG *) ckpObject)); + return ckpObject; } jBooleanArrayClass = (*env)->FindClass(env, "[Z"); - if (jBooleanArrayClass == NULL) { return; } + if (jBooleanArrayClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jBooleanArrayClass)) { - jBooleanArrayToCKBBoolArray(env, jObject, (CK_BBOOL**)ckpObjectPtr, ckpLength); - return; + jBooleanArrayToCKBBoolArray(env, jObject, (CK_BBOOL**) &ckpObject, ckpLength); + return ckpObject; } jIntArrayClass = (*env)->FindClass(env, "[I"); - if (jIntArrayClass == NULL) { return; } + if (jIntArrayClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jIntArrayClass)) { - jLongArrayToCKULongArray(env, jObject, (CK_ULONG_PTR*)ckpObjectPtr, ckpLength); - return; + jLongArrayToCKULongArray(env, jObject, (CK_ULONG_PTR*) &ckpObject, ckpLength); + return ckpObject; } jLongArrayClass = (*env)->FindClass(env, "[J"); - if (jLongArrayClass == NULL) { return; } + if (jLongArrayClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jLongArrayClass)) { - jLongArrayToCKULongArray(env, jObject, (CK_ULONG_PTR*)ckpObjectPtr, ckpLength); - return; + jLongArrayToCKULongArray(env, jObject, (CK_ULONG_PTR*) &ckpObject, ckpLength); + return ckpObject; } jStringClass = (*env)->FindClass(env, "java/lang/String"); - if (jStringClass == NULL) { return; } + if (jStringClass == NULL) { return NULL; } if ((*env)->IsInstanceOf(env, jObject, jStringClass)) { - jStringToCKUTF8CharArray(env, jObject, (CK_UTF8CHAR_PTR*)ckpObjectPtr, ckpLength); - return; + jStringToCKUTF8CharArray(env, jObject, (CK_UTF8CHAR_PTR*) &ckpObject, ckpLength); + return ckpObject; } /* type of jObject unknown, throw PKCS11RuntimeException */ jObjectClass = (*env)->FindClass(env, "java/lang/Object"); - if (jObjectClass == NULL) { return; } + if (jObjectClass == NULL) { return NULL; } jMethod = (*env)->GetMethodID(env, jObjectClass, "getClass", "()Ljava/lang/Class;"); - if (jMethod == NULL) { return; } + if (jMethod == NULL) { return NULL; } jClassObject = (*env)->CallObjectMethod(env, jObject, jMethod); assert(jClassObject != 0); jClassClass = (*env)->FindClass(env, "java/lang/Class"); - if (jClassClass == NULL) { return; } + if (jClassClass == NULL) { return NULL; } jMethod = (*env)->GetMethodID(env, jClassClass, "getName", "()Ljava/lang/String;"); - if (jMethod == NULL) { return; } + if (jMethod == NULL) { return NULL; } jClassNameString = (jstring) (*env)->CallObjectMethod(env, jClassObject, jMethod); assert(jClassNameString != 0); classNameString = (char*) (*env)->GetStringUTFChars(env, jClassNameString, NULL); - if (classNameString == NULL) { return; } + if (classNameString == NULL) { return NULL; } exceptionMsgPrefix = "Java object of this class cannot be converted to native PKCS#11 type: "; exceptionMsg = (char *) malloc((strlen(exceptionMsgPrefix) + strlen(classNameString) + 1)); if (exceptionMsg == NULL) { (*env)->ReleaseStringUTFChars(env, jClassNameString, classNameString); throwOutOfMemoryError(env, 0); - return; + return NULL; } strcpy(exceptionMsg, exceptionMsgPrefix); strcat(exceptionMsg, classNameString); (*env)->ReleaseStringUTFChars(env, jClassNameString, classNameString); throwPKCS11RuntimeException(env, exceptionMsg); free(exceptionMsg); - *ckpObjectPtr = NULL; *ckpLength = 0; TRACE0("FINISHED\n"); + return NULL; } #ifdef P11_MEMORYDEBUG diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs-11v2-20a3.h --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs-11v2-20a3.h Fri Jun 21 12:42:10 2019 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* pkcs-11v2-20a3.h include file for the PKCS #11 Version 2.20 Amendment 3 - document. */ - -/* $Revision: 1.4 $ */ - -/* License to copy and use this software is granted provided that it is - * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface - * (Cryptoki) Version 2.20 Amendment 3" in all material mentioning or - * referencing this software. - - * RSA Security Inc. makes no representations concerning either the - * merchantability of this software or the suitability of this software for - * any particular purpose. It is provided "as is" without express or implied - * warranty of any kind. - */ - -/* This file is preferably included after inclusion of pkcs11.h */ - -#ifndef _PKCS_11V2_20A3_H_ -#define _PKCS_11V2_20A3_H_ 1 - -/* Are the definitions of this file already included in pkcs11t.h ? */ -#ifndef CKK_CAMELLIA - -#ifdef __cplusplus -extern "C" { -#endif - -/* Key types */ - -/* Camellia is new for PKCS #11 v2.20 amendment 3 */ -#define CKK_CAMELLIA 0x00000025 -/* ARIA is new for PKCS #11 v2.20 amendment 3 */ -#define CKK_ARIA 0x00000026 - - -/* Mask-generating functions */ - -/* SHA-224 is new for PKCS #11 v2.20 amendment 3 */ -#define CKG_MGF1_SHA224 0x00000005 - - -/* Mechanism Identifiers */ - -/* SHA-224 is new for PKCS #11 v2.20 amendment 3 */ -#define CKM_SHA224 0x00000255 -#define CKM_SHA224_HMAC 0x00000256 -#define CKM_SHA224_HMAC_GENERAL 0x00000257 - -/* SHA-224 key derivation is new for PKCS #11 v2.20 amendment 3 */ -#define CKM_SHA224_KEY_DERIVATION 0x00000396 - -/* SHA-224 RSA mechanisms are new for PKCS #11 v2.20 amendment 3 */ -#define CKM_SHA224_RSA_PKCS 0x00000046 -#define CKM_SHA224_RSA_PKCS_PSS 0x00000047 - -/* AES counter mode is new for PKCS #11 v2.20 amendment 3 */ -#define CKM_AES_CTR 0x00001086 - -/* Camellia is new for PKCS #11 v2.20 amendment 3 */ -#define CKM_CAMELLIA_KEY_GEN 0x00000550 -#define CKM_CAMELLIA_ECB 0x00000551 -#define CKM_CAMELLIA_CBC 0x00000552 -#define CKM_CAMELLIA_MAC 0x00000553 -#define CKM_CAMELLIA_MAC_GENERAL 0x00000554 -#define CKM_CAMELLIA_CBC_PAD 0x00000555 -#define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556 -#define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557 -#define CKM_CAMELLIA_CTR 0x00000558 - -/* ARIA is new for PKCS #11 v2.20 amendment 3 */ -#define CKM_ARIA_KEY_GEN 0x00000560 -#define CKM_ARIA_ECB 0x00000561 -#define CKM_ARIA_CBC 0x00000562 -#define CKM_ARIA_MAC 0x00000563 -#define CKM_ARIA_MAC_GENERAL 0x00000564 -#define CKM_ARIA_CBC_PAD 0x00000565 -#define CKM_ARIA_ECB_ENCRYPT_DATA 0x00000566 -#define CKM_ARIA_CBC_ENCRYPT_DATA 0x00000567 - - -/* Mechanism parameters */ - -/* CK_AES_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */ -typedef struct CK_AES_CTR_PARAMS { - CK_ULONG ulCounterBits; - CK_BYTE cb[16]; -} CK_AES_CTR_PARAMS; - -typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR; - -/* CK_CAMELLIA_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */ -typedef struct CK_CAMELLIA_CTR_PARAMS { - CK_ULONG ulCounterBits; - CK_BYTE cb[16]; -} CK_CAMELLIA_CTR_PARAMS; - -typedef CK_CAMELLIA_CTR_PARAMS CK_PTR CK_CAMELLIA_CTR_PARAMS_PTR; - -/* CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */ -typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS { - CK_BYTE iv[16]; - CK_BYTE_PTR pData; - CK_ULONG length; -} CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS; - -typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR; - -/* CK_ARIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */ -typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS { - CK_BYTE iv[16]; - CK_BYTE_PTR pData; - CK_ULONG length; -} CK_ARIA_CBC_ENCRYPT_DATA_PARAMS; - -typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR; - -#ifdef __cplusplus -} -#endif - -#endif - -#endif diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11.h --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11.h Fri Jun 21 14:07:48 2019 +0530 @@ -1,19 +1,12 @@ -/* pkcs11.h include file for PKCS #11. */ -/* $Revision: 1.4 $ */ - -/* License to copy and use this software is granted provided that it is - * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface - * (Cryptoki)" in all material mentioning or referencing this software. +/* Copyright (c) OASIS Open 2016. All Rights Reserved./ + * /Distributed under the terms of the OASIS IPR Policy, + * [http://www.oasis-open.org/policies-guidelines/ipr], AS-IS, WITHOUT ANY + * IMPLIED OR EXPRESS WARRANTY; there is no warranty of MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE or NONINFRINGEMENT of the rights of others. + */ - * License is also granted to make and use derivative works provided that - * such works are identified as "derived from the RSA Security Inc. PKCS #11 - * Cryptographic Token Interface (Cryptoki)" in all material mentioning or - * referencing the derived work. - - * RSA Security Inc. makes no representations concerning either the - * merchantability of this software or the suitability of this software for - * any particular purpose. It is provided "as is" without express or implied - * warranty of any kind. +/* Latest version of the specification: + * http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html */ #ifndef _PKCS11_H_ @@ -24,14 +17,14 @@ #endif /* Before including this file (pkcs11.h) (or pkcs11t.h by - * itself), 6 platform-specific macros must be defined. These + * itself), 5 platform-specific macros must be defined. These * macros are described below, and typical definitions for them * are also given. Be advised that these definitions can depend * on both the platform and the compiler used (and possibly also * on whether a Cryptoki library is linked statically or * dynamically). * - * In addition to defining these 6 macros, the packing convention + * In addition to defining these 5 macros, the packing convention * for Cryptoki structures should be set. The Cryptoki * convention on packing is that structures should be 1-byte * aligned. @@ -81,39 +74,7 @@ * #define CK_PTR * * * - * 2. CK_DEFINE_FUNCTION(returnType, name): A macro which makes - * an exportable Cryptoki library function definition out of a - * return type and a function name. It should be used in the - * following fashion to define the exposed Cryptoki functions in - * a Cryptoki library: - * - * CK_DEFINE_FUNCTION(CK_RV, C_Initialize)( - * CK_VOID_PTR pReserved - * ) - * { - * ... - * } - * - * If you're using Microsoft Developer Studio 5.0 to define a - * function in a Win32 Cryptoki .dll, it might be defined by: - * - * #define CK_DEFINE_FUNCTION(returnType, name) \ - * returnType __declspec(dllexport) name - * - * If you're using an earlier version of Microsoft Developer - * Studio to define a function in a Win16 Cryptoki .dll, it - * might be defined by: - * - * #define CK_DEFINE_FUNCTION(returnType, name) \ - * returnType __export _far _pascal name - * - * In a UNIX environment, it might be defined by: - * - * #define CK_DEFINE_FUNCTION(returnType, name) \ - * returnType name - * - * - * 3. CK_DECLARE_FUNCTION(returnType, name): A macro which makes + * 2. CK_DECLARE_FUNCTION(returnType, name): A macro which makes * an importable Cryptoki library function declaration out of a * return type and a function name. It should be used in the * following fashion: @@ -141,7 +102,7 @@ * returnType name * * - * 4. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro + * 3. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro * which makes a Cryptoki API function pointer declaration or * function pointer type declaration out of a return type and a * function name. It should be used in the following fashion: @@ -178,7 +139,7 @@ * returnType (* name) * * - * 5. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes + * 4. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes * a function pointer type for an application callback out of * a return type for the callback and a name for the callback. * It should be used in the following fashion: @@ -210,7 +171,7 @@ * returnType (* name) * * - * 6. NULL_PTR: This macro is the value of a NULL pointer. + * 5. NULL_PTR: This macro is the value of a NULL pointer. * * In any ANSI/ISO C environment (and in many others as well), * this should best be defined by @@ -222,7 +183,8 @@ /* All the various Cryptoki types and #define'd values are in the - * file pkcs11t.h. */ + * file pkcs11t.h. + */ #include "pkcs11t.h" #define __PASTE(x,y) x##y @@ -238,7 +200,8 @@ extern CK_DECLARE_FUNCTION(CK_RV, name) /* pkcs11f.h has all the information about the Cryptoki - * function prototypes. */ + * function prototypes. + */ #include "pkcs11f.h" #undef CK_NEED_ARG_LIST @@ -257,7 +220,8 @@ typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name)) /* pkcs11f.h has all the information about the Cryptoki - * function prototypes. */ + * function prototypes. + */ #include "pkcs11f.h" #undef CK_NEED_ARG_LIST @@ -282,7 +246,8 @@ /* Pile all the function pointers into the CK_FUNCTION_LIST. */ /* pkcs11f.h has all the information about the Cryptoki - * function prototypes. */ + * function prototypes. + */ #include "pkcs11f.h" }; @@ -296,4 +261,5 @@ } #endif -#endif +#endif /* _PKCS11_H_ */ + diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11f.h --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11f.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11f.h Fri Jun 21 14:07:48 2019 +0530 @@ -1,26 +1,20 @@ -/* pkcs11f.h include file for PKCS #11. */ -/* $Revision: 1.4 $ */ - -/* License to copy and use this software is granted provided that it is - * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface - * (Cryptoki)" in all material mentioning or referencing this software. - - * License is also granted to make and use derivative works provided that - * such works are identified as "derived from the RSA Security Inc. PKCS #11 - * Cryptographic Token Interface (Cryptoki)" in all material mentioning or - * referencing the derived work. - - * RSA Security Inc. makes no representations concerning either the - * merchantability of this software or the suitability of this software for - * any particular purpose. It is provided "as is" without express or implied - * warranty of any kind. +/* Copyright (c) OASIS Open 2016. All Rights Reserved./ + * /Distributed under the terms of the OASIS IPR Policy, + * [http://www.oasis-open.org/policies-guidelines/ipr], AS-IS, WITHOUT ANY + * IMPLIED OR EXPRESS WARRANTY; there is no warranty of MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE or NONINFRINGEMENT of the rights of others. */ -/* This header file contains pretty much everything about all the */ -/* Cryptoki function prototypes. Because this information is */ -/* used for more than just declaring function prototypes, the */ -/* order of the functions appearing herein is important, and */ -/* should not be altered. */ +/* Latest version of the specification: + * http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html + */ + +/* This header file contains pretty much everything about all the + * Cryptoki function prototypes. Because this information is + * used for more than just declaring function prototypes, the + * order of the functions appearing herein is important, and + * should not be altered. + */ /* General-purpose */ @@ -30,13 +24,15 @@ ( CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets * cast to CK_C_INITIALIZE_ARGS_PTR - * and dereferenced */ + * and dereferenced + */ ); #endif /* C_Finalize indicates that an application is done with the - * Cryptoki library. */ + * Cryptoki library. + */ CK_PKCS11_FUNCTION_INFO(C_Finalize) #ifdef CK_NEED_ARG_LIST ( @@ -59,7 +55,8 @@ #ifdef CK_NEED_ARG_LIST ( CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to - * function list */ + * function list + */ ); #endif @@ -71,7 +68,7 @@ CK_PKCS11_FUNCTION_INFO(C_GetSlotList) #ifdef CK_NEED_ARG_LIST ( - CK_BBOOL tokenPresent, /* only slots with tokens? */ + CK_BBOOL tokenPresent, /* only slots with tokens */ CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */ CK_ULONG_PTR pulCount /* receives number of slots */ ); @@ -79,7 +76,8 @@ /* C_GetSlotInfo obtains information about a particular slot in - * the system. */ + * the system. + */ CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo) #ifdef CK_NEED_ARG_LIST ( @@ -90,7 +88,8 @@ /* C_GetTokenInfo obtains information about a particular token - * in the system. */ + * in the system. + */ CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo) #ifdef CK_NEED_ARG_LIST ( @@ -101,7 +100,8 @@ /* C_GetMechanismList obtains a list of mechanism types - * supported by a token. */ + * supported by a token. + */ CK_PKCS11_FUNCTION_INFO(C_GetMechanismList) #ifdef CK_NEED_ARG_LIST ( @@ -113,7 +113,8 @@ /* C_GetMechanismInfo obtains information about a particular - * mechanism possibly supported by a token. */ + * mechanism possibly supported by a token. + */ CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo) #ifdef CK_NEED_ARG_LIST ( @@ -127,7 +128,6 @@ /* C_InitToken initializes a token. */ CK_PKCS11_FUNCTION_INFO(C_InitToken) #ifdef CK_NEED_ARG_LIST -/* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */ ( CK_SLOT_ID slotID, /* ID of the token's slot */ CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */ @@ -165,7 +165,8 @@ /* Session management */ /* C_OpenSession opens a session between an application and a - * token. */ + * token. + */ CK_PKCS11_FUNCTION_INFO(C_OpenSession) #ifdef CK_NEED_ARG_LIST ( @@ -179,7 +180,8 @@ /* C_CloseSession closes a session between an application and a - * token. */ + * token. + */ CK_PKCS11_FUNCTION_INFO(C_CloseSession) #ifdef CK_NEED_ARG_LIST ( @@ -208,7 +210,8 @@ /* C_GetOperationState obtains the state of the cryptographic operation - * in a session. */ + * in a session. + */ CK_PKCS11_FUNCTION_INFO(C_GetOperationState) #ifdef CK_NEED_ARG_LIST ( @@ -220,7 +223,8 @@ /* C_SetOperationState restores the state of the cryptographic - * operation in a session. */ + * operation in a session. + */ CK_PKCS11_FUNCTION_INFO(C_SetOperationState) #ifdef CK_NEED_ARG_LIST ( @@ -270,7 +274,8 @@ /* C_CopyObject copies an object, creating a new object for the - * copy. */ + * copy. + */ CK_PKCS11_FUNCTION_INFO(C_CopyObject) #ifdef CK_NEED_ARG_LIST ( @@ -305,7 +310,8 @@ /* C_GetAttributeValue obtains the value of one or more object - * attributes. */ + * attributes. + */ CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue) #ifdef CK_NEED_ARG_LIST ( @@ -318,7 +324,8 @@ /* C_SetAttributeValue modifies the value of one or more object - * attributes */ + * attributes. + */ CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue) #ifdef CK_NEED_ARG_LIST ( @@ -331,7 +338,8 @@ /* C_FindObjectsInit initializes a search for token and session - * objects that match a template. */ + * objects that match a template. + */ CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit) #ifdef CK_NEED_ARG_LIST ( @@ -344,7 +352,8 @@ /* C_FindObjects continues a search for token and session * objects that match a template, obtaining additional object - * handles. */ + * handles. + */ CK_PKCS11_FUNCTION_INFO(C_FindObjects) #ifdef CK_NEED_ARG_LIST ( @@ -357,7 +366,8 @@ /* C_FindObjectsFinal finishes a search for token and session - * objects. */ + * objects. + */ CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal) #ifdef CK_NEED_ARG_LIST ( @@ -394,7 +404,8 @@ /* C_EncryptUpdate continues a multiple-part encryption - * operation. */ + * operation. + */ CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate) #ifdef CK_NEED_ARG_LIST ( @@ -408,7 +419,8 @@ /* C_EncryptFinal finishes a multiple-part encryption - * operation. */ + * operation. + */ CK_PKCS11_FUNCTION_INFO(C_EncryptFinal) #ifdef CK_NEED_ARG_LIST ( @@ -444,7 +456,8 @@ /* C_DecryptUpdate continues a multiple-part decryption - * operation. */ + * operation. + */ CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate) #ifdef CK_NEED_ARG_LIST ( @@ -458,7 +471,8 @@ /* C_DecryptFinal finishes a multiple-part decryption - * operation. */ + * operation. + */ CK_PKCS11_FUNCTION_INFO(C_DecryptFinal) #ifdef CK_NEED_ARG_LIST ( @@ -496,7 +510,8 @@ /* C_DigestUpdate continues a multiple-part message-digesting - * operation. */ + * operation. + */ CK_PKCS11_FUNCTION_INFO(C_DigestUpdate) #ifdef CK_NEED_ARG_LIST ( @@ -509,7 +524,8 @@ /* C_DigestKey continues a multi-part message-digesting * operation, by digesting the value of a secret key as part of - * the data already digested. */ + * the data already digested. + */ CK_PKCS11_FUNCTION_INFO(C_DigestKey) #ifdef CK_NEED_ARG_LIST ( @@ -520,7 +536,8 @@ /* C_DigestFinal finishes a multiple-part message-digesting - * operation. */ + * operation. + */ CK_PKCS11_FUNCTION_INFO(C_DigestFinal) #ifdef CK_NEED_ARG_LIST ( @@ -537,7 +554,8 @@ /* C_SignInit initializes a signature (private key encryption) * operation, where the signature is (will be) an appendix to * the data, and plaintext cannot be recovered from the - *signature. */ + * signature. + */ CK_PKCS11_FUNCTION_INFO(C_SignInit) #ifdef CK_NEED_ARG_LIST ( @@ -550,7 +568,8 @@ /* C_Sign signs (encrypts with private key) data in a single * part, where the signature is (will be) an appendix to the - * data, and plaintext cannot be recovered from the signature. */ + * data, and plaintext cannot be recovered from the signature. + */ CK_PKCS11_FUNCTION_INFO(C_Sign) #ifdef CK_NEED_ARG_LIST ( @@ -565,7 +584,8 @@ /* C_SignUpdate continues a multiple-part signature operation, * where the signature is (will be) an appendix to the data, - * and plaintext cannot be recovered from the signature. */ + * and plaintext cannot be recovered from the signature. + */ CK_PKCS11_FUNCTION_INFO(C_SignUpdate) #ifdef CK_NEED_ARG_LIST ( @@ -577,7 +597,8 @@ /* C_SignFinal finishes a multiple-part signature operation, - * returning the signature. */ + * returning the signature. + */ CK_PKCS11_FUNCTION_INFO(C_SignFinal) #ifdef CK_NEED_ARG_LIST ( @@ -589,7 +610,8 @@ /* C_SignRecoverInit initializes a signature operation, where - * the data can be recovered from the signature. */ + * the data can be recovered from the signature. + */ CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit) #ifdef CK_NEED_ARG_LIST ( @@ -601,7 +623,8 @@ /* C_SignRecover signs data in a single operation, where the - * data can be recovered from the signature. */ + * data can be recovered from the signature. + */ CK_PKCS11_FUNCTION_INFO(C_SignRecover) #ifdef CK_NEED_ARG_LIST ( @@ -619,7 +642,8 @@ /* C_VerifyInit initializes a verification operation, where the * signature is an appendix to the data, and plaintext cannot - * cannot be recovered from the signature (e.g. DSA). */ + * cannot be recovered from the signature (e.g. DSA). + */ CK_PKCS11_FUNCTION_INFO(C_VerifyInit) #ifdef CK_NEED_ARG_LIST ( @@ -632,7 +656,8 @@ /* C_Verify verifies a signature in a single-part operation, * where the signature is an appendix to the data, and plaintext - * cannot be recovered from the signature. */ + * cannot be recovered from the signature. + */ CK_PKCS11_FUNCTION_INFO(C_Verify) #ifdef CK_NEED_ARG_LIST ( @@ -647,7 +672,8 @@ /* C_VerifyUpdate continues a multiple-part verification * operation, where the signature is an appendix to the data, - * and plaintext cannot be recovered from the signature. */ + * and plaintext cannot be recovered from the signature. + */ CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate) #ifdef CK_NEED_ARG_LIST ( @@ -659,7 +685,8 @@ /* C_VerifyFinal finishes a multiple-part verification - * operation, checking the signature. */ + * operation, checking the signature. + */ CK_PKCS11_FUNCTION_INFO(C_VerifyFinal) #ifdef CK_NEED_ARG_LIST ( @@ -671,7 +698,8 @@ /* C_VerifyRecoverInit initializes a signature verification - * operation, where the data is recovered from the signature. */ + * operation, where the data is recovered from the signature. + */ CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit) #ifdef CK_NEED_ARG_LIST ( @@ -683,7 +711,8 @@ /* C_VerifyRecover verifies a signature in a single-part - * operation, where the data is recovered from the signature. */ + * operation, where the data is recovered from the signature. + */ CK_PKCS11_FUNCTION_INFO(C_VerifyRecover) #ifdef CK_NEED_ARG_LIST ( @@ -700,7 +729,8 @@ /* Dual-function cryptographic operations */ /* C_DigestEncryptUpdate continues a multiple-part digesting - * and encryption operation. */ + * and encryption operation. + */ CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate) #ifdef CK_NEED_ARG_LIST ( @@ -714,7 +744,8 @@ /* C_DecryptDigestUpdate continues a multiple-part decryption and - * digesting operation. */ + * digesting operation. + */ CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate) #ifdef CK_NEED_ARG_LIST ( @@ -728,7 +759,8 @@ /* C_SignEncryptUpdate continues a multiple-part signing and - * encryption operation. */ + * encryption operation. + */ CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate) #ifdef CK_NEED_ARG_LIST ( @@ -742,7 +774,8 @@ /* C_DecryptVerifyUpdate continues a multiple-part decryption and - * verify operation. */ + * verify operation. + */ CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate) #ifdef CK_NEED_ARG_LIST ( @@ -759,7 +792,8 @@ /* Key management */ /* C_GenerateKey generates a secret key, creating a new key - * object. */ + * object. + */ CK_PKCS11_FUNCTION_INFO(C_GenerateKey) #ifdef CK_NEED_ARG_LIST ( @@ -773,30 +807,19 @@ /* C_GenerateKeyPair generates a public-key/private-key pair, - * creating new key objects. */ + * creating new key objects. + */ CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair) #ifdef CK_NEED_ARG_LIST ( - CK_SESSION_HANDLE hSession, /* session - * handle */ - CK_MECHANISM_PTR pMechanism, /* key-gen - * mech. */ - CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template - * for pub. - * key */ - CK_ULONG ulPublicKeyAttributeCount, /* # pub. - * attrs. */ - CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template - * for priv. - * key */ - CK_ULONG ulPrivateKeyAttributeCount, /* # priv. - * attrs. */ - CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. - * key - * handle */ - CK_OBJECT_HANDLE_PTR phPrivateKey /* gets - * priv. key - * handle */ + CK_SESSION_HANDLE hSession, /* session handle */ + CK_MECHANISM_PTR pMechanism, /* key-gen mech. */ + CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template for pub. key */ + CK_ULONG ulPublicKeyAttributeCount, /* # pub. attrs. */ + CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template for priv. key */ + CK_ULONG ulPrivateKeyAttributeCount, /* # priv. attrs. */ + CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. key handle */ + CK_OBJECT_HANDLE_PTR phPrivateKey /* gets priv. key handle */ ); #endif @@ -816,7 +839,8 @@ /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new - * key object. */ + * key object. + */ CK_PKCS11_FUNCTION_INFO(C_UnwrapKey) #ifdef CK_NEED_ARG_LIST ( @@ -833,7 +857,8 @@ /* C_DeriveKey derives a key from a base key, creating a new key - * object. */ + * object. + */ CK_PKCS11_FUNCTION_INFO(C_DeriveKey) #ifdef CK_NEED_ARG_LIST ( @@ -851,7 +876,8 @@ /* Random number generation */ /* C_SeedRandom mixes additional seed material into the token's - * random number generator. */ + * random number generator. + */ CK_PKCS11_FUNCTION_INFO(C_SeedRandom) #ifdef CK_NEED_ARG_LIST ( @@ -878,7 +904,8 @@ /* C_GetFunctionStatus is a legacy function; it obtains an * updated status of a function running in parallel with an - * application. */ + * application. + */ CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus) #ifdef CK_NEED_ARG_LIST ( @@ -888,7 +915,8 @@ /* C_CancelFunction is a legacy function; it cancels a function - * running in parallel. */ + * running in parallel. + */ CK_PKCS11_FUNCTION_INFO(C_CancelFunction) #ifdef CK_NEED_ARG_LIST ( @@ -897,11 +925,9 @@ #endif - -/* Functions added in for Cryptoki Version 2.01 or later */ - /* C_WaitForSlotEvent waits for a slot event (token insertion, - * removal, etc.) to occur. */ + * removal, etc.) to occur. + */ CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent) #ifdef CK_NEED_ARG_LIST ( @@ -910,3 +936,4 @@ CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */ ); #endif + diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11t.h --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11t.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11t.h Fri Jun 21 14:07:48 2019 +0530 @@ -1,36 +1,33 @@ -/* pkcs11t.h include file for PKCS #11. */ -/* $Revision: 1.6 $ */ - -/* License to copy and use this software is granted provided that it is - * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface - * (Cryptoki)" in all material mentioning or referencing this software. +/* Copyright (c) OASIS Open 2016. All Rights Reserved./ + * /Distributed under the terms of the OASIS IPR Policy, + * [http://www.oasis-open.org/policies-guidelines/ipr], AS-IS, WITHOUT ANY + * IMPLIED OR EXPRESS WARRANTY; there is no warranty of MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE or NONINFRINGEMENT of the rights of others. + */ - * License is also granted to make and use derivative works provided that - * such works are identified as "derived from the RSA Security Inc. PKCS #11 - * Cryptographic Token Interface (Cryptoki)" in all material mentioning or - * referencing the derived work. - - * RSA Security Inc. makes no representations concerning either the - * merchantability of this software or the suitability of this software for - * any particular purpose. It is provided "as is" without express or implied - * warranty of any kind. +/* Latest version of the specification: + * http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html */ /* See top of pkcs11.h for information about the macros that * must be defined and the structure-packing conventions that - * must be set before including this file. */ + * must be set before including this file. + */ #ifndef _PKCS11T_H_ #define _PKCS11T_H_ 1 -#define CK_TRUE 1 -#define CK_FALSE 0 +#define CRYPTOKI_VERSION_MAJOR 2 +#define CRYPTOKI_VERSION_MINOR 40 +#define CRYPTOKI_VERSION_AMENDMENT 0 + +#define CK_TRUE 1 +#define CK_FALSE 0 #ifndef CK_DISABLE_TRUE_FALSE #ifndef FALSE #define FALSE CK_FALSE #endif - #ifndef TRUE #define TRUE CK_TRUE #endif @@ -52,7 +49,6 @@ typedef unsigned long int CK_ULONG; /* a signed value, the same size as a CK_ULONG */ -/* CK_LONG is new for v2.0 */ typedef long int CK_LONG; /* at least 32 bits; each bit is a Boolean flag */ @@ -60,8 +56,8 @@ /* some special values for certain CK_ULONG variables */ -#define CK_UNAVAILABLE_INFORMATION (~0UL) -#define CK_EFFECTIVELY_INFINITE 0 +#define CK_UNAVAILABLE_INFORMATION (~0UL) +#define CK_EFFECTIVELY_INFINITE 0UL typedef CK_BYTE CK_PTR CK_BYTE_PTR; @@ -74,9 +70,10 @@ typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR; -/* The following value is always invalid if used as a session */ -/* handle or object handle */ -#define CK_INVALID_HANDLE 0 +/* The following value is always invalid if used as a session + * handle or object handle + */ +#define CK_INVALID_HANDLE 0UL typedef struct CK_VERSION { @@ -88,13 +85,9 @@ typedef struct CK_INFO { - /* manufacturerID and libraryDecription have been changed from - * CK_CHAR to CK_UTF8CHAR for v2.10 */ CK_VERSION cryptokiVersion; /* Cryptoki interface ver */ CK_UTF8CHAR manufacturerID[32]; /* blank padded */ CK_FLAGS flags; /* must be zero */ - - /* libraryDescription and libraryVersion are new for v2.0 */ CK_UTF8CHAR libraryDescription[32]; /* blank padded */ CK_VERSION libraryVersion; /* version of library */ } CK_INFO; @@ -103,12 +96,11 @@ /* CK_NOTIFICATION enumerates the types of notifications that - * Cryptoki provides to an application */ -/* CK_NOTIFICATION has been changed from an enum to a CK_ULONG - * for v2.0 */ + * Cryptoki provides to an application + */ typedef CK_ULONG CK_NOTIFICATION; -#define CKN_SURRENDER 0 - +#define CKN_SURRENDER 0UL +#define CKN_OTP_CHANGED 1UL typedef CK_ULONG CK_SLOT_ID; @@ -117,13 +109,10 @@ /* CK_SLOT_INFO provides information about a slot */ typedef struct CK_SLOT_INFO { - /* slotDescription and manufacturerID have been changed from - * CK_CHAR to CK_UTF8CHAR for v2.10 */ CK_UTF8CHAR slotDescription[64]; /* blank padded */ CK_UTF8CHAR manufacturerID[32]; /* blank padded */ CK_FLAGS flags; - /* hardwareVersion and firmwareVersion are new for v2.0 */ CK_VERSION hardwareVersion; /* version of hardware */ CK_VERSION firmwareVersion; /* version of firmware */ } CK_SLOT_INFO; @@ -131,26 +120,21 @@ /* flags: bit flags that provide capabilities of the slot * Bit Flag Mask Meaning */ -#define CKF_TOKEN_PRESENT 0x00000001 /* a token is there */ -#define CKF_REMOVABLE_DEVICE 0x00000002 /* removable devices*/ -#define CKF_HW_SLOT 0x00000004 /* hardware slot */ +#define CKF_TOKEN_PRESENT 0x00000001UL /* a token is there */ +#define CKF_REMOVABLE_DEVICE 0x00000002UL /* removable devices*/ +#define CKF_HW_SLOT 0x00000004UL /* hardware slot */ typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR; /* CK_TOKEN_INFO provides information about a token */ typedef struct CK_TOKEN_INFO { - /* label, manufacturerID, and model have been changed from - * CK_CHAR to CK_UTF8CHAR for v2.10 */ CK_UTF8CHAR label[32]; /* blank padded */ CK_UTF8CHAR manufacturerID[32]; /* blank padded */ CK_UTF8CHAR model[16]; /* blank padded */ CK_CHAR serialNumber[16]; /* blank padded */ CK_FLAGS flags; /* see below */ - /* ulMaxSessionCount, ulSessionCount, ulMaxRwSessionCount, - * ulRwSessionCount, ulMaxPinLen, and ulMinPinLen have all been - * changed from CK_USHORT to CK_ULONG for v2.0 */ CK_ULONG ulMaxSessionCount; /* max open sessions */ CK_ULONG ulSessionCount; /* sess. now open */ CK_ULONG ulMaxRwSessionCount; /* max R/W sessions */ @@ -161,9 +145,6 @@ CK_ULONG ulFreePublicMemory; /* in bytes */ CK_ULONG ulTotalPrivateMemory; /* in bytes */ CK_ULONG ulFreePrivateMemory; /* in bytes */ - - /* hardwareVersion, firmwareVersion, and time are new for - * v2.0 */ CK_VERSION hardwareVersion; /* version of hardware */ CK_VERSION firmwareVersion; /* version of firmware */ CK_CHAR utcTime[16]; /* time */ @@ -172,146 +153,149 @@ /* The flags parameter is defined as follows: * Bit Flag Mask Meaning */ -#define CKF_RNG 0x00000001 /* has random # - * generator */ -#define CKF_WRITE_PROTECTED 0x00000002 /* token is - * write- - * protected */ -#define CKF_LOGIN_REQUIRED 0x00000004 /* user must - * login */ -#define CKF_USER_PIN_INITIALIZED 0x00000008 /* normal user's - * PIN is set */ +#define CKF_RNG 0x00000001UL /* has random # generator */ +#define CKF_WRITE_PROTECTED 0x00000002UL /* token is write-protected */ +#define CKF_LOGIN_REQUIRED 0x00000004UL /* user must login */ +#define CKF_USER_PIN_INITIALIZED 0x00000008UL /* normal user's PIN is set */ -/* CKF_RESTORE_KEY_NOT_NEEDED is new for v2.0. If it is set, +/* CKF_RESTORE_KEY_NOT_NEEDED. If it is set, * that means that *every* time the state of cryptographic * operations of a session is successfully saved, all keys - * needed to continue those operations are stored in the state */ -#define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020 + * needed to continue those operations are stored in the state + */ +#define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020UL -/* CKF_CLOCK_ON_TOKEN is new for v2.0. If it is set, that means +/* CKF_CLOCK_ON_TOKEN. If it is set, that means * that the token has some sort of clock. The time on that - * clock is returned in the token info structure */ -#define CKF_CLOCK_ON_TOKEN 0x00000040 + * clock is returned in the token info structure + */ +#define CKF_CLOCK_ON_TOKEN 0x00000040UL -/* CKF_PROTECTED_AUTHENTICATION_PATH is new for v2.0. If it is +/* CKF_PROTECTED_AUTHENTICATION_PATH. If it is * set, that means that there is some way for the user to login - * without sending a PIN through the Cryptoki library itself */ -#define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100 + * without sending a PIN through the Cryptoki library itself + */ +#define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100UL -/* CKF_DUAL_CRYPTO_OPERATIONS is new for v2.0. If it is true, +/* CKF_DUAL_CRYPTO_OPERATIONS. If it is true, * that means that a single session with the token can perform * dual simultaneous cryptographic operations (digest and * encrypt; decrypt and digest; sign and encrypt; and decrypt - * and sign) */ -#define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200 + * and sign) + */ +#define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200UL -/* CKF_TOKEN_INITIALIZED if new for v2.10. If it is true, the +/* CKF_TOKEN_INITIALIZED. If it is true, the * token has been initialized using C_InitializeToken or an * equivalent mechanism outside the scope of PKCS #11. * Calling C_InitializeToken when this flag is set will cause - * the token to be reinitialized. */ -#define CKF_TOKEN_INITIALIZED 0x00000400 + * the token to be reinitialized. + */ +#define CKF_TOKEN_INITIALIZED 0x00000400UL -/* CKF_SECONDARY_AUTHENTICATION if new for v2.10. If it is +/* CKF_SECONDARY_AUTHENTICATION. If it is * true, the token supports secondary authentication for - * private key objects. This flag is deprecated in v2.11 and - onwards. */ -#define CKF_SECONDARY_AUTHENTICATION 0x00000800 + * private key objects. + */ +#define CKF_SECONDARY_AUTHENTICATION 0x00000800UL -/* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an +/* CKF_USER_PIN_COUNT_LOW. If it is true, an * incorrect user login PIN has been entered at least once - * since the last successful authentication. */ -#define CKF_USER_PIN_COUNT_LOW 0x00010000 - -/* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true, - * supplying an incorrect user PIN will it to become locked. */ -#define CKF_USER_PIN_FINAL_TRY 0x00020000 + * since the last successful authentication. + */ +#define CKF_USER_PIN_COUNT_LOW 0x00010000UL -/* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the +/* CKF_USER_PIN_FINAL_TRY. If it is true, + * supplying an incorrect user PIN will it to become locked. + */ +#define CKF_USER_PIN_FINAL_TRY 0x00020000UL + +/* CKF_USER_PIN_LOCKED. If it is true, the * user PIN has been locked. User login to the token is not - * possible. */ -#define CKF_USER_PIN_LOCKED 0x00040000 + * possible. + */ +#define CKF_USER_PIN_LOCKED 0x00040000UL -/* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true, +/* CKF_USER_PIN_TO_BE_CHANGED. If it is true, * the user PIN value is the default value set by token * initialization or manufacturing, or the PIN has been - * expired by the card. */ -#define CKF_USER_PIN_TO_BE_CHANGED 0x00080000 + * expired by the card. + */ +#define CKF_USER_PIN_TO_BE_CHANGED 0x00080000UL -/* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an +/* CKF_SO_PIN_COUNT_LOW. If it is true, an * incorrect SO login PIN has been entered at least once since - * the last successful authentication. */ -#define CKF_SO_PIN_COUNT_LOW 0x00100000 + * the last successful authentication. + */ +#define CKF_SO_PIN_COUNT_LOW 0x00100000UL -/* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true, - * supplying an incorrect SO PIN will it to become locked. */ -#define CKF_SO_PIN_FINAL_TRY 0x00200000 +/* CKF_SO_PIN_FINAL_TRY. If it is true, + * supplying an incorrect SO PIN will it to become locked. + */ +#define CKF_SO_PIN_FINAL_TRY 0x00200000UL -/* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO +/* CKF_SO_PIN_LOCKED. If it is true, the SO * PIN has been locked. SO login to the token is not possible. */ -#define CKF_SO_PIN_LOCKED 0x00400000 +#define CKF_SO_PIN_LOCKED 0x00400000UL -/* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true, +/* CKF_SO_PIN_TO_BE_CHANGED. If it is true, * the SO PIN value is the default value set by token * initialization or manufacturing, or the PIN has been - * expired by the card. */ -#define CKF_SO_PIN_TO_BE_CHANGED 0x00800000 + * expired by the card. + */ +#define CKF_SO_PIN_TO_BE_CHANGED 0x00800000UL + +#define CKF_ERROR_STATE 0x01000000UL typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR; /* CK_SESSION_HANDLE is a Cryptoki-assigned value that - * identifies a session */ + * identifies a session + */ typedef CK_ULONG CK_SESSION_HANDLE; typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR; /* CK_USER_TYPE enumerates the types of Cryptoki users */ -/* CK_USER_TYPE has been changed from an enum to a CK_ULONG for - * v2.0 */ typedef CK_ULONG CK_USER_TYPE; /* Security Officer */ -#define CKU_SO 0 +#define CKU_SO 0UL /* Normal user */ -#define CKU_USER 1 -/* Context specific (added in v2.20) */ -#define CKU_CONTEXT_SPECIFIC 2 +#define CKU_USER 1UL +/* Context specific */ +#define CKU_CONTEXT_SPECIFIC 2UL /* CK_STATE enumerates the session states */ -/* CK_STATE has been changed from an enum to a CK_ULONG for - * v2.0 */ typedef CK_ULONG CK_STATE; -#define CKS_RO_PUBLIC_SESSION 0 -#define CKS_RO_USER_FUNCTIONS 1 -#define CKS_RW_PUBLIC_SESSION 2 -#define CKS_RW_USER_FUNCTIONS 3 -#define CKS_RW_SO_FUNCTIONS 4 - +#define CKS_RO_PUBLIC_SESSION 0UL +#define CKS_RO_USER_FUNCTIONS 1UL +#define CKS_RW_PUBLIC_SESSION 2UL +#define CKS_RW_USER_FUNCTIONS 3UL +#define CKS_RW_SO_FUNCTIONS 4UL /* CK_SESSION_INFO provides information about a session */ typedef struct CK_SESSION_INFO { CK_SLOT_ID slotID; CK_STATE state; CK_FLAGS flags; /* see below */ - - /* ulDeviceError was changed from CK_USHORT to CK_ULONG for - * v2.0 */ CK_ULONG ulDeviceError; /* device-dependent error code */ } CK_SESSION_INFO; /* The flags are defined in the following table: * Bit Flag Mask Meaning */ -#define CKF_RW_SESSION 0x00000002 /* session is r/w */ -#define CKF_SERIAL_SESSION 0x00000004 /* no parallel */ +#define CKF_RW_SESSION 0x00000002UL /* session is r/w */ +#define CKF_SERIAL_SESSION 0x00000004UL /* no parallel */ typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR; /* CK_OBJECT_HANDLE is a token-specific identifier for an - * object */ + * object + */ typedef CK_ULONG CK_OBJECT_HANDLE; typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR; @@ -319,251 +303,273 @@ /* CK_OBJECT_CLASS is a value that identifies the classes (or * types) of objects that Cryptoki recognizes. It is defined - * as follows: */ -/* CK_OBJECT_CLASS was changed from CK_USHORT to CK_ULONG for - * v2.0 */ + * as follows: + */ typedef CK_ULONG CK_OBJECT_CLASS; /* The following classes of objects are defined: */ -/* CKO_HW_FEATURE is new for v2.10 */ -/* CKO_DOMAIN_PARAMETERS is new for v2.11 */ -/* CKO_MECHANISM is new for v2.20 */ -#define CKO_DATA 0x00000000 -#define CKO_CERTIFICATE 0x00000001 -#define CKO_PUBLIC_KEY 0x00000002 -#define CKO_PRIVATE_KEY 0x00000003 -#define CKO_SECRET_KEY 0x00000004 -#define CKO_HW_FEATURE 0x00000005 -#define CKO_DOMAIN_PARAMETERS 0x00000006 -#define CKO_MECHANISM 0x00000007 -#define CKO_VENDOR_DEFINED 0x80000000 +#define CKO_DATA 0x00000000UL +#define CKO_CERTIFICATE 0x00000001UL +#define CKO_PUBLIC_KEY 0x00000002UL +#define CKO_PRIVATE_KEY 0x00000003UL +#define CKO_SECRET_KEY 0x00000004UL +#define CKO_HW_FEATURE 0x00000005UL +#define CKO_DOMAIN_PARAMETERS 0x00000006UL +#define CKO_MECHANISM 0x00000007UL +#define CKO_OTP_KEY 0x00000008UL + +#define CKO_VENDOR_DEFINED 0x80000000UL typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR; -/* CK_HW_FEATURE_TYPE is new for v2.10. CK_HW_FEATURE_TYPE is a - * value that identifies the hardware feature type of an object - * with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. */ +/* CK_HW_FEATURE_TYPE is a value that identifies the hardware feature type + * of an object with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. + */ typedef CK_ULONG CK_HW_FEATURE_TYPE; /* The following hardware feature types are defined */ -/* CKH_USER_INTERFACE is new for v2.20 */ -#define CKH_MONOTONIC_COUNTER 0x00000001 -#define CKH_CLOCK 0x00000002 -#define CKH_USER_INTERFACE 0x00000003 -#define CKH_VENDOR_DEFINED 0x80000000 +#define CKH_MONOTONIC_COUNTER 0x00000001UL +#define CKH_CLOCK 0x00000002UL +#define CKH_USER_INTERFACE 0x00000003UL +#define CKH_VENDOR_DEFINED 0x80000000UL /* CK_KEY_TYPE is a value that identifies a key type */ -/* CK_KEY_TYPE was changed from CK_USHORT to CK_ULONG for v2.0 */ typedef CK_ULONG CK_KEY_TYPE; /* the following key types are defined: */ -#define CKK_RSA 0x00000000 -#define CKK_DSA 0x00000001 -#define CKK_DH 0x00000002 - -/* CKK_ECDSA and CKK_KEA are new for v2.0 */ -/* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */ -#define CKK_ECDSA 0x00000003 -#define CKK_EC 0x00000003 -#define CKK_X9_42_DH 0x00000004 -#define CKK_KEA 0x00000005 - -#define CKK_GENERIC_SECRET 0x00000010 -#define CKK_RC2 0x00000011 -#define CKK_RC4 0x00000012 -#define CKK_DES 0x00000013 -#define CKK_DES2 0x00000014 -#define CKK_DES3 0x00000015 +#define CKK_RSA 0x00000000UL +#define CKK_DSA 0x00000001UL +#define CKK_DH 0x00000002UL +#define CKK_ECDSA 0x00000003UL /* Deprecated */ +#define CKK_EC 0x00000003UL +#define CKK_X9_42_DH 0x00000004UL +#define CKK_KEA 0x00000005UL +#define CKK_GENERIC_SECRET 0x00000010UL +#define CKK_RC2 0x00000011UL +#define CKK_RC4 0x00000012UL +#define CKK_DES 0x00000013UL +#define CKK_DES2 0x00000014UL +#define CKK_DES3 0x00000015UL +#define CKK_CAST 0x00000016UL +#define CKK_CAST3 0x00000017UL +#define CKK_CAST5 0x00000018UL /* Deprecated */ +#define CKK_CAST128 0x00000018UL +#define CKK_RC5 0x00000019UL +#define CKK_IDEA 0x0000001AUL +#define CKK_SKIPJACK 0x0000001BUL +#define CKK_BATON 0x0000001CUL +#define CKK_JUNIPER 0x0000001DUL +#define CKK_CDMF 0x0000001EUL +#define CKK_AES 0x0000001FUL +#define CKK_BLOWFISH 0x00000020UL +#define CKK_TWOFISH 0x00000021UL +#define CKK_SECURID 0x00000022UL +#define CKK_HOTP 0x00000023UL +#define CKK_ACTI 0x00000024UL +#define CKK_CAMELLIA 0x00000025UL +#define CKK_ARIA 0x00000026UL -/* all these key types are new for v2.0 */ -#define CKK_CAST 0x00000016 -#define CKK_CAST3 0x00000017 -/* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */ -#define CKK_CAST5 0x00000018 -#define CKK_CAST128 0x00000018 -#define CKK_RC5 0x00000019 -#define CKK_IDEA 0x0000001A -#define CKK_SKIPJACK 0x0000001B -#define CKK_BATON 0x0000001C -#define CKK_JUNIPER 0x0000001D -#define CKK_CDMF 0x0000001E -#define CKK_AES 0x0000001F +#define CKK_MD5_HMAC 0x00000027UL +#define CKK_SHA_1_HMAC 0x00000028UL +#define CKK_RIPEMD128_HMAC 0x00000029UL +#define CKK_RIPEMD160_HMAC 0x0000002AUL +#define CKK_SHA256_HMAC 0x0000002BUL +#define CKK_SHA384_HMAC 0x0000002CUL +#define CKK_SHA512_HMAC 0x0000002DUL +#define CKK_SHA224_HMAC 0x0000002EUL -/* BlowFish and TwoFish are new for v2.20 */ -#define CKK_BLOWFISH 0x00000020 -#define CKK_TWOFISH 0x00000021 +#define CKK_SEED 0x0000002FUL +#define CKK_GOSTR3410 0x00000030UL +#define CKK_GOSTR3411 0x00000031UL +#define CKK_GOST28147 0x00000032UL -#define CKK_VENDOR_DEFINED 0x80000000 + + +#define CKK_VENDOR_DEFINED 0x80000000UL /* CK_CERTIFICATE_TYPE is a value that identifies a certificate - * type */ -/* CK_CERTIFICATE_TYPE was changed from CK_USHORT to CK_ULONG - * for v2.0 */ + * type + */ typedef CK_ULONG CK_CERTIFICATE_TYPE; +#define CK_CERTIFICATE_CATEGORY_UNSPECIFIED 0UL +#define CK_CERTIFICATE_CATEGORY_TOKEN_USER 1UL +#define CK_CERTIFICATE_CATEGORY_AUTHORITY 2UL +#define CK_CERTIFICATE_CATEGORY_OTHER_ENTITY 3UL + +#define CK_SECURITY_DOMAIN_UNSPECIFIED 0UL +#define CK_SECURITY_DOMAIN_MANUFACTURER 1UL +#define CK_SECURITY_DOMAIN_OPERATOR 2UL +#define CK_SECURITY_DOMAIN_THIRD_PARTY 3UL + + /* The following certificate types are defined: */ -/* CKC_X_509_ATTR_CERT is new for v2.10 */ -/* CKC_WTLS is new for v2.20 */ -#define CKC_X_509 0x00000000 -#define CKC_X_509_ATTR_CERT 0x00000001 -#define CKC_WTLS 0x00000002 -#define CKC_VENDOR_DEFINED 0x80000000 +#define CKC_X_509 0x00000000UL +#define CKC_X_509_ATTR_CERT 0x00000001UL +#define CKC_WTLS 0x00000002UL +#define CKC_VENDOR_DEFINED 0x80000000UL /* CK_ATTRIBUTE_TYPE is a value that identifies an attribute - * type */ -/* CK_ATTRIBUTE_TYPE was changed from CK_USHORT to CK_ULONG for - * v2.0 */ + * type + */ typedef CK_ULONG CK_ATTRIBUTE_TYPE; /* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which - consists of an array of values. */ -#define CKF_ARRAY_ATTRIBUTE 0x40000000 + * consists of an array of values. + */ +#define CKF_ARRAY_ATTRIBUTE 0x40000000UL + +/* The following OTP-related defines relate to the CKA_OTP_FORMAT attribute */ +#define CK_OTP_FORMAT_DECIMAL 0UL +#define CK_OTP_FORMAT_HEXADECIMAL 1UL +#define CK_OTP_FORMAT_ALPHANUMERIC 2UL +#define CK_OTP_FORMAT_BINARY 3UL + +/* The following OTP-related defines relate to the CKA_OTP_..._REQUIREMENT + * attributes + */ +#define CK_OTP_PARAM_IGNORED 0UL +#define CK_OTP_PARAM_OPTIONAL 1UL +#define CK_OTP_PARAM_MANDATORY 2UL /* The following attribute types are defined: */ -#define CKA_CLASS 0x00000000 -#define CKA_TOKEN 0x00000001 -#define CKA_PRIVATE 0x00000002 -#define CKA_LABEL 0x00000003 -#define CKA_APPLICATION 0x00000010 -#define CKA_VALUE 0x00000011 - -/* CKA_OBJECT_ID is new for v2.10 */ -#define CKA_OBJECT_ID 0x00000012 - -#define CKA_CERTIFICATE_TYPE 0x00000080 -#define CKA_ISSUER 0x00000081 -#define CKA_SERIAL_NUMBER 0x00000082 - -/* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new - * for v2.10 */ -#define CKA_AC_ISSUER 0x00000083 -#define CKA_OWNER 0x00000084 -#define CKA_ATTR_TYPES 0x00000085 - -/* CKA_TRUSTED is new for v2.11 */ -#define CKA_TRUSTED 0x00000086 - -/* CKA_CERTIFICATE_CATEGORY ... - * CKA_CHECK_VALUE are new for v2.20 */ -#define CKA_CERTIFICATE_CATEGORY 0x00000087 -#define CKA_JAVA_MIDP_SECURITY_DOMAIN 0x00000088 -#define CKA_URL 0x00000089 -#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY 0x0000008A -#define CKA_HASH_OF_ISSUER_PUBLIC_KEY 0x0000008B -#define CKA_CHECK_VALUE 0x00000090 +#define CKA_CLASS 0x00000000UL +#define CKA_TOKEN 0x00000001UL +#define CKA_PRIVATE 0x00000002UL +#define CKA_LABEL 0x00000003UL +#define CKA_APPLICATION 0x00000010UL +#define CKA_VALUE 0x00000011UL +#define CKA_OBJECT_ID 0x00000012UL +#define CKA_CERTIFICATE_TYPE 0x00000080UL +#define CKA_ISSUER 0x00000081UL +#define CKA_SERIAL_NUMBER 0x00000082UL +#define CKA_AC_ISSUER 0x00000083UL +#define CKA_OWNER 0x00000084UL +#define CKA_ATTR_TYPES 0x00000085UL +#define CKA_TRUSTED 0x00000086UL +#define CKA_CERTIFICATE_CATEGORY 0x00000087UL +#define CKA_JAVA_MIDP_SECURITY_DOMAIN 0x00000088UL +#define CKA_URL 0x00000089UL +#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY 0x0000008AUL +#define CKA_HASH_OF_ISSUER_PUBLIC_KEY 0x0000008BUL +#define CKA_NAME_HASH_ALGORITHM 0x0000008CUL +#define CKA_CHECK_VALUE 0x00000090UL -#define CKA_KEY_TYPE 0x00000100 -#define CKA_SUBJECT 0x00000101 -#define CKA_ID 0x00000102 -#define CKA_SENSITIVE 0x00000103 -#define CKA_ENCRYPT 0x00000104 -#define CKA_DECRYPT 0x00000105 -#define CKA_WRAP 0x00000106 -#define CKA_UNWRAP 0x00000107 -#define CKA_SIGN 0x00000108 -#define CKA_SIGN_RECOVER 0x00000109 -#define CKA_VERIFY 0x0000010A -#define CKA_VERIFY_RECOVER 0x0000010B -#define CKA_DERIVE 0x0000010C -#define CKA_START_DATE 0x00000110 -#define CKA_END_DATE 0x00000111 -#define CKA_MODULUS 0x00000120 -#define CKA_MODULUS_BITS 0x00000121 -#define CKA_PUBLIC_EXPONENT 0x00000122 -#define CKA_PRIVATE_EXPONENT 0x00000123 -#define CKA_PRIME_1 0x00000124 -#define CKA_PRIME_2 0x00000125 -#define CKA_EXPONENT_1 0x00000126 -#define CKA_EXPONENT_2 0x00000127 -#define CKA_COEFFICIENT 0x00000128 -#define CKA_PRIME 0x00000130 -#define CKA_SUBPRIME 0x00000131 -#define CKA_BASE 0x00000132 +#define CKA_KEY_TYPE 0x00000100UL +#define CKA_SUBJECT 0x00000101UL +#define CKA_ID 0x00000102UL +#define CKA_SENSITIVE 0x00000103UL +#define CKA_ENCRYPT 0x00000104UL +#define CKA_DECRYPT 0x00000105UL +#define CKA_WRAP 0x00000106UL +#define CKA_UNWRAP 0x00000107UL +#define CKA_SIGN 0x00000108UL +#define CKA_SIGN_RECOVER 0x00000109UL +#define CKA_VERIFY 0x0000010AUL +#define CKA_VERIFY_RECOVER 0x0000010BUL +#define CKA_DERIVE 0x0000010CUL +#define CKA_START_DATE 0x00000110UL +#define CKA_END_DATE 0x00000111UL +#define CKA_MODULUS 0x00000120UL +#define CKA_MODULUS_BITS 0x00000121UL +#define CKA_PUBLIC_EXPONENT 0x00000122UL +#define CKA_PRIVATE_EXPONENT 0x00000123UL +#define CKA_PRIME_1 0x00000124UL +#define CKA_PRIME_2 0x00000125UL +#define CKA_EXPONENT_1 0x00000126UL +#define CKA_EXPONENT_2 0x00000127UL +#define CKA_COEFFICIENT 0x00000128UL +#define CKA_PUBLIC_KEY_INFO 0x00000129UL +#define CKA_PRIME 0x00000130UL +#define CKA_SUBPRIME 0x00000131UL +#define CKA_BASE 0x00000132UL -/* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */ -#define CKA_PRIME_BITS 0x00000133 -#define CKA_SUBPRIME_BITS 0x00000134 +#define CKA_PRIME_BITS 0x00000133UL +#define CKA_SUBPRIME_BITS 0x00000134UL #define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS -/* (To retain backwards-compatibility) */ - -#define CKA_VALUE_BITS 0x00000160 -#define CKA_VALUE_LEN 0x00000161 -/* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE, - * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS, - * and CKA_EC_POINT are new for v2.0 */ -#define CKA_EXTRACTABLE 0x00000162 -#define CKA_LOCAL 0x00000163 -#define CKA_NEVER_EXTRACTABLE 0x00000164 -#define CKA_ALWAYS_SENSITIVE 0x00000165 +#define CKA_VALUE_BITS 0x00000160UL +#define CKA_VALUE_LEN 0x00000161UL +#define CKA_EXTRACTABLE 0x00000162UL +#define CKA_LOCAL 0x00000163UL +#define CKA_NEVER_EXTRACTABLE 0x00000164UL +#define CKA_ALWAYS_SENSITIVE 0x00000165UL +#define CKA_KEY_GEN_MECHANISM 0x00000166UL + +#define CKA_MODIFIABLE 0x00000170UL +#define CKA_COPYABLE 0x00000171UL + +#define CKA_DESTROYABLE 0x00000172UL -/* CKA_KEY_GEN_MECHANISM is new for v2.11 */ -#define CKA_KEY_GEN_MECHANISM 0x00000166 +#define CKA_ECDSA_PARAMS 0x00000180UL /* Deprecated */ +#define CKA_EC_PARAMS 0x00000180UL -#define CKA_MODIFIABLE 0x00000170 +#define CKA_EC_POINT 0x00000181UL -/* CKA_ECDSA_PARAMS is deprecated in v2.11, - * CKA_EC_PARAMS is preferred. */ -#define CKA_ECDSA_PARAMS 0x00000180 -#define CKA_EC_PARAMS 0x00000180 +#define CKA_SECONDARY_AUTH 0x00000200UL /* Deprecated */ +#define CKA_AUTH_PIN_FLAGS 0x00000201UL /* Deprecated */ + +#define CKA_ALWAYS_AUTHENTICATE 0x00000202UL -#define CKA_EC_POINT 0x00000181 - -/* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS, - * are new for v2.10. Deprecated in v2.11 and onwards. */ -#define CKA_SECONDARY_AUTH 0x00000200 -#define CKA_AUTH_PIN_FLAGS 0x00000201 +#define CKA_WRAP_WITH_TRUSTED 0x00000210UL +#define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000211UL) +#define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000212UL) +#define CKA_DERIVE_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000213UL) -/* CKA_ALWAYS_AUTHENTICATE ... - * CKA_UNWRAP_TEMPLATE are new for v2.20 */ -#define CKA_ALWAYS_AUTHENTICATE 0x00000202 +#define CKA_OTP_FORMAT 0x00000220UL +#define CKA_OTP_LENGTH 0x00000221UL +#define CKA_OTP_TIME_INTERVAL 0x00000222UL +#define CKA_OTP_USER_FRIENDLY_MODE 0x00000223UL +#define CKA_OTP_CHALLENGE_REQUIREMENT 0x00000224UL +#define CKA_OTP_TIME_REQUIREMENT 0x00000225UL +#define CKA_OTP_COUNTER_REQUIREMENT 0x00000226UL +#define CKA_OTP_PIN_REQUIREMENT 0x00000227UL +#define CKA_OTP_COUNTER 0x0000022EUL +#define CKA_OTP_TIME 0x0000022FUL +#define CKA_OTP_USER_IDENTIFIER 0x0000022AUL +#define CKA_OTP_SERVICE_IDENTIFIER 0x0000022BUL +#define CKA_OTP_SERVICE_LOGO 0x0000022CUL +#define CKA_OTP_SERVICE_LOGO_TYPE 0x0000022DUL -#define CKA_WRAP_WITH_TRUSTED 0x00000210 -#define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000211) -#define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000212) - -/* CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET - * are new for v2.10 */ -#define CKA_HW_FEATURE_TYPE 0x00000300 -#define CKA_RESET_ON_INIT 0x00000301 -#define CKA_HAS_RESET 0x00000302 +#define CKA_GOSTR3410_PARAMS 0x00000250UL +#define CKA_GOSTR3411_PARAMS 0x00000251UL +#define CKA_GOST28147_PARAMS 0x00000252UL -/* The following attributes are new for v2.20 */ -#define CKA_PIXEL_X 0x00000400 -#define CKA_PIXEL_Y 0x00000401 -#define CKA_RESOLUTION 0x00000402 -#define CKA_CHAR_ROWS 0x00000403 -#define CKA_CHAR_COLUMNS 0x00000404 -#define CKA_COLOR 0x00000405 -#define CKA_BITS_PER_PIXEL 0x00000406 -#define CKA_CHAR_SETS 0x00000480 -#define CKA_ENCODING_METHODS 0x00000481 -#define CKA_MIME_TYPES 0x00000482 -#define CKA_MECHANISM_TYPE 0x00000500 -#define CKA_REQUIRED_CMS_ATTRIBUTES 0x00000501 -#define CKA_DEFAULT_CMS_ATTRIBUTES 0x00000502 -#define CKA_SUPPORTED_CMS_ATTRIBUTES 0x00000503 -#define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE|0x00000600) +#define CKA_HW_FEATURE_TYPE 0x00000300UL +#define CKA_RESET_ON_INIT 0x00000301UL +#define CKA_HAS_RESET 0x00000302UL -#define CKA_VENDOR_DEFINED 0x80000000 -#define CKA_NETSCAPE_DB 0xD5A0DB00 +#define CKA_PIXEL_X 0x00000400UL +#define CKA_PIXEL_Y 0x00000401UL +#define CKA_RESOLUTION 0x00000402UL +#define CKA_CHAR_ROWS 0x00000403UL +#define CKA_CHAR_COLUMNS 0x00000404UL +#define CKA_COLOR 0x00000405UL +#define CKA_BITS_PER_PIXEL 0x00000406UL +#define CKA_CHAR_SETS 0x00000480UL +#define CKA_ENCODING_METHODS 0x00000481UL +#define CKA_MIME_TYPES 0x00000482UL +#define CKA_MECHANISM_TYPE 0x00000500UL +#define CKA_REQUIRED_CMS_ATTRIBUTES 0x00000501UL +#define CKA_DEFAULT_CMS_ATTRIBUTES 0x00000502UL +#define CKA_SUPPORTED_CMS_ATTRIBUTES 0x00000503UL +#define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE|0x00000600UL) +#define CKA_VENDOR_DEFINED 0x80000000UL /* CK_ATTRIBUTE is a structure that includes the type, length - * and value of an attribute */ + * and value of an attribute + */ typedef struct CK_ATTRIBUTE { CK_ATTRIBUTE_TYPE type; CK_VOID_PTR pValue; - - /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */ CK_ULONG ulValueLen; /* in bytes */ } CK_ATTRIBUTE; typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR; - /* CK_DATE is a structure that defines a date */ typedef struct CK_DATE{ CK_CHAR year[4]; /* the year ("1900" - "9999") */ @@ -573,341 +579,411 @@ /* CK_MECHANISM_TYPE is a value that identifies a mechanism - * type */ -/* CK_MECHANISM_TYPE was changed from CK_USHORT to CK_ULONG for - * v2.0 */ + * type + */ typedef CK_ULONG CK_MECHANISM_TYPE; /* the following mechanism types are defined: */ -#define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000 -#define CKM_RSA_PKCS 0x00000001 -#define CKM_RSA_9796 0x00000002 -#define CKM_RSA_X_509 0x00000003 +#define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000UL +#define CKM_RSA_PKCS 0x00000001UL +#define CKM_RSA_9796 0x00000002UL +#define CKM_RSA_X_509 0x00000003UL -/* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS - * are new for v2.0. They are mechanisms which hash and sign */ -#define CKM_MD2_RSA_PKCS 0x00000004 -#define CKM_MD5_RSA_PKCS 0x00000005 -#define CKM_SHA1_RSA_PKCS 0x00000006 +#define CKM_MD2_RSA_PKCS 0x00000004UL +#define CKM_MD5_RSA_PKCS 0x00000005UL +#define CKM_SHA1_RSA_PKCS 0x00000006UL + +#define CKM_RIPEMD128_RSA_PKCS 0x00000007UL +#define CKM_RIPEMD160_RSA_PKCS 0x00000008UL +#define CKM_RSA_PKCS_OAEP 0x00000009UL -/* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and - * CKM_RSA_PKCS_OAEP are new for v2.10 */ -#define CKM_RIPEMD128_RSA_PKCS 0x00000007 -#define CKM_RIPEMD160_RSA_PKCS 0x00000008 -#define CKM_RSA_PKCS_OAEP 0x00000009 +#define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000AUL +#define CKM_RSA_X9_31 0x0000000BUL +#define CKM_SHA1_RSA_X9_31 0x0000000CUL +#define CKM_RSA_PKCS_PSS 0x0000000DUL +#define CKM_SHA1_RSA_PKCS_PSS 0x0000000EUL -/* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31, - * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */ -#define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000A -#define CKM_RSA_X9_31 0x0000000B -#define CKM_SHA1_RSA_X9_31 0x0000000C -#define CKM_RSA_PKCS_PSS 0x0000000D -#define CKM_SHA1_RSA_PKCS_PSS 0x0000000E +#define CKM_DSA_KEY_PAIR_GEN 0x00000010UL +#define CKM_DSA 0x00000011UL +#define CKM_DSA_SHA1 0x00000012UL +#define CKM_DSA_SHA224 0x00000013UL +#define CKM_DSA_SHA256 0x00000014UL +#define CKM_DSA_SHA384 0x00000015UL +#define CKM_DSA_SHA512 0x00000016UL -#define CKM_DSA_KEY_PAIR_GEN 0x00000010 -#define CKM_DSA 0x00000011 -#define CKM_DSA_SHA1 0x00000012 -#define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020 -#define CKM_DH_PKCS_DERIVE 0x00000021 +#define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020UL +#define CKM_DH_PKCS_DERIVE 0x00000021UL + +#define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030UL +#define CKM_X9_42_DH_DERIVE 0x00000031UL +#define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032UL +#define CKM_X9_42_MQV_DERIVE 0x00000033UL -/* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE, - * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for - * v2.11 */ -#define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030 -#define CKM_X9_42_DH_DERIVE 0x00000031 -#define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032 -#define CKM_X9_42_MQV_DERIVE 0x00000033 +#define CKM_SHA256_RSA_PKCS 0x00000040UL +#define CKM_SHA384_RSA_PKCS 0x00000041UL +#define CKM_SHA512_RSA_PKCS 0x00000042UL +#define CKM_SHA256_RSA_PKCS_PSS 0x00000043UL +#define CKM_SHA384_RSA_PKCS_PSS 0x00000044UL +#define CKM_SHA512_RSA_PKCS_PSS 0x00000045UL -/* CKM_SHA256/384/512 are new for v2.20 */ -#define CKM_SHA256_RSA_PKCS 0x00000040 -#define CKM_SHA384_RSA_PKCS 0x00000041 -#define CKM_SHA512_RSA_PKCS 0x00000042 -#define CKM_SHA256_RSA_PKCS_PSS 0x00000043 -#define CKM_SHA384_RSA_PKCS_PSS 0x00000044 -#define CKM_SHA512_RSA_PKCS_PSS 0x00000045 +#define CKM_SHA224_RSA_PKCS 0x00000046UL +#define CKM_SHA224_RSA_PKCS_PSS 0x00000047UL + +#define CKM_SHA512_224 0x00000048UL +#define CKM_SHA512_224_HMAC 0x00000049UL +#define CKM_SHA512_224_HMAC_GENERAL 0x0000004AUL +#define CKM_SHA512_224_KEY_DERIVATION 0x0000004BUL +#define CKM_SHA512_256 0x0000004CUL +#define CKM_SHA512_256_HMAC 0x0000004DUL +#define CKM_SHA512_256_HMAC_GENERAL 0x0000004EUL +#define CKM_SHA512_256_KEY_DERIVATION 0x0000004FUL -#define CKM_RC2_KEY_GEN 0x00000100 -#define CKM_RC2_ECB 0x00000101 -#define CKM_RC2_CBC 0x00000102 -#define CKM_RC2_MAC 0x00000103 +#define CKM_SHA512_T 0x00000050UL +#define CKM_SHA512_T_HMAC 0x00000051UL +#define CKM_SHA512_T_HMAC_GENERAL 0x00000052UL +#define CKM_SHA512_T_KEY_DERIVATION 0x00000053UL + +#define CKM_RC2_KEY_GEN 0x00000100UL +#define CKM_RC2_ECB 0x00000101UL +#define CKM_RC2_CBC 0x00000102UL +#define CKM_RC2_MAC 0x00000103UL -/* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */ -#define CKM_RC2_MAC_GENERAL 0x00000104 -#define CKM_RC2_CBC_PAD 0x00000105 +#define CKM_RC2_MAC_GENERAL 0x00000104UL +#define CKM_RC2_CBC_PAD 0x00000105UL -#define CKM_RC4_KEY_GEN 0x00000110 -#define CKM_RC4 0x00000111 -#define CKM_DES_KEY_GEN 0x00000120 -#define CKM_DES_ECB 0x00000121 -#define CKM_DES_CBC 0x00000122 -#define CKM_DES_MAC 0x00000123 +#define CKM_RC4_KEY_GEN 0x00000110UL +#define CKM_RC4 0x00000111UL +#define CKM_DES_KEY_GEN 0x00000120UL +#define CKM_DES_ECB 0x00000121UL +#define CKM_DES_CBC 0x00000122UL +#define CKM_DES_MAC 0x00000123UL -/* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */ -#define CKM_DES_MAC_GENERAL 0x00000124 -#define CKM_DES_CBC_PAD 0x00000125 +#define CKM_DES_MAC_GENERAL 0x00000124UL +#define CKM_DES_CBC_PAD 0x00000125UL -#define CKM_DES2_KEY_GEN 0x00000130 -#define CKM_DES3_KEY_GEN 0x00000131 -#define CKM_DES3_ECB 0x00000132 -#define CKM_DES3_CBC 0x00000133 -#define CKM_DES3_MAC 0x00000134 +#define CKM_DES2_KEY_GEN 0x00000130UL +#define CKM_DES3_KEY_GEN 0x00000131UL +#define CKM_DES3_ECB 0x00000132UL +#define CKM_DES3_CBC 0x00000133UL +#define CKM_DES3_MAC 0x00000134UL -/* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN, - * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC, - * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */ -#define CKM_DES3_MAC_GENERAL 0x00000135 -#define CKM_DES3_CBC_PAD 0x00000136 -#define CKM_CDMF_KEY_GEN 0x00000140 -#define CKM_CDMF_ECB 0x00000141 -#define CKM_CDMF_CBC 0x00000142 -#define CKM_CDMF_MAC 0x00000143 -#define CKM_CDMF_MAC_GENERAL 0x00000144 -#define CKM_CDMF_CBC_PAD 0x00000145 +#define CKM_DES3_MAC_GENERAL 0x00000135UL +#define CKM_DES3_CBC_PAD 0x00000136UL +#define CKM_DES3_CMAC_GENERAL 0x00000137UL +#define CKM_DES3_CMAC 0x00000138UL +#define CKM_CDMF_KEY_GEN 0x00000140UL +#define CKM_CDMF_ECB 0x00000141UL +#define CKM_CDMF_CBC 0x00000142UL +#define CKM_CDMF_MAC 0x00000143UL +#define CKM_CDMF_MAC_GENERAL 0x00000144UL +#define CKM_CDMF_CBC_PAD 0x00000145UL -/* the following four DES mechanisms are new for v2.20 */ -#define CKM_DES_OFB64 0x00000150 -#define CKM_DES_OFB8 0x00000151 -#define CKM_DES_CFB64 0x00000152 -#define CKM_DES_CFB8 0x00000153 +#define CKM_DES_OFB64 0x00000150UL +#define CKM_DES_OFB8 0x00000151UL +#define CKM_DES_CFB64 0x00000152UL +#define CKM_DES_CFB8 0x00000153UL + +#define CKM_MD2 0x00000200UL -#define CKM_MD2 0x00000200 +#define CKM_MD2_HMAC 0x00000201UL +#define CKM_MD2_HMAC_GENERAL 0x00000202UL + +#define CKM_MD5 0x00000210UL -/* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */ -#define CKM_MD2_HMAC 0x00000201 -#define CKM_MD2_HMAC_GENERAL 0x00000202 +#define CKM_MD5_HMAC 0x00000211UL +#define CKM_MD5_HMAC_GENERAL 0x00000212UL + +#define CKM_SHA_1 0x00000220UL -#define CKM_MD5 0x00000210 - -/* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */ -#define CKM_MD5_HMAC 0x00000211 -#define CKM_MD5_HMAC_GENERAL 0x00000212 +#define CKM_SHA_1_HMAC 0x00000221UL +#define CKM_SHA_1_HMAC_GENERAL 0x00000222UL -#define CKM_SHA_1 0x00000220 - -/* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */ -#define CKM_SHA_1_HMAC 0x00000221 -#define CKM_SHA_1_HMAC_GENERAL 0x00000222 +#define CKM_RIPEMD128 0x00000230UL +#define CKM_RIPEMD128_HMAC 0x00000231UL +#define CKM_RIPEMD128_HMAC_GENERAL 0x00000232UL +#define CKM_RIPEMD160 0x00000240UL +#define CKM_RIPEMD160_HMAC 0x00000241UL +#define CKM_RIPEMD160_HMAC_GENERAL 0x00000242UL -/* CKM_RIPEMD128, CKM_RIPEMD128_HMAC, - * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC, - * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */ -#define CKM_RIPEMD128 0x00000230 -#define CKM_RIPEMD128_HMAC 0x00000231 -#define CKM_RIPEMD128_HMAC_GENERAL 0x00000232 -#define CKM_RIPEMD160 0x00000240 -#define CKM_RIPEMD160_HMAC 0x00000241 -#define CKM_RIPEMD160_HMAC_GENERAL 0x00000242 +#define CKM_SHA256 0x00000250UL +#define CKM_SHA256_HMAC 0x00000251UL +#define CKM_SHA256_HMAC_GENERAL 0x00000252UL +#define CKM_SHA224 0x00000255UL +#define CKM_SHA224_HMAC 0x00000256UL +#define CKM_SHA224_HMAC_GENERAL 0x00000257UL +#define CKM_SHA384 0x00000260UL +#define CKM_SHA384_HMAC 0x00000261UL +#define CKM_SHA384_HMAC_GENERAL 0x00000262UL +#define CKM_SHA512 0x00000270UL +#define CKM_SHA512_HMAC 0x00000271UL +#define CKM_SHA512_HMAC_GENERAL 0x00000272UL +#define CKM_SECURID_KEY_GEN 0x00000280UL +#define CKM_SECURID 0x00000282UL +#define CKM_HOTP_KEY_GEN 0x00000290UL +#define CKM_HOTP 0x00000291UL +#define CKM_ACTI 0x000002A0UL +#define CKM_ACTI_KEY_GEN 0x000002A1UL -/* CKM_SHA256/384/512 are new for v2.20 */ -#define CKM_SHA256 0x00000250 -#define CKM_SHA256_HMAC 0x00000251 -#define CKM_SHA256_HMAC_GENERAL 0x00000252 -#define CKM_SHA384 0x00000260 -#define CKM_SHA384_HMAC 0x00000261 -#define CKM_SHA384_HMAC_GENERAL 0x00000262 -#define CKM_SHA512 0x00000270 -#define CKM_SHA512_HMAC 0x00000271 -#define CKM_SHA512_HMAC_GENERAL 0x00000272 - -/* All of the following mechanisms are new for v2.0 */ +#define CKM_CAST_KEY_GEN 0x00000300UL +#define CKM_CAST_ECB 0x00000301UL +#define CKM_CAST_CBC 0x00000302UL +#define CKM_CAST_MAC 0x00000303UL +#define CKM_CAST_MAC_GENERAL 0x00000304UL +#define CKM_CAST_CBC_PAD 0x00000305UL +#define CKM_CAST3_KEY_GEN 0x00000310UL +#define CKM_CAST3_ECB 0x00000311UL +#define CKM_CAST3_CBC 0x00000312UL +#define CKM_CAST3_MAC 0x00000313UL +#define CKM_CAST3_MAC_GENERAL 0x00000314UL +#define CKM_CAST3_CBC_PAD 0x00000315UL /* Note that CAST128 and CAST5 are the same algorithm */ -#define CKM_CAST_KEY_GEN 0x00000300 -#define CKM_CAST_ECB 0x00000301 -#define CKM_CAST_CBC 0x00000302 -#define CKM_CAST_MAC 0x00000303 -#define CKM_CAST_MAC_GENERAL 0x00000304 -#define CKM_CAST_CBC_PAD 0x00000305 -#define CKM_CAST3_KEY_GEN 0x00000310 -#define CKM_CAST3_ECB 0x00000311 -#define CKM_CAST3_CBC 0x00000312 -#define CKM_CAST3_MAC 0x00000313 -#define CKM_CAST3_MAC_GENERAL 0x00000314 -#define CKM_CAST3_CBC_PAD 0x00000315 -#define CKM_CAST5_KEY_GEN 0x00000320 -#define CKM_CAST128_KEY_GEN 0x00000320 -#define CKM_CAST5_ECB 0x00000321 -#define CKM_CAST128_ECB 0x00000321 -#define CKM_CAST5_CBC 0x00000322 -#define CKM_CAST128_CBC 0x00000322 -#define CKM_CAST5_MAC 0x00000323 -#define CKM_CAST128_MAC 0x00000323 -#define CKM_CAST5_MAC_GENERAL 0x00000324 -#define CKM_CAST128_MAC_GENERAL 0x00000324 -#define CKM_CAST5_CBC_PAD 0x00000325 -#define CKM_CAST128_CBC_PAD 0x00000325 -#define CKM_RC5_KEY_GEN 0x00000330 -#define CKM_RC5_ECB 0x00000331 -#define CKM_RC5_CBC 0x00000332 -#define CKM_RC5_MAC 0x00000333 -#define CKM_RC5_MAC_GENERAL 0x00000334 -#define CKM_RC5_CBC_PAD 0x00000335 -#define CKM_IDEA_KEY_GEN 0x00000340 -#define CKM_IDEA_ECB 0x00000341 -#define CKM_IDEA_CBC 0x00000342 -#define CKM_IDEA_MAC 0x00000343 -#define CKM_IDEA_MAC_GENERAL 0x00000344 -#define CKM_IDEA_CBC_PAD 0x00000345 -#define CKM_GENERIC_SECRET_KEY_GEN 0x00000350 -#define CKM_CONCATENATE_BASE_AND_KEY 0x00000360 -#define CKM_CONCATENATE_BASE_AND_DATA 0x00000362 -#define CKM_CONCATENATE_DATA_AND_BASE 0x00000363 -#define CKM_XOR_BASE_AND_DATA 0x00000364 -#define CKM_EXTRACT_KEY_FROM_KEY 0x00000365 -#define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370 -#define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371 -#define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372 +#define CKM_CAST5_KEY_GEN 0x00000320UL +#define CKM_CAST128_KEY_GEN 0x00000320UL +#define CKM_CAST5_ECB 0x00000321UL +#define CKM_CAST128_ECB 0x00000321UL +#define CKM_CAST5_CBC 0x00000322UL /* Deprecated */ +#define CKM_CAST128_CBC 0x00000322UL +#define CKM_CAST5_MAC 0x00000323UL /* Deprecated */ +#define CKM_CAST128_MAC 0x00000323UL +#define CKM_CAST5_MAC_GENERAL 0x00000324UL /* Deprecated */ +#define CKM_CAST128_MAC_GENERAL 0x00000324UL +#define CKM_CAST5_CBC_PAD 0x00000325UL /* Deprecated */ +#define CKM_CAST128_CBC_PAD 0x00000325UL +#define CKM_RC5_KEY_GEN 0x00000330UL +#define CKM_RC5_ECB 0x00000331UL +#define CKM_RC5_CBC 0x00000332UL +#define CKM_RC5_MAC 0x00000333UL +#define CKM_RC5_MAC_GENERAL 0x00000334UL +#define CKM_RC5_CBC_PAD 0x00000335UL +#define CKM_IDEA_KEY_GEN 0x00000340UL +#define CKM_IDEA_ECB 0x00000341UL +#define CKM_IDEA_CBC 0x00000342UL +#define CKM_IDEA_MAC 0x00000343UL +#define CKM_IDEA_MAC_GENERAL 0x00000344UL +#define CKM_IDEA_CBC_PAD 0x00000345UL +#define CKM_GENERIC_SECRET_KEY_GEN 0x00000350UL +#define CKM_CONCATENATE_BASE_AND_KEY 0x00000360UL +#define CKM_CONCATENATE_BASE_AND_DATA 0x00000362UL +#define CKM_CONCATENATE_DATA_AND_BASE 0x00000363UL +#define CKM_XOR_BASE_AND_DATA 0x00000364UL +#define CKM_EXTRACT_KEY_FROM_KEY 0x00000365UL +#define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370UL +#define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371UL +#define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372UL + +#define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373UL +#define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374UL +#define CKM_TLS_MASTER_KEY_DERIVE 0x00000375UL +#define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376UL +#define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377UL + +#define CKM_TLS_PRF 0x00000378UL + +#define CKM_SSL3_MD5_MAC 0x00000380UL +#define CKM_SSL3_SHA1_MAC 0x00000381UL +#define CKM_MD5_KEY_DERIVATION 0x00000390UL +#define CKM_MD2_KEY_DERIVATION 0x00000391UL +#define CKM_SHA1_KEY_DERIVATION 0x00000392UL + +#define CKM_SHA256_KEY_DERIVATION 0x00000393UL +#define CKM_SHA384_KEY_DERIVATION 0x00000394UL +#define CKM_SHA512_KEY_DERIVATION 0x00000395UL +#define CKM_SHA224_KEY_DERIVATION 0x00000396UL -/* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN, - * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and - * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */ -#define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373 -#define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374 -#define CKM_TLS_MASTER_KEY_DERIVE 0x00000375 -#define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376 -#define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377 +#define CKM_PBE_MD2_DES_CBC 0x000003A0UL +#define CKM_PBE_MD5_DES_CBC 0x000003A1UL +#define CKM_PBE_MD5_CAST_CBC 0x000003A2UL +#define CKM_PBE_MD5_CAST3_CBC 0x000003A3UL +#define CKM_PBE_MD5_CAST5_CBC 0x000003A4UL /* Deprecated */ +#define CKM_PBE_MD5_CAST128_CBC 0x000003A4UL +#define CKM_PBE_SHA1_CAST5_CBC 0x000003A5UL /* Deprecated */ +#define CKM_PBE_SHA1_CAST128_CBC 0x000003A5UL +#define CKM_PBE_SHA1_RC4_128 0x000003A6UL +#define CKM_PBE_SHA1_RC4_40 0x000003A7UL +#define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8UL +#define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9UL +#define CKM_PBE_SHA1_RC2_128_CBC 0x000003AAUL +#define CKM_PBE_SHA1_RC2_40_CBC 0x000003ABUL -/* CKM_TLS_PRF is new for v2.20 */ -#define CKM_TLS_PRF 0x00000378 +#define CKM_PKCS5_PBKD2 0x000003B0UL + +#define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0UL -#define CKM_SSL3_MD5_MAC 0x00000380 -#define CKM_SSL3_SHA1_MAC 0x00000381 -#define CKM_MD5_KEY_DERIVATION 0x00000390 -#define CKM_MD2_KEY_DERIVATION 0x00000391 -#define CKM_SHA1_KEY_DERIVATION 0x00000392 +#define CKM_WTLS_PRE_MASTER_KEY_GEN 0x000003D0UL +#define CKM_WTLS_MASTER_KEY_DERIVE 0x000003D1UL +#define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC 0x000003D2UL +#define CKM_WTLS_PRF 0x000003D3UL +#define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE 0x000003D4UL +#define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE 0x000003D5UL -/* CKM_SHA256/384/512 are new for v2.20 */ -#define CKM_SHA256_KEY_DERIVATION 0x00000393 -#define CKM_SHA384_KEY_DERIVATION 0x00000394 -#define CKM_SHA512_KEY_DERIVATION 0x00000395 +#define CKM_TLS10_MAC_SERVER 0x000003D6UL +#define CKM_TLS10_MAC_CLIENT 0x000003D7UL +#define CKM_TLS12_MAC 0x000003D8UL +#define CKM_TLS12_KDF 0x000003D9UL +#define CKM_TLS12_MASTER_KEY_DERIVE 0x000003E0UL +#define CKM_TLS12_KEY_AND_MAC_DERIVE 0x000003E1UL +#define CKM_TLS12_MASTER_KEY_DERIVE_DH 0x000003E2UL +#define CKM_TLS12_KEY_SAFE_DERIVE 0x000003E3UL +#define CKM_TLS_MAC 0x000003E4UL +#define CKM_TLS_KDF 0x000003E5UL + +#define CKM_KEY_WRAP_LYNKS 0x00000400UL +#define CKM_KEY_WRAP_SET_OAEP 0x00000401UL + +#define CKM_CMS_SIG 0x00000500UL +#define CKM_KIP_DERIVE 0x00000510UL +#define CKM_KIP_WRAP 0x00000511UL +#define CKM_KIP_MAC 0x00000512UL -#define CKM_PBE_MD2_DES_CBC 0x000003A0 -#define CKM_PBE_MD5_DES_CBC 0x000003A1 -#define CKM_PBE_MD5_CAST_CBC 0x000003A2 -#define CKM_PBE_MD5_CAST3_CBC 0x000003A3 -#define CKM_PBE_MD5_CAST5_CBC 0x000003A4 -#define CKM_PBE_MD5_CAST128_CBC 0x000003A4 -#define CKM_PBE_SHA1_CAST5_CBC 0x000003A5 -#define CKM_PBE_SHA1_CAST128_CBC 0x000003A5 -#define CKM_PBE_SHA1_RC4_128 0x000003A6 -#define CKM_PBE_SHA1_RC4_40 0x000003A7 -#define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8 -#define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9 -#define CKM_PBE_SHA1_RC2_128_CBC 0x000003AA -#define CKM_PBE_SHA1_RC2_40_CBC 0x000003AB +#define CKM_CAMELLIA_KEY_GEN 0x00000550UL +#define CKM_CAMELLIA_ECB 0x00000551UL +#define CKM_CAMELLIA_CBC 0x00000552UL +#define CKM_CAMELLIA_MAC 0x00000553UL +#define CKM_CAMELLIA_MAC_GENERAL 0x00000554UL +#define CKM_CAMELLIA_CBC_PAD 0x00000555UL +#define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556UL +#define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557UL +#define CKM_CAMELLIA_CTR 0x00000558UL -/* CKM_PKCS5_PBKD2 is new for v2.10 */ -#define CKM_PKCS5_PBKD2 0x000003B0 - -#define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0 +#define CKM_ARIA_KEY_GEN 0x00000560UL +#define CKM_ARIA_ECB 0x00000561UL +#define CKM_ARIA_CBC 0x00000562UL +#define CKM_ARIA_MAC 0x00000563UL +#define CKM_ARIA_MAC_GENERAL 0x00000564UL +#define CKM_ARIA_CBC_PAD 0x00000565UL +#define CKM_ARIA_ECB_ENCRYPT_DATA 0x00000566UL +#define CKM_ARIA_CBC_ENCRYPT_DATA 0x00000567UL -/* WTLS mechanisms are new for v2.20 */ -#define CKM_WTLS_PRE_MASTER_KEY_GEN 0x000003D0 -#define CKM_WTLS_MASTER_KEY_DERIVE 0x000003D1 -#define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC 0x000003D2 -#define CKM_WTLS_PRF 0x000003D3 -#define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE 0x000003D4 -#define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE 0x000003D5 - -/* new for v2.40 */ -#define CKM_TLS12_MASTER_KEY_DERIVE 0x000003E0 -#define CKM_TLS12_KEY_AND_MAC_DERIVE 0x000003E1 -#define CKM_TLS12_MASTER_KEY_DERIVE_DH 0x000003E2 -#define CKM_TLS_MAC 0x000003E4 - -#define CKM_KEY_WRAP_LYNKS 0x00000400 -#define CKM_KEY_WRAP_SET_OAEP 0x00000401 - -/* CKM_CMS_SIG is new for v2.20 */ -#define CKM_CMS_SIG 0x00000500 +#define CKM_SEED_KEY_GEN 0x00000650UL +#define CKM_SEED_ECB 0x00000651UL +#define CKM_SEED_CBC 0x00000652UL +#define CKM_SEED_MAC 0x00000653UL +#define CKM_SEED_MAC_GENERAL 0x00000654UL +#define CKM_SEED_CBC_PAD 0x00000655UL +#define CKM_SEED_ECB_ENCRYPT_DATA 0x00000656UL +#define CKM_SEED_CBC_ENCRYPT_DATA 0x00000657UL -/* Fortezza mechanisms */ -#define CKM_SKIPJACK_KEY_GEN 0x00001000 -#define CKM_SKIPJACK_ECB64 0x00001001 -#define CKM_SKIPJACK_CBC64 0x00001002 -#define CKM_SKIPJACK_OFB64 0x00001003 -#define CKM_SKIPJACK_CFB64 0x00001004 -#define CKM_SKIPJACK_CFB32 0x00001005 -#define CKM_SKIPJACK_CFB16 0x00001006 -#define CKM_SKIPJACK_CFB8 0x00001007 -#define CKM_SKIPJACK_WRAP 0x00001008 -#define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009 -#define CKM_SKIPJACK_RELAYX 0x0000100a -#define CKM_KEA_KEY_PAIR_GEN 0x00001010 -#define CKM_KEA_KEY_DERIVE 0x00001011 -#define CKM_FORTEZZA_TIMESTAMP 0x00001020 -#define CKM_BATON_KEY_GEN 0x00001030 -#define CKM_BATON_ECB128 0x00001031 -#define CKM_BATON_ECB96 0x00001032 -#define CKM_BATON_CBC128 0x00001033 -#define CKM_BATON_COUNTER 0x00001034 -#define CKM_BATON_SHUFFLE 0x00001035 -#define CKM_BATON_WRAP 0x00001036 +#define CKM_SKIPJACK_KEY_GEN 0x00001000UL +#define CKM_SKIPJACK_ECB64 0x00001001UL +#define CKM_SKIPJACK_CBC64 0x00001002UL +#define CKM_SKIPJACK_OFB64 0x00001003UL +#define CKM_SKIPJACK_CFB64 0x00001004UL +#define CKM_SKIPJACK_CFB32 0x00001005UL +#define CKM_SKIPJACK_CFB16 0x00001006UL +#define CKM_SKIPJACK_CFB8 0x00001007UL +#define CKM_SKIPJACK_WRAP 0x00001008UL +#define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009UL +#define CKM_SKIPJACK_RELAYX 0x0000100aUL +#define CKM_KEA_KEY_PAIR_GEN 0x00001010UL +#define CKM_KEA_KEY_DERIVE 0x00001011UL +#define CKM_KEA_DERIVE 0x00001012UL +#define CKM_FORTEZZA_TIMESTAMP 0x00001020UL +#define CKM_BATON_KEY_GEN 0x00001030UL +#define CKM_BATON_ECB128 0x00001031UL +#define CKM_BATON_ECB96 0x00001032UL +#define CKM_BATON_CBC128 0x00001033UL +#define CKM_BATON_COUNTER 0x00001034UL +#define CKM_BATON_SHUFFLE 0x00001035UL +#define CKM_BATON_WRAP 0x00001036UL -/* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11, - * CKM_EC_KEY_PAIR_GEN is preferred */ -#define CKM_ECDSA_KEY_PAIR_GEN 0x00001040 -#define CKM_EC_KEY_PAIR_GEN 0x00001040 +#define CKM_ECDSA_KEY_PAIR_GEN 0x00001040UL /* Deprecated */ +#define CKM_EC_KEY_PAIR_GEN 0x00001040UL + +#define CKM_ECDSA 0x00001041UL +#define CKM_ECDSA_SHA1 0x00001042UL +#define CKM_ECDSA_SHA224 0x00001043UL +#define CKM_ECDSA_SHA256 0x00001044UL +#define CKM_ECDSA_SHA384 0x00001045UL +#define CKM_ECDSA_SHA512 0x00001046UL + +#define CKM_ECDH1_DERIVE 0x00001050UL +#define CKM_ECDH1_COFACTOR_DERIVE 0x00001051UL +#define CKM_ECMQV_DERIVE 0x00001052UL + +#define CKM_ECDH_AES_KEY_WRAP 0x00001053UL +#define CKM_RSA_AES_KEY_WRAP 0x00001054UL + +#define CKM_JUNIPER_KEY_GEN 0x00001060UL +#define CKM_JUNIPER_ECB128 0x00001061UL +#define CKM_JUNIPER_CBC128 0x00001062UL +#define CKM_JUNIPER_COUNTER 0x00001063UL +#define CKM_JUNIPER_SHUFFLE 0x00001064UL +#define CKM_JUNIPER_WRAP 0x00001065UL +#define CKM_FASTHASH 0x00001070UL -#define CKM_ECDSA 0x00001041 -#define CKM_ECDSA_SHA1 0x00001042 +#define CKM_AES_KEY_GEN 0x00001080UL +#define CKM_AES_ECB 0x00001081UL +#define CKM_AES_CBC 0x00001082UL +#define CKM_AES_MAC 0x00001083UL +#define CKM_AES_MAC_GENERAL 0x00001084UL +#define CKM_AES_CBC_PAD 0x00001085UL +#define CKM_AES_CTR 0x00001086UL +#define CKM_AES_GCM 0x00001087UL +#define CKM_AES_CCM 0x00001088UL +#define CKM_AES_CTS 0x00001089UL +#define CKM_AES_CMAC 0x0000108AUL +#define CKM_AES_CMAC_GENERAL 0x0000108BUL -/* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE - * are new for v2.11 */ -#define CKM_ECDH1_DERIVE 0x00001050 -#define CKM_ECDH1_COFACTOR_DERIVE 0x00001051 -#define CKM_ECMQV_DERIVE 0x00001052 +#define CKM_AES_XCBC_MAC 0x0000108CUL +#define CKM_AES_XCBC_MAC_96 0x0000108DUL +#define CKM_AES_GMAC 0x0000108EUL -#define CKM_JUNIPER_KEY_GEN 0x00001060 -#define CKM_JUNIPER_ECB128 0x00001061 -#define CKM_JUNIPER_CBC128 0x00001062 -#define CKM_JUNIPER_COUNTER 0x00001063 -#define CKM_JUNIPER_SHUFFLE 0x00001064 -#define CKM_JUNIPER_WRAP 0x00001065 -#define CKM_FASTHASH 0x00001070 +#define CKM_BLOWFISH_KEY_GEN 0x00001090UL +#define CKM_BLOWFISH_CBC 0x00001091UL +#define CKM_TWOFISH_KEY_GEN 0x00001092UL +#define CKM_TWOFISH_CBC 0x00001093UL +#define CKM_BLOWFISH_CBC_PAD 0x00001094UL +#define CKM_TWOFISH_CBC_PAD 0x00001095UL + +#define CKM_DES_ECB_ENCRYPT_DATA 0x00001100UL +#define CKM_DES_CBC_ENCRYPT_DATA 0x00001101UL +#define CKM_DES3_ECB_ENCRYPT_DATA 0x00001102UL +#define CKM_DES3_CBC_ENCRYPT_DATA 0x00001103UL +#define CKM_AES_ECB_ENCRYPT_DATA 0x00001104UL +#define CKM_AES_CBC_ENCRYPT_DATA 0x00001105UL -/* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC, - * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN, - * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are - * new for v2.11 */ -#define CKM_AES_KEY_GEN 0x00001080 -#define CKM_AES_ECB 0x00001081 -#define CKM_AES_CBC 0x00001082 -#define CKM_AES_MAC 0x00001083 -#define CKM_AES_MAC_GENERAL 0x00001084 -#define CKM_AES_CBC_PAD 0x00001085 +#define CKM_GOSTR3410_KEY_PAIR_GEN 0x00001200UL +#define CKM_GOSTR3410 0x00001201UL +#define CKM_GOSTR3410_WITH_GOSTR3411 0x00001202UL +#define CKM_GOSTR3410_KEY_WRAP 0x00001203UL +#define CKM_GOSTR3410_DERIVE 0x00001204UL +#define CKM_GOSTR3411 0x00001210UL +#define CKM_GOSTR3411_HMAC 0x00001211UL +#define CKM_GOST28147_KEY_GEN 0x00001220UL +#define CKM_GOST28147_ECB 0x00001221UL +#define CKM_GOST28147 0x00001222UL +#define CKM_GOST28147_MAC 0x00001223UL +#define CKM_GOST28147_KEY_WRAP 0x00001224UL -/* BlowFish and TwoFish are new for v2.20 */ -#define CKM_BLOWFISH_KEY_GEN 0x00001090 -#define CKM_BLOWFISH_CBC 0x00001091 -#define CKM_TWOFISH_KEY_GEN 0x00001092 -#define CKM_TWOFISH_CBC 0x00001093 - +#define CKM_DSA_PARAMETER_GEN 0x00002000UL +#define CKM_DH_PKCS_PARAMETER_GEN 0x00002001UL +#define CKM_X9_42_DH_PARAMETER_GEN 0x00002002UL +#define CKM_DSA_PROBABLISTIC_PARAMETER_GEN 0x00002003UL +#define CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN 0x00002004UL -/* CKM_xxx_ENCRYPT_DATA mechanisms are new for v2.20 */ -#define CKM_DES_ECB_ENCRYPT_DATA 0x00001100 -#define CKM_DES_CBC_ENCRYPT_DATA 0x00001101 -#define CKM_DES3_ECB_ENCRYPT_DATA 0x00001102 -#define CKM_DES3_CBC_ENCRYPT_DATA 0x00001103 -#define CKM_AES_ECB_ENCRYPT_DATA 0x00001104 -#define CKM_AES_CBC_ENCRYPT_DATA 0x00001105 +#define CKM_AES_OFB 0x00002104UL +#define CKM_AES_CFB64 0x00002105UL +#define CKM_AES_CFB8 0x00002106UL +#define CKM_AES_CFB128 0x00002107UL -#define CKM_DSA_PARAMETER_GEN 0x00002000 -#define CKM_DH_PKCS_PARAMETER_GEN 0x00002001 -#define CKM_X9_42_DH_PARAMETER_GEN 0x00002002 +#define CKM_AES_CFB1 0x00002108UL +#define CKM_AES_KEY_WRAP 0x00002109UL /* WAS: 0x00001090 */ +#define CKM_AES_KEY_WRAP_PAD 0x0000210AUL /* WAS: 0x00001091 */ -#define CKM_VENDOR_DEFINED 0x80000000 +#define CKM_RSA_PKCS_TPM_1_1 0x00004001UL +#define CKM_RSA_PKCS_OAEP_TPM_1_1 0x00004002UL + +#define CKM_VENDOR_DEFINED 0x80000000UL typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR; /* CK_MECHANISM is a structure that specifies a particular - * mechanism */ + * mechanism + */ typedef struct CK_MECHANISM { CK_MECHANISM_TYPE mechanism; CK_VOID_PTR pParameter; - - /* ulParameterLen was changed from CK_USHORT to CK_ULONG for - * v2.0 */ CK_ULONG ulParameterLen; /* in bytes */ } CK_MECHANISM; @@ -915,7 +991,8 @@ /* CK_MECHANISM_INFO provides information about a particular - * mechanism */ + * mechanism + */ typedef struct CK_MECHANISM_INFO { CK_ULONG ulMinKeySize; CK_ULONG ulMaxKeySize; @@ -923,179 +1000,163 @@ } CK_MECHANISM_INFO; /* The flags are defined as follows: - * Bit Flag Mask Meaning */ -#define CKF_HW 0x00000001 /* performed by HW */ + * Bit Flag Mask Meaning */ +#define CKF_HW 0x00000001UL /* performed by HW */ -/* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN, - * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER, - * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP, - * and CKF_DERIVE are new for v2.0. They specify whether or not - * a mechanism can be used for a particular task */ -#define CKF_ENCRYPT 0x00000100 -#define CKF_DECRYPT 0x00000200 -#define CKF_DIGEST 0x00000400 -#define CKF_SIGN 0x00000800 -#define CKF_SIGN_RECOVER 0x00001000 -#define CKF_VERIFY 0x00002000 -#define CKF_VERIFY_RECOVER 0x00004000 -#define CKF_GENERATE 0x00008000 -#define CKF_GENERATE_KEY_PAIR 0x00010000 -#define CKF_WRAP 0x00020000 -#define CKF_UNWRAP 0x00040000 -#define CKF_DERIVE 0x00080000 +/* Specify whether or not a mechanism can be used for a particular task */ +#define CKF_ENCRYPT 0x00000100UL +#define CKF_DECRYPT 0x00000200UL +#define CKF_DIGEST 0x00000400UL +#define CKF_SIGN 0x00000800UL +#define CKF_SIGN_RECOVER 0x00001000UL +#define CKF_VERIFY 0x00002000UL +#define CKF_VERIFY_RECOVER 0x00004000UL +#define CKF_GENERATE 0x00008000UL +#define CKF_GENERATE_KEY_PAIR 0x00010000UL +#define CKF_WRAP 0x00020000UL +#define CKF_UNWRAP 0x00040000UL +#define CKF_DERIVE 0x00080000UL -/* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE, - * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They - * describe a token's EC capabilities not available in mechanism - * information. */ -#define CKF_EC_F_P 0x00100000 -#define CKF_EC_F_2M 0x00200000 -#define CKF_EC_ECPARAMETERS 0x00400000 -#define CKF_EC_NAMEDCURVE 0x00800000 -#define CKF_EC_UNCOMPRESS 0x01000000 -#define CKF_EC_COMPRESS 0x02000000 +/* Describe a token's EC capabilities not available in mechanism + * information. + */ +#define CKF_EC_F_P 0x00100000UL +#define CKF_EC_F_2M 0x00200000UL +#define CKF_EC_ECPARAMETERS 0x00400000UL +#define CKF_EC_NAMEDCURVE 0x00800000UL +#define CKF_EC_UNCOMPRESS 0x01000000UL +#define CKF_EC_COMPRESS 0x02000000UL -#define CKF_EXTENSION 0x80000000 /* FALSE for this version */ +#define CKF_EXTENSION 0x80000000UL typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR; - /* CK_RV is a value that identifies the return value of a - * Cryptoki function */ -/* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */ + * Cryptoki function + */ typedef CK_ULONG CK_RV; -#define CKR_OK 0x00000000 -#define CKR_CANCEL 0x00000001 -#define CKR_HOST_MEMORY 0x00000002 -#define CKR_SLOT_ID_INVALID 0x00000003 +#define CKR_OK 0x00000000UL +#define CKR_CANCEL 0x00000001UL +#define CKR_HOST_MEMORY 0x00000002UL +#define CKR_SLOT_ID_INVALID 0x00000003UL -/* CKR_FLAGS_INVALID was removed for v2.0 */ - -/* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */ -#define CKR_GENERAL_ERROR 0x00000005 -#define CKR_FUNCTION_FAILED 0x00000006 +#define CKR_GENERAL_ERROR 0x00000005UL +#define CKR_FUNCTION_FAILED 0x00000006UL -/* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS, - * and CKR_CANT_LOCK are new for v2.01 */ -#define CKR_ARGUMENTS_BAD 0x00000007 -#define CKR_NO_EVENT 0x00000008 -#define CKR_NEED_TO_CREATE_THREADS 0x00000009 -#define CKR_CANT_LOCK 0x0000000A +#define CKR_ARGUMENTS_BAD 0x00000007UL +#define CKR_NO_EVENT 0x00000008UL +#define CKR_NEED_TO_CREATE_THREADS 0x00000009UL +#define CKR_CANT_LOCK 0x0000000AUL -#define CKR_ATTRIBUTE_READ_ONLY 0x00000010 -#define CKR_ATTRIBUTE_SENSITIVE 0x00000011 -#define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012 -#define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013 -#define CKR_DATA_INVALID 0x00000020 -#define CKR_DATA_LEN_RANGE 0x00000021 -#define CKR_DEVICE_ERROR 0x00000030 -#define CKR_DEVICE_MEMORY 0x00000031 -#define CKR_DEVICE_REMOVED 0x00000032 -#define CKR_ENCRYPTED_DATA_INVALID 0x00000040 -#define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041 -#define CKR_FUNCTION_CANCELED 0x00000050 -#define CKR_FUNCTION_NOT_PARALLEL 0x00000051 +#define CKR_ATTRIBUTE_READ_ONLY 0x00000010UL +#define CKR_ATTRIBUTE_SENSITIVE 0x00000011UL +#define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012UL +#define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013UL + +#define CKR_ACTION_PROHIBITED 0x0000001BUL -/* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */ -#define CKR_FUNCTION_NOT_SUPPORTED 0x00000054 - -#define CKR_KEY_HANDLE_INVALID 0x00000060 +#define CKR_DATA_INVALID 0x00000020UL +#define CKR_DATA_LEN_RANGE 0x00000021UL +#define CKR_DEVICE_ERROR 0x00000030UL +#define CKR_DEVICE_MEMORY 0x00000031UL +#define CKR_DEVICE_REMOVED 0x00000032UL +#define CKR_ENCRYPTED_DATA_INVALID 0x00000040UL +#define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041UL +#define CKR_FUNCTION_CANCELED 0x00000050UL +#define CKR_FUNCTION_NOT_PARALLEL 0x00000051UL -/* CKR_KEY_SENSITIVE was removed for v2.0 */ +#define CKR_FUNCTION_NOT_SUPPORTED 0x00000054UL -#define CKR_KEY_SIZE_RANGE 0x00000062 -#define CKR_KEY_TYPE_INCONSISTENT 0x00000063 +#define CKR_KEY_HANDLE_INVALID 0x00000060UL + +#define CKR_KEY_SIZE_RANGE 0x00000062UL +#define CKR_KEY_TYPE_INCONSISTENT 0x00000063UL -/* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED, - * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED, - * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for - * v2.0 */ -#define CKR_KEY_NOT_NEEDED 0x00000064 -#define CKR_KEY_CHANGED 0x00000065 -#define CKR_KEY_NEEDED 0x00000066 -#define CKR_KEY_INDIGESTIBLE 0x00000067 -#define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068 -#define CKR_KEY_NOT_WRAPPABLE 0x00000069 -#define CKR_KEY_UNEXTRACTABLE 0x0000006A +#define CKR_KEY_NOT_NEEDED 0x00000064UL +#define CKR_KEY_CHANGED 0x00000065UL +#define CKR_KEY_NEEDED 0x00000066UL +#define CKR_KEY_INDIGESTIBLE 0x00000067UL +#define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068UL +#define CKR_KEY_NOT_WRAPPABLE 0x00000069UL +#define CKR_KEY_UNEXTRACTABLE 0x0000006AUL -#define CKR_MECHANISM_INVALID 0x00000070 -#define CKR_MECHANISM_PARAM_INVALID 0x00000071 +#define CKR_MECHANISM_INVALID 0x00000070UL +#define CKR_MECHANISM_PARAM_INVALID 0x00000071UL -/* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID - * were removed for v2.0 */ -#define CKR_OBJECT_HANDLE_INVALID 0x00000082 -#define CKR_OPERATION_ACTIVE 0x00000090 -#define CKR_OPERATION_NOT_INITIALIZED 0x00000091 -#define CKR_PIN_INCORRECT 0x000000A0 -#define CKR_PIN_INVALID 0x000000A1 -#define CKR_PIN_LEN_RANGE 0x000000A2 +#define CKR_OBJECT_HANDLE_INVALID 0x00000082UL +#define CKR_OPERATION_ACTIVE 0x00000090UL +#define CKR_OPERATION_NOT_INITIALIZED 0x00000091UL +#define CKR_PIN_INCORRECT 0x000000A0UL +#define CKR_PIN_INVALID 0x000000A1UL +#define CKR_PIN_LEN_RANGE 0x000000A2UL + +#define CKR_PIN_EXPIRED 0x000000A3UL +#define CKR_PIN_LOCKED 0x000000A4UL -/* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */ -#define CKR_PIN_EXPIRED 0x000000A3 -#define CKR_PIN_LOCKED 0x000000A4 +#define CKR_SESSION_CLOSED 0x000000B0UL +#define CKR_SESSION_COUNT 0x000000B1UL +#define CKR_SESSION_HANDLE_INVALID 0x000000B3UL +#define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4UL +#define CKR_SESSION_READ_ONLY 0x000000B5UL +#define CKR_SESSION_EXISTS 0x000000B6UL -#define CKR_SESSION_CLOSED 0x000000B0 -#define CKR_SESSION_COUNT 0x000000B1 -#define CKR_SESSION_HANDLE_INVALID 0x000000B3 -#define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4 -#define CKR_SESSION_READ_ONLY 0x000000B5 -#define CKR_SESSION_EXISTS 0x000000B6 +#define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7UL +#define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8UL -/* CKR_SESSION_READ_ONLY_EXISTS and - * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */ -#define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7 -#define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8 +#define CKR_SIGNATURE_INVALID 0x000000C0UL +#define CKR_SIGNATURE_LEN_RANGE 0x000000C1UL +#define CKR_TEMPLATE_INCOMPLETE 0x000000D0UL +#define CKR_TEMPLATE_INCONSISTENT 0x000000D1UL +#define CKR_TOKEN_NOT_PRESENT 0x000000E0UL +#define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1UL +#define CKR_TOKEN_WRITE_PROTECTED 0x000000E2UL +#define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0UL +#define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1UL +#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2UL +#define CKR_USER_ALREADY_LOGGED_IN 0x00000100UL +#define CKR_USER_NOT_LOGGED_IN 0x00000101UL +#define CKR_USER_PIN_NOT_INITIALIZED 0x00000102UL +#define CKR_USER_TYPE_INVALID 0x00000103UL -#define CKR_SIGNATURE_INVALID 0x000000C0 -#define CKR_SIGNATURE_LEN_RANGE 0x000000C1 -#define CKR_TEMPLATE_INCOMPLETE 0x000000D0 -#define CKR_TEMPLATE_INCONSISTENT 0x000000D1 -#define CKR_TOKEN_NOT_PRESENT 0x000000E0 -#define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1 -#define CKR_TOKEN_WRITE_PROTECTED 0x000000E2 -#define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0 -#define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1 -#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2 -#define CKR_USER_ALREADY_LOGGED_IN 0x00000100 -#define CKR_USER_NOT_LOGGED_IN 0x00000101 -#define CKR_USER_PIN_NOT_INITIALIZED 0x00000102 -#define CKR_USER_TYPE_INVALID 0x00000103 +#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104UL +#define CKR_USER_TOO_MANY_TYPES 0x00000105UL -/* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES - * are new to v2.01 */ -#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104 -#define CKR_USER_TOO_MANY_TYPES 0x00000105 +#define CKR_WRAPPED_KEY_INVALID 0x00000110UL +#define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112UL +#define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113UL +#define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114UL +#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115UL +#define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120UL + +#define CKR_RANDOM_NO_RNG 0x00000121UL -#define CKR_WRAPPED_KEY_INVALID 0x00000110 -#define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112 -#define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113 -#define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114 -#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115 -#define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120 +#define CKR_DOMAIN_PARAMS_INVALID 0x00000130UL + +#define CKR_CURVE_NOT_SUPPORTED 0x00000140UL -/* These are new to v2.0 */ -#define CKR_RANDOM_NO_RNG 0x00000121 +#define CKR_BUFFER_TOO_SMALL 0x00000150UL +#define CKR_SAVED_STATE_INVALID 0x00000160UL +#define CKR_INFORMATION_SENSITIVE 0x00000170UL +#define CKR_STATE_UNSAVEABLE 0x00000180UL -/* These are new to v2.11 */ -#define CKR_DOMAIN_PARAMS_INVALID 0x00000130 +#define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190UL +#define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191UL +#define CKR_MUTEX_BAD 0x000001A0UL +#define CKR_MUTEX_NOT_LOCKED 0x000001A1UL -/* These are new to v2.0 */ -#define CKR_BUFFER_TOO_SMALL 0x00000150 -#define CKR_SAVED_STATE_INVALID 0x00000160 -#define CKR_INFORMATION_SENSITIVE 0x00000170 -#define CKR_STATE_UNSAVEABLE 0x00000180 +#define CKR_NEW_PIN_MODE 0x000001B0UL +#define CKR_NEXT_OTP 0x000001B1UL -/* These are new to v2.01 */ -#define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190 -#define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191 -#define CKR_MUTEX_BAD 0x000001A0 -#define CKR_MUTEX_NOT_LOCKED 0x000001A1 +#define CKR_EXCEEDED_MAX_ITERATIONS 0x000001B5UL +#define CKR_FIPS_SELF_TEST_FAILED 0x000001B6UL +#define CKR_LIBRARY_LOAD_FAILED 0x000001B7UL +#define CKR_PIN_TOO_WEAK 0x000001B8UL +#define CKR_PUBLIC_KEY_INVALID 0x000001B9UL -/* This is new to v2.20 */ -#define CKR_FUNCTION_REJECTED 0x00000200 +#define CKR_FUNCTION_REJECTED 0x00000200UL -#define CKR_VENDOR_DEFINED 0x80000000 +#define CKR_VENDOR_DEFINED 0x80000000UL /* CK_NOTIFY is an application callback that processes events */ @@ -1108,8 +1169,8 @@ /* CK_FUNCTION_LIST is a structure holding a Cryptoki spec * version and pointers of appropriate types to all the - * Cryptoki functions */ -/* CK_FUNCTION_LIST is new for v2.0 */ + * Cryptoki functions + */ typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST; typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR; @@ -1118,14 +1179,16 @@ /* CK_CREATEMUTEX is an application callback for creating a - * mutex object */ + * mutex object + */ typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)( CK_VOID_PTR_PTR ppMutex /* location to receive ptr to mutex */ ); /* CK_DESTROYMUTEX is an application callback for destroying a - * mutex object */ + * mutex object + */ typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)( CK_VOID_PTR pMutex /* pointer to mutex */ ); @@ -1138,14 +1201,16 @@ /* CK_UNLOCKMUTEX is an application callback for unlocking a - * mutex */ + * mutex + */ typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)( CK_VOID_PTR pMutex /* pointer to mutex */ ); /* CK_C_INITIALIZE_ARGS provides the optional arguments to - * C_Initialize */ + * C_Initialize + */ typedef struct CK_C_INITIALIZE_ARGS { CK_CREATEMUTEX CreateMutex; CK_DESTROYMUTEX DestroyMutex; @@ -1158,8 +1223,8 @@ /* flags: bit flags that provide capabilities of the slot * Bit Flag Mask Meaning */ -#define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001 -#define CKF_OS_LOCKING_OK 0x00000002 +#define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001UL +#define CKF_OS_LOCKING_OK 0x00000002UL typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR; @@ -1169,37 +1234,36 @@ /* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */ #define CKF_DONT_BLOCK 1 -/* CK_RSA_PKCS_OAEP_MGF_TYPE is new for v2.10. - * CK_RSA_PKCS_OAEP_MGF_TYPE is used to indicate the Message +/* CK_RSA_PKCS_MGF_TYPE is used to indicate the Message * Generation Function (MGF) applied to a message block when * formatting a message block for the PKCS #1 OAEP encryption - * scheme. */ + * scheme. + */ typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE; typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR; /* The following MGFs are defined */ -/* CKG_MGF1_SHA256, CKG_MGF1_SHA384, and CKG_MGF1_SHA512 - * are new for v2.20 */ -#define CKG_MGF1_SHA1 0x00000001 -#define CKG_MGF1_SHA256 0x00000002 -#define CKG_MGF1_SHA384 0x00000003 -#define CKG_MGF1_SHA512 0x00000004 +#define CKG_MGF1_SHA1 0x00000001UL +#define CKG_MGF1_SHA256 0x00000002UL +#define CKG_MGF1_SHA384 0x00000003UL +#define CKG_MGF1_SHA512 0x00000004UL +#define CKG_MGF1_SHA224 0x00000005UL -/* CK_RSA_PKCS_OAEP_SOURCE_TYPE is new for v2.10. - * CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source +/* CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source * of the encoding parameter when formatting a message block - * for the PKCS #1 OAEP encryption scheme. */ + * for the PKCS #1 OAEP encryption scheme. + */ typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE; typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR; /* The following encoding parameter sources are defined */ -#define CKZ_DATA_SPECIFIED 0x00000001 +#define CKZ_DATA_SPECIFIED 0x00000001UL -/* CK_RSA_PKCS_OAEP_PARAMS is new for v2.10. - * CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the - * CKM_RSA_PKCS_OAEP mechanism. */ +/* CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the + * CKM_RSA_PKCS_OAEP mechanism. + */ typedef struct CK_RSA_PKCS_OAEP_PARAMS { CK_MECHANISM_TYPE hashAlg; CK_RSA_PKCS_MGF_TYPE mgf; @@ -1210,9 +1274,9 @@ typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR; -/* CK_RSA_PKCS_PSS_PARAMS is new for v2.11. - * CK_RSA_PKCS_PSS_PARAMS provides the parameters to the - * CKM_RSA_PKCS_PSS mechanism(s). */ +/* CK_RSA_PKCS_PSS_PARAMS provides the parameters to the + * CKM_RSA_PKCS_PSS mechanism(s). + */ typedef struct CK_RSA_PKCS_PSS_PARAMS { CK_MECHANISM_TYPE hashAlg; CK_RSA_PKCS_MGF_TYPE mgf; @@ -1221,15 +1285,23 @@ typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR; -/* CK_EC_KDF_TYPE is new for v2.11. */ typedef CK_ULONG CK_EC_KDF_TYPE; /* The following EC Key Derivation Functions are defined */ -#define CKD_NULL 0x00000001 -#define CKD_SHA1_KDF 0x00000002 +#define CKD_NULL 0x00000001UL +#define CKD_SHA1_KDF 0x00000002UL -/* CK_ECDH1_DERIVE_PARAMS is new for v2.11. - * CK_ECDH1_DERIVE_PARAMS provides the parameters to the +/* The following X9.42 DH key derivation functions are defined */ +#define CKD_SHA1_KDF_ASN1 0x00000003UL +#define CKD_SHA1_KDF_CONCATENATE 0x00000004UL +#define CKD_SHA224_KDF 0x00000005UL +#define CKD_SHA256_KDF 0x00000006UL +#define CKD_SHA384_KDF 0x00000007UL +#define CKD_SHA512_KDF 0x00000008UL +#define CKD_CPDIVERSIFY_KDF 0x00000009UL + + +/* CK_ECDH1_DERIVE_PARAMS provides the parameters to the * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms, * where each party contributes one key pair. */ @@ -1243,10 +1315,10 @@ typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR; - -/* CK_ECDH2_DERIVE_PARAMS is new for v2.11. +/* * CK_ECDH2_DERIVE_PARAMS provides the parameters to the - * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. */ + * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. + */ typedef struct CK_ECDH2_DERIVE_PARAMS { CK_EC_KDF_TYPE kdf; CK_ULONG ulSharedDataLen; @@ -1277,19 +1349,15 @@ typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR; /* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the - * CKM_X9_42_DH_PARAMETER_GEN mechanisms (new for PKCS #11 v2.11) */ + * CKM_X9_42_DH_PARAMETER_GEN mechanisms + */ typedef CK_ULONG CK_X9_42_DH_KDF_TYPE; typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR; -/* The following X9.42 DH key derivation functions are defined - (besides CKD_NULL already defined : */ -#define CKD_SHA1_KDF_ASN1 0x00000003 -#define CKD_SHA1_KDF_CONCATENATE 0x00000004 - -/* CK_X9_42_DH1_DERIVE_PARAMS is new for v2.11. - * CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the +/* CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party - * contributes one key pair */ + * contributes one key pair + */ typedef struct CK_X9_42_DH1_DERIVE_PARAMS { CK_X9_42_DH_KDF_TYPE kdf; CK_ULONG ulOtherInfoLen; @@ -1300,10 +1368,10 @@ typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR; -/* CK_X9_42_DH2_DERIVE_PARAMS is new for v2.11. - * CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the +/* CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation - * mechanisms, where each party contributes two key pairs */ + * mechanisms, where each party contributes two key pairs + */ typedef struct CK_X9_42_DH2_DERIVE_PARAMS { CK_X9_42_DH_KDF_TYPE kdf; CK_ULONG ulOtherInfoLen; @@ -1334,8 +1402,8 @@ typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR; /* CK_KEA_DERIVE_PARAMS provides the parameters to the - * CKM_KEA_DERIVE mechanism */ -/* CK_KEA_DERIVE_PARAMS is new for v2.0 */ + * CKM_KEA_DERIVE mechanism + */ typedef struct CK_KEA_DERIVE_PARAMS { CK_BBOOL isSender; CK_ULONG ulRandomLen; @@ -1350,19 +1418,18 @@ /* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and * CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just - * holds the effective keysize */ + * holds the effective keysize + */ typedef CK_ULONG CK_RC2_PARAMS; typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR; /* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC - * mechanism */ + * mechanism + */ typedef struct CK_RC2_CBC_PARAMS { - /* ulEffectiveBits was changed from CK_USHORT to CK_ULONG for - * v2.0 */ CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ - CK_BYTE iv[8]; /* IV for CBC mode */ } CK_RC2_CBC_PARAMS; @@ -1370,8 +1437,8 @@ /* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the - * CKM_RC2_MAC_GENERAL mechanism */ -/* CK_RC2_MAC_GENERAL_PARAMS is new for v2.0 */ + * CKM_RC2_MAC_GENERAL mechanism + */ typedef struct CK_RC2_MAC_GENERAL_PARAMS { CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ CK_ULONG ulMacLength; /* Length of MAC in bytes */ @@ -1382,8 +1449,8 @@ /* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and - * CKM_RC5_MAC mechanisms */ -/* CK_RC5_PARAMS is new for v2.0 */ + * CKM_RC5_MAC mechanisms + */ typedef struct CK_RC5_PARAMS { CK_ULONG ulWordsize; /* wordsize in bits */ CK_ULONG ulRounds; /* number of rounds */ @@ -1393,8 +1460,8 @@ /* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC - * mechanism */ -/* CK_RC5_CBC_PARAMS is new for v2.0 */ + * mechanism + */ typedef struct CK_RC5_CBC_PARAMS { CK_ULONG ulWordsize; /* wordsize in bits */ CK_ULONG ulRounds; /* number of rounds */ @@ -1406,8 +1473,8 @@ /* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the - * CKM_RC5_MAC_GENERAL mechanism */ -/* CK_RC5_MAC_GENERAL_PARAMS is new for v2.0 */ + * CKM_RC5_MAC_GENERAL mechanism + */ typedef struct CK_RC5_MAC_GENERAL_PARAMS { CK_ULONG ulWordsize; /* wordsize in bits */ CK_ULONG ulRounds; /* number of rounds */ @@ -1417,16 +1484,14 @@ typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \ CK_RC5_MAC_GENERAL_PARAMS_PTR; - /* CK_MAC_GENERAL_PARAMS provides the parameters to most block * ciphers' MAC_GENERAL mechanisms. Its value is the length of - * the MAC */ -/* CK_MAC_GENERAL_PARAMS is new for v2.0 */ + * the MAC + */ typedef CK_ULONG CK_MAC_GENERAL_PARAMS; typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR; -/* CK_DES/AES_ECB/CBC_ENCRYPT_DATA_PARAMS are new for v2.20 */ typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS { CK_BYTE iv[8]; CK_BYTE_PTR pData; @@ -1444,8 +1509,8 @@ typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR; /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the - * CKM_SKIPJACK_PRIVATE_WRAP mechanism */ -/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS is new for v2.0 */ + * CKM_SKIPJACK_PRIVATE_WRAP mechanism + */ typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS { CK_ULONG ulPasswordLen; CK_BYTE_PTR pPassword; @@ -1461,12 +1526,12 @@ } CK_SKIPJACK_PRIVATE_WRAP_PARAMS; typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \ - CK_SKIPJACK_PRIVATE_WRAP_PTR; + CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR; /* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the - * CKM_SKIPJACK_RELAYX mechanism */ -/* CK_SKIPJACK_RELAYX_PARAMS is new for v2.0 */ + * CKM_SKIPJACK_RELAYX mechanism + */ typedef struct CK_SKIPJACK_RELAYX_PARAMS { CK_ULONG ulOldWrappedXLen; CK_BYTE_PTR pOldWrappedX; @@ -1501,17 +1566,15 @@ /* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the - * CKM_KEY_WRAP_SET_OAEP mechanism */ -/* CK_KEY_WRAP_SET_OAEP_PARAMS is new for v2.0 */ + * CKM_KEY_WRAP_SET_OAEP mechanism + */ typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS { CK_BYTE bBC; /* block contents byte */ CK_BYTE_PTR pX; /* extra data */ CK_ULONG ulXLen; /* length of extra data in bytes */ } CK_KEY_WRAP_SET_OAEP_PARAMS; -typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR \ - CK_KEY_WRAP_SET_OAEP_PARAMS_PTR; - +typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR CK_KEY_WRAP_SET_OAEP_PARAMS_PTR; typedef struct CK_SSL3_RANDOM_DATA { CK_BYTE_PTR pClientRandom; @@ -1529,7 +1592,6 @@ typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \ CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR; - typedef struct CK_SSL3_KEY_MAT_OUT { CK_OBJECT_HANDLE hClientMacSecret; CK_OBJECT_HANDLE hServerMacSecret; @@ -1553,7 +1615,6 @@ typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR; -/* CK_TLS_PRF_PARAMS is new for version 2.20 */ typedef struct CK_TLS_PRF_PARAMS { CK_BYTE_PTR pSeed; CK_ULONG ulSeedLen; @@ -1565,7 +1626,6 @@ typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR; -/* WTLS is new for version 2.20 */ typedef struct CK_WTLS_RANDOM_DATA { CK_BYTE_PTR pClientRandom; CK_ULONG ulClientRandomLen; @@ -1617,7 +1677,6 @@ typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR; -/* CMS is new for version 2.20 */ typedef struct CK_CMS_SIG_PARAMS { CK_OBJECT_HANDLE certificateHandle; CK_MECHANISM_PTR pSigningMechanism; @@ -1643,38 +1702,45 @@ /* The CK_EXTRACT_PARAMS is used for the * CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit * of the base key should be used as the first bit of the - * derived key */ -/* CK_EXTRACT_PARAMS is new for v2.0 */ + * derived key + */ typedef CK_ULONG CK_EXTRACT_PARAMS; typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR; -/* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is new for v2.10. - * CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to +/* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to * indicate the Pseudo-Random Function (PRF) used to generate - * key bits using PKCS #5 PBKDF2. */ + * key bits using PKCS #5 PBKDF2. + */ typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE; -typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR; - -/* The following PRFs are defined in PKCS #5 v2.0. */ -#define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001 +typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR \ + CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR; +#define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001UL +#define CKP_PKCS5_PBKD2_HMAC_GOSTR3411 0x00000002UL +#define CKP_PKCS5_PBKD2_HMAC_SHA224 0x00000003UL +#define CKP_PKCS5_PBKD2_HMAC_SHA256 0x00000004UL +#define CKP_PKCS5_PBKD2_HMAC_SHA384 0x00000005UL +#define CKP_PKCS5_PBKD2_HMAC_SHA512 0x00000006UL +#define CKP_PKCS5_PBKD2_HMAC_SHA512_224 0x00000007UL +#define CKP_PKCS5_PBKD2_HMAC_SHA512_256 0x00000008UL -/* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is new for v2.10. - * CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the +/* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the * source of the salt value when deriving a key using PKCS #5 - * PBKDF2. */ + * PBKDF2. + */ typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE; -typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR; +typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR \ + CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR; /* The following salt value sources are defined in PKCS #5 v2.0. */ -#define CKZ_SALT_SPECIFIED 0x00000001 +#define CKZ_SALT_SPECIFIED 0x00000001UL -/* CK_PKCS5_PBKD2_PARAMS is new for v2.10. - * CK_PKCS5_PBKD2_PARAMS is a structure that provides the - * parameters to the CKM_PKCS5_PBKD2 mechanism. */ +/* CK_PKCS5_PBKD2_PARAMS is a structure that provides the + * parameters to the CKM_PKCS5_PBKD2 mechanism. + */ typedef struct CK_PKCS5_PBKD2_PARAMS { CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource; CK_VOID_PTR pSaltSourceData; @@ -1689,34 +1755,248 @@ typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR; -/* new for v2.40 */ +/* CK_PKCS5_PBKD2_PARAMS2 is a corrected version of the CK_PKCS5_PBKD2_PARAMS + * structure that provides the parameters to the CKM_PKCS5_PBKD2 mechanism + * noting that the ulPasswordLen field is a CK_ULONG and not a CK_ULONG_PTR. + */ +typedef struct CK_PKCS5_PBKD2_PARAMS2 { + CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource; + CK_VOID_PTR pSaltSourceData; + CK_ULONG ulSaltSourceDataLen; + CK_ULONG iterations; + CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf; + CK_VOID_PTR pPrfData; + CK_ULONG ulPrfDataLen; + CK_UTF8CHAR_PTR pPassword; + CK_ULONG ulPasswordLen; +} CK_PKCS5_PBKD2_PARAMS2; + +typedef CK_PKCS5_PBKD2_PARAMS2 CK_PTR CK_PKCS5_PBKD2_PARAMS2_PTR; + +typedef CK_ULONG CK_OTP_PARAM_TYPE; +typedef CK_OTP_PARAM_TYPE CK_PARAM_TYPE; /* backward compatibility */ + +typedef struct CK_OTP_PARAM { + CK_OTP_PARAM_TYPE type; + CK_VOID_PTR pValue; + CK_ULONG ulValueLen; +} CK_OTP_PARAM; + +typedef CK_OTP_PARAM CK_PTR CK_OTP_PARAM_PTR; + +typedef struct CK_OTP_PARAMS { + CK_OTP_PARAM_PTR pParams; + CK_ULONG ulCount; +} CK_OTP_PARAMS; + +typedef CK_OTP_PARAMS CK_PTR CK_OTP_PARAMS_PTR; + +typedef struct CK_OTP_SIGNATURE_INFO { + CK_OTP_PARAM_PTR pParams; + CK_ULONG ulCount; +} CK_OTP_SIGNATURE_INFO; + +typedef CK_OTP_SIGNATURE_INFO CK_PTR CK_OTP_SIGNATURE_INFO_PTR; + +#define CK_OTP_VALUE 0UL +#define CK_OTP_PIN 1UL +#define CK_OTP_CHALLENGE 2UL +#define CK_OTP_TIME 3UL +#define CK_OTP_COUNTER 4UL +#define CK_OTP_FLAGS 5UL +#define CK_OTP_OUTPUT_LENGTH 6UL +#define CK_OTP_OUTPUT_FORMAT 7UL + +#define CKF_NEXT_OTP 0x00000001UL +#define CKF_EXCLUDE_TIME 0x00000002UL +#define CKF_EXCLUDE_COUNTER 0x00000004UL +#define CKF_EXCLUDE_CHALLENGE 0x00000008UL +#define CKF_EXCLUDE_PIN 0x00000010UL +#define CKF_USER_FRIENDLY_OTP 0x00000020UL + +typedef struct CK_KIP_PARAMS { + CK_MECHANISM_PTR pMechanism; + CK_OBJECT_HANDLE hKey; + CK_BYTE_PTR pSeed; + CK_ULONG ulSeedLen; +} CK_KIP_PARAMS; + +typedef CK_KIP_PARAMS CK_PTR CK_KIP_PARAMS_PTR; + +typedef struct CK_AES_CTR_PARAMS { + CK_ULONG ulCounterBits; + CK_BYTE cb[16]; +} CK_AES_CTR_PARAMS; + +typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR; + +typedef struct CK_GCM_PARAMS { + CK_BYTE_PTR pIv; + CK_ULONG ulIvLen; + CK_BYTE_PTR pAAD; + CK_ULONG ulAADLen; + CK_ULONG ulTagBits; +} CK_GCM_PARAMS; + +typedef CK_GCM_PARAMS CK_PTR CK_GCM_PARAMS_PTR; + +typedef struct CK_CCM_PARAMS { + CK_ULONG ulDataLen; + CK_BYTE_PTR pNonce; + CK_ULONG ulNonceLen; + CK_BYTE_PTR pAAD; + CK_ULONG ulAADLen; + CK_ULONG ulMACLen; +} CK_CCM_PARAMS; + +typedef CK_CCM_PARAMS CK_PTR CK_CCM_PARAMS_PTR; + +/* Deprecated. Use CK_GCM_PARAMS */ +typedef struct CK_AES_GCM_PARAMS { + CK_BYTE_PTR pIv; + CK_ULONG ulIvLen; + CK_ULONG ulIvBits; + CK_BYTE_PTR pAAD; + CK_ULONG ulAADLen; + CK_ULONG ulTagBits; +} CK_AES_GCM_PARAMS; + +typedef CK_AES_GCM_PARAMS CK_PTR CK_AES_GCM_PARAMS_PTR; + +/* Deprecated. Use CK_CCM_PARAMS */ +typedef struct CK_AES_CCM_PARAMS { + CK_ULONG ulDataLen; + CK_BYTE_PTR pNonce; + CK_ULONG ulNonceLen; + CK_BYTE_PTR pAAD; + CK_ULONG ulAADLen; + CK_ULONG ulMACLen; +} CK_AES_CCM_PARAMS; + +typedef CK_AES_CCM_PARAMS CK_PTR CK_AES_CCM_PARAMS_PTR; + +typedef struct CK_CAMELLIA_CTR_PARAMS { + CK_ULONG ulCounterBits; + CK_BYTE cb[16]; +} CK_CAMELLIA_CTR_PARAMS; + +typedef CK_CAMELLIA_CTR_PARAMS CK_PTR CK_CAMELLIA_CTR_PARAMS_PTR; + +typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[16]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR \ + CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR; + +typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[16]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_ARIA_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR \ + CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR; + +typedef struct CK_DSA_PARAMETER_GEN_PARAM { + CK_MECHANISM_TYPE hash; + CK_BYTE_PTR pSeed; + CK_ULONG ulSeedLen; + CK_ULONG ulIndex; +} CK_DSA_PARAMETER_GEN_PARAM; + +typedef CK_DSA_PARAMETER_GEN_PARAM CK_PTR CK_DSA_PARAMETER_GEN_PARAM_PTR; + +typedef struct CK_ECDH_AES_KEY_WRAP_PARAMS { + CK_ULONG ulAESKeyBits; + CK_EC_KDF_TYPE kdf; + CK_ULONG ulSharedDataLen; + CK_BYTE_PTR pSharedData; +} CK_ECDH_AES_KEY_WRAP_PARAMS; + +typedef CK_ECDH_AES_KEY_WRAP_PARAMS CK_PTR CK_ECDH_AES_KEY_WRAP_PARAMS_PTR; + +typedef CK_ULONG CK_JAVA_MIDP_SECURITY_DOMAIN; + +typedef CK_ULONG CK_CERTIFICATE_CATEGORY; + +typedef struct CK_RSA_AES_KEY_WRAP_PARAMS { + CK_ULONG ulAESKeyBits; + CK_RSA_PKCS_OAEP_PARAMS_PTR pOAEPParams; +} CK_RSA_AES_KEY_WRAP_PARAMS; + +typedef CK_RSA_AES_KEY_WRAP_PARAMS CK_PTR CK_RSA_AES_KEY_WRAP_PARAMS_PTR; typedef struct CK_TLS12_MASTER_KEY_DERIVE_PARAMS { - CK_SSL3_RANDOM_DATA RandomInfo; - CK_VERSION_PTR pVersion; - CK_MECHANISM_TYPE prfHashMechanism; + CK_SSL3_RANDOM_DATA RandomInfo; + CK_VERSION_PTR pVersion; + CK_MECHANISM_TYPE prfHashMechanism; } CK_TLS12_MASTER_KEY_DERIVE_PARAMS; -typedef CK_TLS12_MASTER_KEY_DERIVE_PARAMS CK_PTR CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR; +typedef CK_TLS12_MASTER_KEY_DERIVE_PARAMS CK_PTR \ + CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR; typedef struct CK_TLS12_KEY_MAT_PARAMS { - CK_ULONG ulMacSizeInBits; - CK_ULONG ulKeySizeInBits; - CK_ULONG ulIVSizeInBits; - CK_BBOOL bIsExport; - CK_SSL3_RANDOM_DATA RandomInfo; - CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial; - CK_MECHANISM_TYPE prfHashMechanism; + CK_ULONG ulMacSizeInBits; + CK_ULONG ulKeySizeInBits; + CK_ULONG ulIVSizeInBits; + CK_BBOOL bIsExport; + CK_SSL3_RANDOM_DATA RandomInfo; + CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial; + CK_MECHANISM_TYPE prfHashMechanism; } CK_TLS12_KEY_MAT_PARAMS; typedef CK_TLS12_KEY_MAT_PARAMS CK_PTR CK_TLS12_KEY_MAT_PARAMS_PTR; +typedef struct CK_TLS_KDF_PARAMS { + CK_MECHANISM_TYPE prfMechanism; + CK_BYTE_PTR pLabel; + CK_ULONG ulLabelLength; + CK_SSL3_RANDOM_DATA RandomInfo; + CK_BYTE_PTR pContextData; + CK_ULONG ulContextDataLength; +} CK_TLS_KDF_PARAMS; + +typedef CK_TLS_KDF_PARAMS CK_PTR CK_TLS_KDF_PARAMS_PTR; + typedef struct CK_TLS_MAC_PARAMS { - CK_MECHANISM_TYPE prfMechanism; - CK_ULONG ulMacLength; - CK_ULONG ulServerOrClient; + CK_MECHANISM_TYPE prfMechanism; + CK_ULONG ulMacLength; + CK_ULONG ulServerOrClient; } CK_TLS_MAC_PARAMS; typedef CK_TLS_MAC_PARAMS CK_PTR CK_TLS_MAC_PARAMS_PTR; -#endif +typedef struct CK_GOSTR3410_DERIVE_PARAMS { + CK_EC_KDF_TYPE kdf; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pUKM; + CK_ULONG ulUKMLen; +} CK_GOSTR3410_DERIVE_PARAMS; + +typedef CK_GOSTR3410_DERIVE_PARAMS CK_PTR CK_GOSTR3410_DERIVE_PARAMS_PTR; + +typedef struct CK_GOSTR3410_KEY_WRAP_PARAMS { + CK_BYTE_PTR pWrapOID; + CK_ULONG ulWrapOIDLen; + CK_BYTE_PTR pUKM; + CK_ULONG ulUKMLen; + CK_OBJECT_HANDLE hKey; +} CK_GOSTR3410_KEY_WRAP_PARAMS; + +typedef CK_GOSTR3410_KEY_WRAP_PARAMS CK_PTR CK_GOSTR3410_KEY_WRAP_PARAMS_PTR; + +typedef struct CK_SEED_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[16]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_SEED_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_SEED_CBC_ENCRYPT_DATA_PARAMS CK_PTR \ + CK_SEED_CBC_ENCRYPT_DATA_PARAMS_PTR; + +#endif /* _PKCS11T_H_ */ + diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11wrapper.h --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11wrapper.h Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11wrapper.h Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -69,11 +69,12 @@ #define CKA_NETSCAPE_BASE (0x80000000 + 0x4E534350) #define CKA_NETSCAPE_TRUST_BASE (CKA_NETSCAPE_BASE + 0x2000) - #define CKA_NETSCAPE_TRUST_SERVER_AUTH (CKA_NETSCAPE_TRUST_BASE + 8) #define CKA_NETSCAPE_TRUST_CLIENT_AUTH (CKA_NETSCAPE_TRUST_BASE + 9) #define CKA_NETSCAPE_TRUST_CODE_SIGNING (CKA_NETSCAPE_TRUST_BASE + 10) #define CKA_NETSCAPE_TRUST_EMAIL_PROTECTION (CKA_NETSCAPE_TRUST_BASE + 11) +#define CKA_NETSCAPE_DB 0xD5A0DB00 +#define CKM_NSS_TLS_PRF_GENERAL 0x80000373 /* @@ -154,11 +155,11 @@ #define P11_ENABLE_GETNATIVEKEYINFO #define P11_ENABLE_CREATENATIVEKEY + /* include the platform dependent part of the header */ #include "p11_md.h" #include "pkcs11.h" -#include "pkcs-11v2-20a3.h" #include #include #include @@ -206,8 +207,6 @@ #define ckULongToJSize(x) ((jsize) x) #define unsignedIntToCKULong(x) ((CK_ULONG) x) -//#define P11_DEBUG - #ifdef P11_DEBUG #define TRACE0(s) { printf(s); fflush(stdout); } #define TRACE1(s, p1) { printf(s, p1); fflush(stdout); } @@ -228,6 +227,8 @@ #define CK_ASSERT_OK 0L +#define CLASS_P11PSSSIGNATURE "sun/security/pkcs11/P11PSSSignature" + #define CLASS_INFO "sun/security/pkcs11/wrapper/CK_INFO" #define CLASS_VERSION "sun/security/pkcs11/wrapper/CK_VERSION" #define CLASS_SLOT_INFO "sun/security/pkcs11/wrapper/CK_SLOT_INFO" @@ -249,15 +250,18 @@ /* mechanism parameter classes */ +#define CLASS_AES_CTR_PARAMS "sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS" +#define CLASS_GCM_PARAMS "sun/security/pkcs11/wrapper/CK_GCM_PARAMS" +#define CLASS_CCM_PARAMS "sun/security/pkcs11/wrapper/CK_CCM_PARAMS" +#define CLASS_RSA_PKCS_PSS_PARAMS "sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS" +#define CLASS_RSA_PKCS_OAEP_PARAMS "sun/security/pkcs11/wrapper/CK_RSA_PKCS_OAEP_PARAMS" -#define CLASS_RSA_PKCS_OAEP_PARAMS "sun/security/pkcs11/wrapper/CK_RSA_PKCS_OAEP_PARAMS" #define CLASS_MAC_GENERAL_PARAMS "sun/security/pkcs11/wrapper/CK_MAC_GENERAL_PARAMS" #define CLASS_PBE_PARAMS "sun/security/pkcs11/wrapper/CK_PBE_PARAMS" #define PBE_INIT_VECTOR_SIZE 8 #define CLASS_PKCS5_PBKD2_PARAMS "sun/security/pkcs11/wrapper/CK_PKCS5_PBKD2_PARAMS" #define CLASS_EXTRACT_PARAMS "sun/security/pkcs11/wrapper/CK_EXTRACT_PARAMS" -#define CLASS_RSA_PKCS_PSS_PARAMS "sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS" #define CLASS_ECDH1_DERIVE_PARAMS "sun/security/pkcs11/wrapper/CK_ECDH1_DERIVE_PARAMS" #define CLASS_ECDH2_DERIVE_PARAMS "sun/security/pkcs11/wrapper/CK_ECDH2_DERIVE_PARAMS" #define CLASS_X9_42_DH1_DERIVE_PARAMS "sun/security/pkcs11/wrapper/CK_X9_42_DH1_DERIVE_PARAMS" @@ -287,7 +291,7 @@ #define CLASS_TLS12_KEY_MAT_PARAMS "sun/security/pkcs11/wrapper/CK_TLS12_KEY_MAT_PARAMS" #define CLASS_TLS_PRF_PARAMS "sun/security/pkcs11/wrapper/CK_TLS_PRF_PARAMS" #define CLASS_TLS_MAC_PARAMS "sun/security/pkcs11/wrapper/CK_TLS_MAC_PARAMS" -#define CLASS_AES_CTR_PARAMS "sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS" + /* function to convert a PKCS#11 return value other than CK_OK into a Java Exception * or to throw a PKCS11RuntimeException @@ -300,11 +304,12 @@ void throwPKCS11RuntimeException(JNIEnv *env, const char *message); void throwDisconnectedRuntimeException(JNIEnv *env); -/* function to free CK_ATTRIBUTE array +/* functions to free CK structures and pointers */ void freeCKAttributeArray(CK_ATTRIBUTE_PTR attrPtr, int len); +void freeCKMechanismPtr(CK_MECHANISM_PTR mechPtr); -/* funktions to convert Java arrays to a CK-type array and the array length */ +/* functions to convert Java arrays to a CK-type array and the array length */ void jBooleanArrayToCKBBoolArray(JNIEnv *env, const jbooleanArray jArray, CK_BBOOL **ckpArray, CK_ULONG_PTR ckLength); void jByteArrayToCKByteArray(JNIEnv *env, const jbyteArray jArray, CK_BYTE_PTR *ckpArray, CK_ULONG_PTR ckLength); @@ -316,7 +321,7 @@ /*void jObjectArrayToCKVoidPtrArray(JNIEnv *env, const jobjectArray jArray, CK_VOID_PTR_PTR ckpArray, CK_ULONG_PTR ckpLength); */ -/* funktions to convert a CK-type array and the array length to a Java array */ +/* functions to convert a CK-type array and the array length to a Java array */ jbyteArray ckByteArrayToJByteArray(JNIEnv *env, const CK_BYTE_PTR ckpArray, CK_ULONG ckLength); jlongArray ckULongArrayToJLongArray(JNIEnv *env, const CK_ULONG_PTR ckpArray, CK_ULONG ckLength); @@ -324,7 +329,7 @@ jcharArray ckUTF8CharArrayToJCharArray(JNIEnv *env, const CK_UTF8CHAR_PTR ckpArray, CK_ULONG ckLength); -/* funktions to convert a CK-type structure or a pointer to a CK-value to a Java object */ +/* functions to convert a CK-type structure or a pointer to a CK-value to a Java object */ jobject ckBBoolPtrToJBooleanObject(JNIEnv *env, const CK_BBOOL* ckpValue); jobject ckULongPtrToJLongObject(JNIEnv *env, const CK_ULONG_PTR ckpValue); @@ -334,12 +339,12 @@ jobject ckAttributePtrToJAttribute(JNIEnv *env, const CK_ATTRIBUTE_PTR ckpAttribute); -/* funktion to convert the CK-value used by the CK_ATTRIBUTE structure to a Java object */ +/* function to convert the CK-value used by the CK_ATTRIBUTE structure to a Java object */ jobject ckAttributeValueToJObject(JNIEnv *env, const CK_ATTRIBUTE_PTR ckpAttribute); -/* funktions to convert a Java object to a CK-type structure or a pointer to a CK-value */ +/* functions to convert a Java object to a CK-type structure or a pointer to a CK-value */ CK_BBOOL* jBooleanObjectToCKBBoolPtr(JNIEnv *env, jobject jObject); CK_BYTE_PTR jByteObjectToCKBytePtr(JNIEnv *env, jobject jObject); @@ -349,44 +354,35 @@ CK_VERSION_PTR jVersionToCKVersionPtr(JNIEnv *env, jobject jVersion); CK_DATE * jDateObjectPtrToCKDatePtr(JNIEnv *env, jobject jDate); CK_ATTRIBUTE jAttributeToCKAttribute(JNIEnv *env, jobject jAttribute); -/*CK_MECHANISM jMechanismToCKMechanism(JNIEnv *env, jobject jMechanism);*/ -void jMechanismToCKMechanism(JNIEnv *env, jobject jMechanism, CK_MECHANISM_PTR ckMechanismPtr); +CK_MECHANISM_PTR jMechanismToCKMechanismPtr(JNIEnv *env, jobject jMechanism); -/* funktions to convert Java objects used by the Mechanism and Attribute class to a CK-type structure */ - -void jObjectToPrimitiveCKObjectPtrPtr(JNIEnv *env, jobject jObject, CK_VOID_PTR *ckpObjectPtr, CK_ULONG *pLength); -void jMechanismParameterToCKMechanismParameter(JNIEnv *env, jobject jParam, CK_VOID_PTR *ckpParamPtr, CK_ULONG *ckpLength); +/* functions to convert Java objects used by the Mechanism and Attribute class to a CK-type structure */ +CK_VOID_PTR jObjectToPrimitiveCKObjectPtr(JNIEnv *env, jobject jObject, CK_ULONG *ckpLength); +CK_VOID_PTR jMechParamToCKMechParamPtr(JNIEnv *env, jobject jParam, CK_MECHANISM_TYPE, CK_ULONG +*ckpLength); /* functions to convert a specific Java mechanism parameter object to a CK-mechanism parameter structure */ -CK_RSA_PKCS_OAEP_PARAMS jRsaPkcsOaepParamToCKRsaPkcsOaepParam(JNIEnv *env, jobject jParam); -CK_KEA_DERIVE_PARAMS jKeaDeriveParamToCKKeaDeriveParam(JNIEnv *env, jobject jParam); -CK_RC2_CBC_PARAMS jRc2CbcParamToCKRc2CbcParam(JNIEnv *env, jobject jParam); -CK_RC2_MAC_GENERAL_PARAMS jRc2MacGeneralParamToCKRc2MacGeneralParam(JNIEnv *env, jobject jParam); -CK_RC5_PARAMS jRc5ParamToCKRc5Param(JNIEnv *env, jobject jParam); -CK_RC5_CBC_PARAMS jRc5CbcParamToCKRc5CbcParam(JNIEnv *env, jobject jParam); -CK_RC5_MAC_GENERAL_PARAMS jRc5MacGeneralParamToCKRc5MacGeneralParam(JNIEnv *env, jobject jParam); -CK_SKIPJACK_PRIVATE_WRAP_PARAMS jSkipjackPrivateWrapParamToCKSkipjackPrivateWrapParam(JNIEnv *env, jobject jParam); -CK_SKIPJACK_RELAYX_PARAMS jSkipjackRelayxParamToCKSkipjackRelayxParam(JNIEnv *env, jobject jParam); -CK_PBE_PARAMS jPbeParamToCKPbeParam(JNIEnv *env, jobject jParam); +void jRsaPkcsOaepParamToCKRsaPkcsOaepParam(JNIEnv *env, jobject jParam, CK_RSA_PKCS_OAEP_PARAMS_PTR ckParamPtr); +void jPbeParamToCKPbeParam(JNIEnv *env, jobject jParam, CK_PBE_PARAMS_PTR ckParamPtr); void copyBackPBEInitializationVector(JNIEnv *env, CK_MECHANISM *ckMechanism, jobject jMechanism); -CK_PKCS5_PBKD2_PARAMS jPkcs5Pbkd2ParamToCKPkcs5Pbkd2Param(JNIEnv *env, jobject jParam); -CK_KEY_WRAP_SET_OAEP_PARAMS jKeyWrapSetOaepParamToCKKeyWrapSetOaepParam(JNIEnv *env, jobject jParam); +void jPkcs5Pbkd2ParamToCKPkcs5Pbkd2Param(JNIEnv *env, jobject jParam, CK_PKCS5_PBKD2_PARAMS_PTR ckParamPtr); void copyBackSetUnwrappedKey(JNIEnv *env, CK_MECHANISM *ckMechanism, jobject jMechanism); -CK_SSL3_MASTER_KEY_DERIVE_PARAMS jSsl3MasterKeyDeriveParamToCKSsl3MasterKeyDeriveParam(JNIEnv *env, jobject jParam); +void jSsl3MasterKeyDeriveParamToCKSsl3MasterKeyDeriveParam(JNIEnv *env, jobject jParam, CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR ckParamPtr); void ssl3CopyBackClientVersion(JNIEnv *env, CK_MECHANISM *ckMechanism, jobject jMechanism); void tls12CopyBackClientVersion(JNIEnv *env, CK_MECHANISM *ckMechanism, jobject jMechanism); -CK_SSL3_KEY_MAT_PARAMS jSsl3KeyMatParamToCKSsl3KeyMatParam(JNIEnv *env, jobject jParam); +void jSsl3KeyMatParamToCKSsl3KeyMatParam(JNIEnv *env, jobject jParam, CK_SSL3_KEY_MAT_PARAMS_PTR ckParamPtr); void ssl3CopyBackKeyMatParams(JNIEnv *env, CK_MECHANISM *ckMechanism, jobject jMechanism); void tls12CopyBackKeyMatParams(JNIEnv *env, CK_MECHANISM *ckMechanism, jobject jMechanism); CK_KEY_DERIVATION_STRING_DATA jKeyDerivationStringDataToCKKeyDerivationStringData(JNIEnv *env, jobject jParam); -CK_RSA_PKCS_PSS_PARAMS jRsaPkcsPssParamToCKRsaPkcsPssParam(JNIEnv *env, jobject jParam); -CK_ECDH1_DERIVE_PARAMS jEcdh1DeriveParamToCKEcdh1DeriveParam(JNIEnv *env, jobject jParam); -CK_ECDH2_DERIVE_PARAMS jEcdh2DeriveParamToCKEcdh2DeriveParam(JNIEnv *env, jobject jParam); -CK_X9_42_DH1_DERIVE_PARAMS jX942Dh1DeriveParamToCKX942Dh1DeriveParam(JNIEnv *env, jobject jParam); -CK_X9_42_DH2_DERIVE_PARAMS jX942Dh2DeriveParamToCKX942Dh2DeriveParam(JNIEnv *env, jobject jParam); +void jRsaPkcsPssParamToCKRsaPkcsPssParam(JNIEnv *env, jobject jParam, CK_RSA_PKCS_PSS_PARAMS_PTR ckParamPtr); +void jEcdh1DeriveParamToCKEcdh1DeriveParam(JNIEnv *env, jobject jParam, CK_ECDH1_DERIVE_PARAMS_PTR ckParamPtr); +void jEcdh2DeriveParamToCKEcdh2DeriveParam(JNIEnv *env, jobject jParam, +CK_ECDH2_DERIVE_PARAMS_PTR ckParamPtr); +void jX942Dh1DeriveParamToCKX942Dh1DeriveParam(JNIEnv *env, jobject jParam, CK_X9_42_DH1_DERIVE_PARAMS_PTR ckParamPtr); +void jX942Dh2DeriveParamToCKX942Dh2DeriveParam(JNIEnv *env, jobject jParam, CK_X9_42_DH2_DERIVE_PARAMS_PTR ckParamPtr); /* functions to convert the InitArgs object for calling the right Java mutex functions */ @@ -450,6 +446,7 @@ extern jfieldID pNativeDataID; extern jfieldID mech_mechanismID; extern jfieldID mech_pParameterID; +extern jfieldID mech_pHandleID; extern jclass jByteArrayClass; extern jclass jLongClass; diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyAgreement.java --- a/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyAgreement.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyAgreement.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -38,6 +38,7 @@ import javax.crypto.KeyAgreementSpi; import javax.crypto.SecretKey; import javax.crypto.ShortBufferException; +import javax.crypto.spec.SecretKeySpec; import java.util.function.Function; public class XDHKeyAgreement extends KeyAgreementSpi { @@ -202,7 +203,15 @@ throws IllegalStateException, NoSuchAlgorithmException, InvalidKeyException { - throw new NoSuchAlgorithmException("Not supported"); + if (algorithm == null) { + throw new NoSuchAlgorithmException("Algorithm must not be null"); + } + + if (!(algorithm.equals("TlsPremasterSecret"))) { + throw new NoSuchAlgorithmException( + "Only supported for algorithm TlsPremasterSecret"); + } + return new SecretKeySpec(engineGenerateSecret(), algorithm); } static class X25519 extends XDHKeyAgreement { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.ec/share/classes/sun/security/ec/XECParameters.java --- a/src/jdk.crypto.ec/share/classes/sun/security/ec/XECParameters.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XECParameters.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -156,7 +156,7 @@ new XECParameters(bits, p, a24, basePoint, logCofactor, oid, name); bySize.put(bits, params); byOid.put(oid, params); - byName.put(name, params); + byName.put(name.toLowerCase(), params); } public static Optional getByOid(ObjectIdentifier id) { @@ -166,7 +166,7 @@ return Optional.ofNullable(SIZE_MAP.get(size)); } public static Optional getByName(String name) { - return Optional.ofNullable(NAME_MAP.get(name)); + return Optional.ofNullable(NAME_MAP.get(name.toLowerCase())); } boolean oidEquals(XECParameters other) { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/CSignature.java --- a/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/CSignature.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/CSignature.java Fri Jun 21 14:07:48 2019 +0530 @@ -118,7 +118,9 @@ // initialize for signing. See JCA doc @Override protected void engineInitSign(PrivateKey key) throws InvalidKeyException { - + if (key == null) { + throw new InvalidKeyException("Key cannot be null"); + } if ((key instanceof CPrivateKey) == false || !key.getAlgorithm().equalsIgnoreCase("RSA")) { throw new InvalidKeyException("Key type not supported: " @@ -139,9 +141,13 @@ // initialize for signing. See JCA doc @Override protected void engineInitVerify(PublicKey key) throws InvalidKeyException { + if (key == null) { + throw new InvalidKeyException("Key cannot be null"); + } // This signature accepts only RSAPublicKey if ((key instanceof RSAPublicKey) == false) { - throw new InvalidKeyException("Key type not supported"); + throw new InvalidKeyException("Key type not supported: " + + key.getClass()); } @@ -427,9 +433,13 @@ // initialize for signing. See JCA doc @Override protected void engineInitSign(PrivateKey key) throws InvalidKeyException { + if (key == null) { + throw new InvalidKeyException("Key cannot be null"); + } if ((key instanceof CPrivateKey) == false || !key.getAlgorithm().equalsIgnoreCase("EC")) { - throw new InvalidKeyException("Key type not supported"); + throw new InvalidKeyException("Key type not supported: " + + key.getClass() + " " + key.getAlgorithm()); } privateKey = (CPrivateKey) key; @@ -440,12 +450,15 @@ // initialize for signing. See JCA doc @Override protected void engineInitVerify(PublicKey key) throws InvalidKeyException { + if (key == null) { + throw new InvalidKeyException("Key cannot be null"); + } // This signature accepts only ECPublicKey if ((key instanceof ECPublicKey) == false) { - throw new InvalidKeyException("Key type not supported"); + throw new InvalidKeyException("Key type not supported: " + + key.getClass()); } - if ((key instanceof CPublicKey) == false) { try { publicKey = importECPublicKey("EC", @@ -508,9 +521,13 @@ @Override protected void engineInitVerify(PublicKey key) throws InvalidKeyException { + if (key == null) { + throw new InvalidKeyException("Key cannot be null"); + } // This signature accepts only RSAPublicKey if ((key instanceof java.security.interfaces.RSAPublicKey) == false) { - throw new InvalidKeyException("Key type not supported"); + throw new InvalidKeyException("Key type not supported: " + + key.getClass()); } this.privateKey = null; diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c --- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c Fri Jun 21 14:07:48 2019 +0530 @@ -839,8 +839,51 @@ #define LD_BASE_OFFSET offsetof(struct r_debug, r_ldbase) #define LINK_MAP_ADDR_OFFSET offsetof(struct link_map, l_addr) #define LINK_MAP_NAME_OFFSET offsetof(struct link_map, l_name) +#define LINK_MAP_LD_OFFSET offsetof(struct link_map, l_ld) #define LINK_MAP_NEXT_OFFSET offsetof(struct link_map, l_next) +// Calculate the load address of shared library +// on prelink-enabled environment. +// +// In case of GDB, it would be calculated by offset of link_map.l_ld +// and the address of .dynamic section. +// See GDB implementation: lm_addr_check @ solib-svr4.c +static uintptr_t calc_prelinked_load_address(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* elf_ehdr, uintptr_t link_map_addr) { + ELF_PHDR *phbuf; + uintptr_t lib_ld; + uintptr_t lib_dyn_addr = 0L; + uintptr_t load_addr; + int i; + + phbuf = read_program_header_table(lib_fd, elf_ehdr); + if (phbuf == NULL) { + print_debug("can't read program header of shared object\n"); + return 0L; + } + + // Get the address of .dynamic section from shared library. + for (i = 0; i < elf_ehdr->e_phnum; i++) { + if (phbuf[i].p_type == PT_DYNAMIC) { + lib_dyn_addr = phbuf[i].p_vaddr; + break; + } + } + + free(phbuf); + + if (ps_pdread(ph, (psaddr_t)link_map_addr + LINK_MAP_LD_OFFSET, + &lib_ld, sizeof(uintptr_t)) != PS_OK) { + print_debug("can't read address of dynamic section in shared object\n"); + return 0L; + } + + // Return the load address which is calculated by the address of .dynamic + // and link_map.l_ld . + load_addr = lib_ld - lib_dyn_addr; + print_debug("lib_ld = 0x%lx, lib_dyn_addr = 0x%lx -> lib_base_diff = 0x%lx\n", lib_ld, lib_dyn_addr, load_addr); + return load_addr; +} + // read shared library info from runtime linker's data structures. // This work is done by librtlb_db in Solaris static bool read_shared_lib_info(struct ps_prochandle* ph) { @@ -942,6 +985,14 @@ // continue with other libraries... } else { if (read_elf_header(lib_fd, &elf_ehdr)) { + if (lib_base_diff == 0x0L) { + lib_base_diff = calc_prelinked_load_address(ph, lib_fd, &elf_ehdr, link_map_addr); + if (lib_base_diff == 0x0L) { + close(lib_fd); + return false; + } + } + lib_base = lib_base_diff + find_base_address(lib_fd, &elf_ehdr); print_debug("reading library %s @ 0x%lx [ 0x%lx ]\n", lib_name, lib_base, lib_base_diff); diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java Fri Jun 21 14:07:48 2019 +0530 @@ -64,8 +64,6 @@ public abstract long capacity(); public abstract long used(); - public long oopOffset() { return 0; } - public MemRegion reservedRegion() { return new MemRegion(addr.addOffsetTo(reservedFieldOffset)); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java Fri Jun 21 14:07:48 2019 +0530 @@ -48,7 +48,6 @@ static private CIntegerField logMinObjAlignmentInBytes; static private long regionPtrFieldSize; - static private long brookPtrSize; static { VM.registerVMInitializedObserver(new Observer() { public void update(Observable o, Object data) { @@ -65,7 +64,6 @@ regions = type.getAddressField("_regions"); logMinObjAlignmentInBytes = type.getCIntegerField("_log_min_obj_alignment_in_bytes"); - brookPtrSize = db.lookupIntConstant("HeapWordSize").longValue(); Type regionPtrType = db.lookupType("ShenandoahHeapRegion*"); regionPtrFieldSize = regionPtrType.getSize(); } @@ -75,11 +73,6 @@ } @Override - public long oopOffset() { - return brookPtrSize; - } - - @Override public CollectedHeapName kind() { return CollectedHeapName.SHENANDOAH; } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeapRegion.java --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeapRegion.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeapRegion.java Fri Jun 21 14:07:48 2019 +0530 @@ -184,10 +184,10 @@ if (regionStart == null) { regionStart = start; } else { - regionEnd = start.addOffsetTo(heap.oopOffset() + size); + regionEnd = start.addOffsetTo(size); } } - start = start.addOffsetTo(heap.oopOffset() + size); + start = start.addOffsetTo(size); } if (regionStart != null) { @@ -201,15 +201,13 @@ } private boolean hasForwardee(Address rawPtr) { - // Use Mark as a helper to read forward pointer value. + // Forwarding pointer is stored in mark word when it is flagged "marked" Mark mark = new Mark(rawPtr); - Address forwardee = mark.valueAsAddress(); - return (forwardee != rawPtr.addOffsetTo(heap.oopOffset())); + return mark.isMarked(); } private long getObjectSize(Address rawPtr) { - // Dealing with a raw pointer, offsets forward pointer to find real Oop. - OopHandle handle = rawPtr.addOffsetToAsOopHandle(heap.oopOffset()); + OopHandle handle = rawPtr.addOffsetToAsOopHandle(0); Oop obj = null; try { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Fri Jun 21 14:07:48 2019 +0530 @@ -256,8 +256,6 @@ while (handle.lessThan(top)) { Oop obj = null; - // Raw pointer walk - handle = handle.addOffsetToAsOopHandle(heap.oopOffset()); try { obj = newOop(handle); diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/ExecPty.java --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/ExecPty.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/ExecPty.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2016, the original author or authors. + * Copyright (c) 2002-2019, the original author or authors. * * This software is distributable under the BSD license. See the terms of the * BSD license in the documentation provided with this software. @@ -140,6 +140,9 @@ if (attr.getControlChar(cchar) != current.getControlChar(cchar)) { String str = ""; int v = attr.getControlChar(cchar); + if (v == -1) { // Skip if ControlChar is + continue; + } commands.add(cchar.name().toLowerCase().substring(1)); if (cchar == ControlChar.VMIN || cchar == ControlChar.VTIME) { commands.add(Integer.toBinaryString(v)); diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCI.java --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCI.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCI.java Fri Jun 21 14:07:48 2019 +0530 @@ -71,6 +71,8 @@ errorMessage.format("Currently used Java home directory is %s.%n", javaHome); errorMessage.format("Currently used VM configuration is: %s", vmName); throw new UnsupportedOperationException(errorMessage.toString()); + } finally { + initializing = false; } } } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java Fri Jun 21 14:07:48 2019 +0530 @@ -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 @@ -49,7 +49,7 @@ private final List codeAttributes; private static final int MAJOR_VERSION_JAVA_MIN = 51; // JDK7 - private static final int MAJOR_VERSION_JAVA_MAX = 57; // JDK13 + private static final int MAJOR_VERSION_JAVA_MAX = 58; // JDK14 private static final int MAGIC = 0xCAFEBABE; /** diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -1300,7 +1300,7 @@ String alias = storeHash.get(c); if (alias != null) { - certStr.append(space).append(alias); + certStr.append(space).append("(").append(alias).append(")"); } if (x509Cert != null) { @@ -1425,37 +1425,43 @@ } int result = 0; - List certs = signer.getSignerCertPath().getCertificates(); - for (Certificate c : certs) { - String alias = storeHash.get(c); - if (alias != null) { - if (alias.startsWith("(")) { - result |= IN_KEYSTORE; - } - if (ckaliases.contains(alias.substring(1, alias.length() - 1))) { - result |= SIGNED_BY_ALIAS; - } - } else { - if (store != null) { - try { + if (store != null) { + try { + List certs = + signer.getSignerCertPath().getCertificates(); + for (Certificate c : certs) { + String alias = storeHash.get(c); + if (alias == null) { alias = store.getCertificateAlias(c); - } catch (KeyStoreException kse) { - // never happens, because keystore has been loaded + if (alias != null) { + storeHash.put(c, alias); + } } if (alias != null) { - storeHash.put(c, "(" + alias + ")"); result |= IN_KEYSTORE; } + for (String ckalias : ckaliases) { + if (c.equals(store.getCertificate(ckalias))) { + result |= SIGNED_BY_ALIAS; + // must continue with next certificate c and cannot + // return or break outer loop because has to fill + // storeHash for printCert + break; + } + } } - if (ckaliases.contains(alias)) { - result |= SIGNED_BY_ALIAS; - } + } catch (KeyStoreException kse) { + // never happens, because keystore has been loaded } } cacheForInKS.put(signer, result); return result; } + /** + * Maps certificates (as keys) to alias names associated in the keystore + * {@link #store} (as values). + */ Hashtable storeHash = new Hashtable<>(); int inKeyStore(CodeSigner[] signers) { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -33,6 +33,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; +import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.formats.html.markup.Table; import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeFieldWriter; @@ -104,9 +105,9 @@ if (!writer.printedAnnotationFieldHeading) { Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.fieldDetailsLabel); - memberDetailsTree.add(heading); memberDetailsTree.add(links.createAnchor( SectionName.ANNOTATION_TYPE_FIELD_DETAIL)); + memberDetailsTree.add(heading); writer.printedAnnotationFieldHeading = true; } return memberDetailsTree; @@ -119,9 +120,8 @@ Content annotationDetailsTree) { Content annotationDocTree = new ContentBuilder(); Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); - heading.add(name(member)); + heading.add(links.createAnchor(name(member), new StringContent(name(member)))); annotationDocTree.add(heading); - annotationDocTree.add(links.createAnchor(name(member))); return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -33,6 +33,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; +import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.formats.html.markup.Table; import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter; @@ -106,9 +107,9 @@ if (!writer.printedAnnotationHeading) { Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.annotationTypeDetailsLabel); - memberDetailsTree.add(heading); memberDetailsTree.add(links.createAnchor( SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL)); + memberDetailsTree.add(heading); writer.printedAnnotationHeading = true; } return memberDetailsTree; @@ -122,10 +123,9 @@ String simpleName = name(member); Content annotationDocTree = new ContentBuilder(); Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); - heading.add(simpleName); + heading.add(links.createAnchor( + simpleName + utils.signature((ExecutableElement) member), new StringContent(simpleName))); annotationDocTree.add(heading); - annotationDocTree.add(links.createAnchor( - simpleName + utils.signature((ExecutableElement) member))); return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -37,6 +37,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; +import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.formats.html.markup.Table; import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; import jdk.javadoc.internal.doclets.toolkit.ConstructorWriter; @@ -122,9 +123,9 @@ Content constructorDetailsTree = new ContentBuilder(); Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.constructorDetailsLabel); - constructorDetailsTree.add(heading); constructorDetailsTree.add(links.createAnchor( SectionName.CONSTRUCTOR_DETAIL)); + constructorDetailsTree.add(heading); return constructorDetailsTree; } @@ -137,12 +138,11 @@ String erasureAnchor; Content constructorDocTree = new ContentBuilder(); Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); - heading.add(name(constructor)); + if ((erasureAnchor = getErasureAnchor(constructor)) != null) { + heading.add(links.createAnchor((erasureAnchor))); + } + heading.add(links.createAnchor(writer.getAnchor(constructor), new StringContent(name(constructor)))); constructorDocTree.add(heading); - if ((erasureAnchor = getErasureAnchor(constructor)) != null) { - constructorDocTree.add(links.createAnchor((erasureAnchor))); - } - constructorDocTree.add(links.createAnchor(writer.getAnchor(constructor))); return HtmlTree.SECTION(HtmlStyle.detail, constructorDocTree); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -33,6 +33,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; +import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.formats.html.markup.Table; import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; import jdk.javadoc.internal.doclets.toolkit.Content; @@ -91,9 +92,9 @@ Content enumConstantsDetailsTree = new ContentBuilder(); Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.enumConstantDetailLabel); - enumConstantsDetailsTree.add(heading); enumConstantsDetailsTree.add(links.createAnchor( SectionName.ENUM_CONSTANT_DETAIL)); + enumConstantsDetailsTree.add(heading); return enumConstantsDetailsTree; } @@ -105,9 +106,8 @@ Content enumConstantsDetailsTree) { Content enumConstantsTree = new ContentBuilder(); Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); - heading.add(name(enumConstant)); + heading.add(links.createAnchor(name(enumConstant), new StringContent(name(enumConstant)))); enumConstantsTree.add(heading); - enumConstantsTree.add(links.createAnchor(name(enumConstant))); return HtmlTree.SECTION(HtmlStyle.detail, enumConstantsTree); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -96,9 +96,9 @@ Content fieldDetailsTree = new ContentBuilder(); Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.fieldDetailsLabel); - fieldDetailsTree.add(heading); fieldDetailsTree.add(links.createAnchor( SectionName.FIELD_DETAIL)); + fieldDetailsTree.add(heading); return fieldDetailsTree; } @@ -109,9 +109,8 @@ public Content getFieldDocTreeHeader(VariableElement field, Content fieldDetailsTree) { Content fieldTree = new ContentBuilder(); Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); - heading.add(name(field)); + heading.add(links.createAnchor(name(field), new StringContent(name(field)))); fieldTree.add(heading); - fieldTree.add(links.createAnchor(name(field))); return HtmlTree.SECTION(HtmlStyle.detail, fieldTree); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -109,8 +109,8 @@ Content methodDetailsTree = new ContentBuilder(); Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.methodDetailLabel); + methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL)); methodDetailsTree.add(heading); - methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL)); return methodDetailsTree; } @@ -122,12 +122,11 @@ String erasureAnchor; Content methodDocTree = new ContentBuilder(); Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); - heading.add(name(method)); + if ((erasureAnchor = getErasureAnchor(method)) != null) { + heading.add(links.createAnchor((erasureAnchor))); + } + heading.add(links.createAnchor(writer.getAnchor(method), new StringContent(name(method)))); methodDocTree.add(heading); - if ((erasureAnchor = getErasureAnchor(method)) != null) { - methodDocTree.add(links.createAnchor((erasureAnchor))); - } - methodDocTree.add(links.createAnchor(writer.getAnchor(method))); return HtmlTree.SECTION(HtmlStyle.detail, methodDocTree); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -89,8 +89,8 @@ Content propertyDetailsTree = new ContentBuilder(); Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.propertyDetailsLabel); + propertyDetailsTree.add(links.createAnchor(SectionName.PROPERTY_DETAIL)); propertyDetailsTree.add(heading); - propertyDetailsTree.add(links.createAnchor(SectionName.PROPERTY_DETAIL)); return propertyDetailsTree; } @@ -102,9 +102,9 @@ Content propertyDetailsTree) { Content propertyDocTree = new ContentBuilder(); Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); - heading.add(utils.getPropertyLabel(name(property))); + heading.add(links.createAnchor(name(property), + new StringContent(utils.getPropertyLabel(name(property))))); propertyDocTree.add(heading); - propertyDocTree.add(links.createAnchor(name(property))); return HtmlTree.SECTION(HtmlStyle.detail, propertyDocTree); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java Fri Jun 21 14:07:48 2019 +0530 @@ -100,7 +100,7 @@ * @return a content tree for the marker anchor */ public Content createAnchor(String name, Content content) { - return HtmlTree.A_ID(name, (content == null ? EMPTY_COMMENT : content)); + return HtmlTree.A_ID(getName(name), (content == null ? EMPTY_COMMENT : content)); } private static final Content EMPTY_COMMENT = new Comment(" "); diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Fri Jun 21 14:07:48 2019 +0530 @@ -574,8 +574,7 @@ div.memberSignature { font-family:'DejaVu Sans Mono', monospace; font-size:14px; - margin-top:6px; - margin-bottom:14px; + margin:14px 0; white-space: pre-wrap; } div.memberSignature span.annotations { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jcmd/linux/classes/sun/tools/ProcessHelper.java --- a/src/jdk.jcmd/linux/classes/sun/tools/ProcessHelper.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jcmd/linux/classes/sun/tools/ProcessHelper.java Fri Jun 21 14:07:48 2019 +0530 @@ -66,7 +66,7 @@ if (cmdLine.startsWith(CMD_PREFIX)) { cmdLine = cmdLine.substring(CMD_PREFIX.length()); } - String[] parts = cmdLine.split(" "); + String[] parts = cmdLine.split("\0"); String mainClass = null; if(parts.length == 0) { @@ -87,7 +87,7 @@ // options are used then just return the value (the path to the jar file or module // name with a main class). Otherwise, the main class name is the first part that // is not a Java option (doesn't start with '-' and is not a classpath or a module - // path). + // whitespace option). for (int i = 1; i < parts.length && mainClass == null; i++) { if (i < parts.length - 1) { @@ -95,10 +95,15 @@ return parts[i + 1]; } } - // If this is a classpath or a module path option then skip the next part - // (the classpath or the module path itself) + + if (parts[i].startsWith("--module=")) { + return parts[i].substring("--module=".length()); + } + + // If this is a classpath or a module whitespace option then skip the next part + // (the classpath or the option value itself) if (parts[i].equals("-cp") || parts[i].equals("-classpath") || parts[i].equals("--class-path") || - parts[i].equals("-p") || parts[i].equals("--module-path")) { + isModuleWhiteSpaceOption(parts[i])) { i++; continue; } @@ -106,6 +111,12 @@ if (parts[i].startsWith("-")) { continue; } + + // If it is a source-file mode then return null + if (parts[i].endsWith(".java")) { + return null; + } + mainClass = parts[i]; } return mainClass; @@ -115,11 +126,24 @@ private static String getCommandLine(String pid) { try (Stream lines = Files.lines(Paths.get("/proc/" + pid + "/cmdline"))) { - return lines.map(x -> x.replaceAll("\0", " ")).findFirst().orElse(null); + return lines.findFirst().orElse(null); } catch (IOException | UncheckedIOException e) { return null; } } + + private static boolean isModuleWhiteSpaceOption(String option) { + return option.equals("-p") || + option.equals("--module-path") || + option.equals("--upgrade-module-path") || + option.equals("--add-modules") || + option.equals("--limit-modules") || + option.equals("--add-exports") || + option.equals("--add-opens") || + option.equals("--add-reads") || + option.equals("--patch-module"); + } + } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -808,7 +808,7 @@ MessageDigest md = null; if (options.sysInfo || options.verbose) { try { - md = MessageDigest.getInstance("MD5"); + md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException ignore) { } in = new DigestInputStream(in, md); @@ -829,7 +829,7 @@ if (options.sysInfo || options.verbose) { classWriter.setFile(info.fo.toUri()); classWriter.setLastModified(info.fo.getLastModified()); - classWriter.setDigest("MD5", info.digest); + classWriter.setDigest("SHA-256", info.digest); classWriter.setFileSize(info.size); } @@ -944,7 +944,8 @@ String[] fmOptions = { "--module-path", "--system", "--class-path", "-classpath", "-cp", - "-bootclasspath" + "-bootclasspath", + "--multi-release" }; for (String o: fmOptions) { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties Fri Jun 21 14:07:48 2019 +0530 @@ -92,11 +92,14 @@ main.opt.module_path=\ \ --module-path Specify where to find application modules +main.opt.multi_release=\ +\ --multi-release Specify the version to use in multi-release JAR files + main.opt.constants=\ \ -constants Show final constants main.opt.sysinfo=\ -\ -sysinfo Show system info (path, size, date, MD5 hash)\n\ +\ -sysinfo Show system info (path, size, date, SHA-256 hash)\n\ \ of class being processed main.opt.module=\ diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java Fri Jun 21 14:07:48 2019 +0530 @@ -318,7 +318,6 @@ PlatformRecording clone = recorder.newTemporaryRecording(); clone.setShouldWriteActiveRecordingEvent(false); clone.setName(getName()); - clone.setDestination(this.destination); clone.setToDisk(true); // We purposely don't clone settings here, since // a union a == a diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java Fri Jun 21 14:07:48 2019 +0530 @@ -26,6 +26,8 @@ import java.io.IOException; import java.nio.file.InvalidPathException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.time.Duration; import java.time.Instant; import java.time.LocalDate; @@ -126,26 +128,37 @@ recording = findRecording(name); } PlatformRecorder recorder = PrivateAccess.getInstance().getPlatformRecorder(); - synchronized (recorder) { - dump(recorder, recording, name, filename, maxSize, pathToGcRoots, beginTime, endTime); + + try { + synchronized (recorder) { + dump(recorder, recording, name, filename, maxSize, pathToGcRoots, beginTime, endTime); + } + } catch (IOException | InvalidPathException e) { + throw new DCmdException("Dump failed. Could not copy recording data. %s", e.getMessage()); } return getResult(); } - public void dump(PlatformRecorder recorder, Recording recording, String name, String filename, Long maxSize, Boolean pathToGcRoots, Instant beginTime, Instant endTime) throws DCmdException { + public void dump(PlatformRecorder recorder, Recording recording, String name, String filename, Long maxSize, Boolean pathToGcRoots, Instant beginTime, Instant endTime) throws DCmdException, IOException { try (PlatformRecording r = newSnapShot(recorder, recording, pathToGcRoots)) { r.filter(beginTime, endTime, maxSize); if (r.getChunks().isEmpty()) { throw new DCmdException("Dump failed. No data found in the specified interval."); } - SafePath dumpFile = resolvePath(recording, filename); - - // Needed for JVM - Utils.touch(dumpFile.toPath()); - r.dumpStopped(new WriteableUserPath(dumpFile.toPath())); - reportOperationComplete("Dumped", name, dumpFile); - } catch (IOException | InvalidPathException e) { - throw new DCmdException("Dump failed. Could not copy recording data. %s", e.getMessage()); + // If a filename exist, use it + // if a filename doesn't exist, use destination set earlier + // if destination doesn't exist, generate a filename + WriteableUserPath wup = null; + if (recording != null) { + PlatformRecording pRecording = PrivateAccess.getInstance().getPlatformRecording(recording); + wup = pRecording.getDestination(); + } + if (filename != null || (filename == null && wup == null) ) { + SafePath safe = resolvePath(recording, filename); + wup = new WriteableUserPath(safe.toPath()); + } + r.dumpStopped(wup); + reportOperationComplete("Dumped", name, new SafePath(wup.getRealPathText())); } } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jshell/share/classes/jdk/jshell/Corraller.java --- a/src/jdk.jshell/share/classes/jdk/jshell/Corraller.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jshell/share/classes/jdk/jshell/Corraller.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 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 @@ -25,132 +25,226 @@ package jdk.jshell; -import java.io.IOException; -import java.io.StringWriter; import com.sun.source.tree.ClassTree; import com.sun.source.tree.MethodTree; import com.sun.source.tree.Tree; -import com.sun.tools.javac.code.Flags; +import com.sun.source.tree.Tree.Kind; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCBlock; import com.sun.tools.javac.tree.JCTree.JCClassDecl; -import com.sun.tools.javac.tree.JCTree.JCExpression; import com.sun.tools.javac.tree.JCTree.JCMethodDecl; -import com.sun.tools.javac.tree.JCTree.JCNewClass; -import com.sun.tools.javac.tree.JCTree.JCStatement; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; -import com.sun.tools.javac.tree.Pretty; -import com.sun.tools.javac.tree.TreeMaker; -import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.tree.JCTree.Visitor; import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.ListBuffer; -import com.sun.tools.javac.util.Names; +import static com.sun.tools.javac.code.Flags.FINAL; +import static com.sun.tools.javac.code.Flags.PUBLIC; import static com.sun.tools.javac.code.Flags.STATIC; import static com.sun.tools.javac.code.Flags.INTERFACE; import static com.sun.tools.javac.code.Flags.ENUM; -import static com.sun.tools.javac.code.Flags.PUBLIC; -import com.sun.tools.javac.util.Name; -import jdk.jshell.spi.SPIResolutionException; +import jdk.jshell.Wrap.CompoundWrap; +import jdk.jshell.Wrap.Range; +import jdk.jshell.Wrap.RangeWrap; /** * Produce a corralled version of the Wrap for a snippet. - * Incoming tree is mutated. - * - * @author Robert Field */ -class Corraller extends Pretty { +class Corraller extends Visitor { + + /** Visitor result field: a Wrap + */ + protected Wrap result; + + private final TreeDissector dis; + private final String resolutionExceptionBlock; + private final String source; + + public Corraller(TreeDissector dis, int keyIndex, String source) { + this.dis = dis; + this.resolutionExceptionBlock = "\n { throw new jdk.jshell.spi.SPIResolutionException(" + keyIndex + "); }"; + this.source = source; + } + + public Wrap corralType(ClassTree tree) { + return corralToWrap(tree); + } + + public Wrap corralMethod(MethodTree tree) { + return corralToWrap(tree); + } - private final StringWriter out; - private final int keyIndex; - private final TreeMaker make; - private final Names names; - private JCBlock resolutionExceptionBlock; + private Wrap corralToWrap(Tree tree) { + try { + JCTree jct = (JCTree) tree; + Wrap w = new CompoundWrap( + " public static\n ", + corral(jct)); + debugWrap("corralToWrap SUCCESS source: %s -- wrap:\n %s\n", tree, w.wrapped()); + return w; + } catch (Exception ex) { + debugWrap("corralToWrap FAIL: %s - %s\n", tree, ex); + //ex.printStackTrace(System.err); + return null; + } + } - public Corraller(int keyIndex, Context context) { - this(new StringWriter(), keyIndex, context); + // Corral a single node. +// @SuppressWarnings("unchecked") + private Wrap corral(T tree) { + if (tree == null) { + return null; + } else { + tree.accept(this); + Wrap tmpResult = this.result; + this.result = null; + return tmpResult; + } + } + + private String defaultConstructor(JCClassDecl tree) { + return " public " + tree.name.toString() + "() " + + resolutionExceptionBlock; } - private Corraller(StringWriter out, int keyIndex, Context context) { - super(out, false); - this.out = out; - this.keyIndex = keyIndex; - this.make = TreeMaker.instance(context); - this.names = Names.instance(context); - } + /* *************************************************************************** + * Visitor methods + ****************************************************************************/ - public Wrap corralType(ClassTree ct) { - ((JCClassDecl) ct).mods.flags |= Flags.STATIC | Flags.PUBLIC; - return corral(ct); + @Override + public void visitClassDef(JCClassDecl tree) { + boolean isEnum = (tree.mods.flags & ENUM) != 0; + boolean isInterface = (tree.mods.flags & INTERFACE ) != 0; + int classBegin = dis.getStartPosition(tree); + int classEnd = dis.getEndPosition(tree); + //debugWrap("visitClassDef: %d-%d = %s\n", classBegin, classEnd, source.substring(classBegin, classEnd)); + ListBuffer wrappedDefs = new ListBuffer<>(); + int bodyBegin = -1; + if (tree.defs != null && !tree.defs.isEmpty()) { + if (isEnum) { + // copy the enum constants verbatim + int enumBegin = dis.getStartPosition(tree.defs.head); + JCTree t = null; // null to shut-up compiler, always set because non-empty + List l = tree.defs; + for (; l.nonEmpty(); l = l.tail) { + t = l.head; + if (t.getKind() == Kind.VARIABLE) { + if ((((JCVariableDecl)t).mods.flags & (PUBLIC | STATIC | FINAL)) != (PUBLIC | STATIC | FINAL)) { + // non-enum constant, process normally + break; + } + } else { + // non-variable, process normally + break; + } + } + int constEnd = l.nonEmpty() // end of constants + ? dis.getStartPosition(l.head) - 1 // is one before next defs, if there is one + : dis.getEndPosition(t); // and otherwise end of the last constant + wrappedDefs.append(new RangeWrap(source, new Range(enumBegin, constEnd))); + // handle any other defs + for (; l.nonEmpty(); l = l.tail) { + wrappedDefs.append("\n"); + t = l.head; + wrappedDefs.append(corral(t)); + } + } else { + // non-enum + boolean constructorSeen = false; + for (List l = tree.defs; l.nonEmpty(); l = l.tail) { + wrappedDefs.append("\n "); + JCTree t = l.head; + switch (t.getKind()) { + case METHOD: + constructorSeen = constructorSeen || ((MethodTree)t).getName() == tree.name.table.names.init; + break; + case BLOCK: + // throw exception in instance initializer too -- inline because String not Wrap + wrappedDefs.append((((JCBlock)t).flags & STATIC) != 0 + ? new RangeWrap(source, dis.treeToRange(t)) + : resolutionExceptionBlock); + continue; // already appended, skip append below + } + wrappedDefs.append(corral(t)); + } + if (!constructorSeen && !isInterface && !isEnum) { + // Generate a default constructor, since + // this is a regular class and there are no constructors + if (wrappedDefs.length() > 0) { + wrappedDefs.append("\n "); + } + wrappedDefs.append(defaultConstructor(tree)); + } + } + bodyBegin = dis.getStartPosition(tree.defs.head); + } + Object defs = wrappedDefs.length() == 1 + ? wrappedDefs.first() + : new CompoundWrap(wrappedDefs.toArray()); + if (bodyBegin < 0) { + int brace = source.indexOf('{', classBegin); + if (brace < 0 || brace >= classEnd) { + throw new IllegalArgumentException("No brace found: " + source.substring(classBegin, classEnd)); + } + bodyBegin = brace + 1; + } + // body includes openning brace + result = new CompoundWrap( + new RangeWrap(source, new Range(classBegin, bodyBegin)), + defs, + "\n}" + ); } - public Wrap corralMethod(MethodTree mt) { - ((JCMethodDecl) mt).mods.flags |= Flags.STATIC | Flags.PUBLIC; - return corral(mt); + // Corral the body + @Override + public void visitMethodDef(JCMethodDecl tree) { + int methodBegin = dis.getStartPosition(tree); + int methodEnd = dis.getEndPosition(tree); + //debugWrap("+visitMethodDef: %d-%d = %s\n", methodBegin, methodEnd, + // source.substring(methodBegin, methodEnd)); + int bodyBegin = dis.getStartPosition(tree.getBody()); + if (bodyBegin < 0) { + bodyBegin = source.indexOf('{', methodBegin); + if (bodyBegin > methodEnd) { + bodyBegin = -1; + } + } + if (bodyBegin > 0) { + //debugWrap("-visitMethodDef BEGIN: %d = '%s'\n", bodyBegin, + // source.substring(methodBegin, bodyBegin)); + Range noBodyRange = new Range(methodBegin, bodyBegin); + result = new CompoundWrap( + new RangeWrap(source, noBodyRange), + resolutionExceptionBlock); + } else { + Range range = new Range(methodBegin, methodEnd); + result = new RangeWrap(source, range); + } } - private Wrap corral(Tree tree) { - try { - printStat((JCTree) tree); - } catch (IOException e) { - throw new AssertionError(e); + // Remove initializer, if present + @Override + public void visitVarDef(JCVariableDecl tree) { + int begin = dis.getStartPosition(tree); + int end = dis.getEndPosition(tree); + if (tree.init == null) { + result = new RangeWrap(source, new Range(begin, end)); + } else { + int sinit = dis.getStartPosition(tree.init); + int eq = source.lastIndexOf('=', sinit); + if (eq < begin) { + throw new IllegalArgumentException("Equals not found before init: " + source + " @" + sinit); + } + result = new CompoundWrap(new RangeWrap(source, new Range(begin, eq - 1)), ";"); } - return Wrap.simpleWrap(out.toString()); } @Override - public void visitBlock(JCBlock tree) { - // Top-level executable blocks (usually method bodies) are corralled - super.visitBlock((tree.flags & STATIC) != 0 - ? tree - : resolutionExceptionBlock()); - } - - @Override - public void visitVarDef(JCVariableDecl tree) { - // No field inits in corralled classes - tree.init = null; - super.visitVarDef(tree); + public void visitTree(JCTree tree) { + throw new IllegalArgumentException("Unexpected tree: " + tree); } - @Override - public void visitClassDef(JCClassDecl tree) { - if ((tree.mods.flags & (INTERFACE | ENUM)) == 0 && - !tree.getMembers().stream() - .anyMatch(t -> t.getKind() == Tree.Kind.METHOD && - ((MethodTree) t).getName() == tree.name.table.names.init)) { - // Generate a default constructor, since - // this is a regular class and there are no constructors - ListBuffer ndefs = new ListBuffer<>(); - ndefs.addAll(tree.defs); - ndefs.add(make.MethodDef(make.Modifiers(PUBLIC), - tree.name.table.names.init, - null, List.nil(), List.nil(), List.nil(), - resolutionExceptionBlock(), null)); - tree.defs = ndefs.toList(); - } - super.visitClassDef(tree); - } - - // Build a compiler tree for an exception throwing block, e.g.: - // { - // throw new jdk.jshell.spi.SPIResolutionException(9); - // } - private JCBlock resolutionExceptionBlock() { - if (resolutionExceptionBlock == null) { - JCExpression expClass = null; - // Split the exception class name at dots - for (String id : SPIResolutionException.class.getName().split("\\.")) { - Name nm = names.fromString(id); - if (expClass == null) { - expClass = make.Ident(nm); - } else { - expClass = make.Select(expClass, nm); - } - } - JCNewClass exp = make.NewClass(null, - null, expClass, List.of(make.Literal(keyIndex)), null); - resolutionExceptionBlock = make.Block(0L, List.of(make.Throw(exp))); - } - return resolutionExceptionBlock; + void debugWrap(String format, Object... args) { + //state.debug(this, InternalDebugControl.DBG_WRAP, format, args); } } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jshell/share/classes/jdk/jshell/Eval.java --- a/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -44,7 +44,6 @@ import com.sun.source.tree.NewClassTree; import com.sun.source.tree.Tree; import com.sun.source.tree.VariableTree; -import com.sun.source.util.TreeScanner; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.Pretty; import java.io.IOException; @@ -622,7 +621,6 @@ name = "$" + ++varNumber; } } - TreeDissector dis = TreeDissector.createByFirstClass(pt); ExpressionInfo varEI = ExpressionToTypeInfo.localVariableTypeForInitializer(compileSource, state, true); String declareTypeName; @@ -634,6 +632,7 @@ fullTypeName = varEI.fullTypeName; displayTypeName = varEI.displayTypeName; + TreeDissector dis = TreeDissector.createByFirstClass(pt); Pair anonymous2Member = anonymous2Member(varEI, compileSource, new Range(0, compileSource.length()), dis, expr.getExpression()); guts = Wrap.tempVarWrap(anonymous2Member.second.wrapped(), declareTypeName, name, anonymous2Member.first); @@ -680,8 +679,8 @@ String name = klassTree.getSimpleName().toString(); DiagList modDiag = modifierDiagnostics(klassTree.getModifiers(), dis, false); TypeDeclKey key = state.keyMap.keyForClass(name); - // Corralling mutates. Must be last use of pt, unitTree, klassTree - Wrap corralled = new Corraller(key.index(), pt.getContext()).corralType(klassTree); + // Corralling + Wrap corralled = new Corraller(dis, key.index(), compileSource).corralType(klassTree); Wrap guts = Wrap.classMemberWrap(compileSource); Snippet snip = new TypeDeclSnippet(key, userSource, guts, @@ -752,8 +751,8 @@ Tree returnType = mt.getReturnType(); DiagList modDiag = modifierDiagnostics(mt.getModifiers(), dis, true); MethodKey key = state.keyMap.keyForMethod(name, parameterTypes); - // Corralling mutates. Must be last use of pt, unitTree, mt - Wrap corralled = new Corraller(key.index(), pt.getContext()).corralMethod(mt); + // Corralling + Wrap corralled = new Corraller(dis, key.index(), compileSource).corralMethod(mt); if (modDiag.hasErrors()) { return compileFailResult(modDiag, userSource, Kind.METHOD); diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jshell/share/classes/jdk/jshell/GeneralWrap.java --- a/src/jdk.jshell/share/classes/jdk/jshell/GeneralWrap.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jshell/share/classes/jdk/jshell/GeneralWrap.java Fri Jun 21 14:07:48 2019 +0530 @@ -28,7 +28,10 @@ /** * Common interface for all wrappings of snippet source to Java source. * - * @author Robert Field + * Snippet index is index into the source of the snippet. Note: If the snippet is a sub-range of + * the source, the index is not the index in the snippet. + * + * Wrap index is index into the wrapped snippet. */ interface GeneralWrap { diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java --- a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -301,7 +301,7 @@ SourcePositions sp = at.trees().getSourcePositions(); CompilationUnitTree topLevel = at.firstCuTree(); List result = new ArrayList<>(); - TreePath tp = pathFor(topLevel, sp, code.snippetIndexToWrapIndex(cursor)); + TreePath tp = pathFor(topLevel, sp, code, cursor); if (tp != null) { Scope scope = at.trees().getScope(tp); Predicate accessibility = createAccessibilityFilter(at, tp); @@ -563,7 +563,10 @@ } } - private TreePath pathFor(CompilationUnitTree topLevel, SourcePositions sp, int pos) { + private TreePath pathFor(CompilationUnitTree topLevel, SourcePositions sp, GeneralWrap wrap, int snippetEndPos) { + int wrapEndPos = snippetEndPos == 0 + ? wrap.snippetIndexToWrapIndex(snippetEndPos) + : wrap.snippetIndexToWrapIndex(snippetEndPos - 1) + 1; TreePath[] deepest = new TreePath[1]; new TreePathScanner() { @@ -576,7 +579,7 @@ long end = sp.getEndPosition(topLevel, tree); long prevEnd = deepest[0] != null ? sp.getEndPosition(topLevel, deepest[0].getLeaf()) : -1; - if (start <= pos && pos <= end && + if (start <= wrapEndPos && wrapEndPos <= end && (start != end || prevEnd != end || deepest[0] == null || deepest[0].getParentPath().getLeaf() != getCurrentPath().getLeaf())) { deepest[0] = new TreePath(getCurrentPath(), tree); @@ -1176,7 +1179,7 @@ return proc.taskFactory.analyze(codeWrap, List.of(keepParameterNames), at -> { SourcePositions sp = at.trees().getSourcePositions(); CompilationUnitTree topLevel = at.firstCuTree(); - TreePath tp = pathFor(topLevel, sp, codeWrap.snippetIndexToWrapIndex(cursor)); + TreePath tp = pathFor(topLevel, sp, codeWrap, cursor); if (tp == null) return Collections.emptyList(); @@ -1526,7 +1529,7 @@ return proc.taskFactory.analyze(codeWrap, at -> { SourcePositions sp = at.trees().getSourcePositions(); CompilationUnitTree topLevel = at.firstCuTree(); - TreePath tp = pathFor(topLevel, sp, codeWrap.snippetIndexToWrapIndex(codeFin.length())); + TreePath tp = pathFor(topLevel, sp, codeWrap, codeFin.length()); if (tp.getLeaf().getKind() != Kind.IDENTIFIER) { return new QualifiedNames(Collections.emptyList(), -1, true, false); } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.jshell/share/classes/jdk/jshell/Wrap.java --- a/src/jdk.jshell/share/classes/jdk/jshell/Wrap.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.jshell/share/classes/jdk/jshell/Wrap.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -34,8 +34,6 @@ /** * Wrapping of source into Java methods, fields, etc. All but outer layer * wrapping with imports and class. - * - * @author Robert Field */ abstract class Wrap implements GeneralWrap { @@ -184,7 +182,7 @@ public static final class Range { final int begin; - final int end; + final int end; // exclusive Range(int begin, int end) { this.begin = begin; @@ -216,7 +214,7 @@ @Override public String toString() { - return "Range[" + begin + "," + end + "]"; + return "Range[" + begin + "," + end + ")"; } } @@ -280,8 +278,12 @@ before += s.length(); } else if (o instanceof Wrap) { Wrap w = (Wrap) o; - if (sni >= w.firstSnippetIndex() && sni <= w.lastSnippetIndex()) { - return w.snippetIndexToWrapIndex(sni) + before; + if (sni >= w.firstSnippetIndex() && sni < w.lastSnippetIndex()) { + int wwi = w.snippetIndexToWrapIndex(sni); + debugWrap("\nCommoundWrap.snippetIndexToWrapIndex: SnippetIndex(%d) -> WrapIndex(%d + %d = %d)" + + "\n === %s", + sni, wwi, before, wwi + before, wrapped()); + return wwi + before; } before += w.wrapped().length(); } @@ -300,8 +302,8 @@ w = (Wrap) o; int len = w.wrapped().length(); if ((wi - before) <= len) { - //System.err.printf("Defer to wrap %s - wi: %d. before; %d -- %s >>> %s\n", - // w, wi, before, w.debugPos(wi - before), w.wrapped()); + debugWrap("CommoundWrap.wrapIndexToWrap: Defer to wrap %s - wi: %d. before; %d >>> %s\n", + w, wi, before, w.wrapped()); return w; } before += len; @@ -321,9 +323,10 @@ Wrap w = (Wrap) o; int len = w.wrapped().length(); if ((wi - before) <= len) { - //System.err.printf("Defer to wrap %s - wi: %d. before; %d -- %s >>> %s\n", - // w, wi, before, w.debugPos(wi - before), w.wrapped()); - return w.wrapIndexToSnippetIndex(wi - before); + int si = w.wrapIndexToSnippetIndex(wi - before); + debugWrap("\nCommoundWrap.wrapIndexToSnippetIndex: WrapIndex(%d) -> SnippetIndex(%d)\n", + wi, si); + return si; } before += len; } @@ -369,7 +372,7 @@ } else if (o instanceof Wrap) { w = (Wrap) o; int lns = countLines(w.wrapped()); - if ((wline - before) < lns) { + if ((wline - before) <= lns) { return w; } before += lns; @@ -388,7 +391,7 @@ } else if (o instanceof Wrap) { Wrap w = (Wrap) o; int lns = countLines(w.wrapped()); - if ((wline - before) < lns) { + if ((wline - before) <= lns) { return w.wrapLineToSnippetLine(wline - before); } before += lns; @@ -409,16 +412,21 @@ @Override public String toString() { - return "CompoundWrap(" + Arrays.stream(os).map(Object::toString).collect(joining(",")) + ")"; + return "CompoundWrap(" + Arrays.stream(os) + .map(o -> (o instanceof String) + ? "\"" + o + "\"" + : o.toString()) + .collect(joining(",")) + + ")"; } } - private static class RangeWrap extends Wrap { + static class RangeWrap extends Wrap { final Range range; - final String wrapped; - final int firstSnline; - final int lastSnline; + final String wrapped; // The snippet portion of the source + final int firstSnline; // Line count to start of snippet portion + final int lastSnline; // Line count to end of snippet portion RangeWrap(String snippetSource, Range usedWithinSnippet) { this.range = usedWithinSnippet; @@ -436,24 +444,39 @@ @Override public int snippetIndexToWrapIndex(int sni) { if (sni < range.begin) { + debugWrap("\nRangeWrap.snippetIndexToWrapIndex: ERR before SnippetIndex(%d) -> WrapIndex(%d + %d = %d)\n", + sni, 0); return 0; } if (sni > range.end) { + debugWrap("\nRangeWrap.snippetIndexToWrapIndex: ERR after SnippetIndex(%d) -> WrapIndex(%d + %d = %d)\n", + sni, range.length()); return range.length(); } - return sni - range.begin; + int wi = sni - range.begin; + debugWrap("\nRangeWrap.snippetIndexToWrapIndex: SnippetIndex(%d) -> WrapIndex(%d + %d = %d)" + + "\n === %s", + sni, sni, range.begin, sni - range.begin, wrapped()); + return wi; } @Override public int wrapIndexToSnippetIndex(int wi) { if (wi < 0) { + debugWrap("\nRangeWrap.wrapIndexToSnippetIndex: ERR before WrapIndex(%d) -> SnippetIndex(%d)\n", + wi, 0); return 0; // bad index } int max = range.length(); if (wi > max) { - wi = max; + debugWrap("\nRangeWrap.wrapIndexToSnippetIndex: ERR after WrapIndex(%d) -> SnippetIndex(%d)\n", + wi, max + range.begin); + return max + range.begin; } - return wi + range.begin; + int sni = wi + range.begin; + debugWrap("\nRangeWrap.wrapIndexToSnippetIndex: WrapIndex(%d) -> SnippetIndex(%d)\n", + wi, sni); + return sni; } @Override @@ -535,4 +558,9 @@ super(" public static ", wtype, brackets + " ", wname, semi(wname)); } } + + void debugWrap(String format, Object... args) { + //System.err.printf(format, args); + //state.debug(this, InternalDebugControl.DBG_WRAP, format, args); + } } diff -r 28582d575a98 -r fd4ec73925c3 src/jdk.rmic/share/classes/sun/tools/java/RuntimeConstants.java --- a/src/jdk.rmic/share/classes/sun/tools/java/RuntimeConstants.java Fri Jun 21 12:42:10 2019 +0530 +++ b/src/jdk.rmic/share/classes/sun/tools/java/RuntimeConstants.java Fri Jun 21 14:07:48 2019 +0530 @@ -67,7 +67,7 @@ /* Class File Constants */ int JAVA_MAGIC = 0xcafebabe; int JAVA_MIN_SUPPORTED_VERSION = 45; - int JAVA_MAX_SUPPORTED_VERSION = 57; + int JAVA_MAX_SUPPORTED_VERSION = 58; int JAVA_MAX_SUPPORTED_MINOR_VERSION = 0; int JAVA_MIN_PREVIEW_MAJOR_VERSION = 55; // preview intro'd in JDK 11 int JAVA_PREVIEW_MINOR_VERSION = 0xffff; diff -r 28582d575a98 -r fd4ec73925c3 test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -26,7 +26,7 @@ import com.sun.javatest.Harness; import com.sun.javatest.Parameters; import com.sun.javatest.TestResult; -import com.sun.javatest.InterviewParameters; +import com.sun.javatest.regtest.config.RegressionParameters; import jdk.test.failurehandler.*; import java.io.File; @@ -46,8 +46,8 @@ public static final String LOG_FILENAME = "environment.log"; public static final String ENVIRONMENT_OUTPUT = "environment.html"; - private String compileJdk; - private String testJdk; + private Path compileJdk; + private Path testJdk; /* * The harness calls this method after each test. @@ -80,7 +80,7 @@ log.printf("%s ---%n", name); GathererFactory gathererFactory = new GathererFactory( OS.current().family, workDir, log, - Paths.get(testJdk), Paths.get(compileJdk)); + testJdk, compileJdk); gatherEnvInfo(workDir, name, log, gathererFactory.getEnvironmentInfoGatherer()); } catch (Throwable e) { @@ -117,12 +117,9 @@ */ @Override public void startingTestRun(Parameters params) { - // TODO find a better way to get JDKs - InterviewParameters rp = (InterviewParameters) params; - Map map = new HashMap<>(); - rp.save(map); - compileJdk = map.get("regtest.compilejdk"); - testJdk = map.get("regtest.testjdk"); + RegressionParameters rp = (RegressionParameters) params; + compileJdk = rp.getCompileJDK().getAbsoluteFile().toPath(); + testJdk = rp.getTestJDK().getAbsoluteFile().toPath(); } @Override diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/ProblemList-aot.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/hotspot/jtreg/ProblemList-aot.txt Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,74 @@ +# +# 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. +# + +############################################################################# +# +# List of quarantined tests for testing with AOT. +# +############################################################################# + +serviceability/sa/CDSJMapClstats.java 8216181 generic-all +serviceability/sa/ClhsdbAttach.java 8216181 generic-all +serviceability/sa/ClhsdbCDSCore.java 8216181 generic-all +serviceability/sa/ClhsdbCDSJstackPrintAll.java 8216181 generic-all +serviceability/sa/ClhsdbField.java 8216181 generic-all +serviceability/sa/ClhsdbFindPC.java 8216181 generic-all +serviceability/sa/ClhsdbFlags.java 8216181 generic-all +serviceability/sa/ClhsdbInspect.java 8216181 generic-all +serviceability/sa/ClhsdbJdis.java 8216181 generic-all +serviceability/sa/ClhsdbJhisto.java 8216181 generic-all +serviceability/sa/ClhsdbJstack.java 8216181 generic-all +serviceability/sa/ClhsdbLongConstant.java 8216181 generic-all +serviceability/sa/ClhsdbPmap.java 8216181 generic-all +serviceability/sa/ClhsdbPrintAll.java 8216181 generic-all +serviceability/sa/ClhsdbPrintAs.java 8216181 generic-all +serviceability/sa/ClhsdbPrintStatics.java 8216181 generic-all +serviceability/sa/ClhsdbPstack.java 8216181 generic-all +serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8216181 generic-all +serviceability/sa/ClhsdbScanOops.java 8216181 generic-all +serviceability/sa/ClhsdbSource.java 8216181 generic-all +serviceability/sa/ClhsdbThread.java 8216181 generic-all +serviceability/sa/ClhsdbVmStructsDump.java 8216181 generic-all +serviceability/sa/ClhsdbWhere.java 8216181 generic-all +serviceability/sa/DeadlockDetectionTest.java 8216181 generic-all +serviceability/sa/JhsdbThreadInfoTest.java 8216181 generic-all +serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java 8216181 generic-all +serviceability/sa/sadebugd/SADebugDTest.java 8216181 generic-all +serviceability/sa/TestClassDump.java 8216181 generic-all +serviceability/sa/TestClhsdbJstackLock.java 8216181 generic-all +serviceability/sa/TestCpoolForInvokeDynamic.java 8216181 generic-all +serviceability/sa/TestDefaultMethods.java 8216181 generic-all +serviceability/sa/TestG1HeapRegion.java 8216181 generic-all +serviceability/sa/TestHeapDumpForInvokeDynamic.java 8216181 generic-all +serviceability/sa/TestHeapDumpForLargeArray.java 8216181 generic-all +serviceability/sa/TestInstanceKlassSizeForInterface.java 8216181 generic-all +serviceability/sa/TestInstanceKlassSize.java 8216181 generic-all +serviceability/sa/TestIntConstant.java 8216181 generic-all +serviceability/sa/TestJhsdbJstackLock.java 8216181 generic-all +serviceability/sa/TestJhsdbJstackMixed.java 8216181 generic-all +serviceability/sa/TestJmapCore.java 8216181 generic-all +serviceability/sa/TestJmapCoreMetaspace.java 8216181 generic-all +serviceability/sa/TestPrintMdo.java 8216181 generic-all +serviceability/sa/TestRevPtrsForInvokeDynamic.java 8216181 generic-all +serviceability/sa/TestType.java 8216181 generic-all +serviceability/sa/TestUniverse.java 8216181 generic-all diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/ProblemList-graal.txt --- a/test/hotspot/jtreg/ProblemList-graal.txt Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/ProblemList-graal.txt Fri Jun 21 14:07:48 2019 +0530 @@ -38,11 +38,11 @@ compiler/compilercontrol/mixed/RandomValidCommandsTest.java 8181753 generic-all compiler/compilercontrol/mixed/RandomCommandsTest.java 8181753 generic-all -compiler/graalunit/HotspotJdk9Test.java 8224254 generic-all +compiler/graalunit/HotspotJdk9Test.java 8223807 generic-all +compiler/jsr292/InvokerSignatureMismatch.java 8223807 generic-all + compiler/graalunit/JttThreadsTest.java 8207757 generic-all -compiler/jvmci/SecurityRestrictionsTest.java 8181837 generic-all - compiler/unsafe/UnsafeGetConstantField.java 8181833 generic-all compiler/unsafe/UnsafeGetStableArrayElement.java 8181833 generic-all compiler/unsafe/UnsafeOffHeapBooleanTest.java 8181833 generic-all @@ -60,7 +60,7 @@ gc/g1/TestPeriodicCollection.java 8196611 generic-all gc/g1/TestFromCardCacheIndex.java 8196611 generic-all gc/parallel/TestPrintGCDetailsVerbose.java 8196611 generic-all -vm/gc/InfiniteList.java 8196611 generic-all +gc/InfiniteList.java 8196611 generic-all vmTestbase/gc/lock/jni/jnilock001/TestDescription.java 8196611 generic-all vmTestbase/gc/lock/jniref/jnireflock04/TestDescription.java 8196611 generic-all @@ -147,16 +147,16 @@ # jvmti tests vmTestbase/nsk/jvmti/PopFrame/popframe009/TestDescription.java 8195639 generic-all -vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java 8195674 generic-all -vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java 8195674 generic-all +vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java 8195674,8195635 generic-all +vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java 8195674,8195635 generic-all runtime/appcds/cacheObject/RedefineClassTest.java 8204506 macosx-all -vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001/TestDescription.java 8204506 macosx-all +vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001/TestDescription.java 8204506,8195635 macosx-all,generic-all vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t002/TestDescription.java 8204506 macosx-all -vmTestbase/nsk/jvmti/PopFrame/popframe001/TestDescription.java 8207013 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe003/TestDescription.java 8207013 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe005/TestDescription.java 8207013 generic-all +vmTestbase/nsk/jvmti/PopFrame/popframe001/TestDescription.java 8207013,8195635 generic-all +vmTestbase/nsk/jvmti/PopFrame/popframe003/TestDescription.java 8207013,8195635 generic-all +vmTestbase/nsk/jvmti/PopFrame/popframe005/TestDescription.java 8207013,8195635 generic-all vmTestbase/nsk/jvmti/StopThread/stopthrd007/TestDescription.java 8207013 generic-all serviceability/jvmti/FieldAccessWatch/FieldAccessWatch.java 8202482 generic-all @@ -174,7 +174,6 @@ vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001/TestDescription.java 8195635 generic-all vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002/TestDescription.java 8195635 generic-all vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue003/returnValue003.java 8195635 generic-all -vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001/TestDescription.jav 8195635 generic-all vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001/TestDescription.java 8195635 generic-all vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001/TestDescription.java 8195635 generic-all vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002/TestDescription.java 8195635 generic-all @@ -182,14 +181,8 @@ vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/TestDescription.java 8195635 generic-all vmTestbase/nsk/jdi/stress/serial/mixed002/TestDescription.java 8195635 generic-all vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java 8195635 generic-all -vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe001/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe003/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe005/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.java 8195635 generic-all @@ -234,7 +227,6 @@ vmTestbase/nsk/jdb/clear/clear003/clear003.java 8218701 generic-all -compiler/jsr292/InvokerSignatureMismatch.java 8221577 generic-all # Next tests should be re-enabled once libgraal is introduced compiler/arguments/TestScavengeRootsInCode.java 8207267 generic-all diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/ProblemList.txt --- a/test/hotspot/jtreg/ProblemList.txt Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/ProblemList.txt Fri Jun 21 14:07:48 2019 +0530 @@ -43,12 +43,14 @@ compiler/ciReplay/TestSAServer.java 8029528 generic-all compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all compiler/codegen/Test6896617.java 8193479 generic-all +compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8225370 generic-all compiler/jvmci/compilerToVM/GetFlagValueTest.java 8204459 generic-all compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all compiler/tiered/LevelTransitionTest.java 8067651 generic-all -compiler/types/correctness/CorrectnessTest.java 8066173 generic-all -compiler/types/correctness/OffTest.java 8066173 generic-all + +compiler/types/correctness/CorrectnessTest.java 8225670,8225620 generic-all,solaris-sparcv9 +compiler/types/correctness/OffTest.java 8225670,8225620 generic-all,solaris-sparcv9 compiler/c2/Test6852078.java 8194310 generic-all compiler/c2/Test8004741.java 8214904 generic-all @@ -57,9 +59,6 @@ compiler/runtime/Test8168712.java 8211769,8211771 generic-ppc64,generic-ppc64le,linux-s390x -compiler/codegen/TestCharVect2.java 8224234 generic-x64 -compiler/c2/cr6340864/TestLongVect.java 8224234 generic-x64 - applications/ctw/modules/java_desktop.java 8205016 windows-all applications/ctw/modules/java_desktop_2.java 8205016 windows-all applications/ctw/modules/jdk_jconsole.java 8205016 windows-all @@ -76,13 +75,11 @@ gc/stress/gclocker/TestGCLockerWithG1.java 8180622 generic-all gc/stress/TestJNIBlockFullGC/TestJNIBlockFullGC.java 8192647 generic-all gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java 8193639 solaris-all -gc/stress/TestReclaimStringsLeaksMemory.java 8224847 generic-all ############################################################################# # :hotspot_runtime -runtime/SharedArchiveFile/SASymbolTableTest.java 8193639 solaris-all runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64 ############################################################################# @@ -109,8 +106,6 @@ serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8193639 solaris-all serviceability/sa/ClhsdbScanOops.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbSource.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 -serviceability/sa/ClhsdbSymbol.java 8193639 solaris-all -serviceability/sa/ClhsdbSymbolTable.java 8193639 solaris-all serviceability/sa/ClhsdbThread.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbVmStructsDump.java 8193639 solaris-all serviceability/sa/ClhsdbWhere.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/compiler/c2/Test8202414.java --- a/test/hotspot/jtreg/compiler/c2/Test8202414.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/compiler/c2/Test8202414.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Huawei Technologies Co. Ltd. All rights reserved. + * 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 diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java Fri Jun 21 14:07:48 2019 +0530 @@ -33,8 +33,8 @@ public enum Command { COMPILEONLY("compileonly", ".*", "-Xbatch"), EXCLUDE("exclude", "", "-Xbatch"), - INLINE("inline", ".*", "-Xbatch"), - DONTINLINE("dontinline", "", "-Xbatch"), + INLINE("inline", ".*", "-Xbatch", "-XX:InlineSmallCode=4000"), + DONTINLINE("dontinline", "", "-Xbatch", "-XX:InlineSmallCode=4000"), LOG("log", "", "-XX:+UnlockDiagnosticVMOptions", "-XX:+LogCompilation", "-XX:LogFile=" + LogProcessor.LOG_FILE), PRINT("print", ""), diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/compiler/testlibrary/rtm/libXAbortProvoker.c --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/libXAbortProvoker.c Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/compiler/testlibrary/rtm/libXAbortProvoker.c Fri Jun 21 14:07:48 2019 +0530 @@ -28,7 +28,7 @@ * so doAbort() does nothing special and only returns after being called. * The transaction abortion happens right before the JNI method is called. */ -int JNICALL +JNIEXPORT int JNICALL Java_compiler_testlibrary_rtm_XAbortProvoker_doAbort(JNIEnv *env, jobject o) { return 0; } diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/compiler/unsafe/TestUnsafeLoadWithZeroAddress.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/hotspot/jtreg/compiler/unsafe/TestUnsafeLoadWithZeroAddress.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,84 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8224658 + * @summary Test compilation of unsafe access with zero address. + * @modules java.base/jdk.internal.misc:+open + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* + * compiler.unsafe.TestUnsafeLoadWithZeroAddress + * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline + * -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* + * compiler.unsafe.TestUnsafeLoadWithZeroAddress + */ + +package compiler.unsafe; + +import jdk.internal.misc.Unsafe; + +public class TestUnsafeLoadWithZeroAddress { + static final Unsafe UNSAFE = Unsafe.getUnsafe(); + static boolean f; + + public static void test1() { + if (f) { + // This branch is never executed but compiled due to -Xcomp + UNSAFE.getInt(0); + } + } + + public static void test2() { + if (f) { + // This branch is never executed but compiled due to -Xcomp + UNSAFE.putInt(0, 0); + } + } + + private static int getAddress() { + return 0; + } + + public static void test3() { + if (f) { + // This branch is never executed but compiled due to -Xcomp + UNSAFE.getInt(getAddress()); + } + } + + public static void test4() { + if (f) { + // This branch is never executed but compiled due to -Xcomp + UNSAFE.putInt(getAddress(), 0); + } + } + + static public void main(String[] args) { + test1(); + test2(); + test3(); + test4(); + } +} + diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/gc/arguments/TestMaxHeapSizeTools.java --- a/test/hotspot/jtreg/gc/arguments/TestMaxHeapSizeTools.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/gc/arguments/TestMaxHeapSizeTools.java Fri Jun 21 14:07:48 2019 +0530 @@ -55,6 +55,8 @@ checkValidMinInitialHeapCombinations(gcflag); checkInvalidInitialMaxHeapCombinations(gcflag); checkValidInitialMaxHeapCombinations(gcflag); + checkInvalidMinMaxHeapCombinations(gcflag); + checkValidMinMaxHeapCombinations(gcflag); } public static void checkMinInitialErgonomics(String gcflag) throws Exception { @@ -71,18 +73,33 @@ // -Xms is not set checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize }, values, -1, -1); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-XX:MinHeapSize=" + smallValue }, values, smallValue, -1); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-XX:MinHeapSize=" + largeValue }, values, largeValue, -1); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-XX:MinHeapSize=0" }, values, -1, -1); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-XX:InitialHeapSize=" + smallValue }, values, -1, smallValue); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-XX:InitialHeapSize=" + largeValue }, values, -1, largeValue); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-XX:InitialHeapSize=0" }, values, -1, -1); + // Some extra checks when both are set. + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-XX:MinHeapSize=" + smallValue, "-XX:InitialHeapSize=" + smallValue }, values, smallValue, smallValue); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-XX:MinHeapSize=" + smallValue, "-XX:InitialHeapSize=" + largeValue }, values, smallValue, largeValue); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-XX:MinHeapSize=" + largeValue, "-XX:InitialHeapSize=" + largeValue }, values, largeValue, largeValue); // -Xms is set to zero checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0" }, values, -1, -1); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0", "-XX:MinHeapSize=" + smallValue }, values, smallValue, -1); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0", "-XX:MinHeapSize=" + largeValue }, values, largeValue, -1); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0", "-XX:MinHeapSize=0" }, values, -1, -1); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0", "-XX:InitialHeapSize=" + smallValue }, values, -1, smallValue); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0", "-XX:InitialHeapSize=" + largeValue }, values, -1, largeValue); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0", "-XX:InitialHeapSize=0" }, values, -1, -1); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0", "-XX:MinHeapSize=" + smallValue, "-XX:InitialHeapSize=" + smallValue }, values, smallValue, smallValue); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0", "-XX:MinHeapSize=" + smallValue, "-XX:InitialHeapSize=" + largeValue }, values, smallValue, largeValue); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms0", "-XX:MinHeapSize=" + largeValue, "-XX:InitialHeapSize=" + largeValue }, values, largeValue, largeValue); // -Xms is set to small value checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms" + smallValue }, values, -1, -1); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms" + smallValue, "-XX:MinHeapSize=" + smallValue }, values, smallValue, smallValue); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms" + smallValue, "-XX:MinHeapSize=0" }, values, -1, smallValue); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms" + smallValue, "-XX:InitialHeapSize=" + smallValue }, values, smallValue, smallValue); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms" + smallValue, "-XX:InitialHeapSize=" + largeValue }, values, smallValue, largeValue); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms" + smallValue, "-XX:InitialHeapSize=0" }, values, smallValue, -1); @@ -90,6 +107,7 @@ // -Xms is set to large value checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms" + largeValue }, values, largeValue, largeValue); checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms" + largeValue, "-XX:InitialHeapSize=0" }, values, largeValue, -1); + checkErgonomics(new String[] { gcflag, "-Xmx" + maxHeapSize, "-Xms" + largeValue, "-XX:MinHeapSize=0" }, values, -1, largeValue); } private static long align_up(long value, long alignment) { @@ -116,6 +134,9 @@ private static void checkInvalidMinInitialHeapCombinations(String gcflag) throws Exception { expectError(new String[] { gcflag, "-XX:InitialHeapSize=1023K", "-version" }); expectError(new String[] { gcflag, "-Xms64M", "-XX:InitialHeapSize=32M", "-version" }); + expectError(new String[] { gcflag, "-XX:MinHeapSize=1023K", "-version" }); + expectError(new String[] { gcflag, "-Xms4M", "-XX:MinHeapSize=8M", "-version" }); + expectError(new String[] { gcflag, "-XX:MinHeapSize=8M -XX:InitialHeapSize=4m" }); } private static void checkValidMinInitialHeapCombinations(String gcflag) throws Exception { @@ -123,8 +144,13 @@ expectValid(new String[] { gcflag, "-XX:InitialHeapSize=8M", "-Xms4M", "-version" }); expectValid(new String[] { gcflag, "-Xms4M", "-XX:InitialHeapSize=8M", "-version" }); expectValid(new String[] { gcflag, "-XX:InitialHeapSize=8M", "-Xms8M", "-version" }); + expectValid(new String[] { gcflag, "-XX:MinHeapSize=1024K", "-version" }); + expectValid(new String[] { gcflag, "-XX:MinHeapSize=8M", "-Xms4M", "-version" }); + expectValid(new String[] { gcflag, "-XX:MinHeapSize=8M", "-Xms8M", "-version" }); + expectValid(new String[] { gcflag, "-Xms8M", "-XX:MinHeapSize=4M", "-version" }); // the following is not an error as -Xms sets both minimal and initial heap size expectValid(new String[] { gcflag, "-XX:InitialHeapSize=4M", "-Xms8M", "-version" }); + expectValid(new String[] { gcflag, "-XX:MinHeapSize=4M", "-Xms8M", "-version" }); } private static void checkInvalidInitialMaxHeapCombinations(String gcflag) throws Exception { @@ -133,6 +159,12 @@ expectError(new String[] { gcflag, "-XX:InitialHeapSize=8M", "-XX:MaxHeapSize=4M", "-version" }); } + private static void checkInvalidMinMaxHeapCombinations(String gcflag) throws Exception { + expectError(new String[] { gcflag, "-XX:MaxHeapSize=4M", "-XX:MinHeapSize=8M", "-version" }); + expectError(new String[] { gcflag, "-XX:MinHeapSize=8M", "-XX:MaxHeapSize=4M", "-version" }); + } + + private static void checkValidInitialMaxHeapCombinations(String gcflag) throws Exception { expectValid(new String[] { gcflag, "-XX:InitialHeapSize=4M", "-XX:MaxHeapSize=8M", "-version" }); expectValid(new String[] { gcflag, "-XX:MaxHeapSize=8M", "-XX:InitialHeapSize=4M", "-version" }); @@ -141,6 +173,14 @@ expectValid(new String[] { gcflag, "-XX:MaxHeapSize=4M", "-XX:InitialHeapSize=0M", "-version" }); } + private static void checkValidMinMaxHeapCombinations(String gcflag) throws Exception { + expectValid(new String[] { gcflag, "-XX:MinHeapSize=4M", "-XX:MaxHeapSize=8M", "-version" }); + expectValid(new String[] { gcflag, "-XX:MaxHeapSize=8M", "-XX:MinHeapSize=4M", "-version" }); + expectValid(new String[] { gcflag, "-XX:MaxHeapSize=4M", "-XX:MinHeapSize=4M", "-version" }); + // a value of "0" for min heap size means auto-detect + expectValid(new String[] { gcflag, "-XX:MaxHeapSize=4M", "-XX:MinHeapSize=0M", "-version" }); + } + private static long valueAfter(String source, String match) { int start = source.indexOf(match) + match.length(); String tail = source.substring(start).split(" ")[0]; @@ -294,4 +334,3 @@ expect(flags, false, false, 0); } } - diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java --- a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java Fri Jun 21 14:07:48 2019 +0530 @@ -57,7 +57,7 @@ public static void main(String[] args) throws Exception { ArrayList baseargs = new ArrayList<>(Arrays.asList("-Xms256M", "-Xmx256M", - "-Xlog:gc*", + "-Xlog:gc*,stringtable*=debug:gc.log", "-XX:NativeMemoryTracking=summary", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintNMTStatistics" )); @@ -95,9 +95,19 @@ lastString = (BaseName + i).intern(); } if (++iterations % 5 == 0) { - System.gc(); + System.gc(); } } + // Do one last GC and sleep to give ServiceThread a chance to run. + System.out.println("One last gc"); + System.gc(); + for (int i = 0; i < 100; i++) { + try { + Thread.sleep(10); + } catch (InterruptedException ex) { + } + } + System.out.println("End of test"); } } } diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/gtest/GTestResultParser.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/hotspot/jtreg/gtest/GTestResultParser.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,79 @@ +/* + * 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.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.io.IOException; +import java.io.Reader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class GTestResultParser { + private final List _failedTests; + + public GTestResultParser(Path file) { + List failedTests = new ArrayList<>(); + try (Reader r = Files.newBufferedReader(file)) { + try { + XMLStreamReader xmlReader = XMLInputFactory.newInstance() + .createXMLStreamReader(r); + String testSuite = null; + String testCase = null; + while (xmlReader.hasNext()) { + switch (xmlReader.next()) { + case XMLStreamConstants.START_ELEMENT: + switch (xmlReader.getLocalName()) { + case "testsuite": + testSuite = xmlReader.getAttributeValue("", "name"); + break; + case "testcase": + testCase = xmlReader.getAttributeValue("", "name"); + break; + case "failure": + failedTests.add(testSuite + "::" + testCase); + default: + // ignore + } + break; + default: + // ignore + } + } + } catch (XMLStreamException e) { + throw new IllegalArgumentException("can't open parse xml " + file, e); + } + } catch (IOException e) { + throw new IllegalArgumentException("can't open result file " + file, e); + } + _failedTests = Collections.unmodifiableList(failedTests); + } + + public List failedTests() { + return _failedTests; + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/gtest/GTestWrapper.java --- a/test/hotspot/jtreg/gtest/GTestWrapper.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/gtest/GTestWrapper.java Fri Jun 21 14:07:48 2019 +0530 @@ -25,23 +25,21 @@ * @summary a jtreg wrapper for gtest tests * @library /test/lib * @modules java.base/jdk.internal.misc + * java.xml * @run main/native GTestWrapper */ -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Stream; -import java.util.stream.Collectors; - -import java.io.File; -import java.nio.file.Paths; -import java.nio.file.Path; - import jdk.test.lib.Platform; import jdk.test.lib.Utils; import jdk.test.lib.process.ProcessTools; -import jdk.test.lib.process.OutputAnalyzer; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.List; +import java.util.Map; public class GTestWrapper { public static void main(String[] args) throws Throwable { @@ -76,12 +74,33 @@ env.put(pathVar, path + File.pathSeparator + ldLibraryPath); } - pb.command(new String[] { - execPath.toString(), - "-jdk", - System.getProperty("test.jdk") - }); - ProcessTools.executeCommand(pb).shouldHaveExitValue(0); + Path resultFile = Paths.get("test_result.xml"); + pb.command(execPath.toAbsolutePath().toString(), + "-jdk", Utils.TEST_JDK, + "--gtest_output=xml:" + resultFile); + int exitCode = ProcessTools.executeCommand(pb).getExitValue(); + if (exitCode != 0) { + List failedTests = failedTests(resultFile); + String message = "gtest execution failed; exit code = " + exitCode + "."; + if (!failedTests.isEmpty()) { + message += " the failed tests: " + failedTests; + } + throw new AssertionError(message); + } + } + + private static List failedTests(Path xml) { + if (!Files.exists(xml)) { + System.err.println("WARNING: test result file (" + xml + ") hasn't been found"); + } + + try { + return new GTestResultParser(xml).failedTests(); + } catch (Throwable t) { + System.err.println("WARNING: failed to parse result file (" + xml + ") " + t); + t.printStackTrace(); + } + return Collections.emptyList(); } private static String getJVMVariantSubDir() { diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/runtime/8007320/ConstMethodTest.java --- a/test/hotspot/jtreg/runtime/8007320/ConstMethodTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/runtime/8007320/ConstMethodTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, 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 @@ -122,8 +122,8 @@ equal(ann.length, 3); Annotation foo = ann[0][0]; Annotation bar = ann[1][0]; - equal(foo.toString(), "@Named(value=\"aName\")"); - equal(bar.toString(), "@Named(value=\"bName\")"); + equal(foo.toString(), "@Named(\"aName\")"); + equal(bar.toString(), "@Named(\"bName\")"); check(foo.equals(foo)); check(bar.equals(bar)); check(! foo.equals(bar)); diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java --- a/test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -73,7 +73,7 @@ // Subtract 1 from class's major version. The class should fail to load // because its major_version does not match the JVM current version. - int prev_major_version = Runtime.version().feature() - 1; + int prev_major_version = (klassbuf[6] << 8 | klassbuf[7]) - 1; klassbuf[6] = (byte)((prev_major_version >> 8) & 0xff); klassbuf[7] = (byte)(prev_major_version & 0xff); try { @@ -81,8 +81,8 @@ throw new RuntimeException("UnsupportedClassVersionError exception not thrown"); } catch (java.lang.UnsupportedClassVersionError e) { if (!e.getMessage().contains("compiled with preview features that are unsupported")) { - throw new RuntimeException( - "Wrong UnsupportedClassVersionError exception: " + e.getMessage()); + throw new RuntimeException( + "Wrong UnsupportedClassVersionError exception: " + e.getMessage()); } } @@ -97,10 +97,10 @@ "Unexpected UnsupportedClassVersionError exception thrown: " + e.getMessage()); } - // Check that a class with a recent older major version and a non-zero - // minor version fails to load. + // Check that a class with a recent older major version > JDK-11 and a minor version + // that is neither 0 nor 65535 fails to load. klassbuf[6] = 0; - klassbuf[7] = 53; + klassbuf[7] = 56; klassbuf[4] = 0; klassbuf[5] = 2; try { diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java --- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java Fri Jun 21 14:07:48 2019 +0530 @@ -45,8 +45,6 @@ {"MinRAMFraction", "2"}, {"InitialRAMFraction", "64"}, {"TLABStats", "false"}, - {"ThreadLocalHandshakes", "true"}, - {"AllowJNIEnvProxy", "true"}, {"AllowRedefinitionToAddDeleteMethods", "true"}, // deprecated alias flags (see also aliased_jvm_flags): diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java Fri Jun 21 14:07:48 2019 +0530 @@ -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 @@ -25,12 +25,26 @@ * @test InterpreterMethodEntries * @bug 8169711 * @summary Test interpreter method entries for intrinsics with CDS (class data sharing) - * and different settings of the intrinsic flag during dump/use of the archive. + * and the intrinsic flag enabled during dump and disabled during use of the archive. + * @requires vm.cds + * @comment the test disables intrinsics, so it can't be run w/ AOT'ed java module + * @requires !vm.aot.enabled + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.management + * @run driver TestInterpreterMethodEntries true false + */ + +/** + * @test InterpreterMethodEntries + * @bug 8169711 + * @summary Test interpreter method entries for intrinsics with CDS (class data sharing) + * and the intrinsic flag disabled during dump and enabled during use of the archive. * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @run driver TestInterpreterMethodEntries + * @run driver TestInterpreterMethodEntries false true */ import java.lang.Math; @@ -43,10 +57,12 @@ public class TestInterpreterMethodEntries { public static void main(String[] args) throws Exception { - if (args.length == 0) { + if (args.length > 1) { + boolean dump = Boolean.parseBoolean(args[0]); + boolean use = Boolean.parseBoolean(args[1]); + // Dump and use shared archive with different flag combinations - dumpAndUseSharedArchive("+", "-"); - dumpAndUseSharedArchive("-", "+"); + dumpAndUseSharedArchive(dump ? "+" : "-", use ? "+" : "-"); } else { // Call intrinsified java.lang.Math::fma() Math.fma(1.0, 2.0, 3.0); diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/runtime/classFileParserBug/EmptyUnqName.jasm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/hotspot/jtreg/runtime/classFileParserBug/EmptyUnqName.jasm Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,43 @@ +/* + * 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. + */ + +super public class EmptyUnqName version 56:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + public static Method main:"([Ljava/lang/String;)V" stack 2 locals 1 { + getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; + ldc String "Testing method param types"; + invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; + return; + } + + public static Method func:"(L;)V" stack 0 locals 1 { + return; + } + +} // end Class EmptyUnqName diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyUnqName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyUnqName.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,46 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8225789 + * @summary Test that an unqualified name of "L;" causes a ClassFormatError exception. + * @compile EmptyUnqName.jasm + * @run main/othervm -Xverify:remote TestEmptyUnqName + */ + +public class TestEmptyUnqName { + public static void main(String args[]) throws Throwable { + + System.out.println("Regression test for bug 8225789"); + + try { + Class newClass = Class.forName("EmptyUnqName"); + throw new RuntimeException("Expected ClassFormatError exception not thrown"); + } catch (java.lang.ClassFormatError e) { + if (!e.getMessage().contains("Class name is empty or contains illegal character")) { + throw new RuntimeException("Wrong ClassFormatError: " + e.getMessage()); + } + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/runtime/verifier/TestSigParse.java --- a/test/hotspot/jtreg/runtime/verifier/TestSigParse.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/runtime/verifier/TestSigParse.java Fri Jun 21 14:07:48 2019 +0530 @@ -63,7 +63,7 @@ throw new RuntimeException("Expected ClasFormatError exception not thrown"); } catch (java.lang.ClassFormatError e) { String eMsg = e.getMessage(); - if (!eMsg.contains("Class name contains illegal character")) { + if (!eMsg.contains("Class name is empty or contains illegal character")) { throw new RuntimeException("Unexpected exception: " + eMsg); } } diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -23,6 +23,7 @@ package nsk.jdi.BScenarios.multithrd; +import jdk.test.lib.Utils; import nsk.share.*; import nsk.share.jpda.*; import nsk.share.jdi.*; @@ -95,7 +96,7 @@ ArgumentHandler argHandler = new ArgumentHandler(argv); log = new Log(out, argHandler); - waitTime = argHandler.getWaitTime() * 60000; + waitTime = Utils.adjustTimeout(argHandler.getWaitTime() * 60000); Binder binder = new Binder(argHandler, log); debugee = binder.bindToDebugee(debugeeName); @@ -114,6 +115,7 @@ } display("Test finished. exitStatus = " + exitStatus); + debugee.endDebugee(); return exitStatus; } diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack001.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack001.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack001.java Fri Jun 21 14:07:48 2019 +0530 @@ -52,7 +52,7 @@ * 4302288 the second stack overflow causes Classic VM to exit on win32 * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack001 + * @run main/othervm/timeout=900 nsk.stress.stack.stack001 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack002.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack002.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack002.java Fri Jun 21 14:07:48 2019 +0530 @@ -53,7 +53,7 @@ * 4302288 the second stack overflow causes Classic VM to exit on win32 * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack002 + * @run main/othervm/timeout=900 nsk.stress.stack.stack002 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack003.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack003.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack003.java Fri Jun 21 14:07:48 2019 +0530 @@ -47,7 +47,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack003 + * @run main/othervm/timeout=900 nsk.stress.stack.stack003 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack004.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack004.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack004.java Fri Jun 21 14:07:48 2019 +0530 @@ -47,7 +47,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack004 + * @run main/othervm/timeout=900 nsk.stress.stack.stack004 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack005.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack005.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack005.java Fri Jun 21 14:07:48 2019 +0530 @@ -47,7 +47,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack005 + * @run main/othervm/timeout=900 nsk.stress.stack.stack005 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack006.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack006.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack006.java Fri Jun 21 14:07:48 2019 +0530 @@ -47,7 +47,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack006 + * @run main/othervm/timeout=900 nsk.stress.stack.stack006 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack007.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack007.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack007.java Fri Jun 21 14:07:48 2019 +0530 @@ -46,7 +46,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack007 + * @run main/othervm/timeout=900 nsk.stress.stack.stack007 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack008.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack008.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack008.java Fri Jun 21 14:07:48 2019 +0530 @@ -48,7 +48,7 @@ * * @ignore 8139875 * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack008 + * @run main/othervm/timeout=900 nsk.stress.stack.stack008 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack009.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack009.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack009.java Fri Jun 21 14:07:48 2019 +0530 @@ -47,7 +47,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack009 + * @run main/othervm/timeout=900 nsk.stress.stack.stack009 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack010.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack010.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack010.java Fri Jun 21 14:07:48 2019 +0530 @@ -47,7 +47,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack010 + * @run main/othervm/timeout=900 nsk.stress.stack.stack010 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack011.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack011.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack011.java Fri Jun 21 14:07:48 2019 +0530 @@ -47,7 +47,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack011 + * @run main/othervm/timeout=900 nsk.stress.stack.stack011 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack012.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack012.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack012.java Fri Jun 21 14:07:48 2019 +0530 @@ -48,7 +48,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack012 + * @run main/othervm/timeout=900 nsk.stress.stack.stack012 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack013.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack013.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack013.java Fri Jun 21 14:07:48 2019 +0530 @@ -47,7 +47,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack013 + * @run main/othervm/timeout=900 nsk.stress.stack.stack013 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack014.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack014.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack014.java Fri Jun 21 14:07:48 2019 +0530 @@ -50,7 +50,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack014 + * @run main/othervm/timeout=900 nsk.stress.stack.stack014 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack015.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack015.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack015.java Fri Jun 21 14:07:48 2019 +0530 @@ -48,7 +48,7 @@ * 4366625 (P4/S4) multiple stack overflow causes HS crash * * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack015 + * @run main/othervm/timeout=900 nsk.stress.stack.stack015 */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack016.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack016.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack016.java Fri Jun 21 14:07:48 2019 +0530 @@ -51,7 +51,7 @@ * * @ignore 8139875 * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack016 -eager + * @run main/othervm/timeout=900 nsk.stress.stack.stack016 -eager */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack017.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack017.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack017.java Fri Jun 21 14:07:48 2019 +0530 @@ -44,7 +44,7 @@ * * @ignore 8139875 * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack017 -eager + * @run main/othervm/timeout=900 nsk.stress.stack.stack017 -eager */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack018.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack018.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack018.java Fri Jun 21 14:07:48 2019 +0530 @@ -49,7 +49,7 @@ * * @ignore 8139875 * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack018 -eager + * @run main/othervm/timeout=900 nsk.stress.stack.stack018 -eager */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack019.java --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack019.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack019.java Fri Jun 21 14:07:48 2019 +0530 @@ -42,7 +42,7 @@ * * @ignore 8139875 * @requires vm.opt.DeoptimizeALot != true - * @run main/othervm nsk.stress.stack.stack019 -eager + * @run main/othervm/timeout=900 nsk.stress.stack.stack019 -eager */ package nsk.stress.stack; diff -r 28582d575a98 -r fd4ec73925c3 test/jaxp/javax/xml/jaxp/unittest/transform/ProcessXSLT.java --- a/test/jaxp/javax/xml/jaxp/unittest/transform/ProcessXSLT.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/ProcessXSLT.java Fri Jun 21 14:07:48 2019 +0530 @@ -145,15 +145,12 @@ */ public static void main(String argv[]) { - // Runtime.getRuntime().traceMethodCalls(false); // turns Java tracing off boolean doStackDumpOnError = false; boolean doDiag = false; boolean setQuietMode = false; String msg = null; boolean isSecureProcessing = false; - // Runtime.getRuntime().traceMethodCalls(false); - // Runtime.getRuntime().traceInstructions(false); /** * The default diagnostic writer... */ diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/ProblemList-aot.txt --- a/test/jdk/ProblemList-aot.txt Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/ProblemList-aot.txt Fri Jun 21 14:07:48 2019 +0530 @@ -30,3 +30,5 @@ java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java 8222445 windows-x64 java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java 8222445 windows-x64 java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java 8222445 windows-x64 +java/lang/reflect/PublicMethods/PublicMethodsTest.java 8226309 generic-all +java/lang/constant/MethodTypeDescTest.java 8225349 windows-x64 diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/ProblemList-graal.txt --- a/test/jdk/ProblemList-graal.txt Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/ProblemList-graal.txt Fri Jun 21 14:07:48 2019 +0530 @@ -76,30 +76,15 @@ java/lang/ref/SoftReference/Pin.java 8196611 generic-all java/lang/Runtime/exec/LotsOfOutput.java 8196611 generic-all java/util/concurrent/ScheduledThreadPoolExecutor/BasicCancelTest.java 8196611 generic-all -vm/gc/InfiniteList.java 8196611 generic-all # tests require pop_frame and force_early_return capabilities -com/sun/jdi/RedefineTTYLineNumber.java 8195635 generic-all -com/sun/jdi/RedefineG.java 8195635 generic-all -com/sun/jdi/RedefineCrossStart.java 8195635 generic-all -com/sun/jdi/PopSynchronousTest.java 8195635 generic-all -com/sun/jdi/RedefineTTYLineNumber.java 8195635 generic-all -com/sun/jdi/RedefineG.java 8195635 generic-all -com/sun/jdi/RedefineCrossStart.java 8195635 generic-all -com/sun/jdi/PopSynchronousTest.java 8195635 generic-all -com/sun/jdi/PopAsynchronousTest.java 8195635 generic-all +com/sun/jdi/EarlyReturnTest.java 8195635 generic-all com/sun/jdi/PopAndStepTest.java 8195635 generic-all com/sun/jdi/PopAsynchronousTest.java 8195635 generic-all -com/sun/jdi/PopAndStepTest.java 8195635 generic-all -com/sun/jdi/EarlyReturnTest.java 8195635 generic-all -com/sun/jdi/RedefineTTYLineNumber.java 8195635 generic-all -com/sun/jdi/RedefineG.java 8195635 generic-all +com/sun/jdi/PopSynchronousTest.java 8195635 generic-all com/sun/jdi/RedefineCrossStart.java 8195635 generic-all -com/sun/jdi/PopSynchronousTest.java 8195635 generic-all -com/sun/jdi/PopAsynchronousTest.java 8195635 generic-all -com/sun/jdi/PopAndStepTest.java 8195635 generic-all -com/sun/jdi/EarlyReturnTest.java 8195635 generic-all -com/sun/jdi/EarlyReturnTest.java 8195635 generic-all +com/sun/jdi/RedefineG.java 8195635 generic-all +com/sun/jdi/RedefineTTYLineNumber.java 8195635 generic-all # Next JFR tests fail with Graal. Assuming 8193210. jdk/jfr/event/compiler/TestCodeSweeper.java 8193210 generic-all diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/ProblemList.txt --- a/test/jdk/ProblemList.txt Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/ProblemList.txt Fri Jun 21 14:07:48 2019 +0530 @@ -604,9 +604,6 @@ java/net/ServerSocket/AcceptInheritHandle.java 8211854 aix-ppc64 -java/net/Inet6Address/B6206527.java 8216417 macosx-all -java/net/ipv6tests/B6521014.java 8216417 macosx-all - ############################################################################ # jdk_nio @@ -659,7 +656,7 @@ sun/security/pkcs11/ec/TestKeyFactory.java 8026976 generic-all sun/security/pkcs11/Secmod/AddTrustedCert.java 8180837 generic-all sun/security/pkcs11/tls/TestKeyMaterial.java 8180837 generic-all -sun/security/pkcs11/tls/tls12/FipsModeTLS12.java 8224954 windows-all +sun/security/pkcs11/tls/tls12/FipsModeTLS12.java 8224954,8225678 windows-all,linux-all sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8161536 generic-all sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all @@ -736,7 +733,7 @@ javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java 8193942 generic-all javax/swing/JList/6462008/bug6462008.java 7156347 generic-all -javax/swing/JPopupMenu/6580930/bug6580930.java 8196096 windows-all,macosx-all +javax/swing/JPopupMenu/6580930/bug6580930.java 7124313 macosx-all javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all javax/swing/JPopupMenu/6675802/bug6675802.java 8196097 windows-all javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/MissingTrailingSpace.java --- a/test/jdk/com/sun/net/httpserver/MissingTrailingSpace.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/MissingTrailingSpace.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -25,9 +25,12 @@ * @test * @bug 8068795 * @summary HttpServer missing tailing space for some response codes + * @run main MissingTrailingSpace + * @run main/othervm -Djava.net.preferIPv6Addresses=true MissingTrailingSpace * @author lev.priima@oracle.com */ +import java.net.InetAddress; import java.net.InetSocketAddress; import java.io.InputStreamReader; import java.io.IOException; @@ -47,7 +50,8 @@ private static final String someContext = "/context"; public static void main(String[] args) throws Exception { - HttpServer server = HttpServer.create(new InetSocketAddress(0), 0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + HttpServer server = HttpServer.create(new InetSocketAddress(loopback, 0), 0); try { server.setExecutor(Executors.newFixedThreadPool(1)); server.createContext(someContext, new HttpHandler() { @@ -68,7 +72,7 @@ System.out.println("Server started at port " + server.getAddress().getPort()); - runRawSocketHttpClient("localhost", server.getAddress().getPort()); + runRawSocketHttpClient(loopback, server.getAddress().getPort()); } finally { ((ExecutorService)server.getExecutor()).shutdown(); server.stop(0); @@ -76,7 +80,7 @@ System.out.println("Server finished."); } - static void runRawSocketHttpClient(String hostname, int port) + static void runRawSocketHttpClient(InetAddress address, int port) throws Exception { Socket socket = null; @@ -84,7 +88,7 @@ BufferedReader reader = null; final String CRLF = "\r\n"; try { - socket = new Socket(hostname, port); + socket = new Socket(address, port); writer = new PrintWriter(new OutputStreamWriter( socket.getOutputStream())); System.out.println("Client connected by socket: " + socket); @@ -93,7 +97,7 @@ writer.print("User-Agent: Java/" + System.getProperty("java.version") + CRLF); - writer.print("Host: " + hostname + CRLF); + writer.print("Host: " + address.getHostName() + CRLF); writer.print("Accept: */*" + CRLF); writer.print("Connection: keep-alive" + CRLF); writer.print(CRLF); // Important, else the server will expect that @@ -140,4 +144,3 @@ System.out.println("Client finished." ); } } - diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test1.java --- a/test/jdk/com/sun/net/httpserver/Test1.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test1.java Fri Jun 21 14:07:48 2019 +0530 @@ -27,6 +27,7 @@ * @library /test/lib * @build jdk.test.lib.net.SimpleSSLContext * @run main/othervm Test1 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test1 * @run main/othervm -Djdk.net.usePlainSocketImpl Test1 * @run main/othervm -Dsun.net.httpserver.maxReqTime=10 Test1 * @run main/othervm -Dsun.net.httpserver.nodelay=true Test1 @@ -40,6 +41,7 @@ import java.net.*; import javax.net.ssl.*; import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; /* basic http/s connectivity test * Tests: @@ -64,7 +66,8 @@ try { String root = System.getProperty ("test.src")+ "/docs"; System.out.print ("Test1: "); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); s1 = HttpServer.create (addr, 0); if (s1 instanceof HttpsServer) { throw new RuntimeException ("should not be httpsserver"); @@ -104,8 +107,13 @@ } static void test (boolean fixedLen, String protocol, String root, int port, String f, int size) throws Exception { - URL url = new URL (protocol+"://localhost:"+port+"/test1/"+f); - HttpURLConnection urlc = (HttpURLConnection) url.openConnection(); + URL url = URIBuilder.newBuilder() + .scheme(protocol) + .loopback() + .port(port) + .path("/test1/"+f) + .toURL(); + HttpURLConnection urlc = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY); if (urlc instanceof HttpsURLConnection) { HttpsURLConnection urlcs = (HttpsURLConnection) urlc; urlcs.setHostnameVerifier (new HostnameVerifier () { diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test10.java --- a/test/jdk/com/sun/net/httpserver/Test10.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test10.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -26,6 +26,8 @@ * @bug 7005016 * @summary pit jdk7 b121 sqe test jhttp/HttpServer150013 failing * @run main/othervm -Dsun.net.httpserver.clockTick=1000 -Dsun.net.httpserver.idleInterval=3 Test10 + * @run main/othervm -Dsun.net.httpserver.clockTick=1000 -Dsun.net.httpserver.idleInterval=3 + * -Djava.net.preferIPv6Addresses Test10 */ import com.sun.net.httpserver.*; @@ -42,7 +44,8 @@ public static void main (String[] args) throws Exception { System.out.print ("Test10: "); Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); int port = server.getAddress().getPort(); HttpContext c2 = server.createContext ("/test", handler); @@ -78,7 +81,7 @@ public static void doClient (int port) throws Exception { String s = "GET /test/1.html HTTP/1.1\r\n\r\n"; - Socket socket = new Socket ("localhost", port); + Socket socket = new Socket (InetAddress.getLoopbackAddress(), port); OutputStream os = socket.getOutputStream(); os.write (s.getBytes()); socket.setSoTimeout (10 * 1000); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test11.java --- a/test/jdk/com/sun/net/httpserver/Test11.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test11.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,12 +25,16 @@ * @test * @bug 6270015 * @summary Light weight HTTP server + * @library /test/lib + * @run main Test11 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test11 */ import java.net.*; import java.util.concurrent.*; import java.io.*; import com.sun.net.httpserver.*; +import jdk.test.lib.net.URIBuilder; public class Test11 { static class Handler implements HttpHandler { @@ -51,7 +55,8 @@ public static void main (String[] args) throws Exception { System.out.print ("Test 11: "); - HttpServer server = HttpServer.create(new InetSocketAddress(0), 0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + HttpServer server = HttpServer.create(new InetSocketAddress(loopback, 0), 0); ExecutorService s = Executors.newCachedThreadPool(); try { HttpContext ctx = server.createContext ( @@ -59,9 +64,13 @@ ); s = Executors.newCachedThreadPool(); server.start (); - URL url = new URL ("http://localhost:" + server.getAddress().getPort()+ - "/Foo/bar/test.html"); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection(); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/Foo/bar/test.html") + .toURL(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); int r = urlc.getResponseCode(); if (r == 200) { throw new RuntimeException ("wrong response received"); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test12.java --- a/test/jdk/com/sun/net/httpserver/Test12.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test12.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -27,6 +27,7 @@ * @library /test/lib * @build jdk.test.lib.net.SimpleSSLContext * @run main/othervm Test12 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test12 * @summary Light weight HTTP server */ @@ -37,6 +38,7 @@ import java.net.*; import javax.net.ssl.*; import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; /* basic http/s connectivity test * Tests: @@ -56,7 +58,8 @@ try { String root = System.getProperty ("test.src")+ "/docs"; System.out.print ("Test12: "); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); s1 = HttpServer.create (addr, 0); s2 = HttpsServer.create (addr, 0); HttpHandler h = new FileServerHandler (root); @@ -130,8 +133,13 @@ public void run () { try { - URL url = new URL (protocol+"://localhost:"+port+"/test1/"+f); - HttpURLConnection urlc = (HttpURLConnection) url.openConnection(); + URL url = URIBuilder.newBuilder() + .scheme(protocol) + .loopback() + .port(port) + .path("/test1/"+f) + .toURL(); + HttpURLConnection urlc = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY); if (urlc instanceof HttpsURLConnection) { HttpsURLConnection urlcs = (HttpsURLConnection) urlc; urlcs.setHostnameVerifier (new HostnameVerifier () { diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test13.java --- a/test/jdk/com/sun/net/httpserver/Test13.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test13.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -27,6 +27,7 @@ * @library /test/lib * @build jdk.test.lib.net.SimpleSSLContext * @run main/othervm Test13 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test13 * @summary Light weight HTTP server */ @@ -38,6 +39,7 @@ import java.net.*; import javax.net.ssl.*; import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; /* basic http/s connectivity test * Tests: @@ -61,10 +63,12 @@ ha.setLevel(Level.ALL); l.setLevel(Level.ALL); l.addHandler(ha); + InetAddress loopback = InetAddress.getLoopbackAddress(); + try { String root = System.getProperty ("test.src")+ "/docs"; System.out.print ("Test13: "); - InetSocketAddress addr = new InetSocketAddress (0); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); s1 = HttpServer.create (addr, 0); s2 = HttpsServer.create (addr, 0); HttpHandler h = new FileServerHandler (root); @@ -136,8 +140,13 @@ public void run () { try { - URL url = new URL (protocol+"://localhost:"+port+"/test1/"+f); - HttpURLConnection urlc = (HttpURLConnection) url.openConnection(); + URL url = URIBuilder.newBuilder() + .scheme(protocol) + .loopback() + .port(port) + .path("/test1/"+f) + .toURL(); + HttpURLConnection urlc = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY); if (urlc instanceof HttpsURLConnection) { HttpsURLConnection urlcs = (HttpsURLConnection) urlc; urlcs.setHostnameVerifier (new HostnameVerifier () { diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test14.java --- a/test/jdk/com/sun/net/httpserver/Test14.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test14.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,6 +25,9 @@ * @test * @bug 6270015 * @summary Light weight HTTP server + * @library /test/lib + * @run main Test14 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test14 */ import com.sun.net.httpserver.*; @@ -36,6 +39,7 @@ import java.security.*; import javax.security.auth.callback.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; /** * Test filters @@ -77,7 +81,8 @@ public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); @@ -94,9 +99,14 @@ server.setExecutor (executor); server.start (); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); System.out.print ("Test14: " ); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); InputStream is = urlc.getInputStream(); int x = 0; String output=""; diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test2.java --- a/test/jdk/com/sun/net/httpserver/Test2.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test2.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,6 +25,9 @@ * @test * @bug 6270015 * @summary Light weight HTTP server + * @library /test/lib + * @run main Test2 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test2 */ import com.sun.net.httpserver.*; @@ -36,6 +39,7 @@ import java.security.*; import javax.security.auth.callback.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; /** * Test authentication @@ -45,7 +49,8 @@ public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); BasicAuthenticator a = new BasicAuthenticator ("foobar@test.realm") { @@ -60,9 +65,15 @@ server.start (); java.net.Authenticator.setDefault (new MyAuthenticator()); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + System.out.print ("Test2: " ); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); InputStream is = urlc.getInputStream(); int c = 0; while (is.read()!= -1) { diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test3.java --- a/test/jdk/com/sun/net/httpserver/Test3.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test3.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -26,6 +26,8 @@ * @bug 6270015 * @summary Light weight HTTP server * @run main/othervm -Dsun.net.httpserver.idleInterval=4 Test3 + * @run main/othervm -Djava.net.preferIPv6Addresses=true + * -Dsun.net.httpserver.idleInterval=4 Test3 */ import com.sun.net.httpserver.*; @@ -48,7 +50,8 @@ public static void main (String[] args) throws Exception { System.out.print ("Test3: "); Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); int port = server.getAddress().getPort(); HttpContext c2 = server.createContext ("/test", handler); @@ -135,7 +138,7 @@ "GET /test/4.html HTTP/1.1\r\nContent-length: 10\r\n"+ "\r\n"+body4; - Socket socket = new Socket ("localhost", port); + Socket socket = new Socket (InetAddress.getLoopbackAddress(), port); OutputStream os = socket.getOutputStream(); os.write (s.getBytes()); InputStream is = socket.getInputStream(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test4.java --- a/test/jdk/com/sun/net/httpserver/Test4.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test4.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -26,6 +26,8 @@ * @bug 6270015 * @summary Light weight HTTP server * @run main/othervm -Dsun.net.httpserver.idleInterval=4 Test4 + * @run main/othervm -Djava.net.preferIPv6Addresses=true + * -Dsun.net.httpserver.idleInterval=4 Test4 */ import com.sun.net.httpserver.*; @@ -46,7 +48,8 @@ public static void main (String[] args) throws Exception { System.out.print ("Test4: "); Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); int port = server.getAddress().getPort(); HttpContext c2 = server.createContext ("/test", handler); @@ -133,7 +136,7 @@ "GET /test/4.html HTTP/1.1\r\nContent-length: 10\r\n"+ "\r\n"+body4; - Socket socket = new Socket ("localhost", port); + Socket socket = new Socket (InetAddress.getLoopbackAddress(), port); OutputStream os = socket.getOutputStream(); os.write (s.getBytes()); InputStream is = socket.getInputStream(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test5.java --- a/test/jdk/com/sun/net/httpserver/Test5.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test5.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -26,6 +26,8 @@ * @bug 6270015 * @summary Light weight HTTP server * @run main/othervm -Dsun.net.httpserver.idleInterval=4 Test5 + * @run main/othervm -Djava.net.preferIPv6Addresses=true + * -Dsun.net.httpserver.idleInterval=4 Test5 */ import com.sun.net.httpserver.*; @@ -47,7 +49,8 @@ public static void main (String[] args) throws Exception { System.out.print ("Test5: "); Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); int port = server.getAddress().getPort(); HttpContext c2 = server.createContext ("/test", handler); @@ -132,7 +135,7 @@ "GET /test/4.html HTTP/1.1\r\nContent-length: 10\r\n"+ "\r\n"+body4; - Socket socket = new Socket ("localhost", port); + Socket socket = new Socket (InetAddress.getLoopbackAddress(), port); OutputStream os = socket.getOutputStream(); os.write (s.getBytes()); InputStream is = socket.getInputStream(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test6.java --- a/test/jdk/com/sun/net/httpserver/Test6.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test6.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,6 +25,9 @@ * @test * @bug 6270015 * @summary Light weight HTTP server + * @library /test/lib + * @run main Test6 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test6 */ import com.sun.net.httpserver.*; @@ -36,6 +39,7 @@ import java.security.*; import javax.security.auth.callback.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; /** * Test POST large file via chunked encoding (unusually small chunks) @@ -45,16 +49,23 @@ public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); ExecutorService executor = Executors.newCachedThreadPool(); server.setExecutor (executor); server.start (); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + System.out.print ("Test6: " ); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); urlc.setDoOutput (true); urlc.setRequestMethod ("POST"); urlc.setChunkedStreamingMode (32); // small chunks diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test7.java --- a/test/jdk/com/sun/net/httpserver/Test7.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test7.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -24,7 +24,10 @@ /** * @test * @bug 6270015 + * @library /test/lib * @summary Light weight HTTP server + * @run main Test7 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test7 */ import com.sun.net.httpserver.*; @@ -36,6 +39,7 @@ import java.security.*; import javax.security.auth.callback.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; /** * Test POST large file via chunked encoding (large chunks) @@ -45,16 +49,22 @@ public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); ExecutorService executor = Executors.newCachedThreadPool(); server.setExecutor (executor); server.start (); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); System.out.print ("Test7: " ); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); urlc.setDoOutput (true); urlc.setRequestMethod ("POST"); urlc.setChunkedStreamingMode (16 * 1024); // big chunks diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test7a.java --- a/test/jdk/com/sun/net/httpserver/Test7a.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test7a.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,8 +25,9 @@ * @test * @bug 6270015 * @library /test/lib - * @build jdk.test.lib.net.SimpleSSLContext + * @build jdk.test.lib.net.SimpleSSLContext jdk.test.lib.net.URIBuilder * @run main/othervm Test7a + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test7a * @summary Light weight HTTP server */ @@ -37,6 +38,7 @@ import java.net.*; import javax.net.ssl.*; import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; /** * Test POST large file via chunked encoding (large chunks) @@ -51,7 +53,8 @@ //h.setLevel (Level.ALL); //log.addHandler (h); Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpsServer server = HttpsServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); ExecutorService executor = Executors.newCachedThreadPool(); @@ -60,9 +63,15 @@ server.setExecutor (executor); server.start (); - URL url = new URL ("https://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + URL url = URIBuilder.newBuilder() + .scheme("https") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + System.out.print ("Test7a: " ); - HttpsURLConnection urlc = (HttpsURLConnection)url.openConnection (); + HttpsURLConnection urlc = (HttpsURLConnection)url.openConnection(Proxy.NO_PROXY); urlc.setDoOutput (true); urlc.setRequestMethod ("POST"); urlc.setChunkedStreamingMode (16 * 1024); // big chunks diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test8.java --- a/test/jdk/com/sun/net/httpserver/Test8.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test8.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -24,7 +24,10 @@ /** * @test * @bug 6270015 + * @library /test/lib * @summary Light weight HTTP server + * @run main Test8 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test8 */ import com.sun.net.httpserver.*; @@ -36,6 +39,7 @@ import java.security.*; import javax.security.auth.callback.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; /** * Test POST large file via fixed len encoding @@ -45,16 +49,23 @@ public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); ExecutorService executor = Executors.newCachedThreadPool(); server.setExecutor (executor); server.start (); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + System.out.print ("Test8: " ); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); urlc.setDoOutput (true); urlc.setRequestMethod ("POST"); OutputStream os = new BufferedOutputStream (urlc.getOutputStream()); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test8a.java --- a/test/jdk/com/sun/net/httpserver/Test8a.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test8a.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,8 +25,9 @@ * @test * @bug 6270015 * @library /test/lib - * @build jdk.test.lib.net.SimpleSSLContext + * @build jdk.test.lib.net.SimpleSSLContext jdk.test.lib.net.URIBuilder * @run main/othervm Test8a + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test8a * @summary Light weight HTTP server */ @@ -37,6 +38,7 @@ import java.net.*; import javax.net.ssl.*; import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; /** * Test POST large file via fixed len encoding @@ -54,7 +56,8 @@ ExecutorService executor = null; try { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); server = HttpsServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); executor = Executors.newCachedThreadPool(); @@ -63,9 +66,15 @@ server.setExecutor (executor); server.start (); - URL url = new URL ("https://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + URL url = URIBuilder.newBuilder() + .scheme("https") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + System.out.print ("Test8a: " ); - HttpsURLConnection urlc = (HttpsURLConnection)url.openConnection (); + HttpsURLConnection urlc = (HttpsURLConnection)url.openConnection(Proxy.NO_PROXY); urlc.setDoOutput (true); urlc.setRequestMethod ("POST"); urlc.setHostnameVerifier (new DummyVerifier()); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test9.java --- a/test/jdk/com/sun/net/httpserver/Test9.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test9.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,8 +25,9 @@ * @test * @bug 6270015 * @library /test/lib - * @build jdk.test.lib.net.SimpleSSLContext + * @build jdk.test.lib.net.SimpleSSLContext jdk.test.lib.net.URIBuilder * @run main/othervm Test9 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test9 * @summary Light weight HTTP server */ @@ -37,6 +38,7 @@ import java.net.*; import javax.net.ssl.*; import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; /* Same as Test1 but requests run in parallel. */ @@ -53,7 +55,8 @@ try { String root = System.getProperty ("test.src")+ "/docs"; System.out.print ("Test9: "); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); s1 = HttpServer.create (addr, 0); s2 = HttpsServer.create (addr, 0); HttpHandler h = new FileServerHandler (root); @@ -137,8 +140,14 @@ public void run () { try { - URL url = new URL (protocol+"://localhost:"+port+"/test1/"+f); - HttpURLConnection urlc = (HttpURLConnection) url.openConnection(); + URL url = URIBuilder.newBuilder() + .scheme(protocol) + .loopback() + .port(port) + .path("/test1/" + f) + .toURL(); + + HttpURLConnection urlc = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY); if (urlc instanceof HttpsURLConnection) { HttpsURLConnection urlcs = (HttpsURLConnection) urlc; urlcs.setHostnameVerifier (new HostnameVerifier () { @@ -185,7 +194,8 @@ String orig = root + "/" + f; compare (new File(orig), temp); temp.delete(); - } catch (IOException e) { + } catch (Exception e) { + e.printStackTrace(); error = true; } } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/Test9a.java --- a/test/jdk/com/sun/net/httpserver/Test9a.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/Test9a.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,8 +25,9 @@ * @test * @bug 6270015 * @library /test/lib - * @build jdk.test.lib.net.SimpleSSLContext + * @build jdk.test.lib.net.SimpleSSLContext jdk.test.lib.net.URIBuilder * @run main/othervm Test9a + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test9a * @summary Light weight HTTP server */ @@ -37,6 +38,7 @@ import java.net.*; import javax.net.ssl.*; import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; /* Same as Test1 but requests run in parallel. */ @@ -53,7 +55,8 @@ try { String root = System.getProperty ("test.src")+ "/docs"; System.out.print ("Test9a: "); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); server = HttpsServer.create (addr, 0); HttpHandler h = new FileServerHandler (root); HttpContext c1 = server.createContext ("/test1", h); @@ -131,8 +134,14 @@ public void run () { try { - URL url = new URL (protocol+"://localhost:"+port+"/test1/"+f); - HttpURLConnection urlc = (HttpURLConnection) url.openConnection(); + URL url = URIBuilder.newBuilder() + .scheme(protocol) + .loopback() + .port(port) + .path("/test1/" + f) + .toURL(); + + HttpURLConnection urlc = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY); if (urlc instanceof HttpsURLConnection) { HttpsURLConnection urlcs = (HttpsURLConnection) urlc; urlcs.setHostnameVerifier (new HostnameVerifier () { @@ -179,7 +188,7 @@ String orig = root + "/" + f; compare (new File(orig), temp); temp.delete(); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); error = true; } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/TestLogging.java --- a/test/jdk/com/sun/net/httpserver/TestLogging.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/TestLogging.java Fri Jun 21 14:07:48 2019 +0530 @@ -26,6 +26,8 @@ * @bug 6422914 * @library /test/lib * @summary change httpserver exception printouts + * @run main TestLogging + * @run main/othervm -Djava.net.preferIPv6Addresses=true TestLogging */ import com.sun.net.httpserver.*; @@ -49,7 +51,8 @@ try { System.out.print ("Test9: "); String root = System.getProperty ("test.src")+ "/docs"; - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); Logger logger = Logger.getLogger ("com.sun.net.httpserver"); logger.setLevel (Level.ALL); Handler h1 = new ConsoleHandler (); @@ -70,9 +73,9 @@ .loopback() .port(p1) .path("/test1/smallfile.txt") - .toURLUnchecked(); + .toURL(); System.out.println("URL: " + url); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); InputStream is = urlc.getInputStream(); while (is.read() != -1) ; is.close(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6339483.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6339483.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6339483.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,6 +25,9 @@ * @test * @bug 6339483 * @summary NullPointerException when creating a HttpContext with no handler + * @library /test/lib + * @run main B6339483 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6339483 */ import com.sun.net.httpserver.*; @@ -36,19 +39,26 @@ import java.security.*; import java.security.cert.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; public class B6339483 { public static void main (String[] args) throws Exception { - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test"); ExecutorService executor = Executors.newCachedThreadPool(); server.setExecutor (executor); server.start (); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); try { InputStream is = urlc.getInputStream(); int c = 0; diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6341616.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6341616.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6341616.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -24,6 +24,9 @@ /** * @test * @bug 6341616 + * @library /test/lib + * @run main B6341616 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6341616 * @summary Server doesnt send response if there is a RuntimeException in validate of BasicAuthFilter */ @@ -36,12 +39,14 @@ import java.security.*; import java.security.cert.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; public class B6341616 { public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); BasicAuthenticator filter = new BasicAuthenticator ("foobar@test.realm") { @@ -56,8 +61,13 @@ server.start (); java.net.Authenticator.setDefault (new MyAuthenticator()); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); try { InputStream is = urlc.getInputStream(); int c = 0; diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6373555.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6373555.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6373555.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -26,6 +26,8 @@ * @bug 6373555 * @library /test/lib * @summary HTTP Server failing to answer client requests + * @run main B6373555 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6373555 */ import java.net.*; @@ -105,7 +107,7 @@ .path("/test") .toURLUnchecked(); System.out.println("URL: " + url); - HttpURLConnection con = (HttpURLConnection)url.openConnection(); + HttpURLConnection con = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); con.setDoOutput(true); con.setDoInput(true); con.setRequestMethod("POST"); @@ -148,7 +150,8 @@ private static HttpServer createHttpServer(ExecutorService execs) throws Exception { - InetSocketAddress inetAddress = new InetSocketAddress(0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress inetAddress = new InetSocketAddress(loopback, 0); HttpServer testServer = HttpServer.create(inetAddress, 15); testServer.setExecutor(execs); HttpContext context = testServer.createContext("/test"); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6393710.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6393710.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6393710.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -25,6 +25,8 @@ * @test * @bug 6393710 * @summary Non authenticated call followed by authenticated call never returns + * @run main B6393710 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6393710 */ import com.sun.net.httpserver.*; @@ -65,7 +67,8 @@ public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); ctx.setAuthenticator (new BasicAuthenticator ("test") { @@ -76,7 +79,7 @@ server.start (); - Socket s = new Socket ("localhost", server.getAddress().getPort()); + Socket s = new Socket (loopback, server.getAddress().getPort()); s.setSoTimeout (5000); OutputStream os = s.getOutputStream(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6401598.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6401598.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6401598.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -26,11 +26,14 @@ * @library /test/lib * @bug 6401598 * @summary new HttpServer cannot serve binary stream data + * @run main B6401598 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6401598 */ import java.io.*; import java.net.HttpURLConnection; import java.net.MalformedURLException; +import java.net.Proxy; import java.net.URL; import java.net.InetAddress; import java.net.InetSocketAddress; @@ -84,7 +87,8 @@ public static void main(String[] args) { try { - server = HttpServer.create(new InetSocketAddress(0), 400); + InetAddress loopback = InetAddress.getLoopbackAddress(); + server = HttpServer.create(new InetSocketAddress(loopback, 0), 400); server.createContext("/server/", new MyHandler()); exec = Executors.newFixedThreadPool(3); server.setExecutor(exec); @@ -123,11 +127,9 @@ dis.close(); } System.out.println ("Stopping"); - server.stop (1); - exec.shutdown(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + } catch (Exception e) { + throw new AssertionError("Unexpected exception: " + e, e); + } finally { server.stop (1); exec.shutdown(); } @@ -137,7 +139,8 @@ static HttpURLConnection getHttpURLConnection(URL url, int timeout) throws IOException { - HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); + HttpURLConnection httpURLConnection = + (HttpURLConnection) url.openConnection(Proxy.NO_PROXY); httpURLConnection.setConnectTimeout(40000); httpURLConnection.setReadTimeout(timeout); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6431193.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6431193.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6431193.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -24,13 +24,17 @@ /** * @test * @bug 6431193 + * @library /test/lib * @summary The new HTTP server exits immediately + * @run main B6431193 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6431193 */ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.*; +import jdk.test.lib.net.URIBuilder; import com.sun.net.httpserver.*; @@ -44,8 +48,8 @@ } /** - * @param args - */ + * @param args + */ public static void main(String[] args) { class MyHandler implements HttpHandler { public void handle(HttpExchange t) throws IOException { @@ -64,7 +68,8 @@ HttpServer server; try { - server = HttpServer.create(new InetSocketAddress(0), 10); + InetAddress loopback = InetAddress.getLoopbackAddress(); + server = HttpServer.create(new InetSocketAddress(loopback, 0), 10); server.createContext("/apps", new MyHandler()); server.setExecutor(null); @@ -72,8 +77,13 @@ server.start(); int port = server.getAddress().getPort(); String s = "http://localhost:"+port+"/apps/foo"; - URL url = new URL (s); - InputStream is = url.openStream(); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(port) + .path("/apps/foo") + .toURL(); + InputStream is = url.openConnection(Proxy.NO_PROXY).getInputStream(); read (is); server.stop (1); if (error) { @@ -81,9 +91,8 @@ } } - catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + catch (Exception e) { + throw new AssertionError("Unexpected exception: " + e, e); } } } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6433018.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6433018.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6433018.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -25,6 +25,8 @@ * @test * @bug 6433018 * @summary HTTP server sometimes sends bad request for browsers javascript + * @run main B6433018 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6433018 */ import com.sun.net.httpserver.*; @@ -63,13 +65,14 @@ public static void main(String[] args) throws Exception { CountDownLatch finished = new CountDownLatch(2); Handler handler = new Handler(finished); - InetSocketAddress addr = new InetSocketAddress(0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create(addr, 0); HttpContext ctx = server.createContext("/test", handler); server.start(); int port = server.getAddress().getPort(); - try (Socket s = new Socket("localhost", port); + try (Socket s = new Socket(loopback, port); OutputStream os = s.getOutputStream()) { os.write(cmd.getBytes()); finished.await(30, TimeUnit.SECONDS); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6526158.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6526158.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6526158.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -24,6 +24,9 @@ /** * @test * @bug 6526158 + * @library /test/lib + * @run main B6526158 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6526158 * @summary HttpExchange.getRequestBody().close() throws Exception */ @@ -36,6 +39,7 @@ import java.security.*; import java.security.cert.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; public class B6526158 { @@ -44,7 +48,8 @@ public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); @@ -52,8 +57,13 @@ server.setExecutor (executor); server.start (); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); urlc.setDoOutput (true); try { OutputStream os = new BufferedOutputStream (urlc.getOutputStream()); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6526913.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6526913.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6526913.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -24,7 +24,10 @@ /** * @test * @bug 6526913 + * @library /test/lib * @run main/othervm -Dhttp.keepAlive=false B6526913 + * @run main/othervm -Djava.net.preferIPv6Addresses=true + * -Dhttp.keepAlive=false B6526913 * @summary HttpExchange.getResponseBody().close() throws Exception */ @@ -37,12 +40,14 @@ import java.security.*; import java.security.cert.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; public class B6526913 { public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); @@ -50,8 +55,13 @@ server.setExecutor (executor); server.start (); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection (Proxy.NO_PROXY); try { InputStream is = urlc.getInputStream(); int c ,count = 0; diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6529200.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6529200.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6529200.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -25,6 +25,7 @@ * @test * @bug 6529200 * @run main/othervm B6529200 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6529200 * @summary lightweight http server does not work with http1.0 clients */ @@ -42,7 +43,8 @@ public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); @@ -52,7 +54,7 @@ /* test 1: keep-alive */ - Socket sock = new Socket ("localhost", server.getAddress().getPort()); + Socket sock = new Socket (loopback, server.getAddress().getPort()); OutputStream os = sock.getOutputStream(); System.out.println ("GET /test/foo HTTP/1.0\r\nConnection: keep-alive\r\n\r\n"); os.write ("GET /test/foo HTTP/1.0\r\nConnection: keep-alive\r\n\r\n".getBytes()); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6744329.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6744329.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6744329.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,6 +25,9 @@ * @test * @bug 6744329 * @summary Exception in light weight Http server + * @library /test/lib + * @run main B6744329 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6744329 */ import com.sun.net.httpserver.*; @@ -36,20 +39,27 @@ import java.security.*; import java.security.cert.*; import javax.net.ssl.*; +import jdk.test.lib.net.URIBuilder; public class B6744329 { public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); ExecutorService executor = Executors.newCachedThreadPool(); server.setExecutor (executor); server.start (); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); try { InputStream is = urlc.getInputStream(); int c = 0; @@ -59,6 +69,7 @@ System.out.println ("OK"); } catch (IOException e) { System.out.println ("exception"); + e.printStackTrace(); error = true; } server.stop(2); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B6886436.java --- a/test/jdk/com/sun/net/httpserver/bugs/B6886436.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B6886436.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -24,7 +24,10 @@ /** * @test * @bug 6886436 - * @summary + * @summary HttpServer should not send a body with 204 response. + * @library /test/lib + * @run main B6886436 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B6886436 */ import com.sun.net.httpserver.*; @@ -34,6 +37,7 @@ import java.util.logging.*; import java.io.*; import java.net.*; +import jdk.test.lib.net.URIBuilder; public class B6886436 { @@ -44,20 +48,26 @@ logger.addHandler (c); logger.setLevel (Level.WARNING); Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); HttpServer server = HttpServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); ExecutorService executor = Executors.newCachedThreadPool(); server.setExecutor (executor); server.start (); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); try { InputStream is = urlc.getInputStream(); while (is.read()!= -1) ; is.close (); - urlc = (HttpURLConnection)url.openConnection (); + urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); urlc.setReadTimeout (3000); is = urlc.getInputStream(); while (is.read()!= -1); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/B8211420.java --- a/test/jdk/com/sun/net/httpserver/bugs/B8211420.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/B8211420.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -24,7 +24,9 @@ /** * @test * @bug 8211420 + * @library /test/lib * @run main/othervm B8211420 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B8211420 * @summary */ @@ -36,45 +38,53 @@ import java.io.*; import java.net.*; +import jdk.test.lib.net.URIBuilder; + public class B8211420 { - public static void main (String[] args) throws Exception { - Logger logger = Logger.getLogger ("com.sun.net.httpserver"); + public static void main(String[] args) throws Exception { + Logger logger = Logger.getLogger("com.sun.net.httpserver"); ConsoleHandler c = new ConsoleHandler(); - c.setLevel (Level.WARNING); - logger.addHandler (c); - logger.setLevel (Level.WARNING); + c.setLevel(Level.WARNING); + logger.addHandler(c); + logger.setLevel(Level.WARNING); Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); - HttpServer server = HttpServer.create (addr, 0); - HttpContext ctx = server.createContext ("/test", handler); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); + HttpServer server = HttpServer.create(addr, 0); + HttpContext ctx = server.createContext("/test", handler); ExecutorService executor = Executors.newCachedThreadPool(); - server.setExecutor (executor); - server.start (); + server.setExecutor(executor); + server.start(); - URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + URL url = URIBuilder.newBuilder() + .scheme("http") + .host(server.getAddress().getAddress()) + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURL(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); try { InputStream is = urlc.getInputStream(); while (is.read()!= -1) ; is.close (); String prop = urlc.getHeaderField("Content-length"); - System.out.println ("Content-length = " + prop + " should be null"); + System.out.println("Content-length = " + prop + " should be null"); if (prop != null) throw new RuntimeException("Content-length was present"); - urlc = (HttpURLConnection)url.openConnection(); + urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); is = urlc.getInputStream(); while (is.read()!= -1) ; - is.close (); + is.close(); if (urlc.getResponseCode() != 304) // expected for 2nd test throw new RuntimeException("wrong response code"); String clen = urlc.getHeaderField("Content-length"); - System.out.println ("Content-length = " + clen + " should be 99"); - System.out.println ("len = " + clen.length()); + System.out.println("Content-length = " + clen + " should be 99"); + System.out.println("len = " + clen.length()); if (clen == null || !clen.equals("99")) throw new RuntimeException("Content-length not present or has wrong value"); - System.out.println ("OK"); + System.out.println("OK"); } finally { server.stop(2); executor.shutdown(); @@ -91,7 +101,7 @@ InputStream is = t.getRequestBody(); Headers map = t.getRequestHeaders(); Headers rmap = t.getResponseHeaders(); - while (is.read () != -1) ; + while (is.read() != -1) ; is.close(); if (invocation++ == 1) { // send a 204 response with no body diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/FixedLengthInputStream.java --- a/test/jdk/com/sun/net/httpserver/bugs/FixedLengthInputStream.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/FixedLengthInputStream.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -25,20 +25,26 @@ * @test * @bug 6756771 6755625 * @summary com.sun.net.httpserver.HttpServer should handle POSTs larger than 2Gig + * @library /test/lib + * @run main FixedLengthInputStream + * @run main/othervm -Djava.net.preferIPv6Addresses=true FixedLengthInputStream */ import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.HttpURLConnection; +import java.net.Proxy; import java.net.URL; import java.net.Socket; import java.util.logging.*; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; +import jdk.test.lib.net.URIBuilder; public class FixedLengthInputStream { @@ -48,8 +54,13 @@ HttpServer httpServer = startHttpServer(); int port = httpServer.getAddress().getPort(); try { - URL url = new URL("http://localhost:" + port + "/flis/"); - HttpURLConnection uc = (HttpURLConnection)url.openConnection(); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(port) + .path("/flis/") + .toURLUnchecked(); + HttpURLConnection uc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); uc.setDoOutput(true); uc.setRequestMethod("POST"); uc.setFixedLengthStreamingMode(POST_SIZE); @@ -90,7 +101,8 @@ logger.setLevel(Level.FINEST); logger.addHandler(outHandler); } - HttpServer httpServer = HttpServer.create(new InetSocketAddress(0), 0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + HttpServer httpServer = HttpServer.create(new InetSocketAddress(loopback, 0), 0); httpServer.createContext("/flis/", new MyHandler(POST_SIZE)); httpServer.start(); return httpServer; diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/HeadTest.java --- a/test/jdk/com/sun/net/httpserver/bugs/HeadTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/HeadTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -24,11 +24,16 @@ /** * @test * @bug 6886723 + * @library /test/lib + * @run main HeadTest + * @run main/othervm -Djava.net.preferIPv6Addresses=true HeadTest * @summary light weight http server doesn't return correct status code for HEAD requests */ +import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.HttpURLConnection; +import java.net.Proxy; import java.net.URL; import java.io.IOException; import java.util.concurrent.ExecutorService; @@ -37,6 +42,7 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; +import jdk.test.lib.net.URIBuilder; public class HeadTest { @@ -45,7 +51,8 @@ } static void server() throws Exception { - InetSocketAddress inetAddress = new InetSocketAddress(0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress inetAddress = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create(inetAddress, 5); try { server.setExecutor(Executors.newFixedThreadPool(5)); @@ -88,7 +95,13 @@ } }); server.start(); - String urlStr = "http://localhost:" + server.getAddress().getPort() + "/"; + String urlStr = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/") + .build() + .toString(); System.out.println("Server is at " + urlStr); // Run the chunked client @@ -107,7 +120,7 @@ } static void runClient(String urlStr) throws Exception { - HttpURLConnection conn = (HttpURLConnection) new URL(urlStr).openConnection(); + HttpURLConnection conn = (HttpURLConnection) new URL(urlStr).openConnection(Proxy.NO_PROXY); conn.setRequestMethod("HEAD"); int status = conn.getResponseCode(); if (status != 200) { diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/com/sun/net/httpserver/bugs/TruncatedRequestBody.java --- a/test/jdk/com/sun/net/httpserver/bugs/TruncatedRequestBody.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/com/sun/net/httpserver/bugs/TruncatedRequestBody.java Fri Jun 21 14:07:48 2019 +0530 @@ -90,7 +90,8 @@ logger.setLevel(Level.ALL); logger.addHandler(h); - InetSocketAddress addr = new InetSocketAddress(0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create(addr, 10); HttpContext ct = server.createContext("/", new Handler()); ExecutorService ex = Executors.newCachedThreadPool(); @@ -101,7 +102,7 @@ // Test 1: fixed length - Socket sock = new Socket(InetAddress.getLoopbackAddress(), port); + Socket sock = new Socket(loopback, port); String s1 = "POST /foo HTTP/1.1\r\nContent-length: 200000\r\n" + "\r\nfoo bar99"; @@ -115,7 +116,7 @@ String s2 = "POST /foo HTTP/1.1\r\nTransfer-encoding: chunked\r\n\r\n" + "100\r\nFoo bar"; - sock = new Socket(InetAddress.getLoopbackAddress(), port); + sock = new Socket(loopback, port); os = sock.getOutputStream(); os.write(s2.getBytes(StandardCharsets.ISO_8859_1)); Thread.sleep(500); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java --- a/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -38,7 +38,7 @@ * @bug 8073320 * @summary Windows HiDPI support * @author Alexander Scherbatiy - * @requires (os.family == "windows") + * @requires (os.family == "linux" | os.family == "windows") * @run main/othervm -Dsun.java2d.win.uiScaleX=3 -Dsun.java2d.win.uiScaleY=2 * HiDPIRobotScreenCaptureTest */ @@ -50,11 +50,13 @@ public static void main(String[] args) throws Exception { - try { - UIManager.setLookAndFeel( - "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); - } catch (Exception e) { - return; + if (System.getProperty("os.name").toLowerCase().contains("win")) { + try { + UIManager.setLookAndFeel( + "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + } catch (Exception e) { + return; + } } Frame frame = new Frame(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/lang/annotation/AnnotationToStringTest.java --- a/test/jdk/java/lang/annotation/AnnotationToStringTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/lang/annotation/AnnotationToStringTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 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 @@ -27,6 +27,9 @@ * @summary Test of toString on normal annotations */ +// See also the sibling compile-time test +// test/langtools/tools/javac/processing/model/element/AnnotationToStringTest.java + import java.lang.annotation.*; import java.lang.reflect.*; import java.util.*; @@ -62,22 +65,25 @@ @ExpectedString( "@MostlyPrimitive(c0='a', "+ "c1='\\'', " + + "b0=(byte)0x01, " + "i0=1, " + "i1=2, " + "f0=1.0f, " + "f1=0.0f/0.0f, " + "d0=0.0, " + "d1=1.0/0.0, " + - "l0=5, " + + "l0=5L, " + "l1=9223372036854775807L, " + "l2=-9223372036854775808L, " + - "l3=-2147483648, " + + "l3=-2147483648L, " + "s0=\"Hello world.\", " + "s1=\"a\\\"b\", " + - "class0=Obj[].class)") + "class0=Obj[].class, " + + "classArray={Obj[].class})") @MostlyPrimitive( c0='a', c1='\'', + b0=1, i0=1, i1=2, f0=1.0f, @@ -90,7 +96,8 @@ l3=Integer.MIN_VALUE, s0="Hello world.", s1="a\"b", - class0=Obj[].class + class0=Obj[].class, + classArray={Obj[].class} ) static class PrimHost{} @@ -107,33 +114,33 @@ static class AnnotationHost { @ExpectedString( - "@Classy(value=Obj.class)") - @Classy(value=Obj.class) + "@Classy(Obj.class)") + @Classy(Obj.class) public int f0; @ExpectedString( - "@Classy(value=Obj[].class)") - @Classy(value=Obj[].class) + "@Classy(Obj[].class)") + @Classy(Obj[].class) public int f1; @ExpectedString( - "@Classy(value=Obj[][].class)") - @Classy(value=Obj[][].class) + "@Classy(Obj[][].class)") + @Classy(Obj[][].class) public int f2; @ExpectedString( - "@Classy(value=Obj[][][].class)") - @Classy(value=Obj[][][].class) + "@Classy(Obj[][][].class)") + @Classy(Obj[][][].class) public int f3; @ExpectedString( - "@Classy(value=int.class)") - @Classy(value=int.class) + "@Classy(int.class)") + @Classy(int.class) public int f4; @ExpectedString( - "@Classy(value=int[][][].class)") - @Classy(value=int[][][].class) + "@Classy(int[][][].class)") + @Classy(int[][][].class) public int f5; } @@ -154,60 +161,60 @@ static class ArrayAnnotationHost { @ExpectedString( - "@BooleanArray(value={true, false, true})") - @BooleanArray(value={true, false, true}) + "@BooleanArray({true, false, true})") + @BooleanArray({true, false, true}) public boolean[] f0; @ExpectedString( - "@FloatArray(value={3.0f, 4.0f, 0.0f/0.0f, -1.0f/0.0f, 1.0f/0.0f})") - @FloatArray(value={3.0f, 4.0f, Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY}) + "@FloatArray({3.0f, 4.0f, 0.0f/0.0f, -1.0f/0.0f, 1.0f/0.0f})") + @FloatArray({3.0f, 4.0f, Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY}) public float[] f1; @ExpectedString( - "@DoubleArray(value={1.0, 2.0, 0.0/0.0, 1.0/0.0, -1.0/0.0})") - @DoubleArray(value={1.0, 2.0, Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,}) + "@DoubleArray({1.0, 2.0, 0.0/0.0, 1.0/0.0, -1.0/0.0})") + @DoubleArray({1.0, 2.0, Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,}) public double[] f2; @ExpectedString( - "@ByteArray(value={10, 11, 12})") - @ByteArray(value={10, 11, 12}) + "@ByteArray({(byte)0x0a, (byte)0x0b, (byte)0x0c})") + @ByteArray({10, 11, 12}) public byte[] f3; @ExpectedString( - "@ShortArray(value={0, 4, 5})") - @ShortArray(value={0, 4, 5}) + "@ShortArray({0, 4, 5})") + @ShortArray({0, 4, 5}) public short[] f4; @ExpectedString( - "@CharArray(value={'a', 'b', 'c', '\\''})") - @CharArray(value={'a', 'b', 'c', '\''}) + "@CharArray({'a', 'b', 'c', '\\''})") + @CharArray({'a', 'b', 'c', '\''}) public char[] f5; @ExpectedString( - "@IntArray(value={1})") - @IntArray(value={1}) + "@IntArray({1})") + @IntArray({1}) public int[] f6; @ExpectedString( - "@LongArray(value={-9223372036854775808L, -2147483649L, -2147483648," + - " -2147483647, 2147483648L, 9223372036854775807L})") - @LongArray(value={Long.MIN_VALUE, Integer.MIN_VALUE-1L, Integer.MIN_VALUE, + "@LongArray({-9223372036854775808L, -2147483649L, -2147483648L," + + " -2147483647L, 2147483648L, 9223372036854775807L})") + @LongArray({Long.MIN_VALUE, Integer.MIN_VALUE-1L, Integer.MIN_VALUE, -Integer.MAX_VALUE, Integer.MAX_VALUE+1L, Long.MAX_VALUE}) public long[] f7; @ExpectedString( - "@StringArray(value={\"A\", \"B\", \"C\", \"\\\"Quote\\\"\"})") - @StringArray(value={"A", "B", "C", "\"Quote\""}) + "@StringArray({\"A\", \"B\", \"C\", \"\\\"Quote\\\"\"})") + @StringArray({"A", "B", "C", "\"Quote\""}) public String[] f8; @ExpectedString( - "@ClassArray(value={int.class, Obj[].class})") - @ClassArray(value={int.class, Obj[].class}) + "@ClassArray({int.class, Obj[].class})") + @ClassArray({int.class, Obj[].class}) public Class[] f9; @ExpectedString( - "@EnumArray(value={SOURCE})") - @EnumArray(value={RetentionPolicy.SOURCE}) + "@EnumArray({SOURCE})") + @EnumArray({RetentionPolicy.SOURCE}) public RetentionPolicy[] f10; } } @@ -285,6 +292,7 @@ @interface MostlyPrimitive { char c0(); char c1(); + byte b0(); int i0(); int i1(); float f0(); @@ -298,4 +306,5 @@ String s0(); String s1(); Class class0(); + Class[] classArray(); } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/lang/annotation/ParameterAnnotations.java --- a/test/jdk/java/lang/annotation/ParameterAnnotations.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/lang/annotation/ParameterAnnotations.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -89,8 +89,8 @@ equal(ann.length, 2); Annotation foo = ann[0][0]; Annotation bar = ann[1][0]; - equal(foo.toString(), "@Named(value=\"foo\")"); - equal(bar.toString(), "@Named(value=\"bar\")"); + equal(foo.toString(), "@Named(\"foo\")"); + equal(bar.toString(), "@Named(\"bar\")"); check(foo.equals(foo)); check(! foo.equals(bar)); } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/lang/annotation/TestConstructorParameterAnnotations.java --- a/test/jdk/java/lang/annotation/TestConstructorParameterAnnotations.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/lang/annotation/TestConstructorParameterAnnotations.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -129,21 +129,21 @@ @ExpectedGetParameterAnnotations( "[[], " + - "[@TestConstructorParameterAnnotations$MarkerAnnotation(value=1)]]") + "[@TestConstructorParameterAnnotations$MarkerAnnotation(1)]]") @ExpectedParameterAnnotations({ "null", - "@TestConstructorParameterAnnotations$MarkerAnnotation(value=1)"}) + "@TestConstructorParameterAnnotations$MarkerAnnotation(1)"}) public class NestedClass1 { public NestedClass1(@MarkerAnnotation(1) int parameter) {} } @ExpectedGetParameterAnnotations( "[[], " + - "[@TestConstructorParameterAnnotations$MarkerAnnotation(value=2)], " + + "[@TestConstructorParameterAnnotations$MarkerAnnotation(2)], " + "[]]") @ExpectedParameterAnnotations({ "null", - "@TestConstructorParameterAnnotations$MarkerAnnotation(value=2)", + "@TestConstructorParameterAnnotations$MarkerAnnotation(2)", "null"}) public class NestedClass2 { public NestedClass2(@MarkerAnnotation(2) int parameter1, @@ -152,11 +152,11 @@ @ExpectedGetParameterAnnotations( "[[], " + - "[@TestConstructorParameterAnnotations$MarkerAnnotation(value=3)], " + + "[@TestConstructorParameterAnnotations$MarkerAnnotation(3)], " + "[]]") @ExpectedParameterAnnotations({ "null", - "@TestConstructorParameterAnnotations$MarkerAnnotation(value=3)", + "@TestConstructorParameterAnnotations$MarkerAnnotation(3)", "null"}) public class NestedClass3 { public

    NestedClass3(@MarkerAnnotation(3) P parameter1, @@ -165,11 +165,11 @@ @ExpectedGetParameterAnnotations( "[[], " + - "[@TestConstructorParameterAnnotations$MarkerAnnotation(value=4)], " + + "[@TestConstructorParameterAnnotations$MarkerAnnotation(4)], " + "[]]") @ExpectedParameterAnnotations({ "null", - "@TestConstructorParameterAnnotations$MarkerAnnotation(value=4)", + "@TestConstructorParameterAnnotations$MarkerAnnotation(4)", "null"}) public class NestedClass4 { public NestedClass4(@MarkerAnnotation(4) P parameter1, @@ -183,18 +183,18 @@ } @ExpectedGetParameterAnnotations( - "[[@TestConstructorParameterAnnotations$MarkerAnnotation(value=1)]]") + "[[@TestConstructorParameterAnnotations$MarkerAnnotation(1)]]") @ExpectedParameterAnnotations({ - "@TestConstructorParameterAnnotations$MarkerAnnotation(value=1)"}) + "@TestConstructorParameterAnnotations$MarkerAnnotation(1)"}) public static class StaticNestedClass1 { public StaticNestedClass1(@MarkerAnnotation(1) int parameter) {} } @ExpectedGetParameterAnnotations( - "[[@TestConstructorParameterAnnotations$MarkerAnnotation(value=2)], " + + "[[@TestConstructorParameterAnnotations$MarkerAnnotation(2)], " + "[]]") @ExpectedParameterAnnotations({ - "@TestConstructorParameterAnnotations$MarkerAnnotation(value=2)", + "@TestConstructorParameterAnnotations$MarkerAnnotation(2)", "null"}) public static class StaticNestedClass2 { public StaticNestedClass2(@MarkerAnnotation(2) int parameter1, @@ -202,10 +202,10 @@ } @ExpectedGetParameterAnnotations( - "[[@TestConstructorParameterAnnotations$MarkerAnnotation(value=3)], " + + "[[@TestConstructorParameterAnnotations$MarkerAnnotation(3)], " + "[]]") @ExpectedParameterAnnotations({ - "@TestConstructorParameterAnnotations$MarkerAnnotation(value=3)", + "@TestConstructorParameterAnnotations$MarkerAnnotation(3)", "null"}) public static class StaticNestedClass3 { public

    StaticNestedClass3(@MarkerAnnotation(3) P parameter1, @@ -213,10 +213,10 @@ } @ExpectedGetParameterAnnotations( - "[[@TestConstructorParameterAnnotations$MarkerAnnotation(value=4)], " + + "[[@TestConstructorParameterAnnotations$MarkerAnnotation(4)], " + "[]]") @ExpectedParameterAnnotations({ - "@TestConstructorParameterAnnotations$MarkerAnnotation(value=4)", + "@TestConstructorParameterAnnotations$MarkerAnnotation(4)", "null"}) public static class StaticNestedClass4 { public StaticNestedClass4(@MarkerAnnotation(4) P parameter1, diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/lang/annotation/typeAnnotations/TestConstructorParameterTypeAnnotations.java --- a/test/jdk/java/lang/annotation/typeAnnotations/TestConstructorParameterTypeAnnotations.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/lang/annotation/typeAnnotations/TestConstructorParameterTypeAnnotations.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -128,7 +128,7 @@ @ExpectedGetParameterAnnotations("[[], []]") @ExpectedParameterTypeAnnotations({ "null", - "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(value=1)"}) + "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(1)"}) public class NestedClass1 { public NestedClass1(@MarkerTypeAnnotation(1) int parameter) {} } @@ -136,7 +136,7 @@ @ExpectedGetParameterAnnotations("[[], [], []]") @ExpectedParameterTypeAnnotations({ "null", - "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(value=2)", + "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(2)", "null"}) public class NestedClass2 { public NestedClass2(@MarkerTypeAnnotation(2) int parameter1, @@ -146,7 +146,7 @@ @ExpectedGetParameterAnnotations("[[], [], []]") @ExpectedParameterTypeAnnotations({ "null", - "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(value=3)", + "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(3)", "null"}) public class NestedClass3 { public

    NestedClass3(@MarkerTypeAnnotation(3) P parameter1, @@ -156,7 +156,7 @@ @ExpectedGetParameterAnnotations("[[], [], []]") @ExpectedParameterTypeAnnotations({ "null", - "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(value=4)", + "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(4)", "null"}) public class NestedClass4 { public NestedClass4(@MarkerTypeAnnotation(4) P parameter1, @@ -171,14 +171,14 @@ @ExpectedGetParameterAnnotations("[[]]") @ExpectedParameterTypeAnnotations({ - "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(value=1)"}) + "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(1)"}) public static class StaticNestedClass1 { public StaticNestedClass1(@MarkerTypeAnnotation(1) int parameter) {} } @ExpectedGetParameterAnnotations("[[], []]") @ExpectedParameterTypeAnnotations({ - "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(value=2)", + "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(2)", "null"}) public static class StaticNestedClass2 { public StaticNestedClass2(@MarkerTypeAnnotation(2) int parameter1, @@ -187,7 +187,7 @@ @ExpectedGetParameterAnnotations("[[], []]") @ExpectedParameterTypeAnnotations({ - "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(value=3)", + "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(3)", "null"}) public static class StaticNestedClass3 { public

    StaticNestedClass3(@MarkerTypeAnnotation(3) P parameter1, @@ -196,7 +196,7 @@ @ExpectedGetParameterAnnotations("[[], []]") @ExpectedParameterTypeAnnotations({ - "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(value=4)", + "@TestConstructorParameterTypeAnnotations$MarkerTypeAnnotation(4)", "null"}) public static class StaticNestedClass4 { public StaticNestedClass4(@MarkerTypeAnnotation(4) P parameter1, diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/lang/annotation/typeAnnotations/TestObjectMethods.java --- a/test/jdk/java/lang/annotation/typeAnnotations/TestObjectMethods.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/lang/annotation/typeAnnotations/TestObjectMethods.java Fri Jun 21 14:07:48 2019 +0530 @@ -177,7 +177,7 @@ } } - private static final Pattern annotationRegex = Pattern.compile("@TestObjectMethods\\$AnnotType\\(value=(\\p{Digit})+\\)"); + private static final Pattern annotationRegex = Pattern.compile("@TestObjectMethods\\$AnnotType\\((\\p{Digit})+\\)"); static void testGetAnnotations(Class clazz, boolean annotationsExpectedOnMethods) { System.err.println("Testing getAnnotations on methods of class " + clazz.getName()); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/lang/module/ClassFileVersionsTest.java --- a/test/jdk/java/lang/module/ClassFileVersionsTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/lang/module/ClassFileVersionsTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -57,6 +57,7 @@ { 55, 0, Set.of() }, // JDK 11 { 56, 0, Set.of() }, // JDK 12 { 57, 0, Set.of() }, // JDK 13 + { 58, 0, Set.of() }, // JDK 14 }; } @@ -84,7 +85,11 @@ { 57, 0, Set.of(TRANSITIVE) }, { 57, 0, Set.of(STATIC, TRANSITIVE) }, - { 58, 0, Set.of()}, // JDK 14 + { 58, 0, Set.of(STATIC) }, // JDK 14 + { 58, 0, Set.of(TRANSITIVE) }, + { 58, 0, Set.of(STATIC, TRANSITIVE) }, + + { 59, 0, Set.of()}, // JDK 15 }; } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/AuthNPETest.java --- a/test/jdk/java/net/Authenticator/AuthNPETest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/AuthNPETest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -24,11 +24,15 @@ import java.io.*; import java.net.*; import java.util.*; +import jdk.test.lib.net.URIBuilder; /** * @test * @bug 4662246 * @summary REGRESSION: plugin 14x client authentication dialog returns NullPointerException + * @library /test/lib + * @run main/othervm AuthNPETest + * @run main/othervm -Djava.net.preferIPv6Addresses=true AuthNPETest */ public class AuthNPETest { @@ -53,45 +57,45 @@ "Content-Type: text/html; charset=iso-8859-1\r\n" + "Content-Length: 10\r\n\r\n"; - BasicServer (ServerSocket s) { + BasicServer(ServerSocket s) { server = s; } - void readAll (Socket s) throws IOException { + void readAll(Socket s) throws IOException { byte[] buf = new byte [128]; - InputStream is = s.getInputStream (); + InputStream is = s.getInputStream(); s.setSoTimeout(1000); try { while (is.read(buf) > 0) ; } catch (SocketTimeoutException x) { } } - public void run () { + public void run() { try { - System.out.println ("Server 1: accept"); - s = server.accept (); - System.out.println ("accepted"); + System.out.println("Server 1: accept"); + s = server.accept(); + System.out.println("accepted"); os = s.getOutputStream(); - os.write (reply1.getBytes()); - readAll (s); - s.close (); + os.write(reply1.getBytes()); + readAll(s); + s.close(); - System.out.println ("Server 2: accept"); - s = server.accept (); - System.out.println ("accepted"); + System.out.println("Server 2: accept"); + s = server.accept(); + System.out.println("accepted"); os = s.getOutputStream(); - os.write ((reply2+"HelloWorld").getBytes()); - readAll (s); - s.close (); + os.write((reply2+"HelloWorld").getBytes()); + readAll(s); + s.close(); } catch (Exception e) { System.out.println (e); } - finished (); + finished(); } - public synchronized void finished () { + public synchronized void finished() { notifyAll(); } @@ -99,48 +103,54 @@ static class MyAuthenticator extends Authenticator { - MyAuthenticator () { - super (); + MyAuthenticator() { + super(); } int count = 0; - public PasswordAuthentication getPasswordAuthentication () + public PasswordAuthentication getPasswordAuthentication() { - count ++; - System.out.println ("Auth called"); - return (new PasswordAuthentication ("user", "passwordNotCheckedAnyway".toCharArray())); + count++; + System.out.println("Auth called"); + return (new PasswordAuthentication("user", "passwordNotCheckedAnyway".toCharArray())); } - public int getCount () { - return (count); + public int getCount() { + return count; } } - static void read (InputStream is) throws IOException { + static void read(InputStream is) throws IOException { int c; - System.out.println ("reading"); + System.out.println("reading"); while ((c=is.read()) != -1) { - System.out.write (c); + System.out.write(c); } - System.out.println (""); - System.out.println ("finished reading"); + System.out.println(""); + System.out.println("finished reading"); } - public static void main (String args[]) throws Exception { - MyAuthenticator auth = new MyAuthenticator (); - Authenticator.setDefault (auth); - ServerSocket ss = new ServerSocket (0); - int port = ss.getLocalPort (); - BasicServer server = new BasicServer (ss); + public static void main(String args[]) throws Exception { + MyAuthenticator auth = new MyAuthenticator(); + Authenticator.setDefault(auth); + InetAddress loopback = InetAddress.getLoopbackAddress(); + ServerSocket ss = new ServerSocket(); + ss.bind(new InetSocketAddress(loopback, 0)); + int port = ss.getLocalPort(); + BasicServer server = new BasicServer(ss); synchronized (server) { server.start(); System.out.println ("client 1"); - URL url = new URL ("http://localhost:"+port); - URLConnection urlc = url.openConnection (); - InputStream is = urlc.getInputStream (); - read (is); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(port) + .toURL(); + URLConnection urlc = url.openConnection(Proxy.NO_PROXY); + InputStream is = urlc.getInputStream(); + read(is); is.close(); } } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/B4678055.java --- a/test/jdk/java/net/Authenticator/B4678055.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/B4678055.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -25,14 +25,16 @@ * @test * @bug 4678055 * @modules java.base/sun.net.www - * @library ../../../sun/net/www/httptest/ + * @library ../../../sun/net/www/httptest/ /test/lib * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction - * @run main B4678055 + * @run main/othervm B4678055 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B4678055 * @summary Basic Authentication fails with multiple realms */ import java.io.*; import java.net.*; +import jdk.test.lib.net.URIBuilder; public class B4678055 implements HttpCallback { @@ -125,12 +127,21 @@ public static void main (String[] args) throws Exception { MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); + ProxySelector.setDefault(ProxySelector.of(null)); // no proxy try { - server = new TestHttpServer (new B4678055(), 1, 10, 0); - System.out.println ("Server: listening on port: " + server.getLocalPort()); - client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html"); - client ("http://localhost:"+server.getLocalPort()+"/d2/foo.html"); - client ("http://localhost:"+server.getLocalPort()+"/d2/foo.html"); + InetAddress loopback = InetAddress.getLoopbackAddress(); + server = new TestHttpServer(new B4678055(), 1, 10, loopback, 0); + String serverURL = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getLocalPort()) + .path("/") + .build() + .toString(); + System.out.println("Server: listening at: " + serverURL); + client(serverURL + "d1/foo.html"); + client(serverURL + "d2/foo.html"); + client(serverURL + "d2/foo.html"); } catch (Exception e) { if (server != null) { server.terminate(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/B4759514.java --- a/test/jdk/java/net/Authenticator/B4759514.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/B4759514.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -25,14 +25,16 @@ * @test * @bug 4759514 * @modules java.base/sun.net.www - * @library ../../../sun/net/www/httptest/ + * @library ../../../sun/net/www/httptest/ /test/lib * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction - * @run main B4759514 + * @run main/othervm B4759514 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B4759514 * @summary Digest Authentication is erroniously quoting the nc value, contrary to RFC 2617 */ import java.io.*; import java.net.*; +import jdk.test.lib.net.URIBuilder; public class B4759514 implements HttpCallback { @@ -97,10 +99,19 @@ public static void main (String[] args) throws Exception { MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); + ProxySelector.setDefault(ProxySelector.of(null)); // no proxy try { - server = new TestHttpServer (new B4759514(), 1, 10, 0); - System.out.println ("Server: listening on port: " + server.getLocalPort()); - client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html"); + InetAddress loopback = InetAddress.getLoopbackAddress(); + server = new TestHttpServer (new B4759514(), 1, 10, loopback, 0); + String serverURL = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getLocalPort()) + .path("/") + .build() + .toString(); + System.out.println("Server: listening at: " + serverURL); + client(serverURL + "d1/foo.html"); } catch (Exception e) { if (server != null) { server.terminate(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/B4769350.java --- a/test/jdk/java/net/Authenticator/B4769350.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/B4769350.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -27,6 +27,8 @@ * @modules jdk.httpserver * @run main/othervm B4769350 server * @run main/othervm B4769350 proxy + * @run main/othervm -Djava.net.preferIPv6Addresses=true B4769350 server + * @run main/othervm -Djava.net.preferIPv6Addresses=true B4769350 proxy * @summary proxy authentication username and password caching only works in serial case * Run in othervm since the test sets system properties that are read by the * networking stack and cached when the HTTP handler is invoked, and previous @@ -99,7 +101,8 @@ } public void startServer() { - InetSocketAddress addr = new InetSocketAddress(0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); try { server = HttpServer.create(addr, 0); @@ -456,17 +459,28 @@ System.out.println ("Server: listening on port: " + server.getPort()); if (proxy) { - System.setProperty ("http.proxyHost", "localhost"); + System.setProperty ("http.proxyHost", + InetAddress.getLoopbackAddress().getHostAddress()); System.setProperty ("http.proxyPort", Integer.toString(server.getPort())); doProxyTests ("www.foo.com", server); } else { - doServerTests ("localhost:"+server.getPort(), server); + ProxySelector.setDefault(ProxySelector.of(null)); + doServerTests (authority(server.getPort()), server); } } } + static String authority(int port) { + InetAddress loopback = InetAddress.getLoopbackAddress(); + String hoststr = loopback.getHostAddress(); + if (hoststr.indexOf(':') > -1) { + hoststr = "[" + hoststr + "]"; + } + return hoststr + ":" + port; + } + public static void except (String s, Server server) { server.close(); throw new RuntimeException (s); @@ -496,4 +510,3 @@ } } } - diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/B4921848.java --- a/test/jdk/java/net/Authenticator/B4921848.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/B4921848.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -25,14 +25,17 @@ * @test * @bug 4921848 * @modules java.base/sun.net.www - * @library ../../../sun/net/www/httptest/ + * @library ../../../sun/net/www/httptest/ /test/lib * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction * @run main/othervm -Dhttp.auth.preference=basic B4921848 + * @run main/othervm -Djava.net.preferIPv6Addresses=true + * -Dhttp.auth.preference=basic B4921848 * @summary Allow user control over authentication schemes */ import java.io.*; import java.net.*; +import jdk.test.lib.net.URIBuilder; public class B4921848 implements HttpCallback { @@ -88,10 +91,19 @@ public static void main (String[] args) throws Exception { MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); + ProxySelector.setDefault(ProxySelector.of(null)); // no proxy try { - server = new TestHttpServer (new B4921848(), 1, 10, 0); - System.out.println ("Server started: listening on port: " + server.getLocalPort()); - client ("http://localhost:"+server.getLocalPort()+"/d1/d2/d3/foo.html"); + InetAddress loopback = InetAddress.getLoopbackAddress(); + server = new TestHttpServer (new B4921848(), 1, 10, loopback, 0); + String serverURL = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getLocalPort()) + .path("/") + .build() + .toString(); + System.out.println("Server: listening at: " + serverURL); + client(serverURL + "d1/d2/d3/foo.html"); } catch (Exception e) { if (server != null) { server.terminate(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/B4933582.java --- a/test/jdk/java/net/Authenticator/B4933582.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/B4933582.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -21,10 +21,15 @@ * questions. */ +// Note: this test saves a cache.ser file in the scratch directory, +// which the cache implementation will load its configuration +// from. Therefore adding several @run lines does not work. + /* * @test * @bug 4933582 - * @library ../../../sun/net/www/httptest + * @key intermittent + * @library ../../../sun/net/www/httptest /test/lib * @modules java.base/sun.net.www * java.base/sun.net.www.protocol.http * @build HttpCallback HttpTransaction TestHttpServer B4933582 @@ -34,6 +39,7 @@ import java.net.*; import java.util.*; import sun.net.www.protocol.http.*; +import jdk.test.lib.net.URIBuilder; public class B4933582 implements HttpCallback { @@ -133,12 +139,21 @@ public static void main (String[] args) throws Exception { MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); + ProxySelector.setDefault(ProxySelector.of(null)); // no proxy + InetAddress loopback = InetAddress.getLoopbackAddress(); CacheImpl cache; try { - server = new TestHttpServer (new B4933582(), 1, 10, 0); + server = new TestHttpServer(new B4933582(), 1, 10, loopback, 0); cache = new CacheImpl (server.getLocalPort()); AuthCacheValue.setAuthCache (cache); - client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html"); + String serverURL = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getLocalPort()) + .path("/") + .build() + .toString(); + client(serverURL + "d1/foo.html"); } finally { if (server != null) { server.terminate(); @@ -157,7 +172,7 @@ while (true) { try { server = new TestHttpServer(new B4933582(), 1, 10, - cache.getPort()); + loopback, cache.getPort()); break; } catch (BindException e) { if (retries++ < 5) { @@ -173,7 +188,14 @@ try { AuthCacheValue.setAuthCache(cache); - client("http://localhost:" + server.getLocalPort() + "/d1/foo.html"); + String serverURL = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getLocalPort()) + .path("/") + .build() + .toString(); + client(serverURL + "d1/foo.html"); } finally { if (server != null) { server.terminate(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/B4962064.java --- a/test/jdk/java/net/Authenticator/B4962064.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/B4962064.java Fri Jun 21 14:07:48 2019 +0530 @@ -28,6 +28,7 @@ * @library ../../../sun/net/www/httptest/ * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction * @run main/othervm B4962064 + * @run main/othervm -Djava.net.preferIPv6Addresses=true B4962064 * @summary Extend Authenticator to provide access to request URI and server/proxy */ @@ -91,18 +92,24 @@ public static void main (String[] args) throws Exception { try { - server = new TestHttpServer (new B4962064(), 1, 10, 0); + InetAddress address = InetAddress.getLoopbackAddress(); + InetAddress resolved = InetAddress.getByName(address.getHostName()); + System.out.println("Lookup: " + address + " -> \"" + + address.getHostName() + "\" -> " + + resolved); + server = new TestHttpServer (new B4962064(), 1, 10, address, 0); int port = server.getLocalPort(); - System.setProperty ("http.proxyHost", "localhost"); + String proxyHost = address.equals(resolved) + ? address.getHostName() + : address.getHostAddress(); + System.setProperty ("http.proxyHost", proxyHost); System.setProperty ("http.proxyPort", Integer.toString (port)); MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); System.out.println ("Server started: listening on port: " + port); - //String s = new String ("http://localhost:"+port+"/d1/d2/d3/foo.html"); String s = new String ("http://foo.com/d1/d2/d3/foo.html"); urlsave = new URL (s); client (s); - //s = new String ("http://localhost:"+port+"/dr/d3/foo.html"); s = new String ("http://bar.com/dr/d3/foo.html"); urlsave = new URL (s); client (s); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/B6870935.java --- a/test/jdk/java/net/Authenticator/B6870935.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/B6870935.java Fri Jun 21 14:07:48 2019 +0530 @@ -26,6 +26,8 @@ * @bug 6870935 * @modules java.base/sun.net.www * @run main/othervm -Dhttp.nonProxyHosts="" -Dhttp.auth.digest.validateProxy=true B6870935 + * @run main/othervm -Djava.net.preferIPv6Addresses=true + * -Dhttp.nonProxyHosts="" -Dhttp.auth.digest.validateProxy=true B6870935 */ import java.io.*; @@ -80,18 +82,21 @@ public void run () { try { + System.out.println("Server started"); Socket s1 = s.accept (); is = s1.getInputStream (); os = s1.getOutputStream (); is.read (); os.write (reply1.getBytes()); + System.out.println("First response sent"); Thread.sleep (2000); s1.close (); + System.out.println("First connection closed"); s1 = s.accept (); is = s1.getInputStream (); os = s1.getOutputStream (); - is.read (); + // is.read (); // need to get the cnonce out of the response MessageHeader header = new MessageHeader (is); String raw = header.findValue ("Proxy-Authorization"); @@ -115,12 +120,16 @@ cnstring, passwd, username ) +"\r\n"; os.write (reply.getBytes()); + System.out.println("Second response sent"); Thread.sleep (2000); s1.close (); + System.out.println("Second connection closed"); } catch (Exception e) { System.out.println (e); e.printStackTrace(); + } finally { + System.out.println("Server finished"); } } @@ -225,8 +234,17 @@ DigestServer server; ServerSocket sock; + InetAddress address = InetAddress.getLoopbackAddress(); + InetAddress resolved = InetAddress.getByName(address.getHostName()); + System.out.println("Lookup: " + + address + " -> \"" + address.getHostName() + "\" -> " + + resolved); + String proxyHost = address.equals(resolved) + ? address.getHostName() + : address.getHostAddress(); try { - sock = new ServerSocket (0); + sock = new ServerSocket(); + sock.bind(new InetSocketAddress(address, 0)); port = sock.getLocalPort (); } catch (Exception e) { @@ -238,12 +256,12 @@ server.start (); try { - Authenticator.setDefault (new MyAuthenticator ()); - SocketAddress addr = new InetSocketAddress (InetAddress.getLoopbackAddress(), port); + SocketAddress addr = InetSocketAddress.createUnresolved(proxyHost, port); Proxy proxy = new Proxy (Proxy.Type.HTTP, addr); String s = "http://www.ibm.com"; URL url = new URL(s); + System.out.println("opening connection through proxy: " + addr); java.net.URLConnection conURL = url.openConnection(proxy); InputStream in = conURL.getInputStream(); @@ -255,6 +273,9 @@ catch(IOException e) { e.printStackTrace(); error = true; + sock.close(); + } finally { + server.join(); } if (error) { throw new RuntimeException ("Error in test"); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/B8034170.java --- a/test/jdk/java/net/Authenticator/B8034170.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/B8034170.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -24,13 +24,16 @@ import java.io.*; import java.net.*; import java.util.*; +import jdk.test.lib.net.URIBuilder; /** * @test * @bug 8034170 * @summary Digest authentication interop issue + * @library /test/lib * @run main/othervm B8034170 unquoted * @run main/othervm -Dhttp.auth.digest.quoteParameters=true B8034170 quoted + * @run main/othervm -Djava.net.preferIPv6Addresses=true B8034170 unquoted */ public class B8034170 { @@ -176,14 +179,21 @@ MyAuthenticator3 auth = new MyAuthenticator3 (); Authenticator.setDefault (auth); - ServerSocket ss = new ServerSocket (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + ServerSocket ss = new ServerSocket(); + ss.bind(new InetSocketAddress(loopback, 0)); int port = ss.getLocalPort (); BasicServer server = new BasicServer (ss); synchronized (server) { server.start(); System.out.println ("client 1"); - URL url = new URL ("http://localhost:"+port+"/d1/d2/d3/foo.html"); - URLConnection urlc = url.openConnection (); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(port) + .path("/d1/d2/d3/foo.html") + .toURL(); + URLConnection urlc = url.openConnection(Proxy.NO_PROXY); InputStream is = urlc.getInputStream (); read (is); is.close (); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/BasicTest.java --- a/test/jdk/java/net/Authenticator/BasicTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/BasicTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -24,11 +24,15 @@ import java.io.*; import java.net.*; import java.util.*; +import jdk.test.lib.net.URIBuilder; /** * @test * @bug 4474947 * @summary fix for bug #4244472 is incomplete - HTTP authorization still needs work + * @library /test/lib + * @run main/othervm BasicTest + * @run main/othervm -Djava.net.preferIPv6Addresses=true BasicTest */ /* @@ -151,19 +155,28 @@ public static void main (String args[]) throws Exception { MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); - ServerSocket ss = new ServerSocket (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + ServerSocket ss = new ServerSocket(); + ss.bind(new InetSocketAddress(loopback, 0)); int port = ss.getLocalPort (); BasicServer server = new BasicServer (ss); synchronized (server) { server.start(); System.out.println ("client 1"); - URL url = new URL ("http://localhost:"+port+"/d1/d2/d3/foo.html"); - URLConnection urlc = url.openConnection (); + String base = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(port) + .path("/") + .build() + .toString(); + URL url = new URL(base + "d1/d2/d3/foo.html"); + URLConnection urlc = url.openConnection(Proxy.NO_PROXY); InputStream is = urlc.getInputStream (); read (is); System.out.println ("client 2"); - url = new URL ("http://localhost:"+port+"/d1/foo.html"); - urlc = url.openConnection (); + url = new URL(base + "d1/foo.html"); + urlc = url.openConnection(Proxy.NO_PROXY); is = urlc.getInputStream (); read (is); server.wait (); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/BasicTest3.java --- a/test/jdk/java/net/Authenticator/BasicTest3.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/BasicTest3.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -24,11 +24,15 @@ import java.io.*; import java.net.*; import java.util.*; +import jdk.test.lib.net.URIBuilder; /** * @test * @bug 4513440 * @summary BasicAuthentication is zeroing out the given password + * @library /test/lib + * @run main/othervm BasicTest3 + * @run main/othervm -Djava.net.preferIPv6Addresses=true BasicTest3 */ public class BasicTest3 { @@ -130,14 +134,21 @@ public static void main (String args[]) throws Exception { MyAuthenticator3 auth = new MyAuthenticator3 (); Authenticator.setDefault (auth); - ServerSocket ss = new ServerSocket (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + ServerSocket ss = new ServerSocket(); + ss.bind(new InetSocketAddress(loopback, 0)); int port = ss.getLocalPort (); BasicServer3 server = new BasicServer3 (ss); synchronized (server) { server.start(); System.out.println ("client 1"); - URL url = new URL ("http://localhost:"+port+"/d1/d2/d3/foo.html"); - URLConnection urlc = url.openConnection (); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(port) + .path("/d1/d2/d3/foo.html") + .toURL(); + URLConnection urlc = url.openConnection(Proxy.NO_PROXY); InputStream is = urlc.getInputStream (); read (is); is.close (); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/BasicTest4.java --- a/test/jdk/java/net/Authenticator/BasicTest4.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/BasicTest4.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -24,11 +24,15 @@ import java.io.*; import java.net.*; import java.util.*; +import jdk.test.lib.net.URIBuilder; /** * @test * @bug 4623722 * @summary performance hit for Basic Authentication + * @library /test/lib + * @run main/othervm BasicTest4 + * @run main/othervm -Djava.net.preferIPv6Addresses=true BasicTest4 */ public class BasicTest4 { @@ -59,12 +63,17 @@ static boolean checkFor (InputStream in, char[] seq) throws IOException { System.out.println ("checkfor"); + StringBuilder message = new StringBuilder(); try { int i=0, count=0; while (true) { int c = in.read(); - if (c == -1) + if (c == -1) { + System.out.println(new String(seq) + " not found in \n<<" + + message + ">>"); return false; + } + message.append((char)c); count++; if (c == seq[i]) { i++; @@ -77,6 +86,7 @@ } } catch (SocketTimeoutException e) { + System.out.println("checkFor: " + e); return false; } } @@ -194,23 +204,33 @@ public static void main (String args[]) throws Exception { MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); - ServerSocket ss = new ServerSocket (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + ServerSocket ss = new ServerSocket(); + ss.bind(new InetSocketAddress(loopback, 0)); int port = ss.getLocalPort (); BasicServer server = new BasicServer (ss); synchronized (server) { server.start(); System.out.println ("client 1"); - URL url = new URL ("http://localhost:"+port+"/d1/d3/foo.html"); - URLConnection urlc = url.openConnection (); + String base = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(port) + .path("/d1/") + .build() + .toString(); + System.out.println("Base URL: " + base); + URL url = new URL (base + "d3/foo.html"); + URLConnection urlc = url.openConnection(Proxy.NO_PROXY); InputStream is = urlc.getInputStream (); read (is); System.out.println ("client 2"); - url = new URL ("http://localhost:"+port+"/d1/d2/bar.html"); - urlc = url.openConnection (); + url = new URL (base + "d2/bar.html"); + urlc = url.openConnection(Proxy.NO_PROXY); is = urlc.getInputStream (); System.out.println ("client 3"); - url = new URL ("http://localhost:"+port+"/d1/d4/foobar.html"); - urlc = url.openConnection (); + url = new URL (base + "d4/foobar.html"); + urlc = url.openConnection(Proxy.NO_PROXY); is = urlc.getInputStream (); read (is); server.wait (); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Authenticator/Deadlock.java --- a/test/jdk/java/net/Authenticator/Deadlock.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/Authenticator/Deadlock.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -25,7 +25,10 @@ * @test * @bug 6648001 * @modules jdk.httpserver + * @library /test/lib * @run main/othervm/timeout=20 -ea:sun.net.www.protocol.http.AuthenticationInfo -Dhttp.auth.serializeRequests=true Deadlock + * @run main/othervm/timeout=20 -Djava.net.preferIPv6Addresses=true + * -ea:sun.net.www.protocol.http.AuthenticationInfo -Dhttp.auth.serializeRequests=true Deadlock * @summary cancelling HTTP authentication causes deadlock */ @@ -34,8 +37,10 @@ import java.io.InputStream; import java.io.IOException; import java.net.HttpURLConnection; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.PasswordAuthentication; +import java.net.Proxy; import java.net.URL; import com.sun.net.httpserver.BasicAuthenticator; import com.sun.net.httpserver.Headers; @@ -44,12 +49,14 @@ import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpPrincipal; import com.sun.net.httpserver.HttpServer; +import jdk.test.lib.net.URIBuilder; public class Deadlock { public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress (loopback, 0); HttpServer server = HttpServer.create(addr, 0); HttpContext ctx = server.createContext("/test", handler); BasicAuthenticator a = new BasicAuthenticator("foobar@test.realm") { @@ -97,8 +104,13 @@ URL url; HttpURLConnection urlc; try { - url = new URL("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); - urlc = (HttpURLConnection)url.openConnection (); + url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(server.getAddress().getPort()) + .path("/test/foo.html") + .toURLUnchecked(); + urlc = (HttpURLConnection)url.openConnection (Proxy.NO_PROXY); } catch (IOException e) { error = true; return; diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/CookieHandler/CookieHandlerTest.java --- a/test/jdk/java/net/CookieHandler/CookieHandlerTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/CookieHandler/CookieHandlerTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -24,7 +24,9 @@ /* @test * @summary Unit test for java.net.CookieHandler * @bug 4696506 + * @library /test/lib * @run main/othervm CookieHandlerTest + * @run main/othervm -Djava.net.preferIPv6Addresses=true CookieHandlerTest * @author Yingxian Wang */ @@ -34,6 +36,7 @@ import java.net.*; import java.util.*; import java.io.*; +import jdk.test.lib.net.URIBuilder; public class CookieHandlerTest implements Runnable { static Map cookies; @@ -92,15 +95,19 @@ CookieHandlerTest() throws Exception { /* start the server */ - ss = new ServerSocket(0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + ss = new ServerSocket(); + ss.bind(new InetSocketAddress(loopback, 0)); (new Thread(this)).start(); /* establish http connection to server */ - String uri = "http://localhost:" + - Integer.toString(ss.getLocalPort()); - URL url = new URL(uri); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(ss.getLocalPort()) + .toURL(); - HttpURLConnection http = (HttpURLConnection)url.openConnection(); + HttpURLConnection http = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); int respCode = http.getResponseCode(); http.disconnect(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/CookieHandler/CookieManagerTest.java --- a/test/jdk/java/net/CookieHandler/CookieManagerTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/CookieHandler/CookieManagerTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -57,8 +57,9 @@ } catch (IOException x) { System.out.println("Debug: caught:" + x); } - System.out.println("Using: \"127.0.0.1\""); - return "127.0.0.1"; + InetAddress loopback = InetAddress.getLoopbackAddress(); + System.out.println("Using: \"" + loopback.getHostAddress() + "\""); + return loopback.getHostAddress(); } public static void main(String[] args) throws Exception { @@ -73,7 +74,7 @@ public static void startHttpServer() throws IOException { httpTrans = new CookieTransactionHandler(); - server = HttpServer.create(new InetSocketAddress(0), 0); + server = HttpServer.create(new InetSocketAddress(hostAddress, 0), 0); server.createContext("/", httpTrans); server.start(); } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/CookieHandler/EmptyCookieHeader.java --- a/test/jdk/java/net/CookieHandler/EmptyCookieHeader.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/CookieHandler/EmptyCookieHeader.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, 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 @@ -26,6 +26,9 @@ * @bug 8015799 * @modules jdk.httpserver * @summary HttpURLConnection.getHeaderFields() throws IllegalArgumentException + * @library /test/lib + * @run main EmptyCookieHeader + * @run main/othervm -Djava.net.preferIPv6Addresses=true EmptyCookieHeader */ import com.sun.net.httpserver.*; @@ -33,6 +36,7 @@ import java.io.OutputStream; import java.net.*; import java.util.*; +import jdk.test.lib.net.URIBuilder; public class EmptyCookieHeader { @@ -43,11 +47,17 @@ public void runTest() throws Exception { final CookieHandler oldHandler = CookieHandler.getDefault(); CookieHandler.setDefault(new TestCookieHandler()); - HttpServer s = HttpServer.create(new InetSocketAddress(0), 0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + HttpServer s = HttpServer.create(new InetSocketAddress(loopback, 0), 0); try { startServer(s); - URL url = new URL("http://localhost:" + s.getAddress().getPort() + "/"); - HttpURLConnection c = (HttpURLConnection)url.openConnection(); + URL url = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(s.getAddress().getPort()) + .path("/") + .toURL(); + HttpURLConnection c = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); c.getHeaderFields(); } finally { CookieHandler.setDefault(oldHandler); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/CookieHandler/LocalHostCookie.java --- a/test/jdk/java/net/CookieHandler/LocalHostCookie.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/CookieHandler/LocalHostCookie.java Fri Jun 21 14:07:48 2019 +0530 @@ -33,8 +33,11 @@ /* * @test * @bug 7169142 + * @key intermittent * @modules jdk.httpserver - * @summary CookieHandler does not work with localhost + * @summary CookieHandler does not work with localhost. This requires + * binding to the wildcard address and might fail intermittently + * due to port reuse issues. * @run main/othervm LocalHostCookie */ public class LocalHostCookie { @@ -126,4 +129,3 @@ } } } - diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/Inet6Address/Scoping.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/net/Inet6Address/Scoping.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,196 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8216417 + * @summary cleanup of IPv6 scope-id handling + * @library /test/lib + * @build jdk.test.lib.NetworkConfiguration + * @run main/othervm Scoping + */ + +import java.io.IOException; +import java.net.*; +import java.nio.ByteBuffer; +import java.nio.channels.DatagramChannel; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; +import java.util.Enumeration; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +import jdk.test.lib.NetworkConfiguration; + +public class Scoping { + + interface ThrowingConsumer { + public void accept(T t) throws Exception; + } + + static List> targets = List.of( + /* 0 */ (a) -> {Socket s = new Socket(); s.bind(a);s.close();}, + /* 1 */ (a) -> {ServerSocket s = new ServerSocket(); s.bind(a);s.close();}, + /* 2 */ (a) -> {DatagramSocket s = new DatagramSocket(null); s.bind(a); s.close();}, + /* 3 */ (a) -> {MulticastSocket s = new MulticastSocket(null); s.bind(a); s.close();}, + /* 4 */ (a) -> {SocketChannel s = SocketChannel.open(); s.bind(a);s.close();}, + /* 5 */ (a) -> {ServerSocketChannel s = ServerSocketChannel.open(); s.bind(a);s.close();}, + /* 6 */ (a) -> {DatagramChannel s = DatagramChannel.open(); s.bind(a); s.close();}, + /* 7 */ (a) -> {SocketChannel s = SocketChannel.open(); s.socket().bind(a);s.close();}, + /* 8 */ (a) -> {ServerSocketChannel s = ServerSocketChannel.open(); s.socket().bind(a);s.close();}, + /* 9 */ (a) -> {DatagramChannel s = DatagramChannel.open(); s.socket().bind(a); s.close();}, + /* 10 */ (a) -> {socketTest(a);}, + /* 11 */ (a) -> {dgSocketTest(a, false);}, + /* 12 */ (a) -> {dgSocketTest(a, true);}, + /* 13 */ (a) -> {dgChannelTest(a, false);}, + /* 14 */ (a) -> {dgChannelTest(a, true);} + ); + + static List getLinkLocalAddrs() throws IOException { + return NetworkConfiguration.probe() + .ip6Addresses() + .filter(Inet6Address::isLinkLocalAddress) + .collect(Collectors.toList()); + } + + static void compare(InetSocketAddress a, InetSocketAddress b) { + Inet6Address a1 = (Inet6Address)a.getAddress(); + Inet6Address b1 = (Inet6Address)b.getAddress(); + compare (a1, b1); + } + + static void compare(InetAddress a, InetAddress b) { + Inet6Address a1 = (Inet6Address)a; + Inet6Address b1 = (Inet6Address)b; + if (!a1.equals(b1)) { + System.out.printf("%s != %s\n", a1, b1); + throw new RuntimeException("Addresses not the same"); + } + + if (!a1.getHostAddress().equals(b1.getHostAddress())) { + System.out.printf("%s != %s\n", a1, b1); + if (a1.getScopeId() != b1.getScopeId()) + throw new RuntimeException("Scope ids not the same"); + } + } + + static void socketTest(InetSocketAddress a) throws Exception { + System.out.printf("socketTest: address %s\n", a); + try (ServerSocket server = new ServerSocket(0, 5, a.getAddress())) { + InetAddress saddr = server.getInetAddress(); + int port = server.getLocalPort(); + Socket client = new Socket(saddr, port); + compare(client.getInetAddress(), saddr); + try { + client.close(); + } catch (IOException e) {} + } + } + + static void dgSocketTest(InetSocketAddress a, boolean connect) throws Exception { + try (DatagramSocket s = new DatagramSocket(null)) { + System.out.println("dgSocketTest: " + a); + s.bind(a); + String t = "Hello world"; + DatagramPacket rx = new DatagramPacket(new byte[128], 128); + int port = s.getLocalPort(); + InetSocketAddress dest = new InetSocketAddress(a.getAddress(), port); + DatagramPacket tx = new DatagramPacket(t.getBytes("ISO8859_1"), t.length(), dest); + if (connect) { + s.connect(dest); + System.out.println("dgSocketTest: connect remote addr = " + s.getRemoteSocketAddress()); + compare(a, (InetSocketAddress)s.getRemoteSocketAddress()); + } + s.send(tx); + s.receive(rx); + String t1 = new String(rx.getData(), rx.getOffset(), rx.getLength(), "ISO8859_1"); + if (!t1.equals(t)) + throw new RuntimeException("Packets not equal"); + } + } + + static void dgChannelTest(InetSocketAddress a, boolean connect) throws Exception { + try (DatagramChannel s = DatagramChannel.open()) { + System.out.println("dgChannelTest: " + a); + s.bind(a); + String t = "Hello world"; + ByteBuffer rx = ByteBuffer.allocate(128); + int port = ((InetSocketAddress)s.getLocalAddress()).getPort(); + InetSocketAddress dest = new InetSocketAddress(a.getAddress(), port); + ByteBuffer tx = ByteBuffer.wrap(t.getBytes("ISO8859_1")); + if (connect) { + s.connect(dest); + System.out.println("dgChannelTest: connect remote addr = " + s.getRemoteAddress()); + compare(a, (InetSocketAddress)s.getRemoteAddress()); + } + s.send(tx, dest); + s.receive(rx); + rx.flip(); + String t1 = new String(rx.array(), 0, rx.limit(), "ISO8859_1"); + System.out.printf("rx : %s, data: %s\n", rx, t1); + if (!t1.equals(t)) + throw new RuntimeException("Packets not equal"); + } + } + + static Inet6Address stripScope(Inet6Address address) { + byte[] bytes = address.getAddress(); + InetAddress result = null; + try { + result = InetAddress.getByAddress(bytes); + } catch (UnknownHostException e) { + assert false; + } + return (Inet6Address)result; + } + + public static void main(String[] args) throws Exception { + for (Inet6Address address : getLinkLocalAddrs()) { + Inet6Address stripped = stripScope(address); + InetSocketAddress s1 = new InetSocketAddress(address, 0); + InetSocketAddress s2 = new InetSocketAddress(stripped, 0); + System.out.println("Trying: " + address); + int count = 0, success = 0; + for (ThrowingConsumer target : targets) { + try { + target.accept(s1); + System.out.println("target " + count + " OK"); + // if that succeeds try s2 (the actual test) + try { + target.accept(s2); + success++; + } catch (IOException ee) { + String msg = "Failed: " + s2.toString() + "count: " + Integer.toString(count); + throw new RuntimeException (msg); + } + } catch (IOException e) { + System.out.println(e.getMessage()); + // OK + } + count++; + } + System.out.println("Succeeded with " + success + " binds"); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/MulticastSocket/PromiscuousIPv6.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/net/MulticastSocket/PromiscuousIPv6.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2018, 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. + * + +/* + * @test + * @bug 8215294 + * @requires os.family == "linux" + * @library /test/lib + * @build jdk.test.lib.NetworkConfiguration + * PromiscuousIPv6 + * @run main/othervm PromiscuousIPv6 + * @key randomness + */ + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.net.Inet6Address; +import java.net.InetSocketAddress; +import java.net.MulticastSocket; +import java.net.NetworkInterface; +import java.net.SocketTimeoutException; +import java.net.StandardSocketOptions; +import java.util.List; +import java.util.Random; +import jdk.test.lib.NetworkConfiguration; +import jtreg.SkippedException; +import static java.lang.System.out; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.util.stream.Collectors.toList; + +/* + * This test was created as a clone of the Promiscuous test and adapted for + * IPv6 node-local and link-local multicast addresses on Linux. + */ +public class PromiscuousIPv6 { + + static final Random rand = new Random(); + + static final int TIMEOUT = 5 * 1000; // 5 secs + + static int sendDatagram(NetworkInterface nif, InetAddress group, int port) + throws IOException + { + try (MulticastSocket mc = new MulticastSocket()) { + mc.setOption(StandardSocketOptions.IP_MULTICAST_IF, nif); + + int id = rand.nextInt(); + byte[] msg = Integer.toString(id).getBytes(UTF_8); + DatagramPacket p = new DatagramPacket(msg, msg.length); + p.setAddress(group); + p.setPort(port); + + out.printf("Sending datagram to: %s/%d\n", group, port); + mc.send(p); + return id; + } + } + + static void receiveDatagram(DatagramSocket mc, boolean datagramExpected, int id) + throws IOException + { + byte[] ba = new byte[100]; + DatagramPacket p = new DatagramPacket(ba, ba.length); + try { + mc.receive(p); + int recvId = Integer.parseInt( + new String(p.getData(), 0, p.getLength(), UTF_8)); + if (datagramExpected) { + if (recvId != id) + throw new RuntimeException("Unexpected id, got " + recvId + + ", expected: " + id); + out.printf("Received message as expected, %s\n", p.getAddress()); + } else { + throw new RuntimeException("Unexpected message received, " + + p.getAddress()); + } + } catch (SocketTimeoutException e) { + if (datagramExpected) + throw new RuntimeException("Expected message not received, " + + e.getMessage()); + else + out.printf("Message not received, as expected\n"); + } + } + + static void test(NetworkInterface nif, InetAddress group1, InetAddress group2) + throws IOException + { + // Bind addresses should include the same network interface / scope, so + // as to not reply on the default route when there are multiple interfaces + InetAddress bindAddr1 = Inet6Address.getByAddress(null, group1.getAddress(), nif); + InetAddress bindAddr2 = Inet6Address.getByAddress(null, group2.getAddress(), nif); + + try (MulticastSocket mc1 = new MulticastSocket(new InetSocketAddress(bindAddr1, 0)); + MulticastSocket mc2 = new MulticastSocket(new InetSocketAddress(bindAddr2, mc1.getLocalPort()))) { + + final int port = mc1.getLocalPort(); + out.printf("Using port: %d\n", port); + + mc1.setSoTimeout(TIMEOUT); + mc2.setSoTimeout(TIMEOUT); + + mc1.joinGroup(new InetSocketAddress(group1, 0), nif); + out.printf("mc1 joined the MC group: %s\n", group1); + mc2.joinGroup(new InetSocketAddress(group2, 0), nif); + out.printf("mc2 joined the MC group: %s\n", group2); + + out.printf("Sending datagram to: %s/%d\n", group1, port); + int id = sendDatagram(nif, group1, port); + + // the packet should be received by mc1 only + receiveDatagram(mc1, true, id); + receiveDatagram(mc2, false, 0); + + + out.printf("Sending datagram to: %s/%d\n", group2, port); + id = sendDatagram(nif, group2, port); + + // the packet should be received by mc2 only + receiveDatagram(mc2, true, id); + receiveDatagram(mc1, false, 0); + + mc1.leaveGroup(new InetSocketAddress(group1, 0), nif); + mc2.leaveGroup(new InetSocketAddress(group2, 0), nif); + } + } + + public static void main(String args[]) throws IOException { + String os = System.getProperty("os.name"); + + if (!os.equals("Linux")) { + throw new SkippedException("This test should be run only on Linux"); + } else { + String osVersion = System.getProperty("os.version"); + String prefix = "3.10.0"; + if (osVersion.startsWith(prefix)) { + throw new SkippedException( + String.format("The behavior under test is known NOT to work on '%s' kernels", prefix)); + } + } + + NetworkConfiguration.printSystemConfiguration(System.out); + List nifs = NetworkConfiguration.probe() + .ip6MulticastInterfaces() + .collect(toList()); + + if (nifs.size() == 0) { + throw new SkippedException( + "No IPv6 interfaces that support multicast found"); + } + + InetAddress interfaceLocal1 = InetAddress.getByName("ff11::3.4.5.6"); + InetAddress interfaceLocal2 = InetAddress.getByName("ff11::5.6.7.8"); + + InetAddress linkLocal1 = InetAddress.getByName("ff12::4.5.6.7"); + InetAddress linkLocal2 = InetAddress.getByName("ff12::7.8.9.10"); + + for (NetworkInterface nif : nifs) { + test(nif, interfaceLocal1, interfaceLocal2); + test(nif, linkLocal1, linkLocal2); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/ResponseCache/Test2.java --- a/test/jdk/java/net/ResponseCache/Test2.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/ResponseCache/Test2.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -28,6 +28,7 @@ * @summary Check for CRL results in IllegalArgumentException "white space not allowed" * @modules jdk.httpserver * @run main/othervm Test2 + * @run main/othervm -Djava.net.preferIPv6Addresses=true Test2 */ import com.sun.net.httpserver.*; @@ -69,11 +70,12 @@ public static void main (String[] args) throws Exception { Handler handler = new Handler(); - InetSocketAddress addr = new InetSocketAddress (0); + InetAddress loopback = InetAddress.getLoopbackAddress(); + InetSocketAddress addr = new InetSocketAddress(loopback, 0); HttpServer server = HttpServer.create (addr, 0); port = server.getAddress().getPort(); HttpContext ctx = server.createContext ("/test", handler); - System.out.println ("Server: " + server.getAddress().getPort()); + System.out.println ("Server: " + server.getAddress()); ResponseCache.setDefault(new Cache()); ExecutorService executor = Executors.newCachedThreadPool(); @@ -95,7 +97,7 @@ .toURLUnchecked(); System.out.println("Redir URL: " + redir); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection(); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); urlc.addRequestProperty("X-Foo", "bar"); urlc.setInstanceFollowRedirects(true); System.out.println(urlc.getResponseCode()); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/URL/GetContent.java --- a/test/jdk/java/net/URL/GetContent.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/URL/GetContent.java Fri Jun 21 14:07:48 2019 +0530 @@ -26,6 +26,8 @@ * @bug 4145315 * @library /test/lib * @summary Test a read from nonexistant URL + * @run main GetContent + * @run main/othervm -Djava.net.preferIPv6Addresses GetContent */ import java.net.*; @@ -37,8 +39,7 @@ ServerSocket ss; public void run() { - try { - Socket s = ss.accept(); + try (Socket s = ss.accept()) { s.setTcpNoDelay(true); PrintStream out = new PrintStream( @@ -57,7 +58,6 @@ // client get error and re-establish connection Thread.sleep(2000); - s.close(); } catch (Exception e) { e.printStackTrace(); } finally { @@ -66,8 +66,10 @@ } GetContent() throws Exception { + InetAddress loopback = InetAddress.getLoopbackAddress(); + ss = new ServerSocket(); + ss.bind(new InetSocketAddress(loopback, 0)); - ss = new ServerSocket(0); Thread thr = new Thread(this); thr.start(); @@ -79,7 +81,8 @@ .port(ss.getLocalPort()) .path("/no-such-name") .toURL(); - Object obj = url.getContent(); + Object obj = url.openConnection(Proxy.NO_PROXY) + .getContent(); InputStream in = (InputStream) obj; byte buff[] = new byte[200]; int len = in.read(buff); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/httpclient/BodySubscribersTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/net/httpclient/BodySubscribersTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,159 @@ +/* + * 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. + */ + +/* + * @test + * @summary Basic test for the standard BodySubscribers default behavior + * @bug 8225583 + * @run testng BodySubscribersTest + */ + +import java.net.http.HttpResponse.BodySubscriber; +import java.nio.ByteBuffer; +import java.nio.file.Path; +import java.util.List; +import java.util.concurrent.Flow; +import java.util.function.Supplier; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import static java.lang.System.out; +import static java.net.http.HttpResponse.BodySubscribers.*; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.nio.file.StandardOpenOption.CREATE; +import static org.testng.Assert.assertTrue; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.expectThrows; +import static org.testng.Assert.fail; + +public class BodySubscribersTest { + + static final Class NPE = NullPointerException.class; + + // Supplier of BodySubscriber, with a descriptive name + static class BSSupplier implements Supplier> { + private final Supplier> supplier; + private final String name; + private BSSupplier(Supplier> supplier, String name) { + this.supplier = supplier; + this.name = name; + } + static BSSupplier create(String name, Supplier> supplier) { + return new BSSupplier(supplier, name); + } + @Override public BodySubscriber get() { return supplier.get(); } + @Override public String toString() { return name; } + } + + static class LineSubscriber implements Flow.Subscriber { + @Override public void onSubscribe(Flow.Subscription subscription) { } + @Override public void onNext(String item) { fail(); } + @Override public void onError(Throwable throwable) { fail(); } + @Override public void onComplete() { fail(); } + } + + static class BBSubscriber implements Flow.Subscriber> { + @Override public void onSubscribe(Flow.Subscription subscription) { } + @Override public void onNext(List item) { fail(); } + @Override public void onError(Throwable throwable) { fail(); } + @Override public void onComplete() { fail(); } + } + + @DataProvider(name = "bodySubscriberSuppliers") + public Object[][] bodySubscriberSuppliers() { ; + List>> list = List.of( + BSSupplier.create("ofByteArray", () -> ofByteArray()), + BSSupplier.create("ofInputStream", () -> ofInputStream()), + BSSupplier.create("ofBAConsumer", () -> ofByteArrayConsumer(ba -> { })), + BSSupplier.create("ofLines", () -> ofLines(UTF_8)), + BSSupplier.create("ofPublisher", () -> ofPublisher()), + BSSupplier.create("ofFile", () -> ofFile(Path.of("f"))), + BSSupplier.create("ofFile-opts)", () -> ofFile(Path.of("f"), CREATE)), + BSSupplier.create("ofString", () -> ofString(UTF_8)), + BSSupplier.create("buffering", () -> buffering(ofByteArray(), 10)), + BSSupplier.create("discarding", () -> discarding()), + BSSupplier.create("mapping", () -> mapping(ofString(UTF_8), s -> s)), + BSSupplier.create("replacing", () -> replacing("hello")), + BSSupplier.create("fromSubscriber-1", () -> fromSubscriber(new BBSubscriber())), + BSSupplier.create("fromSubscriber-2", () -> fromSubscriber(new BBSubscriber(), s -> s)), + BSSupplier.create("fromLineSubscriber-1", () -> fromLineSubscriber(new LineSubscriber())), + BSSupplier.create("fromLineSubscriber-2", () -> fromLineSubscriber(new LineSubscriber(), s -> s, UTF_8, ",")) + ); + + return list.stream().map(x -> new Object[] { x }).toArray(Object[][]::new); + } + + @Test(dataProvider = "bodySubscriberSuppliers") + void nulls(Supplier> bodySubscriberSupplier) { + BodySubscriber bodySubscriber = bodySubscriberSupplier.get(); + boolean subscribed = false; + + do { + assertNotNull(bodySubscriber.getBody()); + assertNotNull(bodySubscriber.getBody()); + assertNotNull(bodySubscriber.getBody()); + expectThrows(NPE, () -> bodySubscriber.onSubscribe(null)); + expectThrows(NPE, () -> bodySubscriber.onSubscribe(null)); + expectThrows(NPE, () -> bodySubscriber.onSubscribe(null)); + + expectThrows(NPE, () -> bodySubscriber.onNext(null)); + expectThrows(NPE, () -> bodySubscriber.onNext(null)); + expectThrows(NPE, () -> bodySubscriber.onNext(null)); + expectThrows(NPE, () -> bodySubscriber.onNext(null)); + + expectThrows(NPE, () -> bodySubscriber.onError(null)); + expectThrows(NPE, () -> bodySubscriber.onError(null)); + expectThrows(NPE, () -> bodySubscriber.onError(null)); + + if (!subscribed) { + out.println("subscribing"); + // subscribe the Subscriber and repeat + bodySubscriber.onSubscribe(new Flow.Subscription() { + @Override public void request(long n) { /* do nothing */ } + @Override public void cancel() { fail(); } + }); + subscribed = true; + continue; + } + break; + } while (true); + } + + @Test(dataProvider = "bodySubscriberSuppliers") + void subscribeMoreThanOnce(Supplier> bodySubscriberSupplier) { + BodySubscriber bodySubscriber = bodySubscriberSupplier.get(); + bodySubscriber.onSubscribe(new Flow.Subscription() { + @Override public void request(long n) { /* do nothing */ } + @Override public void cancel() { fail(); } + }); + + for (int i = 0; i < 5; i++) { + var subscription = new Flow.Subscription() { + volatile boolean cancelled; + @Override public void request(long n) { fail(); } + @Override public void cancel() { cancelled = true; } + }; + bodySubscriber.onSubscribe(subscription); + assertTrue(subscription.cancelled); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/httpclient/RelayingPublishers.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/net/httpclient/RelayingPublishers.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,113 @@ +/* + * 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 jdk.test.lib.util.FileUtils; +import org.testng.annotations.Test; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.http.HttpRequest.BodyPublisher; +import java.net.http.HttpRequest.BodyPublishers; +import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Flow; + +import static org.testng.Assert.assertEquals; + +/* + * @test + * @summary Verifies that some of the standard BodyPublishers relay exception + * rather than throw it + * @bug 8226303 + * @library /test/lib + * @run testng/othervm RelayingPublishers + */ +public class RelayingPublishers { + + @Test + public void ofFile0() throws IOException { + Path directory = Files.createDirectory(Path.of("d")); + // Even though the path exists, the publisher should not be able + // to read from it, as that path denotes a directory, not a file + BodyPublisher pub = BodyPublishers.ofFile(directory); + CompletableSubscriber s = new CompletableSubscriber<>(); + pub.subscribe(s); + s.future().join(); + // Interestingly enough, it's FileNotFoundException if a file + // is a directory + assertEquals(s.future().join().getClass(), FileNotFoundException.class); + } + + @Test + public void ofFile1() throws IOException { + Path file = Files.createFile(Path.of("f")); + BodyPublisher pub = BodyPublishers.ofFile(file); + FileUtils.deleteFileWithRetry(file); + CompletableSubscriber s = new CompletableSubscriber<>(); + pub.subscribe(s); + assertEquals(s.future().join().getClass(), FileNotFoundException.class); + } + + @Test + public void ofByteArrays() { + List bytes = new ArrayList<>(); + bytes.add(null); + BodyPublisher pub = BodyPublishers.ofByteArrays(bytes); + CompletableSubscriber s = new CompletableSubscriber<>(); + pub.subscribe(s); + assertEquals(s.future().join().getClass(), NullPointerException.class); + } + + static class CompletableSubscriber implements Flow.Subscriber { + + final CompletableFuture f = new CompletableFuture<>(); + + @Override + public void onSubscribe(Flow.Subscription subscription) { + subscription.request(1); + } + + @Override + public void onNext(T item) { + f.completeExceptionally(new RuntimeException("Unexpected onNext")); + } + + @Override + public void onError(Throwable throwable) { + f.complete(throwable); + } + + @Override + public void onComplete() { + f.completeExceptionally(new RuntimeException("Unexpected onNext")); + } + + CompletableFuture future() { + return f.copy(); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/Http1HeaderParserTest.java --- a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/Http1HeaderParserTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/Http1HeaderParserTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -375,6 +375,17 @@ "HTTP/1.1 200OK\r\n\rT", "HTTP/1.1 200OK\rT", + + "HTTP/1.0 FOO\r\n", + + "HTTP/1.1 BAR\r\n", + + "HTTP/1.1 +99\r\n", + + "HTTP/1.1 -22\r\n", + + "HTTP/1.1 -20 \r\n" + }; Arrays.stream(bad).forEach(responses::add); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/net/ipv6tests/B6521014.java --- a/test/jdk/java/net/ipv6tests/B6521014.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/net/ipv6tests/B6521014.java Fri Jun 21 14:07:48 2019 +0530 @@ -67,7 +67,6 @@ return NetworkConfiguration.probe() .ip6Addresses() .filter(Inet6Address::isLinkLocalAddress) - .map(B6521014::removeScope) .findFirst(); } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2018, 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. + * + +/* + * @test + * @bug 8215294 + * @requires os.family == "linux" + * @library /test/lib + * @build jdk.test.lib.NetworkConfiguration + * PromiscuousIPv6 + * @run main PromiscuousIPv6 + * @key randomness + */ + +import java.nio.ByteBuffer; +import java.nio.channels.*; +import java.net.*; +import java.util.*; +import java.io.IOException; +import jdk.test.lib.NetworkConfiguration; +import jtreg.SkippedException; +import static java.net.StandardProtocolFamily.*; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.util.stream.Collectors.toList; + +/* + * This test was created as a copy of the Promiscuous test and adapted for + * IPv6 node-local and link-local multicast addresses on Linux. + */ +public class PromiscuousIPv6 { + + static final Random rand = new Random(); + + static final ProtocolFamily UNSPEC = () -> "UNSPEC"; + + /** + * Sends a datagram to the given multicast group + */ + static int sendDatagram(NetworkInterface nif, + InetAddress group, + int port) + throws IOException + { + ProtocolFamily family = (group instanceof Inet6Address) ? INET6 : INET; + DatagramChannel dc = DatagramChannel.open(family) + .setOption(StandardSocketOptions.IP_MULTICAST_IF, nif); + int id = rand.nextInt(); + byte[] msg = Integer.toString(id).getBytes(UTF_8); + ByteBuffer buf = ByteBuffer.wrap(msg); + System.out.format("Send message -> group %s (id=0x%x)\n", + group.getHostAddress(), id); + dc.send(buf, new InetSocketAddress(group, port)); + dc.close(); + return id; + } + + /** + * Waits (with timeout) for datagram. The {@code datagramExpected} + * parameter indicates whether a datagram is expected, and if + * {@code true} then {@code id} is the identifier in the payload. + */ + static void receiveDatagram(DatagramChannel dc, + String name, + boolean datagramExpected, + int id) + throws IOException + { + System.out.println("Checking if received by " + name); + + Selector sel = Selector.open(); + dc.configureBlocking(false); + dc.register(sel, SelectionKey.OP_READ); + ByteBuffer buf = ByteBuffer.allocateDirect(100); + + try { + for (;;) { + System.out.println("Waiting to receive message"); + sel.select(5*1000); + SocketAddress sa = dc.receive(buf); + + // no datagram received + if (sa == null) { + if (datagramExpected) { + throw new RuntimeException("Expected message not received"); + } + System.out.println("No message received (correct)"); + return; + } + + // datagram received + + InetAddress sender = ((InetSocketAddress)sa).getAddress(); + buf.flip(); + byte[] bytes = new byte[buf.remaining()]; + buf.get(bytes); + String s = new String(bytes, "UTF-8"); + int receivedId = -1; + try { + receivedId = Integer.parseInt(s); + System.out.format("Received message from %s (id=0x%x)\n", + sender, receivedId); + } catch (NumberFormatException x) { + System.out.format("Received message from %s (msg=%s)\n", sender, s); + } + + if (!datagramExpected) { + if (receivedId == id) + throw new RuntimeException("Message not expected"); + System.out.println("Message ignored (has wrong id)"); + } else { + if (receivedId == id) { + System.out.println("Message expected"); + return; + } + System.out.println("Message ignored (wrong sender)"); + } + + sel.selectedKeys().clear(); + buf.rewind(); + } + } finally { + sel.close(); + } + } + + static void test(ProtocolFamily family, + NetworkInterface nif, + InetAddress group1, + InetAddress group2) + throws IOException + { + + System.out.format("%nTest family=%s%n", family.name()); + + // Bind addresses should include the same network interface / scope, so + // as to not reply on the default route when there are multiple interfaces + InetAddress bindAddr1 = Inet6Address.getByAddress(null, group1.getAddress(), nif); + InetAddress bindAddr2 = Inet6Address.getByAddress(null, group2.getAddress(), nif); + + DatagramChannel dc1 = (family == UNSPEC) ? + DatagramChannel.open() : DatagramChannel.open(family); + DatagramChannel dc2 = (family == UNSPEC) ? + DatagramChannel.open() : DatagramChannel.open(family); + + try { + dc1.setOption(StandardSocketOptions.SO_REUSEADDR, true); + dc2.setOption(StandardSocketOptions.SO_REUSEADDR, true); + + dc1.bind(new InetSocketAddress(bindAddr1, 0)); + int port = dc1.socket().getLocalPort(); + dc2.bind(new InetSocketAddress(bindAddr2, port)); + + System.out.format("dc1 joining [%s]:%d @ %s\n", + group1.getHostAddress(), port, nif.getName()); + System.out.format("dc2 joining [%s]:%d @ %s\n", + group2.getHostAddress(), port, nif.getName()); + + dc1.join(group1, nif); + dc2.join(group2, nif); + + int id = sendDatagram(nif, group1, port); + + receiveDatagram(dc1, "dc1", true, id); + receiveDatagram(dc2, "dc2", false, id); + + id = sendDatagram(nif, group2, port); + + receiveDatagram(dc1, "dc1", false, id); + receiveDatagram(dc2, "dc2", true, id); + + } finally { + dc1.close(); + dc2.close(); + } + } + + public static void main(String[] args) throws IOException { + + String os = System.getProperty("os.name"); + + if (!os.equals("Linux")) { + throw new SkippedException("This test should be run only on Linux"); + } else { + String osVersion = System.getProperty("os.version"); + String prefix = "3.10.0"; + if (osVersion.startsWith(prefix)) { + throw new SkippedException( + String.format("The behavior under test is known NOT to work on '%s' kernels", prefix)); + } + } + + NetworkConfiguration.printSystemConfiguration(System.out); + List nifs = NetworkConfiguration.probe() + .ip6MulticastInterfaces() + .collect(toList()); + + if (nifs.size() == 0) { + throw new SkippedException( + "No IPv6 interfaces that support multicast found"); + } + + InetAddress interfaceLocal1 = InetAddress.getByName("ff11::2.3.4.5"); + InetAddress interfaceLocal2 = InetAddress.getByName("ff11::6.7.8.9"); + + InetAddress linkLocal1 = InetAddress.getByName("ff12::2.3.4.5"); + InetAddress linkLocal2 = InetAddress.getByName("ff12::6.7.8.9"); + + for (NetworkInterface nif : nifs) { + test(INET6, nif, interfaceLocal1, interfaceLocal2); + test(INET6, nif, linkLocal1, linkLocal2); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/rmi/activation/CommandEnvironment/SetChildEnv.java --- a/test/jdk/java/rmi/activation/CommandEnvironment/SetChildEnv.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/rmi/activation/CommandEnvironment/SetChildEnv.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -123,9 +123,7 @@ "WHO INQUIRE ABOUT MY PARENTS."; System.out.println(complaint); - //Runtime.getRuntime().traceMethodCalls(true); String res = doctor.complain(complaint); - //Runtime.getRuntime().traceMethodCalls(false); System.out.println (" => " + res); // Get debugExec line, allowing 15 seconds for it to flush diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/security/cert/CertPathBuilder/selfIssued/KeyUsageMatters.java --- a/test/jdk/java/security/cert/CertPathBuilder/selfIssued/KeyUsageMatters.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/security/cert/CertPathBuilder/selfIssued/KeyUsageMatters.java Fri Jun 21 14:07:48 2019 +0530 @@ -29,13 +29,13 @@ /** * @test - * @bug 6852744 + * @bug 6852744 8133489 * @summary PIT b61: PKI test suite fails because self signed certificates * are being rejected * @modules java.base/sun.security.util - * @run main/othervm KeyUsageMatters subca - * @run main/othervm KeyUsageMatters subci - * @run main/othervm KeyUsageMatters alice + * @run main/othervm -Djava.security.debug=certpath KeyUsageMatters subca + * @run main/othervm -Djava.security.debug=certpath KeyUsageMatters subci + * @run main/othervm -Djava.security.debug=certpath KeyUsageMatters alice * @author Xuelei Fan */ diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/util/HashMap/ToArray.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/HashMap/ToArray.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,155 @@ +/* + * 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 java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.stream.LongStream; + +/* + * @test + * @summary HashMap.toArray() behavior tests + * @author tvaleev + */ +public class ToArray { + public static void main(String[] args) { + checkMap(false); + checkMap(true); + checkSet(false); + checkSet(true); + } + + private static > void checkToArray(String message, T[] expected, Collection collection, + boolean ignoreOrder) { + if (ignoreOrder) { + Arrays.sort(expected); + } + checkToObjectArray(message, expected, collection, ignoreOrder); + checkToTypedArray(message, expected, Arrays.copyOf(expected, 0), collection, ignoreOrder); + checkToTypedArray(message, expected, expected.clone(), collection, ignoreOrder); + if (expected.length > 0) { + T[] biggerArray = Arrays.copyOf(expected, expected.length * 2); + System.arraycopy(expected, 0, biggerArray, expected.length, expected.length); + checkToTypedArray(message, expected, biggerArray, collection, ignoreOrder); + } + } + + private static > void checkToTypedArray(String message, T[] expected, T[] inputArray, + Collection collection, boolean ignoreOrder) { + T[] res = collection.toArray(inputArray); + if (expected.length <= inputArray.length && res != inputArray) { + throw new AssertionError(message + ": not the same array returned"); + } + if (res.getClass() != expected.getClass()) { + throw new AssertionError(message + ": wrong class returned: " + res.getClass()); + } + if (res.length < expected.length) { + throw new AssertionError(message + ": length is smaller than expected: " + res.length + " < " + expected.length); + } + if (ignoreOrder) { + Arrays.sort(res, 0, Math.min(res.length, expected.length)); + } + if (inputArray.length <= expected.length) { + if (!Arrays.equals(res, expected)) { + throw new AssertionError(message + ": not equal: " + Arrays.toString(expected) + " != " + + Arrays.toString(res)); + } + } else { + int mismatch = Arrays.mismatch(expected, res); + if (mismatch != expected.length) { + throw new AssertionError(message + ": mismatch at " + mismatch); + } + if (res[expected.length] != null) { + throw new AssertionError(message + ": no null at position " + expected.length); + } + // The tail of bigger array after expected.length position must be untouched + mismatch = Arrays + .mismatch(expected, 1, expected.length, res, expected.length + 1, res.length); + if (mismatch != -1) { + throw new AssertionError(message + ": mismatch at " + mismatch); + } + } + } + + private static > void checkToObjectArray(String message, T[] expected, + Collection collection, boolean ignoreOrder) { + Object[] objects = collection.toArray(); + if (objects.getClass() != Object[].class) { + throw new AssertionError(message + ": wrong class returned: " + objects.getClass()); + } + if (ignoreOrder) { + Arrays.sort(objects); + } + int mismatch = Arrays.mismatch(expected, objects); + if (mismatch != -1) { + throw new AssertionError(message + ": mismatch at " + mismatch); + } + } + + private static void checkMap(boolean ordered) { + Map map = ordered ? new LinkedHashMap<>() : new HashMap<>(); + checkToArray("Empty-keys", new String[0], map.keySet(), !ordered); + checkToArray("Empty-values", new String[0], map.values(), !ordered); + + List keys = new ArrayList<>(); + List values = new ArrayList<>(); + for (int i = 0; i < 100; i++) { + keys.add(String.valueOf(i)); + values.add(String.valueOf(i * 2)); + map.put(String.valueOf(i), String.valueOf(i * 2)); + checkToArray(i + "-keys", keys.toArray(new String[0]), map.keySet(), !ordered); + checkToArray(i + "-values", values.toArray(new String[0]), map.values(), !ordered); + } + map.clear(); + checkToArray("Empty-keys", new String[0], map.keySet(), !ordered); + checkToArray("Empty-values", new String[0], map.values(), !ordered); + } + + private static void checkSet(boolean ordered) { + Collection set = ordered ? new LinkedHashSet<>() : new HashSet<>(); + checkToArray("Empty", new String[0], set, !ordered); + set.add("foo"); + checkToArray("One", new String[]{"foo"}, set, !ordered); + set.add("bar"); + checkToArray("Two", new String[]{"foo", "bar"}, set, !ordered); + + Collection longSet = ordered ? new LinkedHashSet<>() : new HashSet<>(); + for (int x = 0; x < 100; x++) { + longSet.add((long) x); + } + checkToArray("100", LongStream.range(0, 100).boxed().toArray(Long[]::new), longSet, !ordered); + longSet.clear(); + checkToArray("After clear", new Long[0], longSet, !ordered); + for (int x = 0; x < 100; x++) { + longSet.add(((long) x) | (((long) x) << 32)); + } + checkToArray("Collisions", LongStream.range(0, 100).mapToObj(x -> x | (x << 32)) + .toArray(Long[]::new), longSet, !ordered); + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/java/util/zip/ZipFile/MultiThreadedReadTest.java --- a/test/jdk/java/util/zip/ZipFile/MultiThreadedReadTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/java/util/zip/ZipFile/MultiThreadedReadTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -28,14 +28,14 @@ * @build jdk.test.lib.Platform * jdk.test.lib.util.FileUtils * @run main MultiThreadedReadTest - * @key randomness */ +import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.nio.file.Paths; -import java.util.Random; +import java.util.zip.CRC32; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; @@ -44,7 +44,8 @@ public class MultiThreadedReadTest extends Thread { private static final int NUM_THREADS = 10; - private static final String ZIPFILE_NAME = "large.zip"; + private static final String ZIPFILE_NAME = + System.currentTimeMillis() + "-bug8038491-tmp.large.zip"; private static final String ZIPENTRY_NAME = "random.txt"; private static InputStream is = null; @@ -63,23 +64,30 @@ threadArray[i].join(); } } finally { + long t = System.currentTimeMillis(); FileUtils.deleteFileIfExistsWithRetry(Paths.get(ZIPFILE_NAME)); + System.out.println("Deleting zip file took:" + + (System.currentTimeMillis() - t) + "ms"); } } private static void createZipFile() throws Exception { - try (ZipOutputStream zos = - new ZipOutputStream(new FileOutputStream(ZIPFILE_NAME))) { - - zos.putNextEntry(new ZipEntry(ZIPENTRY_NAME)); - StringBuilder sb = new StringBuilder(); - Random rnd = new Random(); - for(int i = 0; i < 1000; i++) { - // append some random string for ZipEntry - sb.append(Long.toString(rnd.nextLong())); - } - byte[] b = sb.toString().getBytes(); - zos.write(b, 0, b.length); + CRC32 crc32 = new CRC32(); + long t = System.currentTimeMillis(); + File zipFile = new File(ZIPFILE_NAME); + try (FileOutputStream fos = new FileOutputStream(zipFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + ZipOutputStream zos = new ZipOutputStream(bos)) { + ZipEntry e = new ZipEntry(ZIPENTRY_NAME); + e.setMethod(ZipEntry.STORED); + byte[] toWrite = "BLAH".repeat(10_000).getBytes(); + e.setTime(t); + e.setSize(toWrite.length); + crc32.reset(); + crc32.update(toWrite); + e.setCrc(crc32.getValue()); + zos.putNextEntry(e); + zos.write(toWrite); } } @@ -88,6 +96,7 @@ try { while (is.read() != -1) { } } catch (Exception e) { + System.out.println("read exception:" + e); // Swallow any Exceptions (which are expected) - we're only interested in the crash } } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/javax/net/ssl/DTLS/PacketLossRetransmission.java --- a/test/jdk/javax/net/ssl/DTLS/PacketLossRetransmission.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/javax/net/ssl/DTLS/PacketLossRetransmission.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 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 @@ -35,7 +35,7 @@ * @run main/othervm PacketLossRetransmission client 1 client_hello * @run main/othervm PacketLossRetransmission client 2 server_hello * @run main/othervm PacketLossRetransmission client 3 hello_verify_request - * @run main/othervm PacketLossRetransmission client 4 new_session_ticket + * @run main/othervm -Djdk.tls.client.enableSessionTicketExtension=false PacketLossRetransmission client 4 new_session_ticket * @run main/othervm PacketLossRetransmission client 11 certificate * @run main/othervm PacketLossRetransmission client 12 server_key_exchange * @run main/othervm PacketLossRetransmission client 13 certificate_request @@ -51,7 +51,7 @@ * @run main/othervm PacketLossRetransmission server 1 client_hello * @run main/othervm PacketLossRetransmission server 2 server_hello * @run main/othervm PacketLossRetransmission server 3 hello_verify_request - * @run main/othervm PacketLossRetransmission server 4 new_session_ticket + * @run main/othervm -Djdk.tls.client.enableSessionTicketExtension=false PacketLossRetransmission server 4 new_session_ticket * @run main/othervm PacketLossRetransmission server 11 certificate * @run main/othervm PacketLossRetransmission server 12 server_key_exchange * @run main/othervm PacketLossRetransmission server 13 certificate_request diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/javax/net/ssl/SSLSession/SSLCtxAccessToSessCtx.java --- a/test/jdk/javax/net/ssl/SSLSession/SSLCtxAccessToSessCtx.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/javax/net/ssl/SSLSession/SSLCtxAccessToSessCtx.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -25,7 +25,9 @@ * @test * @bug 4473210 * @summary SSLSessionContext should be accessible from SSLContext - * @run main/othervm SSLCtxAccessToSessCtx + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=false + * SSLCtxAccessToSessCtx + * * * SunJSSE does not support dynamic system properties, no way to re-use * system properties in samevm/agentvm mode. diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java --- a/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java Fri Jun 21 14:07:48 2019 +0530 @@ -53,6 +53,9 @@ @Override protected void runServerApplication(SSLSocket socket) throws Exception { + // Set SO_LINGER in case of slow socket + socket.setSoLinger(true, 10); + // here comes the test logic InputStream sslIS = socket.getInputStream(); OutputStream sslOS = socket.getOutputStream(); @@ -81,6 +84,9 @@ * @see #isCustomizedClientConnection() */ protected void runClientApplication(SSLSocket socket) throws Exception { + // Set SO_LINGER in case of slow socket + socket.setSoLinger(true, 10); + socket.setEnabledProtocols(new String[] {"TLSv1.3"}); InputStream sslIS = socket.getInputStream(); OutputStream sslOS = socket.getOutputStream(); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java --- a/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java Fri Jun 21 14:07:48 2019 +0530 @@ -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 @@ -189,10 +189,15 @@ } /* + * Configure the client side socket. + */ + protected void configureClientSocket(SSLSocket socket) { + } + + /* * Configure the server side socket. */ protected void configureServerSocket(SSLServerSocket socket) { - } /* @@ -317,6 +322,7 @@ try (SSLSocket sslSocket = (SSLSocket)sslsf.createSocket()) { try { + configureClientSocket(sslSocket); sslSocket.connect( new InetSocketAddress("localhost", serverPort), 15000); } catch (IOException ioe) { diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/javax/sound/sampled/spi/AudioFileReader/RecognizeAuFloat.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javax/sound/sampled/spi/AudioFileReader/RecognizeAuFloat.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,707 @@ +/* + * 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 java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; + +import javax.sound.sampled.AudioFileFormat; +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; + +/** + * @test + * @bug 8146239 + * @summary Tests that AU_FLOAT and AU_DOUBLE formats are supported + */ +public final class RecognizeAuFloat { + // Create the audio file + // $sox -c 2 -n -b 32 -e floating-point -r 32000 --comment '' tmp.au synth 0.01 sine 1-90000 sine 90000-1 + // sndfile will remove the optional information chunk + // $sndfile-convert tmp.au data.au + private static final byte[] data32 = + new byte[]{46, 115, 110, 100, 0, 0, 0, 24, 0, 0, 10, 0, 0, 0, 0, 6, + 0, 0, 125, 0, 0, 0, 0, 2, 55, 30, 0, 0, -66, 83, 22, 72, 57, + 20, 0, 0, -66, -22, -69, 4, 57, -100, -96, 0, 62, -119, 4, + -42, 57, -15, -80, 0, -67, -102, -15, -24, 58, 39, -84, 0, + -68, 77, 29, 64, 58, 88, -104, 0, 61, 39, -13, -64, 58, + -122, -16, 0, -69, -74, -27, -128, 58, -94, -26, 0, -66, 42, + 16, 116, 58, -63, 38, 0, 63, 5, 27, -95, 58, -32, -6, 0, + -65, 25, 104, -34, 59, 1, -98, 0, -66, -67, -43, 98, 59, 19, + -85, 0, 62, -37, 121, -120, 59, 39, 4, 0, 63, 21, 30, 50, + 59, 59, 110, 0, 63, 65, 109, 87, 59, 81, 60, 0, 63, 11, 74, + 112, 59, 104, 67, 0, 62, -36, 123, -48, 59, -128, 100, 0, + -66, -50, -18, -128, 59, -115, 88, -128, -65, 20, -62, 90, + 59, -101, 27, -128, -67, -122, 39, -88, 59, -87, -89, -128, + 63, 81, 60, -32, 59, -71, 18, -128, -65, 52, -14, 17, 59, + -55, 95, -128, 62, 91, 110, -100, 59, -38, -97, 0, 62, 36, + 28, -120, 59, -20, -38, 0, -66, -97, 28, -24, 60, 0, 15, 0, + 62, -95, 14, 112, 60, 10, 60, -128, -66, -125, -38, 104, 60, + 20, -5, 0, 62, 64, -85, -72, 60, 32, 83, -64, -66, 0, -88, + -124, 60, 44, 75, -128, 61, -104, -68, -104, 60, 56, -19, + 64, -67, 11, -80, 16, 60, 70, 62, 0, 59, 12, 0, 0, 60, 84, + 73, 64, 60, -72, 108, -128, 60, 99, 21, 0, -67, 6, -91, 32, + 60, 114, -83, -128, 61, 110, -11, 32, 60, -127, -116, -64, + -67, 73, -87, -64, 60, -118, 51, 64, 61, -71, 28, -96, 60, + -109, 77, -32, -67, -66, 26, -72, 60, -100, -29, -96, 61, + -101, 24, -112, 60, -90, -7, 32, -67, 110, -4, -64, 60, -79, + -107, -96, 61, -85, -41, 112, 60, -68, -66, 64, -67, -117, + 85, 8, 60, -56, 122, -96, 61, 119, 33, -128, 60, -44, -48, + -32, -67, -123, -116, 104, 60, -31, -56, -64, 60, -101, -65, + -128, 60, -17, 105, 96, 60, 71, 29, -128, 60, -3, -70, -32, + -67, -121, -72, 32, 61, 6, 98, -80, 62, 17, 12, -52, 61, 14, + 72, -96, -66, 98, -7, 120, 61, 22, -109, -48, 62, -89, -123, + -114, 61, 31, 72, -64, -66, -46, -27, -126, 61, 40, 108, + 112, 62, -24, 13, -98, 61, 50, 3, -64, -66, -49, -111, -118, + 61, 60, 20, 32, 62, 65, -50, 0, 61, 70, -94, -48, 62, 7, + -53, -92, 61, 81, -75, -80, -65, 15, 22, 51, 61, 93, 82, + -112, 63, 75, 122, 6, 61, 105, 127, -64, -65, 39, -103, 108, + 61, 118, 67, -128, 61, 102, -22, 32, 61, -127, -46, 80, 63, + 3, -8, 3, 61, -120, -44, -16, -65, 13, 31, -78, 61, -112, + 45, 88, -66, 26, 95, 88, 61, -105, -33, 40, 63, 56, 1, -51, + 61, -97, -18, 104, -66, -87, 96, -96, 61, -88, 94, -24, -65, + 14, -12, 116, 61, -79, 53, 8, 62, -28, 8, -68, 61, -70, 116, + -16, 62, -11, -35, 8, 61, -60, 35, 48, -65, 7, -110, 47, 61, + -50, 68, 96, -65, 4, 62, -13, 61, -40, -35, 48, 62, -54, + -54, 70, 61, -29, -14, -64, 63, 28, -19, -10, 61, -17, -119, + -80, -66, 74, 117, -88, 61, -5, -89, -24, -65, 55, 82, 2, + 62, 4, 40, -40, -66, 119, -21, -24, 62, 10, -58, -4, 62, -8, + 108, 110, 62, 17, -80, 40, 63, 38, 48, 49, 62, 24, -24, + -112, -67, 110, -90, 32, 62, 32, 113, 92, -65, 29, -111, + -11, 62, 40, 79, -92, -65, 31, 111, 119, 62, 48, -125, -68, + -67, -99, -66, -80, 62, 57, 19, -60, 62, -13, -69, 100, 62, + 65, -1, 16, 63, 53, 109, -123, 62, 75, 76, -64, 62, -112, + 45, 8, 62, 84, -5, 36, -66, -117, -58, -90, 62, 95, 18, 24, + -65, 43, -15, -111, 62, 105, -113, 36, -65, 37, -126, 17, + 62, 116, 122, 72, -66, -71, 7, 124, 62, 127, -48, -48, 61, + -80, 58, 104, 62, -123, -52, -22, 63, 10, -42, -96, 62, + -117, -23, -88, 63, 53, 17, -15, 62, -110, 64, -8, 63, 4, + -33, -105, 62, -104, -46, -42, 62, 14, -16, 16, 62, -97, + -97, 98, -66, -120, -100, 48, 62, -90, -88, 106, -65, 16, + -55, 65, 62, -83, -22, -104, -65, 50, 111, 94, 62, -75, 106, + 126, -65, 43, -76, -4, 62, -67, 31, -16, -65, 5, 60, 84, 62, + -59, 19, 34, -66, -101, 116, -118, 62, -51, 53, -64, -67, + -114, -112, 112, 62, -43, -108, 62, 62, 124, 61, 4, 62, -34, + 25, 4, 63, 12, -46, 66, 62, -26, -44, -28, 63, 46, -89, -62, + 62, -17, -86, 94, 63, 49, -118, -31, 62, -8, -83, -6, 63, + 18, 74, -70, 63, 0, -35, 49, 62, -57, -13, -10, 63, 5, 115, + 21, 62, 39, 28, -108, 63, 10, 2, -109, -67, 91, 2, -48, 63, + 14, -106, 126, -66, -125, -114, 6, 63, 19, 22, 108, -66, + -43, -29, 52, 63, 23, -118, -117, -65, 11, 119, -38, 63, 27, + -39, -51, -65, 32, -43, 72, 63, 32, 6, -41, -65, 46, 64, + -64, 63, 35, -6, 65, -65, 51, -67, -118, 63, 39, -83, -78, + -65, 51, -12, -67, 63, 43, 14, 38, -65, 47, -33, -17, 63, + 46, 8, 121, -65, 41, 19, 46, 63, 48, -111, 23, -65, 32, -60, + -18, 63, 50, -124, 76, -65, 23, -122, -109, 63, 51, -31, 5, + -65, 14, -121, 38, 63, 52, 111, -48, -65, 5, -96, -7, 63, + 52, 60, -30, -66, -5, -52, -60, 63, 50, -5, 32, -66, -19, + -110, -102, 63, 48, -58, 58, -66, -30, 112, -76, 63, 45, 59, + -112, -66, -40, -12, 36, 63, 40, -121, -76, -66, -46, -85, + 120, 63, 34, 53, -105, -66, -50, 29, 12, 63, 26, -125, 46, + -66, -52, -124, 104, 63, 16, -17, -11, -66, -52, -114, 12, + 63, 5, -54, -26, -66, -49, 34, 40, 62, -15, 39, -124, -66, + -45, 38, -34, 62, -45, 83, 6, -66, -39, 53, 112, 62, -79, + 58, -88, -66, -32, 113, 10, 62, -117, -71, 118, -66, -23, + 44, -72, 62, 68, -124, 88, -66, -14, -61, 36, 61, -41, 35, + -48, -66, -3, 76, -16, 60, 73, 21, 64, -65, 4, 41, 121, -67, + -84, -32, 56, -65, 9, -32, 97, -66, 59, -16, -68, -65, 15, + -95, -73, -66, -112, -19, 104, -65, 21, 83, -106, -66, -62, + 84, 28, -65, 26, -38, 66, -66, -15, 61, -70, -65, 32, 18, + -104, -65, 13, 91, 117, -65, 36, -21, 35, -65, 31, 24, -23, + -65, 41, 61, 53, -65, 43, -67, -83, -65, 44, -1, 47, -65, + 51, 118, 20, -65, 48, 11, 126, -65, 51, -106, -70, -65, 50, + 94, -68, -65, 45, 55, 12, -65, 51, -40, 0, -65, 29, 54, 57, + -65, 52, 121, 12, -65, 6, 103, 50, -65, 52, 40, 15, -66, + -54, 55, 44, -65, 50, -21, 51, -66, 126, 66, -44, -65, 48, + -79, 26, -67, 117, 95, -48, -65, 45, -125, -61, 61, -106, + 52, -96, -65, 41, 90, -97, 61, -57, 113, -120, -65, 36, 66, + -15, 62, 12, -23, 24, -65, 30, 60, -115, 62, 48, 125, 20, + -65, 23, 87, 95, 62, 90, -59, 68, -65, 15, -102, -111, 62, + -127, -1, 112, -65, 7, 24, 12, 62, -104, 94, -106, -66, -5, + -71, -60, 62, -82, -25, -76, -66, -25, -8, -128, 62, -58, + 53, -84, -66, -45, 14, -22, 62, -35, -81, -96, -66, -67, 36, + -120, 62, -11, 6, -66, -66, -90, 97, 4, 63, 6, 3, 127, -66, + -114, -21, -84, 63, 16, -20, 40, -66, 109, -36, 56, 63, 27, + 40, 41, -66, 61, 28, 72, 63, 36, 33, -103, -66, 11, -23, 72, + 63, 43, -83, 65, -67, -75, 19, 40, 63, 49, 27, 71, -67, 37, + 37, 48, 63, 52, 32, -92, 59, -13, 9, 0, 63, 51, -1, -36, 61, + 95, 94, -112, 63, 48, 88, -114, 61, -50, 123, -8, 63, 40, + 111, -36, 62, 21, -110, 52, 63, 27, -12, -26, 62, 66, -90, + -48, 63, 10, 76, 35, 62, 110, 78, 0, 62, -26, -13, -12, 62, + -116, 49, -14, 62, -82, 100, -112, 62, -96, 99, 6, 62, 88, + -35, 60, 62, -77, -83, 18, 61, -122, 105, 8, 62, -58, 4, 54, + -67, -72, 110, -32, 62, -41, 95, -40, -66, -128, -100, 68, + 62, -25, -72, -8, -66, -50, -95, -10, 62, -9, 11, 32, -65, + 10, 90, -74, 63, 2, -87, -56, -65, 36, 41, 100, 63, 9, 72, + -63, -65, 51, 48, -12, 63, 15, 98, -30, -65, 49, 114, 53, + 63, 20, -7, 86, -65, 31, -51, 3, 63, 26, 13, -7, -66, -14, + -93, 4, 63, 30, -93, 56, -66, -118, -69, 76, 63, 34, -68, + 16, -70, -82, 44, 0, 63, 38, 91, -23, 62, 94, 113, -52, 63, + 41, -122, -105, 62, -89, -122, -42, 63, 44, 64, 56, 62, -28, + 76, -10, 63, 46, -115, 50, 63, 12, 66, 105, 63, 48, 114, 28, + 63, 34, 21, 2, 63, 49, -13, -73, 63, 48, 66, -126, 63, 51, + 22, -34, 63, 52, 69, -91, 63, 51, -32, 123, 63, 44, 33, -96, + 63, 52, 85, -126, 63, 21, 55, -35, 63, 52, 122, -32, 62, + -33, -42, 72, 63, 52, 85, 123, 62, 113, 54, 96, 63, 51, -22, + 37, -69, 84, -27, 0, 63, 51, 61, -98, -66, -125, -34, -80, + 63, 50, 84, -124, -66, -7, -59, 56, 63, 49, 51, 90, -65, 38, + -69, 12, 63, 47, -34, 124, -65, 52, 120, -13, 63, 46, 90, + 32, -65, 28, -48, -75, 63, 44, -86, 84, -66, -62, -122, 2, + 63, 42, -46, -4, -68, -66, 18, -64, 63, 40, -41, -49, 62, + -125, 39, -32, 63, 38, -68, 89, 62, -23, 125, -60, 63, 36, + -125, -7, 63, 32, 56, 64, 63, 34, 49, -32, 63, 51, -95, -58, + 63, 31, -55, 21, 63, 41, -75, 70, 63, 29, 76, 114, 62, -7, + -33, -98, 63, 26, -66, -91, 62, 65, -30, 76, 63, 24, 34, 52, + -66, 48, 71, -116, 63, 21, 121, 124, -65, 2, -67, 114, 63, + 18, -58, -80, -65, 49, 29, -36, 63, 16, 11, -32, -65, 34, + -68, -19, 63, 13, 74, -12, -66, -104, 24, -26, 63, 10, -123, + -76, 62, 51, 28, -80, 63, 7, -67, -61, 63, 2, 89, -28, 63, + 4, -12, -89, 63, 47, -73, -62, 63, 2, 43, -61, 63, 39, 28, + 20, 62, -2, -56, -64, 62, -77, 8, -104, 62, -7, 63, 86, -67, + -19, -18, -96, 62, -13, -67, 110, -65, 14, -31, -41, 62, + -18, 68, -10, -65, 50, -108, 124, 62, -24, -41, -72, -66, + -51, -101, 100, 62, -29, 119, 74, 62, 81, -23, -92, 62, -34, + 37, 28, 63, 35, 19, -90, 62, -40, -30, 118, 63, 42, 75, 0, + 62, -45, -80, -126, 62, -101, 23, -2, 62, -50, -112, 60, + -66, -92, 113, 88, 62, -55, -126, -110, -65, 48, 57, -75, + 62, -60, -120, 62, -66, -18, 109, -36, 62, -65, -95, -2, 62, + -122, 46, -94, 62, -70, -48, 80, 63, 43, -78, 92, 62, -74, + 19, -56, 63, 8, -56, 59, 62, -79, 108, -82, -66, 53, 9, -12, + 62, -84, -37, 124, -65, 45, -38, -43, 62, -88, 96, 68, -66, + -64, 66, -114, 62, -93, -5, 104, 62, -5, -24, -122, 62, -97, + -84, -46, 63, 37, -56, 106, 62, -101, 116, -52, -69, -51, + 74, 0, 62, -105, 83, 38, -65, 52, 39, 12, 62, -109, 72, 12, + -66, 105, -56, -88, 62, -113, 83, 68, 63, 34, 28, -23, 62, + -117, 116, -54, 62, -41, 27, -96, 62, -121, -84, 124, -65, + 6, 56, 36, 62, -125, -6, 18, -66, -24, -78, 120, 62, -128, + 93, -98, 63, 26, -115, 55, 62, 121, -84, -36, 62, -72, -90, + 88, 62, 114, -54, 0, -65, 24, -101, -10, 62, 108, 16, 20, + -66, 52, -39, -8, 62, 101, -127, 68, 63, 69, 45, 6, 62, 95, + 25, 120, -66, -68, 112, 34, 62, 88, -36, 112, -66, -63, + -116, 94, 62, 82, -60, 72, 63, 28, 61, 0, 62, 76, -42, -116, + -66, 27, 72, 116, 62, 71, 11, 104, -66, -7, -1, -124, 62, + 65, 106, 68, 63, 84, 48, 84, 62, 59, -23, 120, -65, 42, 107, + 50, 62, 54, -110, 16, 62, -125, -115, -8, 62, 49, 89, 0, 62, + 57, -24, -4, 62, 44, 72, 60, -66, -35, -117, 4, 62, 39, 84, + 100, 63, 1, -103, 34, 62, 34, -121, 12, -66, -17, 116, 4, + 62, 29, -42, 0, 62, -65, -115, 24, 62, 25, 72, -72, -66, + 120, -42, -28, 62, 20, -40, 64, 62, 26, 47, 8, 62, 16, -121, + -112, -67, 77, -2, 32, 62, 12, 85, -124, 59, 64, 93, 0, 62, + 8, 61, -16, 61, 73, 86, -80, 62, 4, 72, 80, -67, -102, 14, + 0, 62, 0, 102, 100, 61, -76, -35, 112, 61, -7, 86, 72, -67, + 121, 104, -96, 61, -15, -9, 56, 61, 123, -75, 16, 61, -22, + -15, 64, -67, 115, -85, 64, 61, -29, -15, 8, 61, -125, -102, + 40, 61, -35, 86, -16, -68, -17, 52, 32, 61, -42, -80, -128, + 61, 30, -101, 112, 61, -48, 124, -16, 60, 14, -37, 0, 61, + -54, 44, 88, -67, 38, 97, 112, 61, -60, 89, 8, 61, 79, -37, + -96, 61, -66, 91, -64, -67, 76, 109, 80, 61, -72, -31, 72, + 61, -73, -94, -88, 61, -77, 54, 72, -67, -4, 114, -24, 61, + -82, 12, 32, 62, 5, 28, 48, 61, -88, -77, -8, -66, 37, 7, + 20, 61, -93, -48, 88, 62, 36, -101, 8, 61, -98, -52, -16, + -67, -40, 80, 112, 61, -102, 37, 64, -67, -91, -60, 104, 61, + -107, 121, -88, 62, -47, 16, 34, 61, -111, 2, -72, -65, 69, + 50, -82, 61, -116, -78, -96, 63, 20, -70, 1, 61, -120, 97, + 56, 62, -127, -67, -36, 61, -124, 112, 96, -65, 33, -9, -43, + 61, -128, 57, -16, -66, -7, -70, 72, 61, 121, 86, -32, 62, + 41, -78, 116, 61, 113, 13, -80, 63, 18, -75, -76, 61, 106, + -72, 112, 63, 48, 90, 88, 61, 98, -123, 48, 63, 52, 13, -69, + 61, 92, -10, 16, 63, 45, 31, -18, 61, 84, -47, 48, 62, -32, + 12, 26, 61, 80, 0, 48, -66, 38, -81, 88, 61, 71, -23, -16, + -65, 63, -24, 61, 61, 67, -57, 0, 62, -106, -40, 110, 61, + 59, -55, 48, 62, 116, 6, 44, 61, 56, 58, 80, -66, -67, 31, + 42, 61, 48, 106, 64, 62, -88, 121, 104, 61, 45, 73, 16, -66, + -115, -11, -110, 61, 37, -53, 48, 62, -128, -110, -42, 61, + 34, -33, -80, -66, 121, 84, -44, 61, 27, -17, 48, 62, 79, + -38, 28, 61, 24, -30, -16, 61, 91, 108, 16, 61, 18, -23, 32, + -65, 38, 12, 43, 61, 15, 26, -64, 62, 59, -92, -104, 61, 11, + 11, 96, 62, -37, 45, 18, 61, 4, -81, -48, 61, 74, 69, -16, + 61, 6, -67, 80,}; + + // Create the audio file + // $sox -c 2 -n -b 64 -e floating-point -r 32000 --comment '' tmp.au synth 0.01 sine 1-90000 sine 90000-1 + // sndfile will remove the optional information chunk + // $sndfile-convert tmp.au data.au + private static final byte[] data64 = + new byte[]{46, 115, 110, 100, 0, 0, 0, 24, 0, 0, 20, 0, 0, 0, 0, 7, + 0, 0, 125, 0, 0, 0, 0, 2, 62, -29, -76, -128, 0, 0, 0, 0, + -65, -54, 98, -55, 10, 0, 0, 0, 63, 34, 127, 32, 0, 0, 0, 0, + -65, -35, 87, 96, -84, -128, 0, 0, 63, 51, -108, 34, 0, 0, + 0, 0, 63, -47, 32, -102, -49, -128, 0, 0, 63, 62, 54, 74, 0, + 0, 0, 0, -65, -77, 94, 60, -84, 0, 0, 0, 63, 68, -11, 79, 0, + 0, 0, 0, -65, -119, -93, -86, 48, 0, 0, 0, 63, 75, 19, 0, 0, + 0, 0, 0, 63, -92, -2, 120, 56, 0, 0, 0, 63, 80, -34, 23, + -128, 0, 0, 0, -65, 118, -36, -82, 0, 0, 0, 0, 63, 84, 92, + -63, -128, 0, 0, 0, -65, -59, 66, 14, 115, 0, 0, 0, 63, 88, + 36, -38, 0, 0, 0, 0, 63, -32, -93, 116, 32, 0, 0, 0, 63, 92, + 31, 46, -128, 0, 0, 0, -65, -29, 45, 27, -52, 64, 0, 0, 63, + 96, 51, -72, -64, 0, 0, 0, -65, -41, -70, -84, 58, -128, 0, + 0, 63, 98, 117, 82, -128, 0, 0, 0, 63, -37, 111, 49, 18, 0, + 0, 0, 63, 100, -32, 114, -128, 0, 0, 0, 63, -30, -93, -58, + 66, -64, 0, 0, 63, 103, 109, -69, -64, 0, 0, 0, 63, -24, 45, + -86, -27, -128, 0, 0, 63, 106, 39, 113, 0, 0, 0, 0, 63, -31, + 105, 78, 14, 0, 0, 0, 63, 109, 8, 89, 0, 0, 0, 0, 63, -37, + -113, 121, -3, -128, 0, 0, 63, 112, 12, 124, 96, 0, 0, 0, + -65, -39, -35, -48, 29, -128, 0, 0, 63, 113, -85, 22, -32, + 0, 0, 0, -65, -30, -104, 75, 72, -64, 0, 0, 63, 115, 99, + 111, 64, 0, 0, 0, -65, -80, -60, -11, 82, 0, 0, 0, 63, 117, + 52, -17, -128, 0, 0, 0, 63, -22, 39, -100, 28, 64, 0, 0, 63, + 119, 34, 84, -32, 0, 0, 0, -65, -26, -98, 66, 30, 0, 0, 0, + 63, 121, 43, -20, -96, 0, 0, 0, 63, -53, 109, -45, 127, 0, + 0, 0, 63, 123, 83, -34, 0, 0, 0, 0, 63, -60, -125, -111, 35, + 0, 0, 0, 63, 125, -101, 60, 64, 0, 0, 0, -65, -45, -29, -99, + 28, -128, 0, 0, 63, -128, 1, -33, 0, 0, 0, 0, 63, -44, 33, + -50, 29, 0, 0, 0, 63, -127, 71, -115, -80, 0, 0, 0, -65, + -48, 123, 77, 30, 0, 0, 0, 63, -126, -97, 96, -96, 0, 0, 0, + 63, -56, 21, 119, 58, 0, 0, 0, 63, -124, 10, 118, 80, 0, 0, + 0, -65, -64, 21, 16, -60, 0, 0, 0, 63, -123, -119, 115, -96, + 0, 0, 0, 63, -77, 23, -109, 98, 0, 0, 0, 63, -121, 29, -87, + -16, 0, 0, 0, -65, -95, 118, 1, 44, 0, 0, 0, 63, -120, -57, + -66, -128, 0, 0, 0, 63, 97, 127, -7, 0, 0, 0, 0, 63, -118, + -119, 40, -96, 0, 0, 0, 63, -105, 13, -111, 56, 0, 0, 0, 63, + -116, 98, -99, -96, 0, 0, 0, -65, -96, -44, -92, 100, 0, 0, + 0, 63, -114, 85, -80, 32, 0, 0, 0, 63, -83, -34, -93, -24, + 0, 0, 0, 63, -112, 49, -103, 80, 0, 0, 0, -65, -87, 53, 56, + 100, 0, 0, 0, 63, -111, 70, 102, 32, 0, 0, 0, 63, -73, 35, + -108, 44, 0, 0, 0, 63, -110, 105, -69, 40, 0, 0, 0, -65, + -73, -61, 87, -118, 0, 0, 0, 63, -109, -100, 116, 88, 0, 0, + 0, 63, -77, 99, 17, -86, 0, 0, 0, 63, -108, -33, 37, 80, 0, + 0, 0, -65, -83, -33, -104, -20, 0, 0, 0, 63, -106, 50, -78, + 8, 0, 0, 0, 63, -75, 122, -19, -18, 0, 0, 0, 63, -105, -105, + -57, 104, 0, 0, 0, -65, -79, 106, -95, 80, 0, 0, 0, 63, + -103, 15, 82, 104, 0, 0, 0, 63, -82, -28, 47, -68, 0, 0, 0, + 63, -102, -102, 26, 96, 0, 0, 0, -65, -80, -79, -115, -122, + 0, 0, 0, 63, -100, 57, 23, 96, 0, 0, 0, 63, -109, 119, -17, + 0, 0, 0, 0, 63, -99, -19, 43, -8, 0, 0, 0, 63, -120, -29, + -81, -32, 0, 0, 0, 63, -97, -73, 93, -96, 0, 0, 0, -65, -80, + -9, 3, -100, 0, 0, 0, 63, -96, -52, 85, 76, 0, 0, 0, 63, + -62, 33, -103, -109, 0, 0, 0, 63, -95, -55, 20, 116, 0, 0, + 0, -65, -52, 95, 46, -25, 0, 0, 0, 63, -94, -46, 121, 84, 0, + 0, 0, 63, -44, -16, -79, -41, -128, 0, 0, 63, -93, -23, 24, + -80, 0, 0, 0, -65, -38, 92, -80, 77, 0, 0, 0, 63, -91, 13, + -115, -32, 0, 0, 0, 63, -35, 1, -77, -25, 0, 0, 0, 63, -90, + 64, 120, -56, 0, 0, 0, -65, -39, -14, 49, 104, -128, 0, 0, + 63, -89, -126, -125, -120, 0, 0, 0, 63, -56, 57, -65, -19, + 0, 0, 0, 63, -88, -44, 90, 108, 0, 0, 0, 63, -64, -7, 116, + 100, 0, 0, 0, 63, -86, 54, -74, -12, 0, 0, 0, -65, -31, -30, + -58, 100, -64, 0, 0, 63, -85, -86, 83, 0, 0, 0, 0, 63, -23, + 111, 64, -60, -64, 0, 0, 63, -83, 47, -8, 120, 0, 0, 0, -65, + -28, -13, 45, -110, -128, 0, 0, 63, -82, -56, 111, -100, 0, + 0, 0, 63, -84, -35, 68, 16, 0, 0, 0, 63, -80, 58, 73, -36, + 0, 0, 0, 63, -32, 127, 0, 107, 64, 0, 0, 63, -79, 26, -98, + 4, 0, 0, 0, -65, -31, -93, -10, 83, 64, 0, 0, 63, -78, 5, + -85, 102, 0, 0, 0, -65, -61, 75, -21, 38, 0, 0, 0, 63, -78, + -5, -27, 50, 0, 0, 0, 63, -25, 0, 57, -88, -128, 0, 0, 63, + -77, -3, -52, -102, 0, 0, 0, -65, -43, 44, 20, 8, -128, 0, + 0, 63, -75, 11, -36, -46, 0, 0, 0, -65, -31, -34, -114, + -106, -128, 0, 0, 63, -74, 38, -95, 8, 0, 0, 0, 63, -36, + -127, 23, -107, 0, 0, 0, 63, -73, 78, -99, -84, 0, 0, 0, 63, + -34, -69, -95, 14, 0, 0, 0, 63, -72, -124, 102, 120, 0, 0, + 0, -65, -32, -14, 69, -38, 64, 0, 0, 63, -71, -56, -117, + -40, 0, 0, 0, -65, -32, -121, -34, 103, -64, 0, 0, 63, -69, + 27, -90, 118, 0, 0, 0, 63, -39, 89, 72, -38, 0, 0, 0, 63, + -68, 126, 87, -94, 0, 0, 0, 63, -29, -99, -66, -42, 0, 0, 0, + 63, -67, -15, 54, 116, 0, 0, 0, -65, -55, 78, -76, -34, 0, + 0, 0, 63, -65, 116, -4, -82, 0, 0, 0, -65, -26, -22, 64, 89, + -64, 0, 0, 63, -64, -123, 27, 3, 0, 0, 0, -65, -50, -3, 125, + 21, 0, 0, 0, 63, -63, 88, -33, 109, 0, 0, 0, 63, -33, 13, + -115, -60, 0, 0, 0, 63, -62, 54, 5, 67, 0, 0, 0, 63, -28, + -58, 6, 53, 64, 0, 0, 63, -61, 29, 17, -18, 0, 0, 0, -65, + -83, -44, -61, -116, 0, 0, 0, 63, -60, 14, 43, 126, 0, 0, 0, + -65, -29, -78, 62, -76, -64, 0, 0, 63, -59, 9, -12, 83, 0, + 0, 0, -65, -29, -19, -18, -10, -64, 0, 0, 63, -58, 16, 119, + -96, 0, 0, 0, -65, -77, -73, -42, 14, 0, 0, 0, 63, -57, 34, + 120, -123, 0, 0, 0, 63, -34, 119, 108, -99, 0, 0, 0, 63, + -56, 63, -30, 64, 0, 0, 0, 63, -26, -83, -80, -100, -64, 0, + 0, 63, -55, 105, -105, -2, 0, 0, 0, 63, -46, 5, -96, -15, + -128, 0, 0, 63, -54, -97, 100, -116, 0, 0, 0, -65, -47, 120, + -44, -83, -128, 0, 0, 63, -53, -30, 66, -15, 0, 0, 0, -65, + -27, 126, 50, 30, 0, 0, 0, 63, -51, 49, -28, -110, 0, 0, 0, + -65, -28, -80, 66, 35, 0, 0, 0, 63, -50, -113, 73, 47, 0, 0, + 0, -65, -41, 32, -17, 119, -128, 0, 0, 63, -49, -6, 26, 31, + 0, 0, 0, 63, -74, 7, 77, 102, 0, 0, 0, 63, -48, -71, -99, + 98, 0, 0, 0, 63, -31, 90, -44, 17, 64, 0, 0, 63, -47, 125, + 53, 14, -128, 0, 0, 63, -26, -94, 62, 29, 0, 0, 0, 63, -46, + 72, 31, 11, 0, 0, 0, 63, -32, -101, -14, -11, 64, 0, 0, 63, + -45, 26, 90, -23, 0, 0, 0, 63, -63, -34, 1, -36, 0, 0, 0, + 63, -45, -13, -20, 70, -128, 0, 0, -65, -47, 19, -123, -14, + -128, 0, 0, 63, -44, -43, 13, 101, -128, 0, 0, -65, -30, 25, + 40, 47, -128, 0, 0, 63, -43, -67, 83, 25, 0, 0, 0, -65, -26, + 77, -21, -50, -64, 0, 0, 63, -42, -83, 79, -58, 0, 0, 0, + -65, -27, 118, -97, -120, -64, 0, 0, 63, -41, -93, -2, 15, + 0, 0, 0, -65, -32, -89, -118, 122, -128, 0, 0, 63, -40, -94, + 100, 65, 0, 0, 0, -65, -45, 110, -111, 82, -128, 0, 0, 63, + -39, -90, -72, 34, -128, 0, 0, -65, -79, -46, 14, 48, 0, 0, + 0, 63, -38, -78, -121, -43, -128, 0, 0, 63, -49, -121, -96, + 108, 0, 0, 0, 63, -37, -61, 32, -94, -128, 0, 0, 63, -31, + -102, 72, 77, 0, 0, 0, 63, -36, -38, -100, -100, 0, 0, 0, + 63, -27, -44, -8, 75, 64, 0, 0, 63, -35, -11, 75, -73, -128, + 0, 0, 63, -26, 49, 92, 55, 0, 0, 0, 63, -33, 21, -65, 93, + -128, 0, 0, 63, -30, 73, 87, 61, 64, 0, 0, 63, -32, 27, -90, + 45, -64, 0, 0, 63, -40, -2, 126, -69, 0, 0, 0, 63, -32, -82, + 98, -88, 0, 0, 0, 63, -60, -29, -110, 102, 0, 0, 0, 63, -31, + 64, 82, 94, -64, 0, 0, -65, -85, 96, 91, 4, 0, 0, 0, 63, + -31, -46, -49, -65, -64, 0, 0, -65, -48, 113, -64, -42, 0, + 0, 0, 63, -30, 98, -51, -112, 64, 0, 0, -65, -38, -68, 102, + -91, -128, 0, 0, 63, -30, -15, 81, 95, 0, 0, 0, -65, -31, + 110, -5, 67, 0, 0, 0, 63, -29, 123, 57, -90, -128, 0, 0, + -65, -28, 26, -87, 15, -64, 0, 0, 63, -28, 0, -38, -22, + -128, 0, 0, -65, -27, -56, 24, 7, 0, 0, 0, 63, -28, 127, 72, + 54, -128, 0, 0, -65, -26, 119, -79, 75, 0, 0, 0, 63, -28, + -11, -74, 71, 64, 0, 0, -65, -26, 126, -105, -79, 64, 0, 0, + 63, -27, 97, -60, -41, -64, 0, 0, -65, -27, -5, -3, -16, 64, + 0, 0, 63, -27, -63, 15, 40, -64, 0, 0, -65, -27, 34, 101, + -55, 64, 0, 0, 63, -26, 18, 34, -27, -64, 0, 0, -65, -28, + 24, -99, -49, 0, 0, 0, 63, -26, 80, -119, -121, 0, 0, 0, + -65, -30, -16, -46, 103, 0, 0, 0, 63, -26, 124, 32, -98, + -64, 0, 0, -65, -31, -48, -28, -55, -64, 0, 0, 63, -26, + -115, -6, 10, 0, 0, 0, -65, -32, -76, 31, 26, -64, 0, 0, 63, + -26, -121, -100, 75, 64, 0, 0, -65, -33, 121, -104, -99, 0, + 0, 0, 63, -26, 95, 100, 7, -128, 0, 0, -65, -35, -78, 83, + 60, 0, 0, 0, 63, -26, 24, -57, 81, 0, 0, 0, -65, -36, 78, + 22, -86, -128, 0, 0, 63, -27, -89, 113, -4, -64, 0, 0, -65, + -37, 30, -124, -87, -128, 0, 0, 63, -27, 16, -10, 127, -64, + 0, 0, -65, -38, 85, 111, 36, -128, 0, 0, 63, -28, 70, -78, + -26, -128, 0, 0, -65, -39, -61, -95, 119, 0, 0, 0, 63, -29, + 80, 101, -46, 64, 0, 0, -65, -39, -112, -115, 43, -128, 0, + 0, 63, -30, 29, -2, -81, 64, 0, 0, -65, -39, -111, -63, 125, + 0, 0, 0, 63, -32, -71, 92, -46, 0, 0, 0, -65, -39, -28, 69, + 16, 0, 0, 0, 63, -34, 36, -16, 122, -128, 0, 0, -65, -38, + 100, -37, -65, 0, 0, 0, 63, -38, 106, 96, -55, 0, 0, 0, -65, + -37, 38, -82, 17, 0, 0, 0, 63, -42, 39, 85, 33, 0, 0, 0, + -65, -36, 14, 33, 82, 0, 0, 0, 63, -47, 119, 46, -80, -128, + 0, 0, -65, -35, 37, -105, 5, -128, 0, 0, 63, -56, -112, + -118, -42, 0, 0, 0, -65, -34, 88, 100, -116, -128, 0, 0, 63, + -70, -28, 121, -10, 0, 0, 0, -65, -33, -87, -98, 26, -128, + 0, 0, 63, -119, 34, -92, 64, 0, 0, 0, -65, -32, -123, 47, + 53, 64, 0, 0, -65, -75, -100, 7, 12, 0, 0, 0, -65, -31, 60, + 12, 44, 0, 0, 0, -65, -57, 126, 23, -88, 0, 0, 0, -65, -31, + -12, 54, -30, -128, 0, 0, -65, -46, 29, -83, 7, -128, 0, 0, + -65, -30, -86, 114, -44, 64, 0, 0, -65, -40, 74, -125, 121, + -128, 0, 0, -65, -29, 91, 72, 77, 64, 0, 0, -65, -34, 39, + -73, 65, -128, 0, 0, -65, -28, 2, 83, 7, 64, 0, 0, -65, -31, + -85, 110, -101, -64, 0, 0, -65, -28, -99, 100, 118, 64, 0, + 0, -65, -29, -29, 29, 57, 64, 0, 0, -65, -27, 39, -90, -96, + 0, 0, 0, -65, -27, 119, -75, -92, 0, 0, 0, -65, -27, -97, + -27, -34, -128, 0, 0, -65, -26, 110, -62, -112, 64, 0, 0, + -65, -26, 1, 111, -67, 64, 0, 0, -65, -26, 114, -41, 64, + -128, 0, 0, -65, -26, 75, -41, -118, -64, 0, 0, -65, -27, + -90, -31, -123, -64, 0, 0, -65, -26, 123, 0, 25, 64, 0, 0, + -65, -29, -90, -57, 30, 64, 0, 0, -65, -26, -113, 33, -103, + 0, 0, 0, -65, -32, -52, -26, 84, -128, 0, 0, -65, -26, -123, + 1, -28, 64, 0, 0, -65, -39, 70, -27, 117, 0, 0, 0, -65, -26, + 93, 102, 118, 0, 0, 0, -65, -49, -56, 90, 97, 0, 0, 0, -65, + -26, 22, 35, 81, -64, 0, 0, -65, -82, -85, -7, -92, 0, 0, 0, + -65, -27, -80, 120, 104, 0, 0, 0, 63, -78, -58, -109, -68, + 0, 0, 0, -65, -27, 43, 83, -31, 64, 0, 0, 63, -72, -18, 49, + 104, 0, 0, 0, -65, -28, -120, 94, 42, 0, 0, 0, 63, -63, -99, + 35, 2, 0, 0, 0, -65, -29, -57, -111, -85, 64, 0, 0, 63, -58, + 15, -94, 118, 0, 0, 0, -65, -30, -22, -21, -37, 64, 0, 0, + 63, -53, 88, -88, -60, 0, 0, 0, -65, -31, -13, 82, 55, 64, + 0, 0, 63, -48, 63, -18, 34, 0, 0, 0, -65, -32, -29, 1, 122, + -64, 0, 0, 63, -45, 11, -46, -68, 0, 0, 0, -65, -33, 119, + 56, 126, 0, 0, 0, 63, -43, -36, -10, -87, -128, 0, 0, -65, + -36, -1, 15, -10, 0, 0, 0, 63, -40, -58, -75, -91, 0, 0, 0, + -65, -38, 97, -35, 81, -128, 0, 0, 63, -37, -75, -12, 36, 0, + 0, 0, -65, -41, -92, -111, 21, -128, 0, 0, 63, -34, -96, + -41, -42, 0, 0, 0, -65, -44, -52, 32, -107, -128, 0, 0, 63, + -32, -64, 111, -10, 64, 0, 0, -65, -47, -35, 117, 127, 0, 0, + 0, 63, -30, 29, -123, 22, -128, 0, 0, -65, -51, -69, -121, + 60, 0, 0, 0, 63, -29, 101, 5, 56, -128, 0, 0, -65, -57, -93, + -119, 56, 0, 0, 0, 63, -28, -124, 51, 40, 0, 0, 0, -65, -63, + 125, 41, 21, 0, 0, 0, 63, -27, 117, -88, 29, -128, 0, 0, + -65, -74, -94, 100, -80, 0, 0, 0, 63, -26, 35, 104, -15, + -128, 0, 0, -65, -92, -92, -91, -16, 0, 0, 0, 63, -26, -124, + 20, -119, -64, 0, 0, 63, 126, 97, 28, 32, 0, 0, 0, 63, -26, + 127, -5, 123, -128, 0, 0, 63, -85, -21, -46, -32, 0, 0, 0, + 63, -26, 11, 17, -44, -128, 0, 0, 63, -71, -49, 126, -70, 0, + 0, 0, 63, -27, 13, -5, -122, 64, 0, 0, 63, -62, -78, 70, + -80, 0, 0, 0, 63, -29, 126, -100, -51, -64, 0, 0, 63, -56, + 84, -39, -32, 0, 0, 0, 63, -31, 73, -124, 104, -64, 0, 0, + 63, -51, -55, -65, -14, 0, 0, 0, 63, -36, -34, 126, -95, 0, + 0, 0, 63, -47, -122, 62, 92, 0, 0, 0, 63, -43, -52, -110, + 13, -128, 0, 0, 63, -44, 12, 96, -44, -128, 0, 0, 63, -53, + 27, -89, -108, 0, 0, 0, 63, -42, 117, -94, 70, 0, 0, 0, 63, + -80, -51, 33, 86, 0, 0, 0, 63, -40, -64, -122, -40, 0, 0, 0, + -65, -73, 13, -37, -72, 0, 0, 0, 63, -38, -21, -5, 36, -128, + 0, 0, -65, -48, 19, -120, -98, -128, 0, 0, 63, -36, -9, 31, + 1, 0, 0, 0, -65, -39, -44, 62, -40, 0, 0, 0, 63, -34, -31, + 100, 1, 0, 0, 0, -65, -31, 75, 86, -55, 64, 0, 0, 63, -32, + 85, 57, 23, 64, 0, 0, -65, -28, -123, 44, -111, 0, 0, 0, 63, + -31, 41, 24, 30, -64, 0, 0, -65, -26, 102, 30, -108, 64, 0, + 0, 63, -31, -20, 92, 76, 64, 0, 0, -65, -26, 46, 70, -87, + -128, 0, 0, 63, -30, -97, 42, -49, -128, 0, 0, -65, -29, -7, + -96, 121, -128, 0, 0, 63, -29, 65, -65, 33, 0, 0, 0, -65, + -34, 84, 96, -90, -128, 0, 0, 63, -29, -44, 103, 5, 0, 0, 0, + -65, -47, 87, 105, 113, -128, 0, 0, 63, -28, 87, -126, 5, + -128, 0, 0, -65, 85, -59, 122, 0, 0, 0, 0, 63, -28, -53, + 125, 53, -128, 0, 0, 63, -53, -50, 57, 82, 0, 0, 0, 63, -27, + 48, -46, -10, 64, 0, 0, 63, -44, -16, -38, -63, 0, 0, 0, 63, + -27, -120, 7, 2, -64, 0, 0, 63, -36, -119, -98, -76, -128, + 0, 0, 63, -27, -47, -90, 68, 64, 0, 0, 63, -31, -120, 77, + 53, 0, 0, 0, 63, -26, 14, 67, 126, -128, 0, 0, 63, -28, 66, + -96, 73, 64, 0, 0, 63, -26, 62, 118, -24, 64, 0, 0, 63, -26, + 8, 80, 66, -64, 0, 0, 63, -26, 98, -37, -67, -64, 0, 0, 63, + -26, -120, -76, -79, 0, 0, 0, 63, -26, 124, 15, 117, -128, + 0, 0, 63, -27, -124, 51, -4, 0, 0, 0, 63, -26, -118, -80, + 71, 0, 0, 0, 63, -30, -90, -5, -78, 0, 0, 0, 63, -26, -113, + 92, 0, -64, 0, 0, 63, -37, -6, -56, -2, -128, 0, 0, 63, -26, + -118, -81, 92, -64, 0, 0, 63, -50, 38, -52, 64, 0, 0, 0, 63, + -26, 125, 68, -75, 64, 0, 0, -65, 106, -100, -111, -64, 0, + 0, 0, 63, -26, 103, -77, -59, 0, 0, 0, -65, -48, 123, -43, + -12, 0, 0, 0, 63, -26, 74, -112, -108, 0, 0, 0, -65, -33, + 56, -89, 1, -128, 0, 0, 63, -26, 38, 107, 71, 64, 0, 0, -65, + -28, -41, 97, -115, -128, 0, 0, 63, -27, -5, -49, 123, -64, + 0, 0, -65, -26, -113, 30, 103, -64, 0, 0, 63, -27, -53, 67, + -4, -64, 0, 0, -65, -29, -102, 22, -80, -64, 0, 0, 63, -27, + -107, 74, -114, -64, 0, 0, -65, -40, 80, -64, 70, 0, 0, 0, + 63, -27, 90, 95, -120, -64, 0, 0, -65, -105, -62, 88, -64, + 0, 0, 0, 63, -27, 26, -7, -6, 0, 0, 0, 63, -48, 100, -4, 29, + 0, 0, 0, 63, -28, -41, -117, 54, 0, 0, 0, 63, -35, 47, -72, + -117, 0, 0, 0, 63, -28, -112, 127, 49, -128, 0, 0, 63, -28, + 7, 8, 0, -64, 0, 0, 63, -28, 70, 60, 21, 0, 0, 0, 63, -26, + 116, 56, -39, -128, 0, 0, 63, -29, -7, 34, -72, 0, 0, 0, 63, + -27, 54, -88, -53, -128, 0, 0, 63, -29, -87, -114, 65, -128, + 0, 0, 63, -33, 59, -13, -32, 0, 0, 0, 63, -29, 87, -44, -80, + -64, 0, 0, 63, -56, 60, 73, -112, 0, 0, 0, 63, -29, 4, 70, + -111, 64, 0, 0, -65, -58, 8, -15, 84, 0, 0, 0, 63, -30, -81, + 47, -124, 0, 0, 0, -65, -32, 87, -82, 61, 64, 0, 0, 63, -30, + 88, -42, 9, 0, 0, 0, -65, -26, 35, -69, -119, -64, 0, 0, 63, + -30, 1, 124, 2, -64, 0, 0, -65, -28, 87, -99, -98, 64, 0, 0, + 63, -31, -87, 94, -111, 64, 0, 0, -65, -45, 3, 28, -55, 0, + 0, 0, 63, -31, 80, -74, -114, -128, 0, 0, 63, -58, 99, -107, + -26, 0, 0, 0, 63, -32, -9, -72, 118, -128, 0, 0, 63, -32, + 75, 60, -115, 64, 0, 0, 63, -32, -98, -108, -34, 64, 0, 0, + 63, -27, -10, -8, 88, -64, 0, 0, 63, -32, 69, 120, 96, -128, + 0, 0, 63, -28, -29, -126, 123, 64, 0, 0, 63, -33, -39, 24, + 37, -128, 0, 0, 63, -42, 97, 18, -1, 0, 0, 0, 63, -33, 39, + -22, -25, 0, 0, 0, -65, -67, -67, -45, -14, 0, 0, 0, 63, + -34, 119, -83, -70, 0, 0, 0, -65, -31, -36, 58, -38, -64, 0, + 0, 63, -35, -56, -98, -35, -128, 0, 0, -65, -26, 82, -113, + -127, 0, 0, 0, 63, -35, 26, -9, 16, -128, 0, 0, -65, -39, + -77, 108, 121, 0, 0, 0, 63, -36, 110, -23, 49, -128, 0, 0, + 63, -54, 61, 52, -56, 0, 0, 0, 63, -37, -60, -93, -119, 0, + 0, 0, 63, -28, 98, 116, -68, -64, 0, 0, 63, -37, 28, 78, + -53, -128, 0, 0, 63, -27, 73, 96, 4, -64, 0, 0, 63, -38, + 118, 16, 65, -128, 0, 0, 63, -45, 98, -1, -37, -128, 0, 0, + 63, -39, -46, 7, -128, 0, 0, 0, -65, -44, -114, 42, -15, + -128, 0, 0, 63, -39, 48, 82, 66, -128, 0, 0, -65, -26, 7, + 54, -101, -64, 0, 0, 63, -40, -111, 7, -40, 0, 0, 0, -65, + -35, -51, -69, -109, 0, 0, 0, 63, -41, -12, 63, -39, -128, + 0, 0, 63, -48, -59, -44, 99, -128, 0, 0, 63, -41, 90, 10, 1, + -128, 0, 0, 63, -27, 118, 75, -116, 0, 0, 0, 63, -42, -62, + 121, 24, -128, 0, 0, 63, -31, 25, 7, 100, 64, 0, 0, 63, -42, + 45, -107, -23, 0, 0, 0, -65, -58, -95, 62, 125, 0, 0, 0, 63, + -43, -101, 111, -122, -128, 0, 0, -65, -27, -69, 90, -76, + -128, 0, 0, 63, -43, 12, 8, -126, -128, 0, 0, -65, -40, 8, + 81, -41, -128, 0, 0, 63, -44, 127, 108, -11, 0, 0, 0, 63, + -33, 125, 16, -56, -128, 0, 0, 63, -45, -11, -102, 68, 0, 0, + 0, 63, -28, -71, 13, 81, 64, 0, 0, 63, -45, 110, -103, -94, + 0, 0, 0, -65, 121, -87, 70, -96, 0, 0, 0, 63, -46, -22, 100, + -25, -128, 0, 0, -65, -26, -124, -31, -123, 0, 0, 0, 63, + -46, 105, 1, -108, -128, 0, 0, -65, -51, 57, 21, 0, 0, 0, 0, + 63, -47, -22, 104, 115, -128, 0, 0, 63, -28, 67, -99, 49, + -64, 0, 0, 63, -47, 110, -103, 96, 0, 0, 0, 63, -38, -29, + 115, -19, -128, 0, 0, 63, -48, -11, -113, -88, 0, 0, 0, -65, + -32, -57, 4, -111, -64, 0, 0, 63, -48, 127, 66, 73, -128, 0, + 0, -65, -35, 22, 79, 22, -128, 0, 0, 63, -48, 11, -77, -49, + -128, 0, 0, 63, -29, 81, -90, -35, 0, 0, 0, 63, -49, 53, + -101, -54, 0, 0, 0, 63, -41, 20, -53, 34, 0, 0, 0, 63, -50, + 89, 64, 25, 0, 0, 0, -65, -29, 19, 126, -68, 64, 0, 0, 63, + -51, -126, 2, 123, 0, 0, 0, -65, -58, -101, 63, 23, 0, 0, 0, + 63, -52, -80, 40, 91, 0, 0, 0, 63, -24, -91, -96, -50, 0, 0, + 0, 63, -53, -29, 47, 22, 0, 0, 0, -65, -41, -114, 4, 95, + -128, 0, 0, 63, -53, 27, -114, 46, 0, 0, 0, -65, -40, 49, + -117, -81, 0, 0, 0, 63, -54, 88, -119, 16, 0, 0, 0, 63, -29, + -121, -96, 15, -128, 0, 0, 63, -55, -102, -47, -87, 0, 0, 0, + -65, -61, 105, 14, -83, 0, 0, 0, 63, -56, -31, 108, -33, 0, + 0, 0, -65, -33, 63, -16, -111, -128, 0, 0, 63, -56, 45, 72, + -84, 0, 0, 0, 63, -22, -122, 10, -109, -128, 0, 0, 63, -57, + 125, 47, 67, 0, 0, 0, -65, -27, 77, 102, 63, -64, 0, 0, 63, + -58, -46, 65, -16, 0, 0, 0, 63, -48, 113, -66, -14, -128, 0, + 0, 63, -58, 43, 32, 18, 0, 0, 0, 63, -57, 61, 31, -100, 0, + 0, 0, 63, -59, -119, 7, -105, 0, 0, 0, -65, -37, -79, 96, + -95, -128, 0, 0, 63, -60, -22, -116, 96, 0, 0, 0, 63, -32, + 51, 36, 61, -64, 0, 0, 63, -60, 80, -31, 125, 0, 0, 0, -65, + -35, -18, -128, -112, -128, 0, 0, 63, -61, -70, -64, 56, 0, + 0, 0, 63, -41, -15, -93, 33, -128, 0, 0, 63, -61, 41, 23, + 61, 0, 0, 0, -65, -49, 26, -36, -127, 0, 0, 0, 63, -62, + -101, 7, -36, 0, 0, 0, 63, -61, 69, -32, -25, 0, 0, 0, 63, + -62, 16, -14, 0, 0, 0, 0, -65, -87, -65, -61, -96, 0, 0, 0, + 63, -63, -118, -80, -78, 0, 0, 0, 63, 104, 11, -91, 64, 0, + 0, 0, 63, -63, 7, -66, 20, 0, 0, 0, 63, -87, 42, -43, -36, + 0, 0, 0, 63, -64, -119, 9, -46, 0, 0, 0, -65, -77, 65, -65, + -116, 0, 0, 0, 63, -64, 12, -52, 89, 0, 0, 0, 63, -74, -101, + -83, -58, 0, 0, 0, 63, -65, 42, -56, -30, 0, 0, 0, -65, -81, + 45, 20, -48, 0, 0, 0, 63, -66, 62, -26, -48, 0, 0, 0, 63, + -81, 118, -95, -108, 0, 0, 0, 63, -67, 94, 40, 80, 0, 0, 0, + -65, -82, 117, 104, -28, 0, 0, 0, 63, -68, 126, 32, -26, 0, + 0, 0, 63, -80, 115, 69, 50, 0, 0, 0, 63, -69, -86, -34, 124, + 0, 0, 0, -65, -99, -26, -124, 32, 0, 0, 0, 63, -70, -42, 15, + -78, 0, 0, 0, 63, -93, -45, 109, -44, 0, 0, 0, 63, -70, 15, + -98, 2, 0, 0, 0, 63, -127, -37, 95, 16, 0, 0, 0, 63, -71, + 69, -118, -82, 0, 0, 0, -65, -92, -52, 45, 36, 0, 0, 0, 63, + -72, -117, 32, -84, 0, 0, 0, 63, -87, -5, 115, 84, 0, 0, 0, + 63, -73, -53, 119, -96, 0, 0, 0, -65, -87, -115, -86, -80, + 0, 0, 0, 63, -73, 28, 40, -26, 0, 0, 0, 63, -74, -12, 85, + 22, 0, 0, 0, 63, -74, 102, -55, -126, 0, 0, 0, -65, -65, + -114, 92, -36, 0, 0, 0, 63, -75, -63, -125, -78, 0, 0, 0, + 63, -64, -93, -123, -55, 0, 0, 0, 63, -75, 22, 126, -110, 0, + 0, 0, -65, -60, -96, -30, 79, 0, 0, 0, 63, -76, 122, 11, 0, + 0, 0, 0, 63, -60, -109, 97, 47, 0, 0, 0, 63, -77, -39, -99, + -18, 0, 0, 0, -65, -69, 10, 14, 2, 0, 0, 0, 63, -77, 68, + -88, 54, 0, 0, 0, -65, -76, -72, -116, -102, 0, 0, 0, 63, + -78, -81, 52, -44, 0, 0, 0, 63, -38, 34, 4, 75, -128, 0, 0, + 63, -78, 32, 86, -46, 0, 0, 0, -65, -24, -90, 85, -58, 0, 0, + 0, 63, -79, -106, 83, -40, 0, 0, 0, 63, -30, -105, 64, 26, + -64, 0, 0, 63, -79, 12, 38, -62, 0, 0, 0, 63, -48, 55, -69, + 121, -128, 0, 0, 63, -80, -114, 12, 80, 0, 0, 0, -65, -28, + 62, -6, -92, -64, 0, 0, 63, -80, 7, 62, 66, 0, 0, 0, -65, + -33, 55, 73, 0, 0, 0, 0, 63, -81, 42, -36, -104, 0, 0, 0, + 63, -59, 54, 78, 79, 0, 0, 0, 63, -82, 33, -74, 44, 0, 0, 0, + 63, -30, 86, -74, -109, 0, 0, 0, 63, -83, 87, 14, 100, 0, 0, + 0, 63, -26, 11, 75, 15, 64, 0, 0, 63, -84, 80, -91, -68, 0, + 0, 0, 63, -26, -127, -73, 103, -128, 0, 0, 63, -85, -98, + -62, 84, 0, 0, 0, 63, -27, -93, -3, -41, 64, 0, 0, 63, -86, + -102, 37, -108, 0, 0, 0, 63, -36, 1, -125, 75, -128, 0, 0, + 63, -86, 0, 5, -4, 0, 0, 0, -65, -60, -43, -22, -40, 0, 0, + 0, 63, -88, -3, 61, -8, 0, 0, 0, -65, -25, -3, 7, -90, -64, + 0, 0, 63, -88, 120, -33, 124, 0, 0, 0, 63, -46, -37, 13, + -62, -128, 0, 0, 63, -89, 121, 37, -104, 0, 0, 0, 63, -50, + -128, -59, -125, 0, 0, 0, 63, -89, 7, 73, 52, 0, 0, 0, -65, + -41, -93, -27, 70, 0, 0, 0, 63, -90, 13, 72, -32, 0, 0, 0, + 63, -43, 15, 45, 20, 0, 0, 0, 63, -91, -87, 33, 104, 0, 0, + 0, -65, -47, -66, -78, 59, 0, 0, 0, 63, -92, -71, 101, -36, + 0, 0, 0, 63, -48, 18, 90, -72, -128, 0, 0, 63, -92, 91, -10, + 92, 0, 0, 0, -65, -49, 42, -102, -49, 0, 0, 0, 63, -93, 125, + -26, -36, 0, 0, 0, 63, -55, -5, 67, 105, 0, 0, 0, 63, -93, + 28, 93, -20, 0, 0, 0, 63, -85, 109, -126, -76, 0, 0, 0, 63, + -94, 93, 36, -20, 0, 0, 0, -65, -28, -63, -123, 118, 0, 0, + 0, 63, -95, -29, 88, 16, 0, 0, 0, 63, -57, 116, -110, -20, + 0, 0, 0, 63, -95, 97, 107, 88, 0, 0, 0, 63, -37, 101, -94, + 50, 0, 0, 0, 63, -96, -107, -6, 36, 0, 0, 0, 63, -87, 72, + -66, 4, 0, 0, 0, 63, -96, -41, -86, 72, 0, 0, 0}; + + public static void main(final String[] args) throws Exception { + test(data32, 32); + test(data64, 64); + } + + private static void test(final byte[] data, final int bits) + throws Exception { + + // Audio data should contain the same format as a command lines above + checkAudioStream(new ByteArrayInputStream(data), data, bits); + + // Checks that the data will be preserved when we save audio data to the + // file and read it again + final File file = File.createTempFile("sound", "test"); + try (final InputStream fis = new FileInputStream(file); + final InputStream is = new ByteArrayInputStream(data); + final AudioInputStream ais = AudioSystem.getAudioInputStream(is)) { + AudioSystem.write(ais, AudioFileFormat.Type.AU, file); + if (!Arrays.equals(data, fis.readAllBytes())) { + throw new RuntimeException("Wrong data in the file"); + } + } finally { + Files.delete(Paths.get(file.getAbsolutePath())); + } + + // Checks that the data will be preserved when we save audio data to the + // stream and read it again + try (final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final InputStream is = new ByteArrayInputStream(data); + final AudioInputStream ais = AudioSystem.getAudioInputStream(is)) { + AudioSystem.write(ais, AudioFileFormat.Type.AU, baos); + if (!Arrays.equals(data, baos.toByteArray())) { + throw new RuntimeException("Wrong data in the stream"); + } + } + } + + /** + * Tests that audio data is the same format as a command lines above. + */ + private static void checkAudioStream(final InputStream is, + final byte[] data, final int bits) + throws Exception { + final AudioFileFormat aff = AudioSystem.getAudioFileFormat(is); + final int byteLength = aff.getByteLength(); + if (byteLength != data.length) { + throw new RuntimeException("Wrong byteLength: " + byteLength); + } + final AudioFileFormat.Type type = aff.getType(); + if (!type.equals(AudioFileFormat.Type.AU)) { + throw new RuntimeException("Wrong type: " + type); + } + final int frameLength = aff.getFrameLength(); + if (frameLength != 0.01f * aff.getFormat().getFrameRate()) { + throw new RuntimeException("Wrong frameLength: " + frameLength); + } + checkAudioFormat(aff.getFormat(), bits); + try (AudioInputStream ais = AudioSystem.getAudioInputStream(is)) { + final AudioFormat format = ais.getFormat(); + if (ais.getFrameLength() != 0.01f * format.getFrameRate()) { + throw new RuntimeException( + "Wrong frameLength: " + ais.getFrameLength()); + } + checkAudioFormat(format, bits); + } + } + + /** + * Tests that audio data is the same format as a command lines above. + */ + private static void checkAudioFormat(final AudioFormat audioFormat, + final int bits) { + final int channels = audioFormat.getChannels(); + if (channels != 2) { + throw new RuntimeException("Wrong channels: " + channels); + } + final int sizeInBits = audioFormat.getSampleSizeInBits(); + if (sizeInBits != bits) { + throw new RuntimeException("Wrong sizeInBits: " + sizeInBits); + } + final int frameSize = audioFormat.getFrameSize(); + if (frameSize != sizeInBits * channels / 8) { + throw new RuntimeException("Wrong frameSize: " + frameSize); + } + final AudioFormat.Encoding encoding = audioFormat.getEncoding(); + if (!encoding.equals(AudioFormat.Encoding.PCM_FLOAT)) { + throw new RuntimeException("Wrong encoding: " + encoding); + } + final float frameRate = audioFormat.getFrameRate(); + if (frameRate != 32000) { + throw new RuntimeException("Wrong frameRate: " + frameRate); + } + final float sampleRate = audioFormat.getSampleRate(); + if (sampleRate != 32000) { + throw new RuntimeException("Wrong sampleRate: " + sampleRate); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/javax/swing/JPopupMenu/6580930/bug6580930.java --- a/test/jdk/javax/swing/JPopupMenu/6580930/bug6580930.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/javax/swing/JPopupMenu/6580930/bug6580930.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -42,6 +42,8 @@ private static JPopupMenu popup; private static Toolkit toolkit; private static volatile boolean skipTest = false; + private static Point loc; + private static int y; private static void createGui() { frame = new JFrame(); @@ -93,12 +95,15 @@ if(skipTest) { return; } - Point loc = frame.getLocationOnScreen(); + + SwingUtilities.invokeAndWait(() -> loc = frame.getLocationOnScreen()); + robot.waitForIdle(); robot.mouseMove(loc.x, loc.y); showPopup(); robot.waitForIdle(); - if (isHeavyWeightMenuVisible()) { + if (!System.getProperty("os.name").startsWith("Mac") + && isHeavyWeightMenuVisible()) { throw new RuntimeException("HeavyWeightPopup is unexpectedly visible"); } @@ -106,12 +111,16 @@ robot.keyRelease(KeyEvent.VK_ESCAPE); int x = loc.x; - int y = loc.y + (frame.getHeight() - popup.getPreferredSize().height) + 1; + SwingUtilities.invokeAndWait( () -> y = loc.y + (frame.getHeight() - + popup.getPreferredSize().height) + 1); + robot.waitForIdle(); robot.mouseMove(x, y); showPopup(); + SwingUtilities.invokeAndWait(() -> loc = popup.getLocationOnScreen()); + robot.waitForIdle(); - if (!popup.getLocationOnScreen().equals(new Point(x, y))) { + if (!loc.equals(new Point(x, y))) { throw new RuntimeException("Popup is unexpectedly shifted"); } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/javax/swing/JWindow/ShapedAndTranslucentWindows/Common.java --- a/test/jdk/javax/swing/JWindow/ShapedAndTranslucentWindows/Common.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/javax/swing/JWindow/ShapedAndTranslucentWindows/Common.java Fri Jun 21 14:07:48 2019 +0530 @@ -367,13 +367,13 @@ // Drag Point location = window.getLocationOnScreen(); robot.dragAndDrop(location.x + 30, location.y + 5, location.x + dl + random.nextInt(dl), location.y + random.nextInt(dl)); - robot.waitForIdle(delay); + robot.waitForIdle(2*delay); checkTranslucentShape(); // Resize location = window.getLocationOnScreen(); robot.dragAndDrop(location.x + 4, location.y + 4, location.x + random.nextInt(2*dl)-dl, location.y + random.nextInt(2*dl)-dl); - robot.waitForIdle(delay); + robot.waitForIdle(2*delay); checkTranslucentShape(); EventQueue.invokeAndWait(this::dispose); @@ -385,13 +385,13 @@ // Drag Point location = window.getLocationOnScreen(); robot.dragAndDrop(location.x + 30, location.y + 5, location.x + dl + random.nextInt(dl), location.y + random.nextInt(dl)); - robot.waitForIdle(delay); + robot.waitForIdle(2*delay); checkDynamicShape(); // Resize location = window.getLocationOnScreen(); robot.dragAndDrop(location.x + 4, location.y + 4, location.x + random.nextInt(2*dl)-dl, location.y + random.nextInt(2*dl)-dl); - robot.waitForIdle(delay); + robot.waitForIdle(2*delay); checkDynamicShape(); EventQueue.invokeAndWait(this::dispose); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/javax/swing/text/JTextComponent/6361367/bug6361367.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javax/swing/text/JTextComponent/6361367/bug6361367.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2006, 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. + */ + +/* @test + @bug 6361367 7109126 8225144 + @key headful + @summary Tests that backspace key does delete when Shift is pressed +*/ + +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.FutureTask; +import java.util.concurrent.atomic.AtomicReference; + +import javax.swing.JComponent; +import javax.swing.JEditorPane; +import javax.swing.JFormattedTextField; +import javax.swing.JFrame; +import javax.swing.JPasswordField; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.text.Caret; +import javax.swing.text.JTextComponent; + +public class bug6361367 { + final static String testString = "123 456 789"; + final static String resultString = "123 456 78"; + final static List> textClasses = Arrays.asList( + JTextArea.class, JEditorPane.class, JTextPane.class, + JTextField.class, JFormattedTextField.class, JPasswordField.class); + + public static void main(String[] args) throws Exception { + for(UIManager.LookAndFeelInfo info: UIManager.getInstalledLookAndFeels()) { + UIManager.setLookAndFeel(info.getClassName()); + System.out.println(info); + for (Class clazz : textClasses) { + boolean res = test(clazz); + if (! res) { + throw new RuntimeException("failed"); + } + } + } + } + + static boolean test(final Class textComponentClass) throws Exception { + final AtomicReference ref = new AtomicReference<>(); + final JTextComponent textComponent = invokeAndWait( + new Callable() { + public JTextComponent call() throws Exception { + return initialize(textComponentClass, ref); + } + }); + waitForFocus(textComponent); + Robot robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(250); + robot.keyPress(KeyEvent.VK_END); + robot.keyRelease(KeyEvent.VK_END); + robot.keyPress(KeyEvent.VK_SHIFT); + robot.keyPress(KeyEvent.VK_BACK_SPACE); + robot.keyRelease(KeyEvent.VK_BACK_SPACE); + robot.keyRelease(KeyEvent.VK_SHIFT); + String str = invokeAndWait( + new Callable() { + public String call() throws Exception { + JFrame frame = ref.get(); + if (frame != null) { + frame.dispose(); + } + return textComponent.getText(); + } + }); + return resultString.equals(str); + } + + static JTextComponent initialize( + Class textComponentClass, + AtomicReference ref) throws Exception { + JFrame frame = new JFrame("bug6361367"); + ref.set(frame); + JTextComponent textComponent = textComponentClass.newInstance(); + textComponent.setText(testString); + frame.add(textComponent); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + textComponent.requestFocus(); + Caret caret = textComponent.getCaret(); + caret.setDot(textComponent.getDocument().getLength()); + return textComponent; + } + + static T invokeAndWait(Callable callable) throws Exception { + FutureTask future = new FutureTask(callable); + SwingUtilities.invokeLater(future); + return future.get(); + } + + static void waitForFocus(JComponent component) throws Exception { + synchronized (component) { + while(! component.isFocusOwner()) { + component.wait(100); + } + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,120 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package jdk.jfr.jcmd; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.stream.Stream; + +import jdk.jfr.Recording; +import jdk.test.lib.Asserts; + +/** + * @test + * @bug 8220657 + * @key jfr + * @requires vm.hasJFR + * @library /test/lib /test/jdk + * @run main/othervm jdk.jfr.jcmd.TestJcmdDumpWithFileName + */ +public class TestJcmdDumpWithFileName { + + public static void main(String[] args) throws Exception { + testDumpAll(); + testDumpNamed(); + testDumpNamedWithFilename(); + } + + private static void testDumpAll() throws Exception { + Path p = Path.of("testDumpAll.jfr").toAbsolutePath(); + try (Recording r = new Recording()) { + r.setName("testDumpAll"); + r.setDestination(p); + r.start(); + + JcmdHelper.jcmd("JFR.dump"); + + Asserts.assertFalse(namedFile(p), "Unexpected file: " + p.toString()); + Asserts.assertTrue(generatedFile(), "Expected generated file"); + } + cleanup(); + } + + private static void testDumpNamed() throws Exception { + Path p = Path.of("testDumpNamed.jfr").toAbsolutePath(); + try (Recording r = new Recording()) { + r.setName("testDumpNamed"); + r.setDestination(p); + r.start(); + + JcmdHelper.jcmd("JFR.dump", "name=testDumpNamed"); + + Asserts.assertTrue(namedFile(p), "Expected file: " + p.toString()); + Asserts.assertFalse(generatedFile(), "Unexpected generated file"); + } + cleanup(); + } + + private static void testDumpNamedWithFilename() throws Exception { + Path p = Path.of("testDumpNamedWithFilename.jfr").toAbsolutePath(); + Path override = Path.of("override.jfr").toAbsolutePath(); + try (Recording r = new Recording()) { + r.setName("testDumpNamedWithFilename"); + r.setDestination(p); + r.start(); + + JcmdHelper.jcmd("JFR.dump", "name=testDumpNamedWithFilename", "filename=" + override.toString()); + + Asserts.assertFalse(namedFile(p), "Unexpected file: " + p.toString()); + Asserts.assertTrue(namedFile(override), "Expected file: " + override.toString()); + Asserts.assertFalse(generatedFile(), "Unexpected generated file"); + } + cleanup(); + } + + private static boolean namedFile(Path dumpFile) throws IOException { + return Files.exists(dumpFile) && (Files.size(dumpFile) > 0); + } + + private static boolean generatedFile() throws IOException { + long pid = ProcessHandle.current().pid(); + Stream stream = Files.find(Path.of("."), 1, (p, a) -> p.toString() + .matches("^.*hotspot-pid-" + pid + "-[0-9_]+\\.jfr$") && (a.size() > 0L)); + try (stream) { + return stream.findAny() + .isPresent(); + } + } + + private static void cleanup() throws IOException { + Stream stream = Files.find(Path.of("."), 1, (p, a) -> p.toString().endsWith(".jfr")); + try (stream) { + stream.forEach(p -> p.toFile().delete()); + } + } + +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/net/www/http/HttpClient/StreamingRetry.java --- a/test/jdk/sun/net/www/http/HttpClient/StreamingRetry.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/net/www/http/HttpClient/StreamingRetry.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -25,9 +25,15 @@ * @test * @bug 6672144 8050983 * @summary Do not retry failed request with a streaming body. + * @library /test/lib + * @run main StreamingRetry + * @run main/othervm -Djava.net.preferIPv6Addresses=true StreamingRetry */ import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Proxy; import java.net.ServerSocket; import java.net.URL; import java.io.IOException; @@ -35,6 +41,8 @@ import java.io.OutputStream; import static java.lang.System.out; +import jdk.test.lib.net.URIBuilder; + public class StreamingRetry implements Runnable { static final int ACCEPT_TIMEOUT = 20 * 1000; // 20 seconds volatile ServerSocket ss; @@ -55,7 +63,8 @@ } void test(String method) throws Exception { - ss = new ServerSocket(0); + ss = new ServerSocket(); + ss.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); ss.setSoTimeout(ACCEPT_TIMEOUT); int port = ss.getLocalPort(); @@ -63,8 +72,13 @@ otherThread.start(); try { - URL url = new URL("http://localhost:" + port + "/"); - HttpURLConnection uc = (HttpURLConnection) url.openConnection(); + URL url = URIBuilder.newBuilder() + .scheme("http") + .host(ss.getInetAddress()) + .port(port) + .path("/") + .toURL(); + HttpURLConnection uc = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY); uc.setDoOutput(true); if (method != null) uc.setRequestMethod(method); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/net/www/protocol/http/DigestTest.java --- a/test/jdk/sun/net/www/protocol/http/DigestTest.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/net/www/protocol/http/DigestTest.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -26,6 +26,13 @@ * @bug 4432213 * @modules java.base/sun.net.www * @run main/othervm -Dhttp.auth.digest.validateServer=true DigestTest + * @run main/othervm -Djava.net.preferIPv6Addresses=true + * -Dhttp.auth.digest.validateServer=true DigestTest + * @run main/othervm -Dhttp.auth.digest.validateServer=true + -Dtest.succeed=true DigestTest + * @run main/othervm -Djava.net.preferIPv6Addresses=true + * -Dhttp.auth.digest.validateServer=true + -Dtest.succeed=true DigestTest * @summary Need to support Digest Authentication for Proxies */ @@ -57,13 +64,15 @@ "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" + "Server: Apache/1.3.14 (Unix)\r\n" + "Content-Type: text/html; charset=iso-8859-1\r\n" + - "Transfer-encoding: chunked\r\n\r\n"+ + "Transfer-encoding: chunked\r\n"; + String body = "B\r\nHelloWorld1\r\n"+ "B\r\nHelloWorld2\r\n"+ "B\r\nHelloWorld3\r\n"+ "B\r\nHelloWorld4\r\n"+ "B\r\nHelloWorld5\r\n"+ - "0\r\n"+ + "0\r\n\r\n"; + String authInfo = "Authentication-Info: "; DigestServer (ServerSocket y) { @@ -84,7 +93,7 @@ s1 = s.accept (); is = s1.getInputStream (); os = s1.getOutputStream (); - is.read (); + //is.read (); // need to get the cnonce out of the response MessageHeader header = new MessageHeader (is); String raw = header.findValue ("Authorization"); @@ -92,7 +101,7 @@ String cnonce = parser.findValue ("cnonce"); String cnstring = parser.findValue ("nc"); - String reply = reply2 + getAuthorization (uri, "GET", cnonce, cnstring) +"\r\n"; + String reply = reply2 + authInfo + getAuthorization (uri, "GET", cnonce, cnstring) +"\r\n" + body; os.write (reply.getBytes()); Thread.sleep (2000); s1.close (); @@ -193,6 +202,9 @@ public class DigestTest { + static final boolean SUCCEED = + Boolean.parseBoolean(System.getProperty("test.succeed", "false")); + static class MyAuthenticator extends Authenticator { public MyAuthenticator () { super (); @@ -200,7 +212,9 @@ public PasswordAuthentication getPasswordAuthentication () { - return (new PasswordAuthentication ("user", "Wrongpassword".toCharArray())); + char[] passwd = SUCCEED ? DigestServer.passwd.clone() + : "Wrongpassword".toCharArray(); + return new PasswordAuthentication("user", passwd); } } @@ -210,34 +224,47 @@ DigestServer server; ServerSocket sock; + InetAddress loopback = InetAddress.getLoopbackAddress(); try { - sock = new ServerSocket (0); - port = sock.getLocalPort (); + sock = new ServerSocket(); + sock.bind(new InetSocketAddress(loopback, 0)); + port = sock.getLocalPort(); } catch (Exception e) { System.out.println ("Exception: " + e); - return; + throw e; } server = new DigestServer(sock); server.start (); boolean passed = false; + ProtocolException exception = null; try { Authenticator.setDefault (new MyAuthenticator ()); - String s = "http://localhost:" + port + DigestServer.uri; + String address = loopback.getHostAddress(); + if (address.indexOf(':') > -1) address = "[" + address + "]"; + String s = "http://" + address + ":" + port + DigestServer.uri; URL url = new URL(s); - java.net.URLConnection conURL = url.openConnection(); + java.net.URLConnection conURL = url.openConnection(Proxy.NO_PROXY); InputStream in = conURL.getInputStream(); while (in.read () != -1) {} in.close (); + if (SUCCEED) passed = true; } catch(ProtocolException e) { - passed = true; + exception = e; + if (!SUCCEED) passed = true; } if (!passed) { - throw new RuntimeException ("Expected a ProtocolException from wrong password"); + if (!SUCCEED) { + throw new RuntimeException("Expected a ProtocolException from wrong password"); + } else { + assert exception != null; + throw new RuntimeException("Unexpected ProtocolException from correct password: " + + exception, exception); + } } } } diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/net/www/protocol/http/RelativeRedirect.java --- a/test/jdk/sun/net/www/protocol/http/RelativeRedirect.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/net/www/protocol/http/RelativeRedirect.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -28,6 +28,7 @@ * @library ../../httptest/ * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction * @run main RelativeRedirect + * @run main/othervm -Djava.net.preferIPv6Addresses=true RelativeRedirect * @summary URLConnection cannot handle redirects */ @@ -58,7 +59,7 @@ void secondReply (HttpTransaction req) throws IOException { if (req.getRequestURI().toString().equals("/redirect/file.html") && - req.getRequestHeader("Host").equals("localhost:"+server.getLocalPort())) { + req.getRequestHeader("Host").equals(authority(server.getLocalPort()))) { req.setResponseEntityBody ("Hello ."); req.sendResponse (200, "Ok"); } else { @@ -86,15 +87,25 @@ } } + static String authority(int port) { + InetAddress loopback = InetAddress.getLoopbackAddress(); + String hostaddr = loopback.getHostAddress(); + if (hostaddr.indexOf(':') > -1) { + hostaddr = "[" + hostaddr + "]"; + } + return hostaddr + ":" + port; + } + public static void main (String[] args) throws Exception { + InetAddress loopback = InetAddress.getLoopbackAddress(); MyAuthenticator auth = new MyAuthenticator (); Authenticator.setDefault (auth); try { - server = new TestHttpServer (new RelativeRedirect(), 1, 10, 0); + server = new TestHttpServer (new RelativeRedirect(), 1, 10, loopback, 0); System.out.println ("Server: listening on port: " + server.getLocalPort()); - URL url = new URL("http://localhost:"+server.getLocalPort()); + URL url = new URL("http://" + authority(server.getLocalPort())); System.out.println ("client opening connection to: " + url); - HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection (Proxy.NO_PROXY); InputStream is = urlc.getInputStream (); is.close(); } catch (Exception e) { diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/rmi/log/ReliableLog/Recovery.java --- a/test/jdk/sun/rmi/log/ReliableLog/Recovery.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/rmi/log/ReliableLog/Recovery.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -88,13 +88,7 @@ Recovery handler = new Recovery(); ReliableLog log; - if (size == 4 && deathpoint == 6) { - Runtime.getRuntime().traceMethodCalls(true); - } log = new ReliableLog(dir, handler); - if (size == 4 && deathpoint == 6) { - Runtime.getRuntime().traceMethodCalls(false); - } // Generate a number of updates (size - 1) until failing int i; diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/lib/cacerts/VerifyCACerts.java --- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java Fri Jun 21 14:07:48 2019 +0530 @@ -26,11 +26,13 @@ * @test * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 * 8209452 8209506 8210432 8195793 8216577 8222089 8222133 8222137 8222136 - * 8223499 + * 8223499 8225392 * @summary Check root CA entries in cacerts file */ +import java.io.ByteArrayInputStream; import java.io.File; -import java.io.FileInputStream; +import java.nio.file.Files; +import java.nio.file.Path; import java.security.KeyStore; import java.security.MessageDigest; import java.security.cert.Certificate; @@ -52,6 +54,11 @@ // The numbers of certs now. private static final int COUNT = 88; + // SHA-256 of cacerts, can be generated with + // shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95 + private static final String CHECKSUM + = "4E:21:94:7C:1D:49:28:BB:34:B0:40:DF:AE:19:B4:41:C6:B5:8A:EE:EB:D5:DE:B4:EF:07:AF:63:18:73:A6:FE"; + // map of cert alias to SHA-256 fingerprint @SuppressWarnings("serial") private static final Map FINGERPRINT_MAP = new HashMap<>() { @@ -255,8 +262,16 @@ public static void main(String[] args) throws Exception { System.out.println("cacerts file: " + CACERTS); md = MessageDigest.getInstance("SHA-256"); + + byte[] data = Files.readAllBytes(Path.of(CACERTS)); + String checksum = toHexString(md.digest(data)); + if (!checksum.equals(CHECKSUM)) { + atLeastOneFailed = true; + System.err.println("ERROR: wrong checksum\n" + checksum); + } + KeyStore ks = KeyStore.getInstance("JKS"); - ks.load(new FileInputStream(CACERTS), "changeit".toCharArray()); + ks.load(new ByteArrayInputStream(data), "changeit".toCharArray()); // check the count of certs inside if (ks.size() != COUNT) { diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/mscapi/NullKey.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/mscapi/NullKey.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,54 @@ +/* + * 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 java.security.InvalidKeyException; +import java.security.PublicKey; +import java.security.Signature; +import java.util.List; + +/** + * @test + * @bug 8225180 + * @requires os.family == "windows" + * @summary SunMSCAPI Signature should throw InvalidKeyException when + * initialized with a null key + */ + +public class NullKey { + public static void main(String[] args) throws Exception { + for (String alg : List.of( + "SHA256withRSA", "SHA256withECDSA", "RSASSA-PSS")) { + Signature sig = Signature.getInstance(alg, "SunMSCAPI"); + try { + sig.initSign(null); + } catch (InvalidKeyException e) { + // Expected + } + try { + sig.initVerify((PublicKey)null); + } catch (InvalidKeyException e) { + // Expected + } + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Cipher/Test4512704.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Cipher/Test4512704.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* + * @test + * @bug 8080462 + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main Test4512704 + * @summary Verify that AES cipher can generate default IV in encrypt mode + */ +import java.io.PrintStream; +import java.security.*; +import java.security.spec.*; +import java.util.Random; + +import javax.crypto.*; +import javax.crypto.spec.*; +import java.security.Provider; + +public class Test4512704 extends PKCS11Test { + + public void test(String mode, Provider p) throws Exception { + Cipher c; + String transformation = "AES/" + mode + "/NoPadding"; + + try { + transformation = "AES/" + mode + "/NoPadding"; + c = Cipher.getInstance(transformation, p); + } catch (GeneralSecurityException e) { + System.out.println("Skip testing " + p.getName() + + ", no support for " + mode); + return; + } + SecretKey key = new SecretKeySpec(new byte[16], "AES"); + + AlgorithmParameterSpec aps = null; + Cipher ci = Cipher.getInstance(transformation, p); + try { + ci.init(Cipher.ENCRYPT_MODE, key, aps); + } catch(InvalidAlgorithmParameterException ex) { + throw new Exception("parameter should be generated when null is specified!"); + } + System.out.println(transformation + ": Passed"); + } + + public static void main (String[] args) throws Exception { + main(new Test4512704(), args); + } + + @Override + public void main(Provider p) throws Exception { + test("GCM", p); + } + +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* + * @test + * @bug 8080462 + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main TestCICOWithGCM + * @summary Test CipherInputStream/OutputStream with AES GCM mode. + * @key randomness + */ + +import java.security.*; +import javax.crypto.*; +import javax.crypto.spec.*; +import java.math.*; +import java.io.*; + +import java.util.*; + +public class TestCICOWithGCM extends PKCS11Test { + public static void main(String[] args) throws Exception { + main(new TestCICOWithGCM(), args); + } + + @Override + public void main(Provider p) throws Exception { + test("GCM", p); + } + + public void test(String mode, Provider p) throws Exception { + Cipher c; + try { + String transformation = "AES/" + mode + "/NoPadding"; + c = Cipher.getInstance(transformation, p); + } catch (GeneralSecurityException e) { + System.out.println("Skip testing " + p.getName() + + ", no support for " + mode); + return; + } + + SecretKey key = new SecretKeySpec(new byte[16], "AES"); + + //do initialization of the plainText + byte[] plainText = new byte[800]; + Random rdm = new Random(); + rdm.nextBytes(plainText); + + //init ciphers + Cipher encCipher = Cipher.getInstance("AES/GCM/NoPadding", p); + encCipher.init(Cipher.ENCRYPT_MODE, key); + Cipher decCipher = Cipher.getInstance("AES/GCM/NoPadding", p); + decCipher.init(Cipher.DECRYPT_MODE, key, encCipher.getParameters()); + + //init cipher streams + ByteArrayInputStream baInput = new ByteArrayInputStream(plainText); + CipherInputStream ciInput = new CipherInputStream(baInput, encCipher); + ByteArrayOutputStream baOutput = new ByteArrayOutputStream(); + CipherOutputStream ciOutput = new CipherOutputStream(baOutput, decCipher); + + //do test + byte[] buffer = new byte[800]; + int len = ciInput.read(buffer); + System.out.println("read " + len + " bytes from input buffer"); + + while (len != -1) { + ciOutput.write(buffer, 0, len); + System.out.println("wite " + len + " bytes to output buffer"); + len = ciInput.read(buffer); + if (len != -1) { + System.out.println("read " + len + " bytes from input buffer"); + } else { + System.out.println("finished reading"); + } + } + + ciOutput.flush(); + ciInput.close(); + ciOutput.close(); + byte[] recovered = baOutput.toByteArray(); + System.out.println("recovered " + recovered.length + " bytes"); + if (!Arrays.equals(plainText, recovered)) { + throw new RuntimeException("diff check failed!"); + } else { + System.out.println("diff check passed"); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* + * @test + * @bug 8080462 + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main TestCICOWithGCMAndAAD + * @summary Test CipherInputStream/OutputStream with AES GCM mode with AAD. + * @key randomness + */ +import java.io.*; +import java.security.*; +import java.util.*; +import javax.crypto.*; +import javax.crypto.spec.*; + +public class TestCICOWithGCMAndAAD extends PKCS11Test { + public static void main(String[] args) throws Exception { + main(new TestCICOWithGCMAndAAD(), args); + } + + @Override + public void main(Provider p) throws Exception { + test("GCM", p); +// test("CCM", p); + } + + public void test(String mode, Provider p) throws Exception { + Cipher c; + try { + String transformation = "AES/" + mode + "/NoPadding"; + c = Cipher.getInstance(transformation, p); + } catch (GeneralSecurityException e) { + System.out.println("Skip testing " + p.getName() + + ", no support for " + mode); + return; + } + SecretKey key = new SecretKeySpec(new byte[16], "AES"); + + //Do initialization of the plainText + byte[] plainText = new byte[700]; + Random rdm = new Random(); + rdm.nextBytes(plainText); + + byte[] aad = new byte[128]; + rdm.nextBytes(aad); + byte[] aad2 = aad.clone(); + aad2[50]++; + + Cipher encCipher = Cipher.getInstance("AES/GCM/NoPadding", p); + encCipher.init(Cipher.ENCRYPT_MODE, key); + encCipher.updateAAD(aad); + Cipher decCipher = Cipher.getInstance("AES/GCM/NoPadding", p); + decCipher.init(Cipher.DECRYPT_MODE, key, encCipher.getParameters()); + decCipher.updateAAD(aad); + + byte[] recovered = test(encCipher, decCipher, plainText); + if (!Arrays.equals(plainText, recovered)) { + throw new Exception("sameAAD: diff check failed!"); + } else System.out.println("sameAAD: passed"); + + encCipher.init(Cipher.ENCRYPT_MODE, key); + encCipher.updateAAD(aad2); + recovered = test(encCipher, decCipher, plainText); + if (recovered != null && recovered.length != 0) { + throw new Exception("diffAAD: no data should be returned!"); + } else System.out.println("diffAAD: passed"); + } + + private static byte[] test(Cipher encCipher, Cipher decCipher, byte[] plainText) + throws Exception { + //init cipher streams + ByteArrayInputStream baInput = new ByteArrayInputStream(plainText); + CipherInputStream ciInput = new CipherInputStream(baInput, encCipher); + ByteArrayOutputStream baOutput = new ByteArrayOutputStream(); + CipherOutputStream ciOutput = new CipherOutputStream(baOutput, decCipher); + + //do test + byte[] buffer = new byte[200]; + int len = ciInput.read(buffer); + System.out.println("read " + len + " bytes from input buffer"); + + while (len != -1) { + ciOutput.write(buffer, 0, len); + System.out.println("wite " + len + " bytes to output buffer"); + len = ciInput.read(buffer); + if (len != -1) { + System.out.println("read " + len + " bytes from input buffer"); + } else { + System.out.println("finished reading"); + } + } + + ciOutput.flush(); + ciInput.close(); + ciOutput.close(); + + return baOutput.toByteArray(); + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* + * @test + * @bug 8080462 + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main TestGCMKeyAndIvCheck + * @summary Ensure that same key+iv can't be repeated used for encryption. + */ + + +import java.security.*; +import java.security.spec.AlgorithmParameterSpec; +import javax.crypto.*; +import javax.crypto.spec.*; +import java.math.*; + +import java.util.*; + +public class TestGCMKeyAndIvCheck extends PKCS11Test { + + private static final byte[] AAD = new byte[5]; + private static final byte[] PT = new byte[18]; + + public static void main(String[] args) throws Exception { + main(new TestGCMKeyAndIvCheck(), args); + } + + private static void checkISE(Cipher c) throws Exception { + // Subsequent encryptions should fail + try { + c.updateAAD(AAD); + throw new Exception("Should throw ISE for updateAAD()"); + } catch (IllegalStateException ise) { + // expected + } + + try { + c.update(PT); + throw new Exception("Should throw ISE for update()"); + } catch (IllegalStateException ise) { + // expected + } + try { + c.doFinal(PT); + throw new Exception("Should throw ISE for doFinal()"); + } catch (IllegalStateException ise) { + // expected + } + } + + public void test(String mode, Provider p) throws Exception { + Cipher c; + try { + String transformation = "AES/" + mode + "/NoPadding"; + c = Cipher.getInstance(transformation, p); + } catch (GeneralSecurityException e) { + System.out.println("Skip testing " + p.getName() + + ", no support for " + mode); + return; + } + SecretKey key = new SecretKeySpec(new byte[16], "AES"); + // First try parameter-less init. + c.init(Cipher.ENCRYPT_MODE, key); + c.updateAAD(AAD); + byte[] ctPlusTag = c.doFinal(PT); + + // subsequent encryption should fail unless re-init w/ different key+iv + checkISE(c); + + // Validate the retrieved parameters against the IV and tag length. + AlgorithmParameters params = c.getParameters(); + if (params == null) { + throw new Exception("getParameters() should not return null"); + } + byte[] iv = null; + int tagLength = 0; // in bits + if (mode.equalsIgnoreCase("GCM")) { + GCMParameterSpec spec = params.getParameterSpec(GCMParameterSpec.class); + tagLength = spec.getTLen(); + iv = spec.getIV(); + } else { + throw new RuntimeException("Error: Unsupported mode: " + mode); + } + if (tagLength != (ctPlusTag.length - PT.length)*8) { + throw new Exception("Parameters contains incorrect TLen value"); + } + if (!Arrays.equals(iv, c.getIV())) { + throw new Exception("Parameters contains incorrect IV value"); + } + + // Should be ok to use the same key+iv for decryption + c.init(Cipher.DECRYPT_MODE, key, params); + c.updateAAD(AAD); + byte[] recovered = c.doFinal(ctPlusTag); + if (!Arrays.equals(recovered, PT)) { + throw new Exception("decryption result mismatch"); + } + + // Now try to encrypt again using the same key+iv; should fail also + try { + c.init(Cipher.ENCRYPT_MODE, key, params); + throw new Exception("Should throw exception when same key+iv is used"); + } catch (InvalidAlgorithmParameterException iape) { + // expected + } + + // Now try to encrypt again using parameter-less init; should work + c.init(Cipher.ENCRYPT_MODE, key); + c.doFinal(PT); + + // make sure a different iv is used + byte[] ivNew = c.getIV(); + if (Arrays.equals(iv, ivNew)) { + throw new Exception("IV should be different now"); + } + + // Now try to encrypt again using a different parameter; should work + AlgorithmParameterSpec spec2 = new GCMParameterSpec(128, new byte[30]); + c.init(Cipher.ENCRYPT_MODE, key, spec2); + c.updateAAD(AAD); + c.doFinal(PT); + // subsequent encryption should fail unless re-init w/ different key+iv + checkISE(c); + + // Now try decryption twice in a row; no re-init required and + // same parameters is used. + c.init(Cipher.DECRYPT_MODE, key, params); + c.updateAAD(AAD); + recovered = c.doFinal(ctPlusTag); + + c.updateAAD(AAD); + recovered = c.doFinal(ctPlusTag); + if (!Arrays.equals(recovered, PT)) { + throw new Exception("decryption result mismatch"); + } + + // Now try decryption again and re-init using the same parameters + c.init(Cipher.DECRYPT_MODE, key, params); + c.updateAAD(AAD); + recovered = c.doFinal(ctPlusTag); + + // init to decrypt w/o parameters; should fail with IKE as + // javadoc specified + try { + c.init(Cipher.DECRYPT_MODE, key); + throw new Exception("Should throw IKE for dec w/o params"); + } catch (InvalidKeyException ike) { + // expected + } + + // Lastly, try encryption AND decryption w/ wrong type of parameters, + // e.g. IvParameterSpec + try { + c.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(iv)); + throw new Exception("Should throw IAPE"); + } catch (InvalidAlgorithmParameterException iape) { + // expected + } + try { + c.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv)); + throw new Exception("Should throw IAPE"); + } catch (InvalidAlgorithmParameterException iape) { + // expected + } + + System.out.println("Test Passed!"); + } + + @Override + public void main(Provider p) throws Exception { + test("GCM", p); + } +} + diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* + * @test + * @bug 8080462 + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main TestKATForGCM + * @summary Known Answer Test for AES cipher with GCM mode support in + * PKCS11 provider. + */ +import java.security.*; +import javax.crypto.*; +import javax.crypto.spec.*; +import java.math.*; + +import java.util.*; + +public class TestKATForGCM extends PKCS11Test { + + // Utility methods + private static byte[] HexToBytes(String hexVal) { + if (hexVal == null) return new byte[0]; + byte[] result = new byte[hexVal.length()/2]; + for (int i = 0; i < result.length; i++) { + // 2 characters at a time + String byteVal = hexVal.substring(2*i, 2*i +2); + result[i] = Integer.valueOf(byteVal, 16).byteValue(); + } + return result; + } + + private static class TestVector { + SecretKey key; + byte[] plainText; + byte[] aad; + byte[] cipherText; + byte[] tag; + GCMParameterSpec spec; + String info; + + TestVector(String key, String iv, String pt, String aad, + String ct, String tag) { + this.key = new SecretKeySpec(HexToBytes(key), "AES"); + this.plainText = HexToBytes(pt); + this.aad = HexToBytes(aad); + this.cipherText = HexToBytes(ct); + this.tag = HexToBytes(tag); + this.spec = new GCMParameterSpec(this.tag.length * 8, HexToBytes(iv)); + this.info = "key=" + key + ", iv=" + iv + ", pt=" + pt + + ",aad=" + aad + ", ct=" + ct + ", tag=" + tag; + } + + public String toString() { + return info; + } + } + + // These test vectors are found off NIST's CAVP page + // http://csrc.nist.gov/groups/STM/cavp/index.html + // inside the link named "GCM Test Vectors", i.e. + // http://csrc.nist.gov/groups/STM/cavp/documents/mac/gcmtestvectors.zip + // CAVS 14.0, set of test vectors w/ count = 0, keysize = 128 + private static TestVector[] testValues = { + // 96-bit iv w/ 128/120/112/104/96-bit tags + // no plain text, no aad + new TestVector("11754cd72aec309bf52f7687212e8957", + "3c819d9a9bed087615030b65", + null, null, null, + "250327c674aaf477aef2675748cf6971"), + new TestVector("272f16edb81a7abbea887357a58c1917", + "794ec588176c703d3d2a7a07", + null, null, null, + "b6e6f197168f5049aeda32dafbdaeb"), + new TestVector("81b6844aab6a568c4556a2eb7eae752f", + "ce600f59618315a6829bef4d", + null, null, null, + "89b43e9dbc1b4f597dbbc7655bb5"), + new TestVector("cde2f9a9b1a004165ef9dc981f18651b", + "29512c29566c7322e1e33e8e", + null, null, null, + "2e58ce7dabd107c82759c66a75"), + new TestVector("b01e45cc3088aaba9fa43d81d481823f", + "5a2c4a66468713456a4bd5e1", + null, null, null, + "014280f944f53c681164b2ff"), + // 96-bit iv w/ 128/120/112/104/96-bit tags + // no plain text, 16-byte aad + new TestVector("77be63708971c4e240d1cb79e8d77feb", + "e0e00f19fed7ba0136a797f3", + null, + "7a43ec1d9c0a5a78a0b16533a6213cab", + null, + "209fcc8d3675ed938e9c7166709dd946"), + new TestVector("da0b615656135194ba6d3c851099bc48", + "d39d4b4d3cc927885090e6c3", + null, + "e7e5e6f8dac913036cb2ff29e8625e0e", + null, + "ab967711a5770461724460b07237e2"), + new TestVector("7e0986937a88eef894235aba4a2f43b2", + "92c4a631695907166b422d60", + null, + "85c185f8518f9f2cd597a8f9208fc76b", + null, + "3bb916b728df94fe9d1916736be1"), + new TestVector("c3db570d7f0c21e86b028f11465d1dc9", + "f86970f58ceef89fc7cb679e", + null, + "c095240708c0f57c288d86090ae34ee1", + null, + "e043c52160d652e82c7262fcf4"), + new TestVector("bea48ae4980d27f357611014d4486625", + "32bddb5c3aa998a08556454c", + null, + "8a50b0b8c7654bced884f7f3afda2ead", + null, + "8e0f6d8bf05ffebe6f500eb1"), + // 96-bit iv w/ 128/120/112/104/96-bit tags + // no plain text, 20-byte aad + new TestVector("2fb45e5b8f993a2bfebc4b15b533e0b4", + "5b05755f984d2b90f94b8027", + null, + "e85491b2202caf1d7dce03b97e09331c32473941", + null, + "c75b7832b2a2d9bd827412b6ef5769db"), + new TestVector("9bf406339fcef9675bbcf156aa1a0661", + "8be4a9543d40f542abacac95", + null, + "7167cbf56971793186333a6685bbd58d47d379b3", + null, + "5e7968d7bbd5ba58cfcc750e2ef8f1"), + new TestVector("a2e962fff70fd0f4d63be728b80556fc", + "1fa7103483de43d09bc23db4", + null, + "2a58edf1d53f46e4e7ee5e77ee7aeb60fc360658", + null, + "fa37f2dbbefab1451eae1d0d74ca"), + new TestVector("6bf4fdce82926dcdfc52616ed5f23695", + "cc0f5899a10615567e1193ed", + null, + "3340655592374c1da2f05aac3ee111014986107f", + null, + "8ad3385cce3b5e7c985908192c"), + new TestVector("4df7a13e43c3d7b66b1a72fac5ba398e", + "97179a3a2d417908dcf0fb28", + null, + "cbb7fc0010c255661e23b07dbd804b1e06ae70ac", + null, + "37791edae6c137ea946cfb40"), + // 96-bit iv w/ 128-bit tags, 13/16/32/51-byte plain text, no aad + new TestVector("fe9bb47deb3a61e423c2231841cfd1fb", + "4d328eb776f500a2f7fb47aa", + "f1cc3818e421876bb6b8bbd6c9", + null, + "b88c5c1977b35b517b0aeae967", + "43fd4727fe5cdb4b5b42818dea7ef8c9"), + new TestVector("7fddb57453c241d03efbed3ac44e371c", + "ee283a3fc75575e33efd4887", + "d5de42b461646c255c87bd2962d3b9a2", + null, + "2ccda4a5415cb91e135c2a0f78c9b2fd", + "b36d1df9b9d5e596f83e8b7f52971cb3"), + new TestVector("9971071059abc009e4f2bd69869db338", + "07a9a95ea3821e9c13c63251", + "f54bc3501fed4f6f6dfb5ea80106df0bd836e6826225b75c0222f6e859b35983", + null, + "0556c159f84ef36cb1602b4526b12009c775611bffb64dc0d9ca9297cd2c6a01", + "7870d9117f54811a346970f1de090c41"), + new TestVector("594157ec4693202b030f33798b07176d", + "49b12054082660803a1df3df", + +"3feef98a976a1bd634f364ac428bb59cd51fb159ec1789946918dbd50ea6c9d594a3a31a5269b0da6936c29d063a5fa2cc8a1c", + null, + +"c1b7a46a335f23d65b8db4008a49796906e225474f4fe7d39e55bf2efd97fd82d4167de082ae30fa01e465a601235d8d68bc69", + "ba92d3661ce8b04687e8788d55417dc2"), + // 96-bit iv w/ 128-bit tags, 16-byte plain text, 16/20/48/90-byte aad + new TestVector("c939cc13397c1d37de6ae0e1cb7c423c", + "b3d8cc017cbb89b39e0f67e2", + "c3b3c41f113a31b73d9a5cd432103069", + "24825602bd12a984e0092d3e448eda5f", + "93fe7d9e9bfd10348a5606e5cafa7354", + "0032a1dc85f1c9786925a2e71d8272dd"), + new TestVector("d4a22488f8dd1d5c6c19a7d6ca17964c", + "f3d5837f22ac1a0425e0d1d5", + "7b43016a16896497fb457be6d2a54122", + "f1c5d424b83f96c6ad8cb28ca0d20e475e023b5a", + "c2bd67eef5e95cac27e3b06e3031d0a8", + "f23eacf9d1cdf8737726c58648826e9c"), + new TestVector("89850dd398e1f1e28443a33d40162664", + "e462c58482fe8264aeeb7231", + "2805cdefb3ef6cc35cd1f169f98da81a", + +"d74e99d1bdaa712864eec422ac507bddbe2b0d4633cd3dff29ce5059b49fe868526c59a2a3a604457bc2afea866e7606", + "ba80e244b7fc9025cd031d0f63677e06", + "d84a8c3eac57d1bb0e890a8f461d1065"), + new TestVector("bd7c5c63b7542b56a00ebe71336a1588", + "87721f23ba9c3c8ea5571abc", + "de15ddbb1e202161e8a79af6a55ac6f3", + +"a6ec8075a0d3370eb7598918f3b93e48444751624997b899a87fa6a9939f844e008aa8b70e9f4c3b1a19d3286bf543e7127bfecba1ad17a5ec53fccc26faecacc4c75369498eaa7d706aef634d0009279b11e4ba6c993e5e9ed9", + "41eb28c0fee4d762de972361c863bc80", + "9cb567220d0b252eb97bff46e4b00ff8"), + // 8/1024-bit iv w/ 128-bit tag, no plain text, no aad + new TestVector("1672c3537afa82004c6b8a46f6f0d026", + "05", + null, null, null, + "8e2ad721f9455f74d8b53d3141f27e8e"), + new TestVector("d0f1f4defa1e8c08b4b26d576392027c", + +"42b4f01eb9f5a1ea5b1eb73b0fb0baed54f387ecaa0393c7d7dffc6af50146ecc021abf7eb9038d4303d91f8d741a11743166c0860208bcc02c6258fd9511a2fa626f96d60b72fcff773af4e88e7a923506e4916ecbd814651e9f445adef4ad6a6b6c7290cc13b956130eef5b837c939fcac0cbbcc9656cd75b13823ee5acdac", + null, null, null, + "7ab49b57ddf5f62c427950111c5c4f0d"), + // 8-bit iv w/ 128-bit tag, 13-byte plain text, 90-byte aad + new TestVector("9f79239f0904eace50784b863e723f6b", + "d9", + "bdb0bb10c87965acd34d146171", + +"44db436089327726c5f01139e1f339735c9e85514ccc2f167bad728010fb34a9072a9794c8a5e7361b1d0dbcdc9ac4091e354bb2896561f0486645252e9c78c86beece91bfa4f7cc4a8794ce1f305b1b735efdbf1ed1563c0be0", + "7e5a7c8dadb3f0c7335b4d9d8d", + "6b6ef1f53723a89f3bb7c6d043840717"), + // 1024-bit iv w/ 128-bit tag, 51-byte plain text, 48-byte aad + new TestVector("141f1ce91989b07e7eb6ae1dbd81ea5e", + +"49451da24bd6074509d3cebc2c0394c972e6934b45a1d91f3ce1d3ca69e194aa1958a7c21b6f21d530ce6d2cc5256a3f846b6f9d2f38df0102c4791e57df038f6e69085646007df999751e248e06c47245f4cd3b8004585a7470dee1690e9d2d63169a58d243c0b57b3e5b4a481a3e4e8c60007094ef3adea2e8f05dd3a1396f", + +"d384305af2388699aa302f510913fed0f2cb63ba42efa8c5c9de2922a2ec2fe87719dadf1eb0aef212b51e74c9c5b934104a43", + +"630cf18a91cc5a6481ac9eefd65c24b1a3c93396bd7294d6b8ba323951727666c947a21894a079ef061ee159c05beeb4", + +"f4c34e5fbe74c0297313268296cd561d59ccc95bbfcdfcdc71b0097dbd83240446b28dc088abd42b0fc687f208190ff24c0548", + "dbb93bbb56d0439cd09f620a57687f5d"), + }; + + public boolean execute(TestVector[] testValues, Cipher c) throws Exception { + boolean testFailed = false; + for (int i = 0; i < testValues.length; i++) { + try { + c.init(Cipher.ENCRYPT_MODE, testValues[i].key, testValues[i].spec); + c.updateAAD(testValues[i].aad); + byte[] ctPlusTag = c.doFinal(testValues[i].plainText); + + c.init(Cipher.DECRYPT_MODE, testValues[i].key, testValues[i].spec); + c.updateAAD(testValues[i].aad); + byte[] pt = c.doFinal(ctPlusTag); // should fail if tag mismatched + + // check encryption/decryption results just to be sure + if (!Arrays.equals(testValues[i].plainText, pt)) { + System.out.println("PlainText diff failed for test# " + i); + testFailed = true; + } + int ctLen = testValues[i].cipherText.length; + if (!Arrays.equals(testValues[i].cipherText, + Arrays.copyOf(ctPlusTag, ctLen))) { + System.out.println("CipherText diff failed for test# " + i); + testFailed = true; + } + int tagLen = testValues[i].tag.length; + if (!Arrays.equals + (testValues[i].tag, + Arrays.copyOfRange(ctPlusTag, ctLen, ctLen+tagLen))) { + System.out.println("Tag diff failed for test# " + i); + testFailed = true; + } + } catch (Exception ex) { + // continue testing other test vectors + System.out.println("Failed Test Vector: " + testValues[i]); + ex.printStackTrace(); + testFailed = true; + continue; + } + } + if (testFailed) { + throw new Exception("Test Failed"); + } + // passed all tests...hooray! + return true; + } + + public static void main(String[] args) throws Exception { + main(new TestKATForGCM(), args); + } + + @Override + public void main(Provider p) throws Exception { + Cipher c; + String transformation = "AES/GCM/NoPadding"; + try { + c = Cipher.getInstance(transformation, p); + } catch (GeneralSecurityException e) { + System.out.println("Skip testing " + p.getName() + + ", no support for " + transformation); + return; + } + if (execute(testValues, c)) { + System.out.println("Test Passed!"); + } + } +} + diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java --- a/test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -23,60 +23,74 @@ /* * @test - * @bug 4856966 + * @bug 4856966 8080462 * @summary Test the MessageDigest.update(ByteBuffer) method * @author Andreas Sterbenz * @library /test/lib .. * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm ByteBuffers - * @run main/othervm ByteBuffers sm */ import java.nio.ByteBuffer; -import java.security.MessageDigest; -import java.security.Provider; +import java.security.*; import java.util.Arrays; import java.util.Random; public class ByteBuffers extends PKCS11Test { + static final String[] ALGS = { + "SHA-224", "SHA-256", "SHA-384", "SHA-512", "SHA-512/224", "SHA-512/256" + }; + + private static Random random = new Random(); + public static void main(String[] args) throws Exception { main(new ByteBuffers(), args); } @Override public void main(Provider p) throws Exception { - if (p.getService("MessageDigest", "MD5") == null) { - System.out.println("Provider does not support MD5, skipping"); - return; - } - - Random random = new Random(); int n = 10 * 1024; byte[] t = new byte[n]; random.nextBytes(t); - MessageDigest md = MessageDigest.getInstance("MD5", p); - byte[] d1 = md.digest(t); + for (String alg : ALGS) { + runTest(p, alg, t); + } + } + + private void runTest(Provider p, String alg, byte[] data) throws Exception { + System.out.println("Test against " + p.getName() + " and " + alg); + MessageDigest md; + try { + md = MessageDigest.getInstance(alg, p); + } catch (NoSuchAlgorithmException e) { + System.out.println("Skip " + alg + " due to no support"); + return; + } + + byte[] d1 = md.digest(data); + + int n = data.length; // test 1: ByteBuffer with an accessible backing array ByteBuffer b1 = ByteBuffer.allocate(n + 256); b1.position(random.nextInt(256)); b1.limit(b1.position() + n); ByteBuffer b2 = b1.slice(); - b2.put(t); + b2.put(data); b2.clear(); - byte[] d2 = digest(md, b2, random); + byte[] d2 = digest(md, b2); if (Arrays.equals(d1, d2) == false) { throw new Exception("Test 1 failed"); } // test 2: direct ByteBuffer - ByteBuffer b3 = ByteBuffer.allocateDirect(t.length); - b3.put(t); + ByteBuffer b3 = ByteBuffer.allocateDirect(n); + b3.put(data); b3.clear(); - byte[] d3 = digest(md, b3, random); + byte[] d3 = digest(md, b3); if (Arrays.equals(d1, d2) == false) { throw new Exception("Test 2 failed"); } @@ -84,14 +98,15 @@ // test 3: ByteBuffer without an accessible backing array b2.clear(); ByteBuffer b4 = b2.asReadOnlyBuffer(); - byte[] d4 = digest(md, b4, random); + byte[] d4 = digest(md, b4); if (Arrays.equals(d1, d2) == false) { throw new Exception("Test 3 failed"); } System.out.println("All tests passed"); } - private static byte[] digest(MessageDigest md, ByteBuffer b, Random random) throws Exception { + private static byte[] digest(MessageDigest md, ByteBuffer b) + throws Exception { int lim = b.limit(); b.limit(random.nextInt(lim)); md.update(b); diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Signature/InitAgainPSS.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Signature/InitAgainPSS.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,87 @@ +/* + * 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 java.security.*; +import java.security.spec.*; + +/** + * @test + * @bug 8080462 + * @summary Make sure old state is cleared when init is called again + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + */ +public class InitAgainPSS extends PKCS11Test { + + public static void main(String[] args) throws Exception { + main(new InitAgainPSS(), args); + } + + @Override + public void main(Provider p) throws Exception { + Signature s1; + try { + s1 = Signature.getInstance("RSASSA-PSS", p); + } catch (NoSuchAlgorithmException e) { + System.out.println("Skip testing RSASSA-PSS" + + " due to no support"); + return; + } + + byte[] msg = "hello".getBytes(); + + Signature s2 = Signature.getInstance("RSASSA-PSS", p); + + PSSParameterSpec params = new PSSParameterSpec("SHA-256", "MGF1", + new MGF1ParameterSpec("SHA-256"), 32, + PSSParameterSpec.TRAILER_FIELD_BC); + s1.setParameter(params); + s2.setParameter(params); + + KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); + kpg.initialize(2048); + KeyPair kp = kpg.generateKeyPair(); + + s1.initSign(kp.getPrivate()); + + s1.update(msg); + s1.initSign(kp.getPrivate()); + s1.update(msg); + // Data digested in s1: + // Before this fix, msg | msg + // After this fix, msg + + s2.initVerify(kp.getPublic()); + s2.update(msg); + s2.initVerify(kp.getPublic()); + s2.update(msg); + s2.initVerify(kp.getPublic()); + s2.update(msg); + // Data digested in s2: + // Before this fix, msg | msg | msg + // After this fix, msg + + if (!s2.verify(s1.sign())) { + throw new Exception(); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Signature/KeyAndParamCheckForPSS.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Signature/KeyAndParamCheckForPSS.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,132 @@ +/* + * 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 java.security.*; +import java.security.interfaces.*; +import java.security.spec.*; + +/** + * @test + * @bug 8080462 + * @summary Ensure that PSS key and params check are implemented properly + * regardless of call sequence + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main KeyAndParamCheckForPSS + */ +public class KeyAndParamCheckForPSS extends PKCS11Test { + + /** + * ALGORITHM name, fixed as RSA for PKCS11 + */ + private static final String KEYALG = "RSA"; + private static final String SIGALG = "RSASSA-PSS"; + + public static void main(String[] args) throws Exception { + main(new KeyAndParamCheckForPSS(), args); + } + + @Override + public void main(Provider p) throws Exception { + Signature sig; + try { + sig = Signature.getInstance(SIGALG, p); + } catch (NoSuchAlgorithmException e) { + System.out.println("Skip testing RSASSA-PSS" + + " due to no support"); + return; + } + // NOTE: key length >= (digest length + 2) in bytes + // otherwise, even salt length = 0 would not work + runTest(p, 1024, "SHA-384"); + runTest(p, 1040, "SHA-512"); + } + + private void runTest(Provider p, int keySize, String hashAlg) + throws Exception { + System.out.println("Testing [" + keySize + " " + hashAlg + "]"); + + // create a key pair with the supplied size + KeyPairGenerator kpg = KeyPairGenerator.getInstance(KEYALG, p); + kpg.initialize(keySize); + KeyPair kp = kpg.generateKeyPair(); + + int bigSaltLen = keySize/8 - 14; + AlgorithmParameterSpec paramsBad = new PSSParameterSpec(hashAlg, + "MGF1", new MGF1ParameterSpec(hashAlg), bigSaltLen, 1); + AlgorithmParameterSpec paramsGood = new PSSParameterSpec(hashAlg, + "MGF1", new MGF1ParameterSpec(hashAlg), 0, 1); + + PrivateKey priv = kp.getPrivate(); + PublicKey pub = kp.getPublic(); + + // test#1 - setParameter then initSign + Signature sig = Signature.getInstance("RSASSA-PSS", p); + sig.setParameter(paramsBad); + try { + sig.initSign(priv); + throw new RuntimeException("Expected IKE not thrown"); + } catch (InvalidKeyException ike) { + System.out.println("test#1: got expected IKE"); + } + sig.setParameter(paramsGood); + sig.initSign(priv); + System.out.println("test#1: pass"); + + // test#2 - setParameter then initVerify + sig = Signature.getInstance("RSASSA-PSS", p); + sig.setParameter(paramsBad); + try { + sig.initVerify(pub); + throw new RuntimeException("Expected IKE not thrown"); + } catch (InvalidKeyException ike) { + System.out.println("test#2: got expected IKE"); + } + sig.setParameter(paramsGood); + sig.initVerify(pub); + System.out.println("test#2: pass"); + + // test#3 - initSign, then setParameter + sig = Signature.getInstance("RSASSA-PSS", p); + sig.initSign(priv); + try { + sig.setParameter(paramsBad); + throw new RuntimeException("Expected IAPE not thrown"); + } catch (InvalidAlgorithmParameterException iape) { + System.out.println("test#3: got expected IAPE"); + } + sig.setParameter(paramsGood); + System.out.println("test#3: pass"); + + // test#4 - initVerify, then setParameter + sig = Signature.getInstance("RSASSA-PSS", p); + sig.initVerify(pub); + try { + sig.setParameter(paramsBad); + throw new RuntimeException("Expected IAPE not thrown"); + } catch (InvalidAlgorithmParameterException iape) { + System.out.println("test#4: got expected IAPE"); + } + sig.setParameter(paramsGood); + System.out.println("test#4: pass"); + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Signature/SigInteropPSS.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,121 @@ +/* + * 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 java.security.*; +import java.security.spec.*; +import java.security.interfaces.*; + +/* + * @test + * @bug 8080462 + * @summary testing interoperability of PSS signatures of PKCS11 provider + * against SunRsaSign provider + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main/othervm SigInteropPSS + */ +public class SigInteropPSS extends PKCS11Test { + + private static final byte[] MSG = + "Interoperability test between SunRsaSign and SunPKCS11".getBytes(); + + private static final String[] DIGESTS = { + "SHA-224", "SHA-256", "SHA-384", "SHA-512" + }; + + public static void main(String[] args) throws Exception { + main(new SigInteropPSS(), args); + } + + @Override + public void main(Provider p) throws Exception { + Signature sigPkcs11; + try { + sigPkcs11 = Signature.getInstance("RSASSA-PSS", p); + } catch (NoSuchAlgorithmException e) { + System.out.println("Skip testing RSASSA-PSS" + + " due to no support"); + return; + } + + Signature sigSunRsaSign = + Signature.getInstance("RSASSA-PSS", "SunRsaSign"); + + KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); + kpg.initialize(3072); + KeyPair kp = kpg.generateKeyPair(); + boolean status; + try { + status = runTest(sigSunRsaSign, sigPkcs11, kp); + status &= runTest(sigPkcs11, sigSunRsaSign, kp); + } catch (Exception e) { + System.out.println("Unexpected exception: " + e); + e.printStackTrace(System.out); + status = false; + } + + if (!status) { + throw new RuntimeException("One or more test failed"); + } + System.out.println("Test passed"); + } + + static boolean runTest(Signature signer, Signature verifier, KeyPair kp) throws Exception { + System.out.println("\tSign using " + signer.getProvider().getName()); + System.out.println("\tVerify using " + verifier.getProvider().getName()); + + boolean status; + for (String digestAlg : DIGESTS) { + System.out.println("\tDigest = " + digestAlg); + PSSParameterSpec params = new PSSParameterSpec(digestAlg, "MGF1", + new MGF1ParameterSpec(digestAlg), 0, 1); + try { + signer.setParameter(params); + signer.initSign(kp.getPrivate()); + verifier.setParameter(params); + verifier.initVerify(kp.getPublic()); + } catch (Exception e) { + System.out.println("\tERROR: unexpected ex during init" + e); + status = false; + continue; + } + try { + signer.update(MSG); + byte[] sigBytes = signer.sign(); + verifier.update(MSG); + boolean isValid = verifier.verify(sigBytes); + if (isValid) { + System.out.println("\tPSS Signature verified"); + } else { + System.out.println("\tERROR verifying PSS Signature"); + status = false; + } + } catch (Exception e) { + System.out.println("\tERROR: unexpected ex" + e); + e.printStackTrace(); + status = false; + } + } + return true; + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,147 @@ +/* + * 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 java.security.*; +import java.security.interfaces.*; +import java.security.spec.*; +import java.util.stream.IntStream; + +/** + * @test + * @bug 8080462 + * @summary Generate a RSASSA-PSS signature and verify it using PKCS11 provider + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main SignatureTestPSS + */ +public class SignatureTestPSS extends PKCS11Test { + + // PKCS11 does not support RSASSA-PSS keys yet + private static final String KEYALG = "RSA"; + private static final String SIGALG = "RSASSA-PSS"; + + private static final int[] KEYSIZES = { 2048, 3072 }; + private static final String[] DIGESTS = { "SHA-224", "SHA-256", + "SHA-384" , "SHA-512" }; + private Provider prov; + + /** + * How much times signature updated. + */ + private static final int UPDATE_TIMES_FIFTY = 50; + + /** + * How much times signature initial updated. + */ + private static final int UPDATE_TIMES_HUNDRED = 100; + + public static void main(String[] args) throws Exception { + main(new SignatureTestPSS(), args); + } + + @Override + public void main(Provider p) throws Exception { + Signature sig; + try { + sig = Signature.getInstance(SIGALG, p); + } catch (NoSuchAlgorithmException e) { + System.out.println("Skip testing RSASSA-PSS" + + " due to no support"); + return; + } + this.prov = p; + for (int i : KEYSIZES) { + runTest(i); + } + } + + private void runTest(int keySize) throws Exception { + byte[] data = new byte[100]; + IntStream.range(0, data.length).forEach(j -> { + data[j] = (byte) j; + }); + System.out.println("[KEYSIZE = " + keySize + "]"); + + // create a key pair + KeyPair kpair = generateKeys(KEYALG, keySize); + test(DIGESTS, kpair.getPrivate(), kpair.getPublic(), data); + } + + private void test(String[] testAlgs, PrivateKey privKey, + PublicKey pubKey, byte[] data) throws RuntimeException { + // For signature algorithm, create and verify a signature + for (String testAlg : testAlgs) { + try { + checkSignature(data, pubKey, privKey, testAlg); + } catch (NoSuchAlgorithmException | InvalidKeyException | + SignatureException | NoSuchProviderException ex) { + throw new RuntimeException(ex); + } catch (InvalidAlgorithmParameterException ex2) { + System.out.println("Skip test due to " + ex2); + } + }; + } + + private KeyPair generateKeys(String keyalg, int size) + throws NoSuchAlgorithmException { + KeyPairGenerator kpg = KeyPairGenerator.getInstance(keyalg, prov); + kpg.initialize(size); + return kpg.generateKeyPair(); + } + + private void checkSignature(byte[] data, PublicKey pub, + PrivateKey priv, String mdAlg) throws NoSuchAlgorithmException, + InvalidKeyException, SignatureException, NoSuchProviderException, + InvalidAlgorithmParameterException { + System.out.println("Testing against " + mdAlg); + Signature sig = Signature.getInstance(SIGALG, prov); + AlgorithmParameterSpec params = new PSSParameterSpec( + mdAlg, "MGF1", new MGF1ParameterSpec(mdAlg), 0, 1); + sig.setParameter(params); + sig.initSign(priv); + for (int i = 0; i < UPDATE_TIMES_HUNDRED; i++) { + sig.update(data); + } + byte[] signedData = sig.sign(); + + // Make sure signature verifies with original data + // do we need to call sig.setParameter(params) again? + sig.initVerify(pub); + for (int i = 0; i < UPDATE_TIMES_HUNDRED; i++) { + sig.update(data); + } + if (!sig.verify(signedData)) { + throw new RuntimeException("Failed to verify signature"); + } + + // Make sure signature does NOT verify when the original data + // has changed + sig.initVerify(pub); + for (int i = 0; i < UPDATE_TIMES_FIFTY; i++) { + sig.update(data); + } + + if (sig.verify(signedData)) { + throw new RuntimeException("Failed to detect bad signature"); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/pkcs11/Signature/TestDSA2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/pkcs11/Signature/TestDSA2.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2012, 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. + */ +/* + * @test + * @bug 8080462 + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main/othervm/timeout=250 TestDSA2 + * @summary verify that DSA signature works using SHA-2 digests. + * @key randomness + */ + + +import java.security.*; +import java.security.spec.*; +import java.security.interfaces.*; + +public class TestDSA2 extends PKCS11Test { + + private static final String[] SIG_ALGOS = { + "SHA224withDSA", + "SHA256withDSA", + //"SHA384withDSA", + //"SHA512withDSA", + }; + + private static final int KEYSIZE = 2048; + + public static void main(String[] args) throws Exception { + main(new TestDSA2(), args); + } + + @Override + public void main(Provider p) throws Exception { + KeyPair kp; + try { + KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA", p); + kpg.initialize(KEYSIZE); + kp = kpg.generateKeyPair(); + } catch (Exception ex) { + System.out.println("Skip due to no 2048-bit DSA support: " + ex); + ex.printStackTrace(); + return; + } + + for (String sigAlg : SIG_ALGOS) { + test(sigAlg, kp, p); + } + } + + private static void test(String sigAlg, KeyPair kp, Provider p) + throws Exception { + Signature sig; + try { + sig = Signature.getInstance(sigAlg, p); + } catch (Exception ex) { + System.out.println("Skip due to no support: " + sigAlg); + ex.printStackTrace(); + return; + } + + byte[] data = "anything will do".getBytes(); + + sig.initSign(kp.getPrivate()); + sig.update(data); + byte[] signature = sig.sign(); + + sig.initVerify(kp.getPublic()); + sig.update(data); + boolean verifies = sig.verify(signature); + System.out.println(sigAlg + ": Passed"); + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/ssl/CipherSuite/SupportedGroups.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/ssl/CipherSuite/SupportedGroups.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,87 @@ +/* + * 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. + */ + + /* + * @test + * @bug 8171279 + * @library /javax/net/ssl/templates + * @summary Test TLS connection with each individual supported group + * @run main/othervm SupportedGroups x25519 + * @run main/othervm SupportedGroups x448 + * @run main/othervm SupportedGroups secp256r1 + * @run main/othervm SupportedGroups secp384r1 + * @run main/othervm SupportedGroups secp521r1 + * @run main/othervm SupportedGroups ffdhe2048 + * @run main/othervm SupportedGroups ffdhe3072 + * @run main/othervm SupportedGroups ffdhe4096 + * @run main/othervm SupportedGroups ffdhe6144 + * @run main/othervm SupportedGroups ffdhe8192 + */ +import java.util.Arrays; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLServerSocket; + +public class SupportedGroups extends SSLSocketTemplate { + + private static volatile int index; + private static final String[][][] protocols = { + {{"TLSv1.3"}, {"TLSv1.3"}}, + {{"TLSv1.3", "TLSv1.2"}, {"TLSv1.2"}}, + {{"TLSv1.2"}, {"TLSv1.3", "TLSv1.2"}}, + {{"TLSv1.2"}, {"TLSv1.2"}} + }; + + // Servers are configured before clients, increment test case after. + @Override + protected void configureClientSocket(SSLSocket socket) { + String[] ps = protocols[index][0]; + + System.out.print("Setting client protocol(s): "); + Arrays.stream(ps).forEachOrdered(System.out::print); + System.out.println(); + + socket.setEnabledProtocols(ps); + } + + @Override + protected void configureServerSocket(SSLServerSocket serverSocket) { + String[] ps = protocols[index][1]; + + System.out.print("Setting server protocol(s): "); + Arrays.stream(ps).forEachOrdered(System.out::print); + System.out.println(); + + serverSocket.setEnabledProtocols(ps); + } + + /* + * Run the test case. + */ + public static void main(String[] args) throws Exception { + System.setProperty("jdk.tls.namedGroups", args[0]); + + for (index = 0; index < protocols.length; index++) { + (new SupportedGroups()).run(); + } + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/ssl/DHKeyExchange/DHEKeySizing.java --- a/test/jdk/sun/security/ssl/DHKeyExchange/DHEKeySizing.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/security/ssl/DHKeyExchange/DHEKeySizing.java Fri Jun 21 14:07:48 2019 +0530 @@ -30,44 +30,57 @@ * @test * @bug 6956398 * @summary make ephemeral DH key match the length of the certificate key - * @run main/othervm + * @run main/othervm -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1643 267 * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1259 75 * @run main/othervm -Djsse.enableFFDHE=false * -Djdk.tls.ephemeralDHKeySize=matched + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1259 75 * @run main/othervm -Djsse.enableFFDHE=false * -Djdk.tls.ephemeralDHKeySize=legacy + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1259 75 * @run main/othervm -Djsse.enableFFDHE=false * -Djdk.tls.ephemeralDHKeySize=1024 + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1259 75 * * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA true 233 75 * * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1387 139 * @run main/othervm -Djsse.enableFFDHE=false * -Djdk.tls.ephemeralDHKeySize=legacy + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1323 107 * @run main/othervm -Djsse.enableFFDHE=false * -Djdk.tls.ephemeralDHKeySize=matched + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1643 267 * @run main/othervm -Djsse.enableFFDHE=false * -Djdk.tls.ephemeralDHKeySize=1024 + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1387 139 * * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.client.enableSessionTicketExtension=false * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 361 139 * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.client.enableSessionTicketExtension=false * -Djdk.tls.ephemeralDHKeySize=legacy * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 297 107 * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.client.enableSessionTicketExtension=false * -Djdk.tls.ephemeralDHKeySize=matched * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 361 139 * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.client.enableSessionTicketExtension=false * -Djdk.tls.ephemeralDHKeySize=1024 * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 361 139 */ diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksClient.java --- a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksClient.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksClient.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -26,13 +26,17 @@ * @bug 8206929 8212885 * @summary ensure that client only resumes a session if certain properties * of the session are compatible with the new connection - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 ResumeChecksClient BASIC - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksClient BASIC - * @run main/othervm ResumeChecksClient BASIC - * @run main/othervm ResumeChecksClient VERSION_2_TO_3 - * @run main/othervm ResumeChecksClient VERSION_3_TO_2 - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksClient CIPHER_SUITE - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksClient SIGNATURE_SCHEME + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient VERSION_2_TO_3 + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient VERSION_3_TO_2 + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient CIPHER_SUITE + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient SIGNATURE_SCHEME * */ diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksClientStateless.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksClientStateless.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,40 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8211018 + * @summary ensure that client only resumes a session if certain properties + * of the session are compatible with the new connection + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient BASIC + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient VERSION_2_TO_3 + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient VERSION_3_TO_2 + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient CIPHER_SUITE + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksClient SIGNATURE_SCHEME + */ diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksServer.java --- a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksServer.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksServer.java Fri Jun 21 14:07:48 2019 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -26,16 +26,18 @@ * @bug 8206929 * @summary ensure that server only resumes a session if certain properties * of the session are compatible with the new connection - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 ResumeChecksServer BASIC - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksServer BASIC - * @run main/othervm ResumeChecksServer BASIC - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 ResumeChecksServer CLIENT_AUTH - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksServer CLIENT_AUTH - * @run main/othervm ResumeChecksServer CLIENT_AUTH - * @run main/othervm ResumeChecksServer VERSION_2_TO_3 - * @run main/othervm ResumeChecksServer VERSION_3_TO_2 - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksServer CIPHER_SUITE - * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksServer SIGNATURE_SCHEME + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksServer BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksServer BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksServer BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksServer CLIENT_AUTH + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksServer CLIENT_AUTH + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksServer CLIENT_AUTH + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksServer VERSION_2_TO_3 + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksServer VERSION_2_TO_3 + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksServer VERSION_2_TO_3 + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksServer VERSION_3_TO_2 + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=true ResumeChecksServer VERSION_3_TO_2 + * @run main/othervm -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=false ResumeChecksServer VERSION_3_TO_2 * */ diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksServerStateless.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumeChecksServerStateless.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8211018 + * @summary ensure that server only resumes a session if certain properties + * of the session are compatible with the new connection + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksServer BASIC + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksServer CLIENT_AUTH + * @run main/othervm ResumeChecksServer VERSION_2_TO_3 + * @run main/othervm ResumeChecksServer VERSION_3_TO_2 + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksServer CIPHER_SUITE + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 ResumeChecksServer SIGNATURE_SCHEME + */ diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/ssl/SSLSocketImpl/BlockedAsyncClose.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/BlockedAsyncClose.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,147 @@ +/* + * 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. + */ + +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + +/* + * @test + * @bug 8224829 + * @summary AsyncSSLSocketClose.java has timing issue + * @run main/othervm BlockedAsyncClose + */ + +import javax.net.ssl.*; +import java.io.*; +import java.net.SocketException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +public class BlockedAsyncClose implements Runnable { + SSLSocket socket; + SSLServerSocket ss; + + // Is the socket ready to close? + private final CountDownLatch closeCondition = new CountDownLatch(1); + + // Where do we find the keystores? + static String pathToStores = "../../../../javax/net/ssl/etc"; + static String keyStoreFile = "keystore"; + static String trustStoreFile = "truststore"; + static String passwd = "passphrase"; + + public static void main(String[] args) throws Exception { + String keyFilename = + System.getProperty("test.src", "./") + "/" + pathToStores + + "/" + keyStoreFile; + String trustFilename = + System.getProperty("test.src", "./") + "/" + pathToStores + + "/" + trustStoreFile; + + System.setProperty("javax.net.ssl.keyStore", keyFilename); + System.setProperty("javax.net.ssl.keyStorePassword", passwd); + System.setProperty("javax.net.ssl.trustStore", trustFilename); + System.setProperty("javax.net.ssl.trustStorePassword", passwd); + + new BlockedAsyncClose(); + } + + public BlockedAsyncClose() throws Exception { + SSLServerSocketFactory sslssf = + (SSLServerSocketFactory)SSLServerSocketFactory.getDefault(); + InetAddress loopback = InetAddress.getLoopbackAddress(); + ss = (SSLServerSocket)sslssf.createServerSocket(); + ss.bind(new InetSocketAddress(loopback, 0)); + + SSLSocketFactory sslsf = + (SSLSocketFactory)SSLSocketFactory.getDefault(); + socket = (SSLSocket)sslsf.createSocket(loopback, ss.getLocalPort()); + SSLSocket serverSoc = (SSLSocket)ss.accept(); + ss.close(); + + (new Thread(this)).start(); + serverSoc.startHandshake(); + + boolean closeIsReady = closeCondition.await(90L, TimeUnit.SECONDS); + if (!closeIsReady) { + System.out.println( + "Ignore, the closure is not ready yet in 90 seconds."); + return; + } + + socket.setSoLinger(true, 10); + System.out.println("Calling Socket.close"); + + // Sleep for a while so that the write thread blocks by hitting the + // output stream buffer limit. + Thread.sleep(1000); + + socket.close(); + System.out.println("ssl socket get closed"); + System.out.flush(); + } + + // block in write + public void run() { + byte[] ba = new byte[1024]; + for (int i = 0; i < ba.length; i++) { + ba[i] = 0x7A; + } + + try { + OutputStream os = socket.getOutputStream(); + int count = 0; + + // 1st round write + count += ba.length; + System.out.println(count + " bytes to be written"); + os.write(ba); + System.out.println(count + " bytes written"); + + // Signal, ready to close. + closeCondition.countDown(); + + // write more + while (true) { + count += ba.length; + System.out.println(count + " bytes to be written"); + os.write(ba); + System.out.println(count + " bytes written"); + } + } catch (SocketException se) { + // the closing may be in progress + System.out.println("interrupted? " + se); + } catch (Exception e) { + if (socket.isClosed() || socket.isOutputShutdown()) { + System.out.println("interrupted, the socket is closed"); + } else { + throw new RuntimeException("interrupted?", e); + } + } + } +} + diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/ssl/SignatureScheme/Tls13NamedGroups.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/ssl/SignatureScheme/Tls13NamedGroups.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,188 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + +/* + * @test + * @bug 8225766 + * @summary Curve in certificate should not affect signature scheme + * when using TLSv1.3 + * @library /javax/net/ssl/templates + * @run main/othervm Tls13NamedGroups + */ + +import java.net.*; +import java.io.*; +import javax.net.ssl.*; +import java.security.*; +import java.security.cert.*; +import java.security.spec.*; +import java.security.interfaces.*; +import java.util.Base64; + +public class Tls13NamedGroups extends SSLSocketTemplate { + + public static void main(String[] args) throws Exception { + // Limit the supported named group to secp521r1. + System.setProperty("jdk.tls.namedGroups", "secp521r1"); + + new Tls13NamedGroups().run(); + } + + @Override + protected SSLContext createServerSSLContext() throws Exception { + return generateSSLContext(); + } + + @Override + protected void configureServerSocket(SSLServerSocket socket) { + socket.setNeedClientAuth(true); + } + + @Override + protected SSLContext createClientSSLContext() throws Exception { + return generateSSLContext(); + } + + /* + * ============================================================= + * The remainder is just support stuff + */ + + // Certificates and key used in the test. + // + // Trusted Certificate. + static String trustedCertStr = + // SHA256withECDSA, curve prime256v1 + // Validity + // Not Before: May 22 07:18:16 2018 GMT + // Not After : May 17 07:18:16 2038 GMT + // Subject Key Identifier: + // 60:CF:BD:73:FF:FA:1A:30:D2:A4:EC:D3:49:71:46:EF:1A:35:A0:86 + "-----BEGIN CERTIFICATE-----\n" + + "MIIBvjCCAWOgAwIBAgIJAIvFG6GbTroCMAoGCCqGSM49BAMCMDsxCzAJBgNVBAYT\n" + + "AlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZj\n" + + "ZTAeFw0xODA1MjIwNzE4MTZaFw0zODA1MTcwNzE4MTZaMDsxCzAJBgNVBAYTAlVT\n" + + "MQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZjZTBZ\n" + + "MBMGByqGSM49AgEGCCqGSM49AwEHA0IABBz1WeVb6gM2mh85z3QlvaB/l11b5h0v\n" + + "LIzmkC3DKlVukZT+ltH2Eq1oEkpXuf7QmbM0ibrUgtjsWH3mULfmcWmjUDBOMB0G\n" + + "A1UdDgQWBBRgz71z//oaMNKk7NNJcUbvGjWghjAfBgNVHSMEGDAWgBRgz71z//oa\n" + + "MNKk7NNJcUbvGjWghjAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0kAMEYCIQCG\n" + + "6wluh1r2/T6L31mZXRKf9JxeSf9pIzoLj+8xQeUChQIhAJ09wAi1kV8yePLh2FD9\n" + + "2YEHlSQUAbwwqCDEVB5KxaqP\n" + + "-----END CERTIFICATE-----"; + // -----BEGIN PRIVATE KEY----- + // MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg/HcHdoLJCdq3haVd + // XZTSKP00YzM3xX97l98vGL/RI1KhRANCAAQc9VnlW+oDNpofOc90Jb2gf5ddW+Yd + // LyyM5pAtwypVbpGU/pbR9hKtaBJKV7n+0JmzNIm61ILY7Fh95lC35nFp + // -----END PRIVATE KEY----- + + // End entity certificate. + static String targetCertStr = + // SHA256withECDSA, curve prime256v1 + // Validity + // Not Before: May 22 07:18:16 2018 GMT + // Not After : May 17 07:18:16 2038 GMT + // Authority Key Identifier: + // 60:CF:BD:73:FF:FA:1A:30:D2:A4:EC:D3:49:71:46:EF:1A:35:A0:86 + "-----BEGIN CERTIFICATE-----\n" + + "MIIBqjCCAVCgAwIBAgIJAPLY8qZjgNRAMAoGCCqGSM49BAMCMDsxCzAJBgNVBAYT\n" + + "AlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZj\n" + + "ZTAeFw0xODA1MjIwNzE4MTZaFw0zODA1MTcwNzE4MTZaMFUxCzAJBgNVBAYTAlVT\n" + + "MQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZjZTEY\n" + + "MBYGA1UEAwwPUmVncmVzc2lvbiBUZXN0MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD\n" + + "QgAEb+9n05qfXnfHUb0xtQJNS4JeSi6IjOfW5NqchvKnfJey9VkJzR7QHLuOESdf\n" + + "xlR7q8YIWgih3iWLGfB+wxHiOqMjMCEwHwYDVR0jBBgwFoAUYM+9c//6GjDSpOzT\n" + + "SXFG7xo1oIYwCgYIKoZIzj0EAwIDSAAwRQIgWpRegWXMheiD3qFdd8kMdrkLxRbq\n" + + "1zj8nQMEwFTUjjQCIQDRIrAjZX+YXHN9b0SoWWLPUq0HmiFIi8RwMnO//wJIGQ==\n" + + "-----END CERTIFICATE-----"; + + // Private key in the format of PKCS#8. + static String targetPrivateKey = + // + // EC private key related to cert endEntityCertStrs[0]. + // + "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgn5K03bpTLjEtFQRa\n" + + "JUtx22gtmGEvvSUSQdimhGthdtihRANCAARv72fTmp9ed8dRvTG1Ak1Lgl5KLoiM\n" + + "59bk2pyG8qd8l7L1WQnNHtAcu44RJ1/GVHurxghaCKHeJYsZ8H7DEeI6"; + + static char passphrase[] = "passphrase".toCharArray(); + + // Create the SSLContext instance. + private static SSLContext generateSSLContext() throws Exception { + + // generate certificate from cert string + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + + // create a key store + KeyStore ks = KeyStore.getInstance("JKS"); + ks.load(null, null); + + // import the trused cert + X509Certificate trusedCert = null; + ByteArrayInputStream is = + new ByteArrayInputStream(trustedCertStr.getBytes()); + trusedCert = (X509Certificate)cf.generateCertificate(is); + is.close(); + + ks.setCertificateEntry("Trusted EC Signer", trusedCert); + + // generate the private key. + PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec( + Base64.getMimeDecoder().decode(targetPrivateKey)); + KeyFactory kf = KeyFactory.getInstance("EC"); + ECPrivateKey priKey = + (ECPrivateKey)kf.generatePrivate(priKeySpec); + + // generate certificate chain + is = new ByteArrayInputStream(targetCertStr.getBytes()); + X509Certificate keyCert = (X509Certificate)cf.generateCertificate(is); + is.close(); + + X509Certificate[] chain = new X509Certificate[2]; + chain[0] = keyCert; + chain[1] = trusedCert; + + // import the key entry and the chain + ks.setKeyEntry("TheKey", priKey, passphrase, chain); + + // create SSL context + TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); + tmf.init(ks); + + KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509"); + kmf.init(ks, passphrase); + + SSLContext ctx = SSLContext.getInstance("TLSv1.3"); + ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + ks = null; + + return ctx; + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/tools/jarsigner/JavaKeyStoreAliasCaseInsensitive.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/tools/jarsigner/JavaKeyStoreAliasCaseInsensitive.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,135 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8221719 + * @library /test/lib + * @run testng JavaKeyStoreAliasCaseInsensitive + * @summary Checks that jarsigner verifies a signed jar with the same alias as + * was specified for signing, particularly regarding upper and lower case and + * its conversion to lower case by JKS + * ({@link sun.security.provider.JavaKeyStore.JKS#convertAlias(String)}). + */ + +import java.nio.file.Files; +import java.nio.file.Paths; +import jdk.test.lib.util.JarUtils; +import jdk.test.lib.SecurityTools; +import org.testng.annotations.Test; + +public class JavaKeyStoreAliasCaseInsensitive { + + /** + * Alias for certificates in the keystore with letters in different + * (upper and lower) cases. + */ + static final String ALIAS = "AlIaS"; + + @Test + public void testAliasCase() throws Exception { + final String KEYSTORE_OPTIONS = "-storetype JKS -keystore " + + "test-alias-case.jks -storepass changeit"; + SecurityTools.keytool(KEYSTORE_OPTIONS + " -genkeypair" + + " -keypass changeit -alias " + ALIAS + " -dname CN=" + ALIAS) + .shouldHaveExitValue(0); + String jarFilename = "test-alias-case.jar"; + JarUtils.createJarFile(Paths.get(jarFilename), Paths.get("."), + Files.write(Paths.get("aFile"), new byte[1])); + + SecurityTools.jarsigner(KEYSTORE_OPTIONS + " -verbose -debug " + + jarFilename + " " + ALIAS).shouldHaveExitValue(0); + + SecurityTools.jarsigner("-verify -strict " + KEYSTORE_OPTIONS + + " -debug -verbose " + jarFilename + " " + ALIAS) + .shouldHaveExitValue(0) + .shouldNotContain( + "This jar contains signed entries which are not " + + "signed by the specified alias(es)."); + } + + /** + * This test essentially covers compatibility with the previous version of + * {@link sun.security.tools.jarsigner.Main#inKeyStoreForOneSigner} in case + * a certificate and alias entry is already in + * {@link sun.security.tools.jarsigner.Main#storeHash} when + * {@link sun.security.tools.jarsigner.Main#inKeyStoreForOneSigner} is + * invoked from a previous invocation of it. + * It passed with the previous {@code jarsigner} version with a lowercase + * alias {@link #ALIAS} and basically covers the duplicated portions of + * code in {@link sun.security.tools.jarsigner.Main#inKeyStoreForOneSigner} + * near {@code IN_KEYSTORE} and {@code SIGNED_BY_ALIAS} before having + * refactored and re-unified them in order to demonstrate identical + * behavior. + */ + @Test + public void testAliasCaseStoreHash() throws Exception { + // Create a keystore with a certificate associated with ALIAS + "2" + // signed by another certificate associated with ALIAS + "1". + final String KEYSTORE_OPTIONS = "-storetype JKS -keystore" + + " test-alias-storeHash-case.jks -storepass changeit"; + SecurityTools.keytool(KEYSTORE_OPTIONS + " -genkeypair" + + " -keypass changeit -alias " + ALIAS + "1 -dname CN=" + + ALIAS + "1").shouldHaveExitValue(0); + SecurityTools.keytool(KEYSTORE_OPTIONS + " -genkeypair" + + " -keypass changeit -alias " + ALIAS + "2 -dname CN=" + + ALIAS + "2").shouldHaveExitValue(0); + String certReq = SecurityTools.keytool(KEYSTORE_OPTIONS + + " -certreq -keypass changeit -alias " + ALIAS + "2") + .shouldHaveExitValue(0).getStdout(); + SecurityTools.setResponse(certReq); + String cert = SecurityTools.keytool(KEYSTORE_OPTIONS + + " -gencert -rfc -keypass changeit -alias " + ALIAS + "1") + .shouldHaveExitValue(0).getOutput(); + SecurityTools.setResponse(cert); + SecurityTools.keytool(KEYSTORE_OPTIONS + + " -importcert -keypass changeit -alias " + ALIAS + "2") + .shouldHaveExitValue(0); + + // Create a jar file signed by ALIAS + "2" and then add another file to + // that same jar and sign it by ALIAS + "1", ALIAS + "1" being an alias + // for a certificate which is part of the certificate chain of ALIAS + + // "2" but not the certificate ALIAS + "2" points to directly. + String jarFilename = "test-alias-storeHash-case.jar"; + JarUtils.createJarFile(Paths.get(jarFilename), Paths.get(".")); + SecurityTools.jarsigner(KEYSTORE_OPTIONS + " -verbose -debug " + + jarFilename + " " + ALIAS + "2").shouldHaveExitValue(0); + JarUtils.updateJarFile(Paths.get(jarFilename), Paths.get("."), + Files.write(Paths.get("added-file"), new byte[1])); + SecurityTools.jarsigner(KEYSTORE_OPTIONS + " -verbose -debug " + + jarFilename + " " + ALIAS + "1").shouldHaveExitValue(0); + + // The later added file "added-file" is signed by the certificate + // associated with alias ALIAS + "1" directly while the other jarfile + // contents is signed by a certificate associated with alias ALIAS + "2" + // which includes the certificate associated with alias ALIAS + "1" in + // its certification path. + SecurityTools.jarsigner("-verify -strict " + KEYSTORE_OPTIONS + + " -debug -verbose " + jarFilename + " " + ALIAS + "1") + .shouldHaveExitValue(0) + .shouldNotContain( + "This jar contains signed entries which are not " + + "signed by the specified alias(es)."); + } + +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/security/tools/keytool/ListOrder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/sun/security/tools/keytool/ListOrder.java Fri Jun 21 14:07:48 2019 +0530 @@ -0,0 +1,64 @@ +/* + * 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. + */ + +/** + * @test + * @bug 8225392 + * @summary Comparison builds are failing due to cacerts file + * @library /test/lib + */ + +import jdk.test.lib.SecurityTools; + +import java.util.Random; + +public class ListOrder { + + public static void main(String[] args) throws Throwable { + + Random rand = new Random(); + for (int i = 0; i < 10; i++) { + gen(String.format("a%02d", rand.nextInt(100))); + } + + String last = ""; + for (String line : SecurityTools.keytool( + "-keystore ks -storepass changeit -list").asLines()) { + if (line.contains("PrivateKeyEntry")) { + // This is the line starting with the alias + System.out.println(line); + if (line.compareTo(last) <= 0) { + throw new RuntimeException("Not ordered"); + } else { + last = line; + } + } + } + } + + static void gen(String a) throws Exception { + // Do not check result, there might be duplicated alias(es). + SecurityTools.keytool("-keystore ks -storepass changeit " + + "-keyalg ec -genkeypair -alias " + a + " -dname CN=" + a); + } +} diff -r 28582d575a98 -r fd4ec73925c3 test/jdk/sun/tools/jcmd/TestProcessHelper.java --- a/test/jdk/sun/tools/jcmd/TestProcessHelper.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/jdk/sun/tools/jcmd/TestProcessHelper.java Fri Jun 21 14:07:48 2019 +0530 @@ -73,13 +73,21 @@ .resolve(TEST_PROCESS_MAIN_CLASS_NAME + ".class"); private static final String[] CP_OPTIONS = {"-cp", "-classpath", "--class-path"}; - private static final String[][] VM_ARGS = {{}, {"-Dtest1=aaa"}, {"-Dtest1=aaa", "-Dtest2=bbb"}}; + private static final String[][] VM_ARGS = {{}, {"-Dtest1=aaa"}, {"-Dtest1=aaa", "-Dtest2=bbb ccc"}}; private static final String[][] ARGS = {{}, {"param1"}, {"param1", "param2"}}; private static final String[] MP_OPTIONS = {"-p", "--module-path"}; - private static final String[] MODULE_OPTIONS = {"-m", "--module"}; + private static final String[] MODULE_OPTIONS = {"-m", "--module", "--module="}; private static final String JAR_OPTION = "-jar"; private static final String MODULE_NAME = "module1"; + private static final String[][] EXTRA_MODULAR_OPTIONS = {null, + {"--add-opens", "java.base/java.net=ALL-UNNAMED"}, + {"--add-exports", "java.base/java.net=ALL-UNNAMED"}, + {"--add-reads", "java.base/java.net=ALL-UNNAMED"}, + {"--add-modules", "java.management"}, + {"--limit-modules", "java.management"}, + {"--upgrade-module-path", "test"}}; + private static final String[] PATCH_MODULE_OPTIONS = {"--patch-module", null}; public static void main(String[] args) throws Exception { new TestProcessHelper().runTests(); @@ -97,18 +105,24 @@ for (String cp : CP_OPTIONS) { for (String[] vma : VM_ARGS) { for (String[] arg : ARGS) { - List cmd = new LinkedList<>(); - cmd.add(JAVA_PATH); - cmd.add(cp); - cmd.add(TEST_CLASSES.toAbsolutePath().toString()); - for (String v : vma) { - cmd.add(v); + for (String[] modularOptions : EXTRA_MODULAR_OPTIONS) { + List cmd = new LinkedList<>(); + cmd.add(JAVA_PATH); + cmd.add(cp); + cmd.add(TEST_CLASSES.toAbsolutePath().toString()); + for (String v : vma) { + cmd.add(v); + } + if (modularOptions != null) { + cmd.add(modularOptions[0]); + cmd.add(modularOptions[1]); + } + cmd.add(TEST_PROCESS_MAIN_CLASS); + for (String a : arg) { + cmd.add(a); + } + testProcessHelper(cmd, TEST_PROCESS_MAIN_CLASS); } - cmd.add(TEST_PROCESS_MAIN_CLASS); - for (String a : arg) { - cmd.add(a); - } - testProcessHelper(cmd, TEST_PROCESS_MAIN_CLASS); } } } @@ -144,19 +158,29 @@ for (String m : MODULE_OPTIONS) { for (String[] vma : VM_ARGS) { for (String[] arg : ARGS) { - List cmd = new LinkedList<>(); - cmd.add(JAVA_PATH); - cmd.add(mp); - cmd.add(TEST_MODULES.toAbsolutePath().toString()); - for (String v : vma) { - cmd.add(v); + for(String patchModuleOption : PATCH_MODULE_OPTIONS) { + List cmd = new LinkedList<>(); + cmd.add(JAVA_PATH); + cmd.add(mp); + cmd.add(TEST_MODULES.toAbsolutePath().toString()); + if (patchModuleOption != null) { + cmd.add(patchModuleOption); + cmd.add(MODULE_NAME + "=" + TEST_MODULES.toAbsolutePath().toString()); + } + for (String v : vma) { + cmd.add(v); + } + if (m.endsWith("=")) { + cmd.add(m + MODULE_NAME + "/" + TEST_PROCESS_MAIN_CLASS); + } else { + cmd.add(m); + cmd.add(MODULE_NAME + "/" + TEST_PROCESS_MAIN_CLASS); + } + for (String a : arg) { + cmd.add(a); + } + testProcessHelper(cmd, MODULE_NAME + "/" + TEST_PROCESS_MAIN_CLASS); } - cmd.add(m); - cmd.add(MODULE_NAME + "/" + TEST_PROCESS_MAIN_CLASS); - for (String a : arg) { - cmd.add(a); - } - testProcessHelper(cmd, MODULE_NAME + "/" + TEST_PROCESS_MAIN_CLASS); } } } diff -r 28582d575a98 -r fd4ec73925c3 test/langtools/ProblemList.txt --- a/test/langtools/ProblemList.txt Fri Jun 21 12:42:10 2019 +0530 +++ b/test/langtools/ProblemList.txt Fri Jun 21 14:07:48 2019 +0530 @@ -37,7 +37,6 @@ jdk/jshell/UserJdiUserRemoteTest.java 8173079 linux-all jdk/jshell/UserInputTest.java 8169536 generic-all -jdk/jshell/ExceptionsTest.java 8200701 windows-all ########################################################################### # diff -r 28582d575a98 -r fd4ec73925c3 test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java --- a/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java Fri Jun 21 12:42:10 2019 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java Fri Jun 21 14:07:48 2019 +0530 @@ -23,7 +23,7 @@ /* * @test - * @bug 4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765 + * @bug 4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765 8223364 * @summary Make sure that annotation types with 0 members does not have * extra HR tags. * @author jamieh @@ -61,10 +61,7 @@ "DEFAULT_NAME" + "", "", - "

    DEFAULT_NAME

    \n" - + "\n" - + "\n" - + "\n" + "

    DEFAULT_NAME

    \n" + "
    static final " + "java.lang.String " + "DEFAULT_NAME
    \n"); @@ -87,10 +84,7 @@ "