From aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 Sep 2019 18:12:46 +0000 Subject: [PATCH] libgo: update to Go 1.13beta1 release Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497 From-SVN: r275473 --- gcc/go/gofrontend/MERGE | 2 +- gcc/testsuite/ChangeLog | 5 + .../go.test/test/fixedbugs/bug369.go | 1 + gotools/ChangeLog | 6 + gotools/Makefile.am | 8 +- gotools/Makefile.in | 8 +- libgo/MERGE | 2 +- libgo/Makefile.am | 43 +- libgo/Makefile.in | 49 +- libgo/VERSION | 2 +- libgo/check-packages.txt | 15 +- libgo/configure | 4 +- libgo/configure.ac | 4 +- libgo/go/archive/tar/strconv.go | 2 +- libgo/go/archive/tar/strconv_test.go | 42 +- libgo/go/archive/zip/struct.go | 13 +- libgo/go/archive/zip/zip_test.go | 46 +- libgo/go/bufio/bufio.go | 3 + libgo/go/bufio/bufio_test.go | 54 + libgo/go/bufio/example_test.go | 16 + libgo/go/bufio/scan.go | 2 +- libgo/go/builtin/builtin.go | 9 +- libgo/go/bytes/buffer.go | 7 +- libgo/go/bytes/buffer_test.go | 22 +- libgo/go/bytes/bytes.go | 197 +- libgo/go/bytes/bytes_test.go | 337 +- libgo/go/bytes/example_test.go | 30 + libgo/go/bytes/export_test.go | 1 - libgo/go/cmd/cgo/doc.go | 4 +- libgo/go/cmd/cgo/gcc.go | 3 + libgo/go/cmd/cgo/godefs.go | 36 +- libgo/go/cmd/cgo/out.go | 27 +- libgo/go/cmd/go/alldocs.go | 682 +- libgo/go/cmd/go/go_test.go | 255 +- libgo/go/cmd/go/go_windows_test.go | 89 +- libgo/go/cmd/go/help_test.go | 5 + libgo/go/cmd/go/init_test.go | 34 + libgo/go/cmd/go/internal/auth/auth.go | 23 + libgo/go/cmd/go/internal/auth/netrc.go | 111 + libgo/go/cmd/go/internal/auth/netrc_test.go | 58 + libgo/go/cmd/go/internal/base/base.go | 6 +- libgo/go/cmd/go/internal/base/env.go | 32 +- libgo/go/cmd/go/internal/base/goflags.go | 3 +- libgo/go/cmd/go/internal/bug/bug.go | 86 +- libgo/go/cmd/go/internal/cache/cache.go | 14 +- libgo/go/cmd/go/internal/cache/cache_test.go | 51 +- libgo/go/cmd/go/internal/cache/default.go | 3 +- libgo/go/cmd/go/internal/cfg/cfg.go | 270 +- libgo/go/cmd/go/internal/clean/clean.go | 22 +- libgo/go/cmd/go/internal/envcmd/env.go | 241 +- libgo/go/cmd/go/internal/generate/generate.go | 20 +- .../cmd/go/internal/generate/generate_test.go | 198 + libgo/go/cmd/go/internal/get/get.go | 16 +- libgo/go/cmd/go/internal/get/path.go | 3 + libgo/go/cmd/go/internal/get/vcs.go | 176 +- libgo/go/cmd/go/internal/get/vcs_test.go | 2 +- libgo/go/cmd/go/internal/help/help.go | 7 +- libgo/go/cmd/go/internal/help/helpdoc.go | 74 +- libgo/go/cmd/go/internal/imports/build.go | 67 +- libgo/go/cmd/go/internal/imports/scan.go | 2 +- libgo/go/cmd/go/internal/imports/scan_test.go | 41 +- libgo/go/cmd/go/internal/imports/tags.go | 15 + .../imports/testdata/android/a_android.go | 3 + .../testdata/android/b_android_arm64.go | 3 + .../imports/testdata/android/c_linux.go | 3 + .../imports/testdata/android/d_linux_arm64.go | 3 + .../go/internal/imports/testdata/android/e.go | 5 + .../go/internal/imports/testdata/android/f.go | 5 + .../go/internal/imports/testdata/android/g.go | 5 + .../imports/testdata/illumos/a_illumos.go | 3 + .../testdata/illumos/b_illumos_amd64.go | 3 + .../imports/testdata/illumos/c_solaris.go | 3 + .../testdata/illumos/d_solaris_amd64.go | 3 + .../go/internal/imports/testdata/illumos/e.go | 5 + .../go/internal/imports/testdata/illumos/f.go | 5 + .../go/internal/imports/testdata/illumos/g.go | 5 + .../imports/testdata/{import1 => star}/x.go | 0 .../imports/testdata/{import1 => star}/x1.go | 0 .../testdata/{import1 => star}/x_darwin.go | 0 .../testdata/{import1 => star}/x_windows.go | 0 libgo/go/cmd/go/internal/list/list.go | 70 +- libgo/go/cmd/go/internal/load/path.go | 24 - libgo/go/cmd/go/internal/load/pkg.go | 830 +- libgo/go/cmd/go/internal/load/pkg_test.go | 68 + libgo/go/cmd/go/internal/load/test.go | 165 +- .../internal/filelock/filelock_test.go | 9 +- libgo/go/cmd/go/internal/lockedfile/mutex.go | 11 +- libgo/go/cmd/go/internal/modcmd/download.go | 13 +- libgo/go/cmd/go/internal/modcmd/edit.go | 4 +- libgo/go/cmd/go/internal/modcmd/graph.go | 9 + libgo/go/cmd/go/internal/modcmd/init.go | 3 + libgo/go/cmd/go/internal/modcmd/vendor.go | 38 +- libgo/go/cmd/go/internal/modcmd/verify.go | 9 + libgo/go/cmd/go/internal/modconv/convert.go | 32 +- .../cmd/go/internal/modconv/convert_test.go | 14 +- libgo/go/cmd/go/internal/modconv/dep.go | 66 +- libgo/go/cmd/go/internal/modconv/glide.go | 3 +- libgo/go/cmd/go/internal/modconv/glock.go | 3 +- .../cmd/go/internal/modconv/modconv_test.go | 3 + libgo/go/cmd/go/internal/modconv/tsv.go | 3 +- libgo/go/cmd/go/internal/modconv/vconf.go | 3 +- libgo/go/cmd/go/internal/modconv/vyml.go | 3 +- .../go/cmd/go/internal/modfetch/bootstrap.go | 17 + libgo/go/cmd/go/internal/modfetch/cache.go | 123 +- .../go/internal/modfetch/codehost/codehost.go | 44 +- .../cmd/go/internal/modfetch/codehost/git.go | 163 +- .../cmd/go/internal/modfetch/codehost/vcs.go | 47 +- libgo/go/cmd/go/internal/modfetch/coderepo.go | 427 +- .../cmd/go/internal/modfetch/coderepo_test.go | 425 +- libgo/go/cmd/go/internal/modfetch/fetch.go | 286 +- libgo/go/cmd/go/internal/modfetch/key.go | 9 + libgo/go/cmd/go/internal/modfetch/noweb.go | 24 - libgo/go/cmd/go/internal/modfetch/proxy.go | 282 +- libgo/go/cmd/go/internal/modfetch/pseudo.go | 156 +- .../cmd/go/internal/modfetch/pseudo_test.go | 80 + libgo/go/cmd/go/internal/modfetch/repo.go | 83 +- libgo/go/cmd/go/internal/modfetch/sumdb.go | 263 + libgo/go/cmd/go/internal/modfetch/web.go | 31 - libgo/go/cmd/go/internal/modfile/rule.go | 75 +- libgo/go/cmd/go/internal/modget/get.go | 928 +- libgo/go/cmd/go/internal/modinfo/info.go | 2 +- libgo/go/cmd/go/internal/modload/build.go | 38 +- libgo/go/cmd/go/internal/modload/help.go | 96 +- libgo/go/cmd/go/internal/modload/import.go | 54 +- .../go/cmd/go/internal/modload/import_test.go | 3 +- libgo/go/cmd/go/internal/modload/init.go | 287 +- libgo/go/cmd/go/internal/modload/init_test.go | 42 - libgo/go/cmd/go/internal/modload/list.go | 29 +- libgo/go/cmd/go/internal/modload/load.go | 296 +- libgo/go/cmd/go/internal/modload/query.go | 426 +- .../go/cmd/go/internal/modload/query_test.go | 76 +- libgo/go/cmd/go/internal/modload/search.go | 60 +- libgo/go/cmd/go/internal/module/module.go | 124 +- .../go/cmd/go/internal/module/module_test.go | 2 +- libgo/go/cmd/go/internal/mvs/mvs.go | 203 +- libgo/go/cmd/go/internal/mvs/mvs_test.go | 5 +- libgo/go/cmd/go/internal/note/example_test.go | 128 + libgo/go/cmd/go/internal/note/note.go | 683 ++ libgo/go/cmd/go/internal/note/note_test.go | 472 + libgo/go/cmd/go/internal/par/work.go | 41 + libgo/go/cmd/go/internal/renameio/renameio.go | 44 +- .../cmd/go/internal/renameio/renameio_test.go | 145 + .../go/cmd/go/internal/renameio/umask_test.go | 42 + libgo/go/cmd/go/internal/robustio/robustio.go | 53 + .../go/internal/robustio/robustio_other.go | 28 + .../go/internal/robustio/robustio_windows.go | 105 + libgo/go/cmd/go/internal/run/run.go | 36 +- libgo/go/cmd/go/internal/search/search.go | 31 +- libgo/go/cmd/go/internal/str/path.go | 45 + libgo/go/cmd/go/internal/sumweb/cache.go | 59 + libgo/go/cmd/go/internal/sumweb/client.go | 619 ++ .../go/cmd/go/internal/sumweb/client_test.go | 460 + libgo/go/cmd/go/internal/sumweb/encode.go | 167 + .../go/cmd/go/internal/sumweb/encode_test.go | 67 + libgo/go/cmd/go/internal/sumweb/server.go | 183 + libgo/go/cmd/go/internal/sumweb/test.go | 133 + libgo/go/cmd/go/internal/test/test.go | 54 +- libgo/go/cmd/go/internal/test/testflag.go | 1 + libgo/go/cmd/go/internal/tlog/ct_test.go | 96 + libgo/go/cmd/go/internal/tlog/note.go | 135 + libgo/go/cmd/go/internal/tlog/note_test.go | 117 + libgo/go/cmd/go/internal/tlog/tile.go | 418 + libgo/go/cmd/go/internal/tlog/tlog.go | 601 ++ libgo/go/cmd/go/internal/tlog/tlog_test.go | 269 + libgo/go/cmd/go/internal/tool/tool.go | 2 - libgo/go/cmd/go/internal/version/exe.go | 252 + libgo/go/cmd/go/internal/version/version.go | 185 +- libgo/go/cmd/go/internal/vet/vet.go | 2 +- libgo/go/cmd/go/internal/web/api.go | 133 + libgo/go/cmd/go/internal/web/bootstrap.go | 26 +- libgo/go/cmd/go/internal/web/file_test.go | 58 + libgo/go/cmd/go/internal/web/http.go | 219 +- libgo/go/cmd/go/internal/web/security.go | 16 - libgo/go/cmd/go/internal/web/url.go | 95 + libgo/go/cmd/go/internal/web/url_other.go | 21 + .../go/cmd/go/internal/web/url_other_test.go | 36 + libgo/go/cmd/go/internal/web/url_test.go | 77 + libgo/go/cmd/go/internal/web/url_windows.go | 43 + .../cmd/go/internal/web/url_windows_test.go | 94 + libgo/go/cmd/go/internal/web2/web.go | 299 - libgo/go/cmd/go/internal/web2/web_test.go | 35 - libgo/go/cmd/go/internal/webtest/test.go | 314 - libgo/go/cmd/go/internal/work/action.go | 148 +- libgo/go/cmd/go/internal/work/build.go | 89 +- libgo/go/cmd/go/internal/work/build_test.go | 4 +- libgo/go/cmd/go/internal/work/buildid.go | 23 +- libgo/go/cmd/go/internal/work/exec.go | 314 +- libgo/go/cmd/go/internal/work/gc.go | 110 +- libgo/go/cmd/go/internal/work/gccgo.go | 11 +- libgo/go/cmd/go/internal/work/init.go | 3 +- libgo/go/cmd/go/internal/work/security.go | 27 +- .../go/cmd/go/internal/work/security_test.go | 8 + libgo/go/cmd/go/main.go | 58 +- libgo/go/cmd/go/note_test.go | 2 - libgo/go/cmd/go/proxy_test.go | 232 +- libgo/go/cmd/go/script_test.go | 237 +- libgo/go/cmd/go/testdata/addmod.go | 4 +- libgo/go/cmd/go/testdata/flag_test.go | 9 +- .../mod/example.com_badchain_a_v1.0.0.txt | 12 + .../mod/example.com_badchain_a_v1.1.0.txt | 12 + .../mod/example.com_badchain_b_v1.0.0.txt | 12 + .../mod/example.com_badchain_b_v1.1.0.txt | 12 + .../mod/example.com_badchain_c_v1.0.0.txt | 8 + .../mod/example.com_badchain_c_v1.1.0.txt | 8 + .../mod/example.com_downgrade_v2.0.0.txt | 9 + .../mod/example.com_downgrade_v2_v2.0.1.txt | 13 + .../mod/example.com_invalidpath_v1_v1.0.0.txt | 13 + .../mod/example.com_latemigrate_v2_v2.0.0.txt | 14 + .../mod/example.com_latemigrate_v2_v2.0.1.txt | 20 + .../mod/example.com_missingpkg_v1.0.0.txt | 11 + .../example.com_missingpkg_v1.0.1-beta.txt | 8 + .../mod/example.com_nest_sub_v1.0.0.txt | 12 + .../testdata/mod/example.com_nest_v1.0.0.txt | 12 + .../testdata/mod/example.com_nest_v1.1.0.txt | 12 + .../mod/example.com_newcycle_a_v1.0.0.txt | 10 + .../mod/example.com_newcycle_a_v1.0.1.txt | 10 + .../mod/example.com_newcycle_b_v1.0.0.txt | 8 + .../mod/example.com_noroot_v1.0.0.txt | 8 + .../mod/example.com_noroot_v1.0.1.txt | 8 + ...ags_v0.0.0-20190507143103-cc8cbe209b64.txt | 9 + .../mod/example.com_printversion_v0.1.0.txt | 27 + .../mod/example.com_printversion_v1.0.0.txt | 35 + ...ade_v0.0.0-20190430073000-30950c05d534.txt | 13 + .../mod/example.com_pseudoupgrade_v0.1.0.txt | 13 + ...e_v0.1.1-0.20190429073117-b5426c86b553.txt | 13 + .../testdata/mod/example.com_tools_v1.0.0.txt | 12 + .../mod/example.com_usemissingpre_v1.0.0.txt | 13 + .../mod/example.com_version_v1.0.0.txt | 11 + .../mod/example.com_version_v1.0.1.txt | 11 + .../mod/example.com_version_v1.1.0.txt | 11 + ...st5_v0.0.0-20190619020302-197a620e0c9a.txt | 10 + ....0-alpha.0.20190619023908-3da23a9deb9e.txt | 10 + ...om_dmitshur-test_modtest5_v0.5.0-alpha.txt | 10 + ...ch.example.com_depofdirectpatch_v1.0.0.txt | 11 + ...ch.example.com_depofdirectpatch_v1.0.1.txt | 11 + .../mod/patch.example.com_direct_v1.0.0.txt | 21 + .../mod/patch.example.com_direct_v1.0.1.txt | 27 + .../mod/patch.example.com_direct_v1.1.0.txt | 21 + .../mod/patch.example.com_indirect_v1.0.0.txt | 11 + .../mod/patch.example.com_indirect_v1.0.1.txt | 11 + .../mod/patch.example.com_indirect_v1.1.0.txt | 11 + .../go/testdata/mod/rsc.io_badsum_v1.0.0.txt | 14 + .../go/testdata/mod/rsc.io_badsum_v1.0.1.txt | 14 + .../go/testdata/mod/rsc.io_badzip_v1.0.0.txt | 11 + libgo/go/cmd/go/testdata/script/README | 12 +- .../go/cmd/go/testdata/script/binary_only.txt | 10 - libgo/go/cmd/go/testdata/script/bug.txt | 46 + .../cmd/go/testdata/script/build_GOTMPDIR.txt | 3 + .../go/testdata/script/build_acl_windows.txt | 44 + .../testdata/script/build_cache_compile.txt | 3 + .../go/testdata/script/build_cache_gomips.txt | 40 + .../go/testdata/script/build_cache_link.txt | 7 +- .../go/testdata/script/build_cache_output.txt | 3 + .../testdata/script/build_cache_trimpath.txt | 20 + .../go/testdata/script/build_multi_main.txt | 33 + .../cmd/go/testdata/script/build_nocache.txt | 40 + .../testdata/script/build_relative_pkgdir.txt | 9 + .../testdata/script/build_relative_tmpdir.txt | 18 + .../testdata/script/build_runtime_gcflags.txt | 11 + .../cmd/go/testdata/script/build_trimpath.txt | 21 + .../go/cmd/go/testdata/script/cache_unix.txt | 36 + .../testdata/script/cgo_syso_issue29253.txt | 31 + .../go/testdata/script/clean_testcache.txt | 19 + .../testdata/script/cover_atomic_pkgall.txt | 2 + .../testdata/script/cover_pkgall_runtime.txt | 2 + .../go/testdata/script/cpu_profile_twice.txt | 2 + libgo/go/cmd/go/testdata/script/env_write.txt | 87 + libgo/go/cmd/go/testdata/script/fileline.txt | 2 + .../go/testdata/script/gcflags_patterns.txt | 86 + .../cmd/go/testdata/script/get_404_meta.txt | 11 + libgo/go/cmd/go/testdata/script/get_brace.txt | 51 + .../cmd/go/testdata/script/get_dotfiles.txt | 64 + .../testdata/script/get_insecure_redirect.txt | 13 + libgo/go/cmd/go/testdata/script/get_tilde.txt | 24 + .../go/cmd/go/testdata/script/get_unicode.txt | 40 + .../go/testdata/script/get_with_git_trace.txt | 2 + libgo/go/cmd/go/testdata/script/goflags.txt | 2 + .../go/testdata/script/gopath_std_vendor.txt | 44 + libgo/go/cmd/go/testdata/script/help.txt | 4 +- .../testdata/script/install_cleans_build.txt | 15 +- .../go/testdata/script/install_cmd_gobin.txt | 11 + .../testdata/script/install_cross_gobin.txt | 3 + .../script/install_rebuild_gopath.txt | 2 + .../script/install_rebuild_removed.txt | 2 + libgo/go/cmd/go/testdata/script/linkname.txt | 2 + .../go/testdata/script/list_bad_import.txt | 3 + .../testdata/script/list_compiled_imports.txt | 2 + libgo/go/cmd/go/testdata/script/list_find.txt | 12 + .../cmd/go/testdata/script/list_importmap.txt | 27 + libgo/go/cmd/go/testdata/script/list_std.txt | 23 +- libgo/go/cmd/go/testdata/script/list_tags.txt | 2 + .../go/cmd/go/testdata/script/list_test_e.txt | 4 +- .../cmd/go/testdata/script/list_test_err.txt | 126 + .../go/testdata/script/list_test_imports.txt | 2 + .../script/list_test_non_go_files.txt | 13 + .../cmd/go/testdata/script/mod_alt_goroot.txt | 20 + libgo/go/cmd/go/testdata/script/mod_auth.txt | 32 + .../cmd/go/testdata/script/mod_build_tags.txt | 3 + .../testdata/script/mod_build_versioned.txt | 17 + .../go/testdata/script/mod_clean_cache.txt | 58 + .../cmd/go/testdata/script/mod_concurrent.txt | 31 + .../go/testdata/script/mod_convert_dep.txt | 22 + .../go/testdata/script/mod_convert_git.txt | 15 +- .../go/testdata/script/mod_convert_glide.txt | 9 + .../testdata/script/mod_convert_glockfile.txt | 9 + .../go/testdata/script/mod_convert_godeps.txt | 9 + .../go/testdata/script/mod_convert_tsv.txt | 9 + .../script/mod_convert_vendor_conf.txt | 9 + .../script/mod_convert_vendor_json.txt | 9 + .../script/mod_convert_vendor_manifest.txt | 9 + .../script/mod_convert_vendor_yml.txt | 9 + libgo/go/cmd/go/testdata/script/mod_dir.txt | 20 + libgo/go/cmd/go/testdata/script/mod_doc.txt | 3 +- .../cmd/go/testdata/script/mod_download.txt | 9 + .../go/testdata/script/mod_download_hash.txt | 24 + libgo/go/cmd/go/testdata/script/mod_edit.txt | 16 +- .../go/cmd/go/testdata/script/mod_edit_go.txt | 18 + .../go/cmd/go/testdata/script/mod_enabled.txt | 21 +- .../cmd/go/testdata/script/mod_file_proxy.txt | 17 +- libgo/go/cmd/go/testdata/script/mod_find.txt | 22 +- .../go/cmd/go/testdata/script/mod_get_cmd.txt | 20 + .../cmd/go/testdata/script/mod_get_commit.txt | 16 +- .../go/testdata/script/mod_get_downgrade.txt | 18 +- .../cmd/go/testdata/script/mod_get_hash.txt | 19 + .../go/testdata/script/mod_get_indirect.txt | 16 +- .../testdata/script/mod_get_latest_pseudo.txt | 10 + .../cmd/go/testdata/script/mod_get_local.txt | 37 +- .../cmd/go/testdata/script/mod_get_main.txt | 32 + .../cmd/go/testdata/script/mod_get_moved.txt | 2 + .../go/testdata/script/mod_get_newcycle.txt | 14 + .../go/testdata/script/mod_get_patterns.txt | 36 + .../testdata/script/mod_get_private_vcs.txt | 11 + .../cmd/go/testdata/script/mod_get_pseudo.txt | 30 +- .../script/mod_get_pseudo_other_branch.txt | 67 + .../testdata/script/mod_get_pseudo_prefix.txt | 64 + .../go/cmd/go/testdata/script/mod_get_svn.txt | 20 + .../cmd/go/testdata/script/mod_get_tags.txt | 44 + .../cmd/go/testdata/script/mod_get_test.txt | 58 + .../go/testdata/script/mod_get_upgrade.txt | 19 +- .../script/mod_get_upgrade_pseudo.txt | 46 + .../go/testdata/script/mod_get_warning.txt | 10 - .../go/testdata/script/mod_getmode_vendor.txt | 2 +- .../testdata/script/mod_git_export_subst.txt | 21 + .../go/testdata/script/mod_gobuild_import.txt | 28 +- .../cmd/go/testdata/script/mod_gonoproxy.txt | 37 + .../go/testdata/script/mod_gopkg_unstable.txt | 4 +- libgo/go/cmd/go/testdata/script/mod_help.txt | 6 + .../testdata/script/mod_import_v1suffix.txt | 11 + .../cmd/go/testdata/script/mod_init_dep.txt | 23 + .../cmd/go/testdata/script/mod_init_empty.txt | 18 + .../cmd/go/testdata/script/mod_init_glide.txt | 34 + .../cmd/go/testdata/script/mod_init_path.txt | 20 + .../cmd/go/testdata/script/mod_internal.txt | 1 + .../testdata/script/mod_invalid_version.txt | 227 + libgo/go/cmd/go/testdata/script/mod_list.txt | 11 +- .../cmd/go/testdata/script/mod_list_dir.txt | 4 +- .../go/testdata/script/mod_list_pseudo.txt | 50 + .../testdata/script/mod_list_replace_dir.txt | 19 + .../cmd/go/testdata/script/mod_list_std.txt | 58 + .../cmd/go/testdata/script/mod_list_test.txt | 16 + .../script/mod_list_upgrade_pseudo.txt | 26 + .../go/testdata/script/mod_load_badchain.txt | 75 + .../go/testdata/script/mod_load_badzip.txt | 15 + .../script/mod_missingpkg_prerelease.txt | 12 + .../go/cmd/go/testdata/script/mod_modinfo.txt | 91 + libgo/go/cmd/go/testdata/script/mod_off.txt | 35 + .../cmd/go/testdata/script/mod_off_init.txt | 5 + .../go/cmd/go/testdata/script/mod_outside.txt | 250 + .../cmd/go/testdata/script/mod_patterns.txt | 20 +- .../testdata/script/mod_patterns_vendor.txt | 28 + .../go/testdata/script/mod_proxy_https.txt | 19 + .../cmd/go/testdata/script/mod_proxy_list.txt | 29 + .../go/testdata/script/mod_pseudo_cache.txt | 29 + libgo/go/cmd/go/testdata/script/mod_query.txt | 10 +- .../go/testdata/script/mod_query_empty.txt | 52 + .../go/testdata/script/mod_query_exclude.txt | 1 + .../cmd/go/testdata/script/mod_readonly.txt | 1 + .../go/cmd/go/testdata/script/mod_replace.txt | 1 + .../go/testdata/script/mod_replace_import.txt | 109 + .../go/testdata/script/mod_run_internal.txt | 46 + .../cmd/go/testdata/script/mod_run_path.txt | 15 + .../cmd/go/testdata/script/mod_std_vendor.txt | 80 + .../go/testdata/script/mod_string_alias.txt | 14 + .../go/testdata/script/mod_sum_replaced.txt | 28 + libgo/go/cmd/go/testdata/script/mod_sumdb.txt | 33 + .../go/testdata/script/mod_sumdb_cache.txt | 47 + .../testdata/script/mod_sumdb_file_path.txt | 41 + .../go/testdata/script/mod_sumdb_golang.txt | 44 + .../go/testdata/script/mod_sumdb_proxy.txt | 50 + .../go/cmd/go/testdata/script/mod_symlink.txt | 42 + libgo/go/cmd/go/testdata/script/mod_test.txt | 25 +- .../cmd/go/testdata/script/mod_test_files.txt | 49 + .../go/testdata/script/mod_tidy_replace.txt | 111 + .../cmd/go/testdata/script/mod_tidy_sum.txt | 4 +- .../go/testdata/script/mod_upgrade_patch.txt | 97 +- .../go/testdata/script/mod_vcs_missing.txt | 28 + .../go/cmd/go/testdata/script/mod_vendor.txt | 12 +- .../go/testdata/script/mod_vendor_build.txt | 11 + .../go/testdata/script/mod_vendor_replace.txt | 39 + .../go/cmd/go/testdata/script/mod_verify.txt | 1 + libgo/go/cmd/go/testdata/script/mod_why.txt | 1 + .../testdata/script/pattern_syntax_error.txt | 2 + .../script/prevent_sys_unix_import.txt | 6 + libgo/go/cmd/go/testdata/script/run_hello.txt | 2 + .../script/run_set_executable_name.txt | 50 + .../cmd/go/testdata/script/run_wildcard.txt | 7 + .../go/cmd/go/testdata/script/script_wait.txt | 24 + .../go/cmd/go/testdata/script/std_vendor.txt | 43 + .../cmd/go/testdata/script/sum_readonly.txt | 29 + .../cmd/go/testdata/script/test_badtest.txt | 2 + .../testdata/script/test_compile_binary.txt | 2 + .../cmd/go/testdata/script/test_devnull.txt | 15 + .../testdata/script/test_generated_main.txt | 35 + libgo/go/cmd/go/testdata/script/test_init.txt | 86 + .../go/cmd/go/testdata/script/test_status.txt | 18 + .../cmd/go/testdata/script/test_timeout.txt | 22 + .../cmd/go/testdata/script/vendor_complex.txt | 2 + libgo/go/cmd/go/testdata/script/version.txt | 12 + libgo/go/cmd/go/testdata/script/vet_asm.txt | 32 + libgo/go/cmd/go/testdata/script/vet_deps.txt | 34 + libgo/go/cmd/go/testdata/testcover/pkg4/a.go | 5 + .../cmd/go/testdata/testcover/pkg4/a_test.go | 9 + libgo/go/cmd/go/testdata/vendormod.txt | 2 +- libgo/go/cmd/go/vendor_test.go | 9 + libgo/go/cmd/gofmt/gofmt.go | 55 + libgo/go/cmd/internal/objabi/funcdata.go | 13 +- libgo/go/cmd/internal/objabi/head.go | 2 +- libgo/go/cmd/internal/objabi/line.go | 54 +- libgo/go/cmd/internal/objabi/line_test.go | 50 + libgo/go/cmd/internal/objabi/reloctype.go | 27 +- .../cmd/internal/objabi/reloctype_string.go | 4 +- libgo/go/cmd/internal/objabi/typekind.go | 1 - libgo/go/cmd/internal/objabi/util.go | 53 +- libgo/go/cmd/internal/sys/supported.go | 16 + libgo/go/cmd/vet/all/main.go | 392 - libgo/go/cmd/vet/main.go | 6 + .../go/cmd/vet/testdata/{src => }/asm/asm.go | 0 .../vet/testdata/{src => }/assign/assign.go | 0 .../vet/testdata/{src => }/atomic/atomic.go | 0 .../cmd/vet/testdata/{src => }/bool/bool.go | 0 .../testdata/{src => }/buildtag/buildtag.go | 0 .../go/cmd/vet/testdata/{src => }/cgo/cgo.go | 0 .../testdata/{src => }/composite/composite.go | 0 .../testdata/{src => }/copylock/copylock.go | 0 .../testdata/{src => }/deadcode/deadcode.go | 0 .../{src => }/httpresponse/httpresponse.go | 0 .../{src => }/lostcancel/lostcancel.go | 0 .../vet/testdata/{src => }/method/method.go | 0 .../vet/testdata/{src => }/nilfunc/nilfunc.go | 0 libgo/go/cmd/vet/testdata/print/print.go | 681 ++ .../testdata/{src => }/rangeloop/rangeloop.go | 0 .../cmd/vet/testdata/{src => }/shift/shift.go | 0 libgo/go/cmd/vet/testdata/src/print/print.go | 681 -- .../testdata/{src => }/structtag/structtag.go | 0 .../vet/testdata/{src => }/tagtest/file1.go | 0 .../vet/testdata/{src => }/tagtest/file2.go | 0 .../testdata/{src => }/testingpkg/tests.go | 0 .../{src => }/testingpkg/tests_test.go | 0 .../testdata/{src => }/unmarshal/unmarshal.go | 0 .../testdata/{src => }/unsafeptr/unsafeptr.go | 0 .../vet/testdata/{src => }/unused/unused.go | 0 libgo/go/cmd/vet/vet_test.go | 37 +- libgo/go/compress/flate/deflate_test.go | 8 +- libgo/go/compress/flate/huffman_bit_writer.go | 6 +- libgo/go/compress/gzip/gunzip.go | 4 +- libgo/go/compress/gzip/gzip_test.go | 3 + libgo/go/container/ring/ring_test.go | 2 +- libgo/go/context/context.go | 50 +- libgo/go/context/context_test.go | 11 +- libgo/go/context/example_test.go | 2 +- libgo/go/crypto/cipher/cfb_test.go | 2 +- libgo/go/crypto/cipher/xor_test.go | 3 + libgo/go/crypto/des/block.go | 14 +- libgo/go/crypto/ecdsa/ecdsa.go | 19 +- libgo/go/crypto/ecdsa/ecdsa_noasm.go | 22 + libgo/go/crypto/ecdsa/ecdsa_s390x.go | 153 + libgo/go/crypto/ecdsa/ecdsa_s390x_test.go | 33 + libgo/go/crypto/ed25519/ed25519.go | 216 + libgo/go/crypto/ed25519/ed25519_test.go | 219 + .../ed25519/internal/edwards25519/const.go | 1422 +++ .../internal/edwards25519/edwards25519.go | 1793 ++++ .../go/crypto/ed25519/testdata/sign.input.gz | Bin 0 -> 50330 bytes libgo/go/crypto/elliptic/fuzz_test.go | 2 +- libgo/go/crypto/elliptic/p256_s390x.go | 2 +- libgo/go/crypto/md5/md5_test.go | 4 +- libgo/go/crypto/rand/rand_js.go | 5 +- libgo/go/crypto/rand/util_test.go | 3 + libgo/go/crypto/rsa/pkcs1v15_test.go | 6 +- libgo/go/crypto/sha1/sha1.go | 37 +- libgo/go/crypto/sha1/sha1_test.go | 4 +- libgo/go/crypto/sha1/sha1block.go | 35 +- libgo/go/crypto/sha256/sha256.go | 43 +- libgo/go/crypto/sha256/sha256_test.go | 6 +- libgo/go/crypto/sha256/sha256block.go | 10 +- libgo/go/crypto/sha512/sha512.go | 35 +- libgo/go/crypto/sha512/sha512_test.go | 4 +- libgo/go/crypto/sha512/sha512block.go | 10 +- libgo/go/crypto/tls/auth.go | 73 +- libgo/go/crypto/tls/auth_test.go | 16 +- libgo/go/crypto/tls/cipher_suites.go | 26 +- libgo/go/crypto/tls/common.go | 50 +- libgo/go/crypto/tls/conn.go | 21 +- libgo/go/crypto/tls/generate_cert.go | 55 +- libgo/go/crypto/tls/handshake_client.go | 34 +- libgo/go/crypto/tls/handshake_client_test.go | 167 +- libgo/go/crypto/tls/handshake_client_tls13.go | 10 +- libgo/go/crypto/tls/handshake_messages.go | 4 +- libgo/go/crypto/tls/handshake_server.go | 65 +- libgo/go/crypto/tls/handshake_server_test.go | 410 +- libgo/go/crypto/tls/handshake_server_tls13.go | 10 +- libgo/go/crypto/tls/handshake_test.go | 251 +- libgo/go/crypto/tls/key_agreement.go | 34 +- libgo/go/crypto/tls/key_schedule.go | 15 +- libgo/go/crypto/tls/prf.go | 15 +- .../Client-TLSv10-ClientCert-ECDSA-ECDSA | 100 +- .../Client-TLSv10-ClientCert-ECDSA-RSA | 96 +- .../testdata/Client-TLSv10-ClientCert-Ed25519 | 110 + .../Client-TLSv10-ClientCert-RSA-ECDSA | 102 +- .../testdata/Client-TLSv10-ClientCert-RSA-RSA | 96 +- .../testdata/Client-TLSv10-ECDHE-ECDSA-AES | 82 +- .../tls/testdata/Client-TLSv10-ECDHE-RSA-AES | 78 +- .../crypto/tls/testdata/Client-TLSv10-Ed25519 | 0 .../Client-TLSv10-ExportKeyingMaterial | 78 +- .../crypto/tls/testdata/Client-TLSv10-RSA-RC4 | 46 +- .../testdata/Client-TLSv11-ECDHE-ECDSA-AES | 80 +- .../tls/testdata/Client-TLSv11-ECDHE-RSA-AES | 78 +- .../crypto/tls/testdata/Client-TLSv11-Ed25519 | 0 .../crypto/tls/testdata/Client-TLSv11-RSA-RC4 | 46 +- .../testdata/Client-TLSv12-AES128-GCM-SHA256 | 50 +- .../tls/testdata/Client-TLSv12-AES128-SHA256 | 64 +- .../testdata/Client-TLSv12-AES256-GCM-SHA384 | 50 +- .../go/crypto/tls/testdata/Client-TLSv12-ALPN | 72 +- .../Client-TLSv12-ClientCert-ECDSA-ECDSA | 100 +- .../Client-TLSv12-ClientCert-ECDSA-RSA | 94 +- .../testdata/Client-TLSv12-ClientCert-Ed25519 | 119 + ...nt-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 | 90 +- .../Client-TLSv12-ClientCert-RSA-ECDSA | 108 +- .../Client-TLSv12-ClientCert-RSA-PSS-Disabled | 137 - ...ent-TLSv12-ClientCert-RSA-PSS-Disabled-512 | 125 - .../testdata/Client-TLSv12-ClientCert-RSA-RSA | 90 +- .../Client-TLSv12-ClientCert-RSA-RSAPKCS1v15 | 90 +- .../Client-TLSv12-ClientCert-RSA-RSAPSS | 169 +- .../testdata/Client-TLSv12-ECDHE-ECDSA-AES | 80 +- .../Client-TLSv12-ECDHE-ECDSA-AES-GCM | 76 +- .../Client-TLSv12-ECDHE-ECDSA-AES128-SHA256 | 88 +- ...lient-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 | 74 +- ...lient-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305 | 72 +- .../tls/testdata/Client-TLSv12-ECDHE-RSA-AES | 78 +- .../Client-TLSv12-ECDHE-RSA-AES128-SHA256 | 86 +- .../Client-TLSv12-ECDHE-RSA-CHACHA20-POLY1305 | 70 +- .../crypto/tls/testdata/Client-TLSv12-Ed25519 | 68 + .../Client-TLSv12-ExportKeyingMaterial | 68 +- .../tls/testdata/Client-TLSv12-P256-ECDHE | 82 +- .../crypto/tls/testdata/Client-TLSv12-RSA-RC4 | 46 +- .../testdata/Client-TLSv12-RenegotiateOnce | 364 +- .../testdata/Client-TLSv12-RenegotiateTwice | 554 +- .../Client-TLSv12-RenegotiateTwiceRejected | 370 +- .../Client-TLSv12-RenegotiationRejected | 74 +- .../go/crypto/tls/testdata/Client-TLSv12-SCT | 68 +- .../tls/testdata/Client-TLSv12-X25519-ECDHE | 74 +- .../tls/testdata/Client-TLSv13-AES128-SHA256 | 154 +- .../tls/testdata/Client-TLSv13-AES256-SHA384 | 158 +- .../go/crypto/tls/testdata/Client-TLSv13-ALPN | 160 +- .../testdata/Client-TLSv13-CHACHA20-SHA256 | 154 +- .../Client-TLSv13-ClientCert-ECDSA-RSA | 252 +- .../testdata/Client-TLSv13-ClientCert-Ed25519 | 122 + .../Client-TLSv13-ClientCert-RSA-ECDSA | 242 +- .../Client-TLSv13-ClientCert-RSA-PSS-Disabled | 138 - .../Client-TLSv13-ClientCert-RSA-RSAPSS | 253 +- .../crypto/tls/testdata/Client-TLSv13-ECDSA | 146 +- .../crypto/tls/testdata/Client-TLSv13-Ed25519 | 68 + .../Client-TLSv13-ExportKeyingMaterial | 154 +- .../testdata/Client-TLSv13-HelloRetryRequest | 175 +- .../tls/testdata/Client-TLSv13-KeyUpdate | 170 +- .../tls/testdata/Client-TLSv13-P256-ECDHE | 162 +- .../tls/testdata/Client-TLSv13-X25519-ECDHE | 156 +- .../go/crypto/tls/testdata/Server-TLSv12-ALPN | 64 +- .../tls/testdata/Server-TLSv12-ALPN-NoMatch | 64 +- ...rver-TLSv12-CipherSuiteCertPreferenceECDSA | 66 +- ...Server-TLSv12-CipherSuiteCertPreferenceRSA | 60 +- ...er-TLSv12-ClientAuthRequestedAndECDSAGiven | 79 +- ...-TLSv12-ClientAuthRequestedAndEd25519Given | 111 + .../Server-TLSv12-ClientAuthRequestedAndGiven | 110 +- ...2-ClientAuthRequestedAndGiven-PSS-Disabled | 126 - ...uthRequestedAndGiven-PSS-Disabled-Required | 74 - ...TLSv12-ClientAuthRequestedAndPKCS1v15Given | 86 +- .../Server-TLSv12-ClientAuthRequestedNotGiven | 61 +- .../crypto/tls/testdata/Server-TLSv12-Ed25519 | 63 + .../Server-TLSv12-ExportKeyingMaterial | 64 +- .../go/crypto/tls/testdata/Server-TLSv12-P256 | 54 +- .../tls/testdata/Server-TLSv12-RSA-3DES | 50 +- .../crypto/tls/testdata/Server-TLSv12-RSA-AES | 54 +- .../tls/testdata/Server-TLSv12-RSA-AES-GCM | 50 +- .../Server-TLSv12-RSA-AES256-GCM-SHA384 | 50 +- .../testdata/Server-TLSv12-RSA-PSS-Disabled | 84 - .../Server-TLSv12-RSA-PSS-Disabled-Required | 54 - .../crypto/tls/testdata/Server-TLSv12-RSA-RC4 | 44 +- .../testdata/Server-TLSv12-RSA-RSAPKCS1v15 | 50 +- .../tls/testdata/Server-TLSv12-RSA-RSAPSS | 35 +- .../go/crypto/tls/testdata/Server-TLSv12-SNI | 54 +- .../testdata/Server-TLSv12-SNI-GetCertificate | 54 +- .../Server-TLSv12-SNI-GetCertificateNotFound | 54 +- .../crypto/tls/testdata/Server-TLSv12-X25519 | 50 +- ...er-TLSv13-ClientAuthRequestedAndECDSAGiven | 336 +- ...-TLSv13-ClientAuthRequestedAndEd25519Given | 154 + .../Server-TLSv13-ClientAuthRequestedAndGiven | 332 +- ...3-ClientAuthRequestedAndGiven-PSS-Disabled | 182 - .../Server-TLSv13-ClientAuthRequestedNotGiven | 186 +- .../crypto/tls/testdata/Server-TLSv13-Ed25519 | 81 + .../testdata/Server-TLSv13-RSA-PSS-Disabled | 103 - libgo/go/crypto/tls/ticket.go | 2 +- libgo/go/crypto/tls/tls.go | 21 +- libgo/go/crypto/tls/tls_test.go | 48 +- libgo/go/crypto/x509/name_constraints_test.go | 764 +- libgo/go/crypto/x509/pem_decrypt_test.go | 44 +- libgo/go/crypto/x509/pkcs1.go | 25 +- libgo/go/crypto/x509/pkcs8.go | 51 +- libgo/go/crypto/x509/pkcs8_test.go | 33 +- libgo/go/crypto/x509/root_cgo_darwin.go | 76 +- libgo/go/crypto/x509/root_darwin.go | 12 +- libgo/go/crypto/x509/root_linux.go | 1 + libgo/go/crypto/x509/root_windows.go | 6 +- libgo/go/crypto/x509/sec1.go | 16 +- libgo/go/crypto/x509/sec1_test.go | 22 + libgo/go/crypto/x509/verify.go | 2 +- libgo/go/crypto/x509/x509.go | 156 +- libgo/go/crypto/x509/x509_test.go | 180 +- libgo/go/crypto/x509/x509_test_import.go | 9 +- libgo/go/database/sql/convert.go | 60 +- libgo/go/database/sql/convert_test.go | 114 +- libgo/go/database/sql/driver/driver.go | 2 +- libgo/go/database/sql/driver/types.go | 17 +- libgo/go/database/sql/driver/types_test.go | 14 + libgo/go/database/sql/fakedb_test.go | 8 +- libgo/go/database/sql/sql.go | 89 +- libgo/go/database/sql/sql_test.go | 90 +- .../go/debug/dwarf/testdata/cppunsuptypes.cc | 34 + .../go/debug/dwarf/testdata/cppunsuptypes.elf | Bin 0 -> 3920 bytes libgo/go/debug/dwarf/type.go | 24 + libgo/go/debug/dwarf/type_test.go | 60 + libgo/go/debug/elf/file.go | 7 +- libgo/go/debug/elf/file_test.go | 11 + libgo/go/debug/gosym/pclntab.go | 6 +- libgo/go/debug/gosym/pclntab_test.go | 5 +- libgo/go/debug/gosym/symtab.go | 14 +- libgo/go/debug/gosym/symtab_test.go | 15 + libgo/go/debug/macho/file_test.go | 6 +- libgo/go/debug/macho/macho.go | 7 +- libgo/go/debug/pe/file.go | 6 +- libgo/go/debug/pe/file_test.go | 50 + libgo/go/encoding/base32/base32.go | 52 +- libgo/go/encoding/base32/base32_test.go | 62 +- libgo/go/encoding/base64/base64.go | 123 +- libgo/go/encoding/base64/base64_test.go | 17 +- libgo/go/encoding/csv/fuzz.go | 70 + libgo/go/encoding/csv/reader.go | 2 + libgo/go/encoding/csv/writer.go | 13 +- libgo/go/encoding/gob/codec_test.go | 10 +- libgo/go/encoding/gob/decgen.go | 4 +- libgo/go/encoding/gob/doc.go | 15 +- libgo/go/encoding/gob/encgen.go | 4 +- libgo/go/encoding/gob/encode.go | 4 +- libgo/go/encoding/hex/hex.go | 26 +- libgo/go/encoding/hex/hex_test.go | 16 + libgo/go/encoding/json/bench_test.go | 14 +- libgo/go/encoding/json/decode.go | 173 +- libgo/go/encoding/json/decode_test.go | 64 +- libgo/go/encoding/json/encode.go | 55 +- libgo/go/encoding/json/encode_test.go | 6 + libgo/go/encoding/json/fuzz.go | 42 + libgo/go/encoding/json/indent.go | 3 + libgo/go/encoding/json/stream.go | 12 +- libgo/go/encoding/json/stream_test.go | 4 +- libgo/go/encoding/pem/pem.go | 18 +- libgo/go/encoding/pem/pem_test.go | 36 +- libgo/go/errors/wrap.go | 86 + libgo/go/errors/wrap_test.go | 253 + libgo/go/expvar/expvar.go | 10 +- libgo/go/expvar/expvar_test.go | 40 + libgo/go/flag/flag.go | 12 +- libgo/go/fmt/doc.go | 24 +- libgo/go/fmt/errors.go | 43 + libgo/go/fmt/errors_test.go | 73 + libgo/go/fmt/example_test.go | 10 +- libgo/go/fmt/fmt_test.go | 30 + libgo/go/fmt/format.go | 45 +- libgo/go/fmt/print.go | 232 +- libgo/go/fmt/scan.go | 70 +- libgo/go/fmt/scan_test.go | 38 +- libgo/go/go/ast/ast.go | 15 +- libgo/go/go/ast/import.go | 81 +- libgo/go/go/build/build.go | 82 +- libgo/go/go/build/build_test.go | 12 + libgo/go/go/build/deps_test.go | 111 +- libgo/go/go/build/doc.go | 28 +- libgo/go/go/build/syslist.go | 2 +- libgo/go/go/constant/example_test.go | 22 + libgo/go/go/constant/value.go | 98 +- libgo/go/go/constant/value_test.go | 163 +- libgo/go/go/doc/comment.go | 14 +- libgo/go/go/doc/comment_test.go | 28 + libgo/go/go/doc/example.go | 4 +- libgo/go/go/doc/exports.go | 12 +- libgo/go/go/doc/headscan.go | 4 +- libgo/go/go/doc/lazyre.go | 51 - libgo/go/go/doc/reader.go | 11 +- libgo/go/go/doc/testdata/issue10858.0.golden | 79 + libgo/go/go/doc/testdata/issue10858.1.golden | 79 + libgo/go/go/doc/testdata/issue10858.2.golden | 79 + libgo/go/go/doc/testdata/issue10858.go | 102 + libgo/go/go/importer/importer.go | 2 +- .../internal/gccgoimporter/importer_test.go | 23 +- libgo/go/go/internal/gccgoimporter/parser.go | 46 +- .../gccgoimporter/testdata/issue30628.go | 18 + .../gccgoimporter/testdata/issue30628.gox | 28 + .../gccgoimporter/testdata/issue31540.go | 26 + .../gccgoimporter/testdata/issue31540.gox | 16 + libgo/go/go/internal/gcimporter/bimport.go | 11 +- .../internal/gcimporter/testdata/exports.go | 2 +- .../internal/srcimporter/srcimporter_test.go | 14 +- libgo/go/go/parser/parser.go | 15 +- libgo/go/go/printer/nodes.go | 2 +- libgo/go/go/printer/printer_test.go | 7 + libgo/go/go/scanner/scanner.go | 236 +- libgo/go/go/scanner/scanner_test.go | 210 +- libgo/go/go/token/token.go | 34 +- libgo/go/go/token/token_test.go | 33 + libgo/go/go/types/call.go | 4 +- libgo/go/go/types/check_test.go | 1 + libgo/go/go/types/eval.go | 53 +- libgo/go/go/types/eval_test.go | 96 + libgo/go/go/types/expr.go | 37 +- libgo/go/go/types/gccgosizes.go | 42 + libgo/go/go/types/object.go | 5 +- libgo/go/go/types/resolver.go | 19 +- libgo/go/go/types/stdlib_test.go | 1 + .../chacha20poly1305/chacha20poly1305.go | 101 + .../chacha20poly1305_amd64.go | 86 + .../chacha20poly1305_generic.go | 81 + .../chacha20poly1305_noasm.go | 0 .../chacha20poly1305/xchacha20poly1305.go | 104 + .../go/golang.org/x/crypto/cryptobyte/asn1.go | 751 ++ .../x/crypto/cryptobyte/asn1/asn1.go | 46 + .../golang.org/x/crypto/cryptobyte/builder.go | 337 + .../golang.org/x/crypto/cryptobyte/string.go | 166 + .../x/crypto/curve25519/curve25519.go | 834 ++ .../go/golang.org/x/crypto/curve25519/doc.go | 23 + .../x/crypto/curve25519/mont25519_amd64.go | 0 libgo/go/golang.org/x/crypto/hkdf/hkdf.go | 93 + .../crypto/internal/chacha20/chacha_arm64.go | 31 + .../internal/chacha20/chacha_generic.go | 264 + .../crypto/internal/chacha20/chacha_noasm.go | 16 + .../internal/chacha20/chacha_ppc64le.go | 52 + .../crypto/internal/chacha20/chacha_s390x.go | 29 + .../x/crypto/internal/chacha20/xor.go | 0 .../x/crypto/internal/subtle/aliasing.go | 32 + .../internal/subtle/aliasing_appengine.go | 35 + .../golang.org/x/crypto/poly1305/mac_noasm.go | 11 + .../golang.org/x/crypto/poly1305/poly1305.go | 83 + .../golang.org/x/crypto/poly1305/sum_amd64.go | 68 + .../x/crypto/poly1305/sum_arm.go | 0 .../x/crypto/poly1305/sum_generic.go | 172 + .../golang.org/x/crypto/poly1305/sum_noasm.go | 16 + .../x/crypto/poly1305/sum_ppc64le.go | 68 + .../golang.org/x/crypto/poly1305/sum_s390x.go | 42 + .../x/net/dns/dnsmessage/message.go | 2606 ++++++ .../x/net/http/httpguts/guts.go | 0 .../golang.org/x/net/http/httpguts/httplex.go | 346 + .../golang.org/x/net/http/httpproxy/proxy.go | 370 + .../x/net/http2/hpack/encode.go | 0 .../x/net/http2/hpack/hpack.go | 0 .../x/net/http2/hpack/huffman.go | 0 .../x/net/http2/hpack/tables.go | 0 libgo/go/golang.org/x/net/idna/idna10.0.0.go | 734 ++ libgo/go/golang.org/x/net/idna/idna9.0.0.go | 682 ++ .../x/net/idna/punycode.go | 0 .../go/golang.org/x/net/idna/tables10.0.0.go | 4559 ++++++++++ .../go/golang.org/x/net/idna/tables11.0.0.go | 4653 ++++++++++ libgo/go/golang.org/x/net/idna/tables9.0.0.go | 4486 ++++++++++ .../x/net/idna/trie.go | 0 libgo/go/golang.org/x/net/idna/trieval.go | 119 + .../x/net/lif/address.go | 0 .../x/net/lif/binary.go | 0 .../{internal => golang.org}/x/net/lif/lif.go | 0 .../x/net/lif/link.go | 0 .../{internal => golang.org}/x/net/lif/sys.go | 0 libgo/go/golang.org/x/net/lif/syscall.go | 28 + .../x/net/lif/zsys_solaris_amd64.go | 103 + libgo/go/golang.org/x/net/nettest/conntest.go | 464 + libgo/go/golang.org/x/net/nettest/nettest.go | 345 + .../golang.org/x/net/nettest/nettest_stub.go | 11 + .../golang.org/x/net/nettest/nettest_unix.go | 21 + .../x/net/nettest/nettest_windows.go | 26 + .../x/net/route/address.go | 0 .../x/net/route/binary.go | 0 .../x/net/route/interface.go | 0 .../x/net/route/interface_announce.go | 0 .../x/net/route/interface_classic.go | 0 .../x/net/route/interface_freebsd.go | 0 .../x/net/route/interface_multicast.go | 0 .../x/net/route/interface_openbsd.go | 0 .../x/net/route/message.go | 0 libgo/go/golang.org/x/net/route/route.go | 123 + .../x/net/route/route_classic.go | 0 .../x/net/route/route_openbsd.go | 0 libgo/go/golang.org/x/net/route/sys.go | 39 + .../x/net/route/sys_darwin.go | 0 .../x/net/route/sys_dragonfly.go | 0 .../x/net/route/sys_freebsd.go | 0 .../x/net/route/sys_netbsd.go | 0 .../x/net/route/sys_openbsd.go | 0 .../x/net/route/syscall.go | 0 .../x/net/route/syscall_go1_11_darwin.go | 0 .../x/net/route/syscall_go1_12_darwin.go | 0 .../x/net/route/zsys_darwin.go | 0 .../x/net/route/zsys_dragonfly.go | 0 .../x/net/route/zsys_freebsd_386.go | 0 .../x/net/route/zsys_freebsd_amd64.go | 0 .../x/net/route/zsys_freebsd_arm.go | 0 .../x/net/route/zsys_freebsd_arm64.go | 123 + .../x/net/route/zsys_netbsd.go | 0 .../x/net/route/zsys_openbsd.go | 0 libgo/go/golang.org/x/sys/cpu/byteorder.go | 30 + libgo/go/golang.org/x/sys/cpu/cpu.go | 126 + .../go/golang.org/x/sys/cpu/cpu_aix_ppc64.go | 34 + libgo/go/golang.org/x/sys/cpu/cpu_arm.go | 9 + libgo/go/golang.org/x/sys/cpu/cpu_gc_s390x.go | 21 + libgo/go/golang.org/x/sys/cpu/cpu_gc_x86.go | 16 + libgo/go/golang.org/x/sys/cpu/cpu_gccgo.c | 43 + libgo/go/golang.org/x/sys/cpu/cpu_gccgo.go | 26 + .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 22 + libgo/go/golang.org/x/sys/cpu/cpu_linux.go | 59 + .../golang.org/x/sys/cpu/cpu_linux_arm64.go | 67 + .../golang.org/x/sys/cpu/cpu_linux_ppc64x.go | 33 + .../golang.org/x/sys/cpu/cpu_linux_s390x.go | 161 + libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go | 11 + libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go | 11 + .../golang.org/x/sys/cpu/cpu_other_arm64.go | 11 + libgo/go/golang.org/x/sys/cpu/cpu_wasm.go | 15 + libgo/go/golang.org/x/sys/cpu/cpu_x86.go | 59 + .../x/sys/cpu/syscall_aix_ppc64_gc.go | 36 + .../x/text/secure/bidirule/bidirule.go | 336 + .../x/text/secure/bidirule/bidirule10.0.0.go | 11 + .../x/text/secure/bidirule/bidirule9.0.0.go | 14 + .../golang.org/x/text/transform/transform.go | 705 ++ .../go/golang.org/x/text/unicode/bidi/bidi.go | 198 + .../golang.org/x/text/unicode/bidi/bracket.go | 335 + .../go/golang.org/x/text/unicode/bidi/core.go | 1058 +++ .../go/golang.org/x/text/unicode/bidi/prop.go | 206 + .../x/text/unicode/bidi/tables10.0.0.go | 1815 ++++ .../x/text/unicode/bidi/tables11.0.0.go | 1887 ++++ .../x/text/unicode/bidi/tables9.0.0.go | 1781 ++++ .../golang.org/x/text/unicode/bidi/trieval.go | 60 + .../x/text/unicode/norm/composition.go | 512 ++ .../x/text/unicode/norm/forminfo.go | 278 + .../golang.org/x/text/unicode/norm/input.go | 109 + .../go/golang.org/x/text/unicode/norm/iter.go | 458 + .../x/text/unicode/norm/normalize.go | 609 ++ .../x/text/unicode/norm/readwriter.go | 125 + .../x/text/unicode/norm/tables10.0.0.go | 7657 ++++++++++++++++ .../x/text/unicode/norm/tables11.0.0.go | 7693 +++++++++++++++++ .../x/text/unicode/norm/tables9.0.0.go | 7637 ++++++++++++++++ .../x/text/unicode/norm/transform.go | 88 + .../go/golang.org/x/text/unicode/norm/trie.go | 54 + .../x/tools/go/analysis/analysis.go | 40 +- .../go/golang.org/x/tools/go/analysis/doc.go | 2 +- .../analysis/internal/analysisflags/flags.go | 59 +- .../analysis/internal/analysisflags/help.go | 3 + .../analysis/internal/analysisflags/patch.go | 7 - .../go/analysis/passes/asmdecl/asmdecl.go | 39 +- .../x/tools/go/analysis/passes/bools/bools.go | 21 +- .../go/analysis/passes/cgocall/cgocall.go | 8 +- .../go/analysis/passes/composite/composite.go | 11 +- .../go/analysis/passes/errorsas/errorsas.go | 75 + .../go/analysis/passes/inspect/inspect.go | 6 +- .../analysis/passes/lostcancel/lostcancel.go | 17 +- .../tools/go/analysis/passes/printf/printf.go | 45 +- .../tools/go/analysis/passes/printf/types.go | 5 +- .../x/tools/go/analysis/passes/shift/shift.go | 31 +- .../analysis/passes/stdmethods/stdmethods.go | 17 +- .../go/analysis/passes/structtag/structtag.go | 76 +- .../x/tools/go/analysis/passes/tests/tests.go | 49 +- .../go/analysis/passes/unmarshal/unmarshal.go | 7 + .../go/analysis/unitchecker/unitchecker.go | 1 + .../x/tools/go/ast/inspector/inspector.go | 2 +- libgo/go/html/fuzz.go | 31 + libgo/go/html/template/context.go | 6 +- libgo/go/html/template/css.go | 6 +- libgo/go/html/template/escape_test.go | 3 +- libgo/go/html/template/html.go | 8 +- libgo/go/html/template/js.go | 10 +- libgo/go/html/template/js_test.go | 1 + libgo/go/html/template/template.go | 15 +- libgo/go/html/template/template_test.go | 6 + libgo/go/image/decode_test.go | 4 + libgo/go/image/draw/draw.go | 4 +- libgo/go/image/geom.go | 4 + libgo/go/image/gif/writer.go | 19 +- libgo/go/image/gif/writer_test.go | 132 +- libgo/go/image/jpeg/fdct.go | 34 +- libgo/go/image/jpeg/idct.go | 88 +- libgo/go/image/png/fuzz.go | 52 + libgo/go/image/png/reader.go | 2 +- libgo/go/image/png/reader_test.go | 15 + .../go/image/png/testdata/invalid-palette.png | Bin 0 -> 1122 bytes libgo/go/image/png/writer.go | 1 - libgo/go/index/suffixarray/gen.go | 92 + libgo/go/index/suffixarray/qsufsort.go | 168 - libgo/go/index/suffixarray/sais.go | 899 ++ libgo/go/index/suffixarray/sais2.go | 1741 ++++ libgo/go/index/suffixarray/suffixarray.go | 136 +- .../go/index/suffixarray/suffixarray_test.go | 359 +- libgo/go/internal/bytealg/bytealg.c | 15 - libgo/go/internal/bytealg/count_generic.go | 2 +- libgo/go/internal/bytealg/count_native.go | 2 +- libgo/go/internal/bytealg/equal_generic.go | 18 + libgo/go/internal/bytealg/equal_native.go | 5 - libgo/go/internal/bytealg/index_arm64.go | 4 +- libgo/go/internal/cpu/cpu.go | 42 +- libgo/go/internal/cpu/cpu_s390x.go | 54 +- libgo/go/internal/goversion/goversion.go | 13 + libgo/go/internal/lazyregexp/lazyre.go | 78 + .../go/internal/lazytemplate/lazytemplate.go | 52 + libgo/go/internal/oserror/errors.go | 64 + libgo/go/internal/oserror/errors_test.go | 63 + libgo/go/internal/poll/errno_unix.go | 33 + libgo/go/internal/poll/errno_windows.go | 31 + libgo/go/internal/poll/error_linux_test.go | 31 + libgo/go/internal/poll/error_stub_test.go | 21 + libgo/go/internal/poll/error_test.go | 50 + libgo/go/internal/poll/fd.go | 13 +- libgo/go/internal/poll/fd_opendir_darwin.go | 32 + libgo/go/internal/poll/fd_opendir_ios.go | 35 - libgo/go/internal/poll/fd_poll_runtime.go | 4 +- libgo/go/internal/poll/fd_windows.go | 84 +- libgo/go/internal/poll/read_test.go | 62 + libgo/go/internal/poll/sendfile_windows.go | 8 +- libgo/go/internal/poll/writev.go | 8 +- libgo/go/internal/reflectlite/all_test.go | 1048 +++ libgo/go/internal/reflectlite/export_test.go | 117 + libgo/go/internal/reflectlite/set_test.go | 92 + libgo/go/internal/reflectlite/swapper.go | 74 + .../go/internal/reflectlite/tostring_test.go | 98 + libgo/go/internal/reflectlite/type.go | 729 ++ libgo/go/internal/reflectlite/value.go | 497 ++ .../go/internal/syscall/windows/mksyscall.go | 2 + .../syscall/windows/registry/mksyscall.go | 2 + .../syscall/windows/reparse_windows.go | 24 + .../syscall/windows/syscall_windows.go | 3 + .../internal/syscall/windows/sysdll/sysdll.go | 2 + .../syscall/windows/zsyscall_windows.go | 32 + libgo/go/internal/testenv/testenv.go | 19 + libgo/go/internal/trace/gc_test.go | 4 + libgo/go/internal/trace/parser_test.go | 13 +- .../chacha20poly1305/chacha20poly1305.go | 91 - .../chacha20poly1305_amd64.go | 80 - .../chacha20poly1305_generic.go | 74 - .../chacha20poly1305/chacha20poly1305_test.go | 182 - .../chacha20poly1305_vectors_test.go | 339 - libgo/go/internal/x/crypto/cryptobyte/asn1.go | 751 -- .../internal/x/crypto/cryptobyte/asn1/asn1.go | 46 - .../internal/x/crypto/cryptobyte/asn1_test.go | 333 - .../internal/x/crypto/cryptobyte/builder.go | 309 - .../x/crypto/cryptobyte/cryptobyte_test.go | 428 - .../x/crypto/cryptobyte/example_test.go | 156 - .../go/internal/x/crypto/cryptobyte/string.go | 166 - .../x/crypto/curve25519/curve25519.go | 834 -- .../x/crypto/curve25519/curve25519_test.go | 39 - libgo/go/internal/x/crypto/curve25519/doc.go | 23 - .../go/internal/x/crypto/hkdf/example_test.go | 58 - libgo/go/internal/x/crypto/hkdf/hkdf.go | 93 - libgo/go/internal/x/crypto/hkdf/hkdf_test.go | 449 - .../internal/chacha20/chacha_generic.go | 227 - .../crypto/internal/chacha20/chacha_noasm.go | 16 - .../crypto/internal/chacha20/chacha_s390x.go | 30 - .../x/crypto/internal/chacha20/chacha_test.go | 188 - .../crypto/internal/chacha20/vectors_test.go | 578 -- .../go/internal/x/crypto/poly1305/poly1305.go | 33 - .../x/crypto/poly1305/poly1305_test.go | 132 - .../internal/x/crypto/poly1305/sum_amd64.go | 22 - .../internal/x/crypto/poly1305/sum_noasm.go | 14 - .../go/internal/x/crypto/poly1305/sum_ref.go | 139 - .../internal/x/crypto/poly1305/sum_s390x.go | 49 - .../x/crypto/poly1305/vectors_test.go | 2943 ------- .../x/net/dns/dnsmessage/example_test.go | 134 - .../internal/x/net/dns/dnsmessage/message.go | 2103 ----- .../x/net/dns/dnsmessage/message_test.go | 1137 --- .../internal/x/net/http/httpguts/httplex.go | 346 - .../x/net/http/httpguts/httplex_test.go | 119 - .../x/net/http/httpproxy/export_test.go | 13 - .../go/internal/x/net/http/httpproxy/proxy.go | 370 - .../x/net/http/httpproxy/proxy_test.go | 351 - .../internal/x/net/http2/hpack/encode_test.go | 386 - .../internal/x/net/http2/hpack/hpack_test.go | 770 -- .../internal/x/net/http2/hpack/tables_test.go | 214 - libgo/go/internal/x/net/idna/idna.go | 732 -- libgo/go/internal/x/net/idna/punycode_test.go | 198 - libgo/go/internal/x/net/idna/tables.go | 4559 ---------- libgo/go/internal/x/net/idna/trieval.go | 121 - .../x/net/internal/nettest/helper_bsd.go | 53 - .../x/net/internal/nettest/helper_nobsd.go | 15 - .../x/net/internal/nettest/helper_posix.go | 31 - .../x/net/internal/nettest/helper_stub.go | 32 - .../x/net/internal/nettest/helper_unix.go | 29 - .../x/net/internal/nettest/helper_windows.go | 42 - .../x/net/internal/nettest/interface.go | 94 - .../internal/x/net/internal/nettest/rlimit.go | 11 - .../internal/x/net/internal/nettest/stack.go | 152 - libgo/go/internal/x/net/lif/address_test.go | 123 - libgo/go/internal/x/net/lif/defs_solaris.go | 90 - libgo/go/internal/x/net/lif/link_test.go | 63 - libgo/go/internal/x/net/lif/syscall.go | 22 - libgo/go/internal/x/net/lif/zsys_solaris.go | 101 - libgo/go/internal/x/net/nettest/conntest.go | 456 - .../internal/x/net/nettest/conntest_go16.go | 24 - .../internal/x/net/nettest/conntest_go17.go | 24 - .../internal/x/net/nettest/conntest_test.go | 76 - .../x/net/route/address_darwin_test.go | 63 - libgo/go/internal/x/net/route/address_test.go | 103 - libgo/go/internal/x/net/route/defs_darwin.go | 114 - .../go/internal/x/net/route/defs_dragonfly.go | 113 - libgo/go/internal/x/net/route/defs_freebsd.go | 337 - libgo/go/internal/x/net/route/defs_netbsd.go | 112 - libgo/go/internal/x/net/route/defs_openbsd.go | 116 - .../x/net/route/message_darwin_test.go | 34 - .../x/net/route/message_freebsd_test.go | 88 - libgo/go/internal/x/net/route/message_test.go | 239 - libgo/go/internal/x/net/route/route.go | 123 - libgo/go/internal/x/net/route/route_test.go | 390 - libgo/go/internal/x/net/route/sys.go | 39 - .../x/text/secure/bidirule/bidirule.go | 342 - libgo/go/internal/x/text/secure/doc.go | 8 - .../x/text/transform/examples_test.go | 39 - .../go/internal/x/text/transform/transform.go | 707 -- libgo/go/internal/x/text/unicode/bidi/bidi.go | 198 - .../internal/x/text/unicode/bidi/bracket.go | 337 - libgo/go/internal/x/text/unicode/bidi/core.go | 1060 --- .../x/text/unicode/bidi/example_test.go | 185 - libgo/go/internal/x/text/unicode/bidi/prop.go | 208 - .../go/internal/x/text/unicode/bidi/tables.go | 1815 ---- .../internal/x/text/unicode/bidi/trieval.go | 62 - libgo/go/internal/x/text/unicode/doc.go | 10 - .../x/text/unicode/norm/composition.go | 510 -- .../x/text/unicode/norm/example_iter_test.go | 84 - .../x/text/unicode/norm/example_test.go | 29 - .../internal/x/text/unicode/norm/forminfo.go | 261 - .../go/internal/x/text/unicode/norm/input.go | 111 - libgo/go/internal/x/text/unicode/norm/iter.go | 459 - .../internal/x/text/unicode/norm/normalize.go | 609 -- .../x/text/unicode/norm/readwriter.go | 127 - .../go/internal/x/text/unicode/norm/tables.go | 7653 ---------------- .../internal/x/text/unicode/norm/transform.go | 90 - libgo/go/internal/x/text/unicode/norm/trie.go | 56 - .../internal/x/text/unicode/norm/triegen.go | 117 - libgo/go/internal/xcoff/ar_test.go | 4 +- libgo/go/internal/xcoff/file.go | 4 +- libgo/go/io/multi_test.go | 4 +- libgo/go/log/log.go | 5 + libgo/go/log/log_test.go | 6 +- libgo/go/math/all_test.go | 14 + libgo/go/math/big/arith.go | 268 +- libgo/go/math/big/arith_decl_pure.go | 14 +- libgo/go/math/big/arith_test.go | 129 +- libgo/go/math/big/floatconv.go | 63 +- libgo/go/math/big/floatconv_test.go | 277 +- libgo/go/math/big/floatmarsh_test.go | 3 + libgo/go/math/big/ftoa.go | 102 +- libgo/go/math/big/int.go | 49 +- libgo/go/math/big/int_test.go | 84 +- libgo/go/math/big/intconv.go | 22 +- libgo/go/math/big/intconv_test.go | 30 +- libgo/go/math/big/nat.go | 9 +- libgo/go/math/big/natconv.go | 215 +- libgo/go/math/big/natconv_test.go | 172 +- libgo/go/math/big/prime_test.go | 14 +- libgo/go/math/big/rat.go | 42 +- libgo/go/math/big/rat_test.go | 58 + libgo/go/math/big/ratconv.go | 230 +- libgo/go/math/big/ratconv_test.go | 172 +- libgo/go/math/big/sqrt_test.go | 3 + libgo/go/math/bits/bits.go | 108 +- libgo/go/math/bits/bits_errors.go | 15 + libgo/go/math/bits/bits_errors_bootstrap.go | 22 + libgo/go/math/bits/bits_test.go | 25 + libgo/go/math/bits/example_test.go | 6 + libgo/go/math/cmplx/cmath_test.go | 8 +- libgo/go/math/cmplx/pow.go | 3 + libgo/go/math/cmplx/tan.go | 6 +- libgo/go/math/example_test.go | 38 + libgo/go/math/j0.go | 4 +- libgo/go/math/j1.go | 4 +- libgo/go/math/jn.go | 20 +- libgo/go/math/rand/rand_test.go | 2 +- libgo/go/math/remainder.go | 4 + libgo/go/math/sin.go | 36 +- libgo/go/math/sincos.go | 6 +- libgo/go/math/tan.go | 22 +- libgo/go/math/tanh.go | 12 +- libgo/go/mime/mediatype.go | 36 +- libgo/go/mime/mediatype_test.go | 25 +- libgo/go/mime/multipart/formdata_test.go | 9 +- libgo/go/mime/multipart/multipart_test.go | 5 +- libgo/go/mime/quotedprintable/reader_test.go | 13 +- libgo/go/mime/type.go | 5 +- libgo/go/net/cgo_unix.go | 31 +- libgo/go/net/dial.go | 31 +- libgo/go/net/dial_test.go | 10 +- libgo/go/net/dnsclient.go | 2 +- libgo/go/net/dnsclient_unix.go | 101 +- libgo/go/net/dnsclient_unix_test.go | 156 +- libgo/go/net/dnsconfig_unix.go | 39 +- libgo/go/net/dnsconfig_unix_test.go | 55 + libgo/go/net/error_test.go | 6 +- libgo/go/net/fd_unix.go | 12 +- libgo/go/net/file_plan9.go | 2 +- libgo/go/net/file_unix.go | 2 +- libgo/go/net/http/cgi/child.go | 2 +- libgo/go/net/http/client.go | 15 +- libgo/go/net/http/client_test.go | 10 +- libgo/go/net/http/clientserver_test.go | 2 +- libgo/go/net/http/clone.go | 64 + libgo/go/net/http/cookie.go | 40 +- libgo/go/net/http/cookie_test.go | 42 + libgo/go/net/http/export_test.go | 16 + libgo/go/net/http/fs.go | 2 + libgo/go/net/http/h2_bundle.go | 71 +- libgo/go/net/http/header.go | 15 +- libgo/go/net/http/http.go | 4 +- libgo/go/net/http/httptest/recorder.go | 33 +- libgo/go/net/http/httputil/dump_test.go | 98 +- libgo/go/net/http/httputil/persist.go | 4 +- libgo/go/net/http/httputil/reverseproxy.go | 27 +- .../go/net/http/httputil/reverseproxy_test.go | 37 +- libgo/go/net/http/internal/testcert.go | 8 +- libgo/go/net/http/request.go | 80 +- libgo/go/net/http/request_test.go | 136 +- libgo/go/net/http/response.go | 5 +- libgo/go/net/http/response_test.go | 4 +- libgo/go/net/http/roundtrip_js.go | 47 +- libgo/go/net/http/serve_test.go | 151 +- libgo/go/net/http/server.go | 139 +- libgo/go/net/http/sniff.go | 117 +- libgo/go/net/http/sniff_test.go | 12 + libgo/go/net/http/status.go | 2 + libgo/go/net/http/transfer.go | 73 +- libgo/go/net/http/transfer_test.go | 220 + libgo/go/net/http/transport.go | 172 +- libgo/go/net/http/transport_test.go | 407 +- libgo/go/net/interface_aix.go | 13 +- libgo/go/net/interface_bsd.go | 2 +- libgo/go/net/interface_bsdvar.go | 2 +- libgo/go/net/interface_darwin.go | 2 +- libgo/go/net/interface_freebsd.go | 2 +- libgo/go/net/interface_plan9.go | 8 +- libgo/go/net/interface_solaris.go | 2 +- libgo/go/net/interface_test.go | 4 +- libgo/go/net/ip.go | 2 +- libgo/go/net/listen_test.go | 10 +- libgo/go/net/lookup.go | 6 +- libgo/go/net/lookup_plan9.go | 6 +- libgo/go/net/lookup_test.go | 13 + libgo/go/net/lookup_unix.go | 2 +- libgo/go/net/lookup_windows.go | 40 +- libgo/go/net/mac.go | 18 +- libgo/go/net/mac_test.go | 76 +- libgo/go/net/mail/message.go | 15 + libgo/go/net/mail/message_test.go | 3 + libgo/go/net/net.go | 28 +- libgo/go/net/pipe.go | 5 + libgo/go/net/pipe_test.go | 2 +- libgo/go/net/platform_test.go | 27 +- libgo/go/net/rpc/client_test.go | 2 +- libgo/go/net/rpc/server.go | 13 +- libgo/go/net/sendfile_unix_alt.go | 4 +- libgo/go/net/smtp/smtp_test.go | 8 +- libgo/go/net/splice_test.go | 1 + libgo/go/net/tcpsock.go | 5 +- libgo/go/net/tcpsock_plan9.go | 13 +- libgo/go/net/tcpsock_posix.go | 13 +- libgo/go/net/tcpsock_test.go | 2 +- libgo/go/net/tcpsockopt_darwin.go | 1 + .../go/net/testdata/freebsd-usevc-resolv.conf | 1 + .../go/net/testdata/linux-use-vc-resolv.conf | 1 + libgo/go/net/testdata/openbsd-tcp-resolv.conf | 1 + .../single-request-reopen-resolv.conf | 1 + .../net/testdata/single-request-resolv.conf | 1 + libgo/go/net/textproto/reader.go | 11 +- libgo/go/net/textproto/reader_test.go | 3 +- libgo/go/net/textproto/writer.go | 5 +- libgo/go/net/textproto/writer_test.go | 26 + libgo/go/net/timeout_test.go | 5 + libgo/go/net/url/url.go | 62 +- libgo/go/net/url/url_test.go | 11 + libgo/go/os/dir_ios.go | 87 - libgo/go/os/env_default.go | 13 + libgo/go/os/env_windows.go | 40 + libgo/go/os/error.go | 53 +- libgo/go/os/error_plan9.go | 44 - libgo/go/os/error_test.go | 28 +- libgo/go/os/error_unix.go | 24 - libgo/go/os/error_windows.go | 28 - libgo/go/os/example_test.go | 1 + libgo/go/os/exec/bench_test.go | 23 + libgo/go/os/exec/exec.go | 62 +- libgo/go/os/exec/exec_posix_test.go | 5 + libgo/go/os/exec/exec_test.go | 58 +- libgo/go/os/exec_plan9.go | 1 + libgo/go/os/exec_posix.go | 6 +- libgo/go/os/export_test.go | 2 + libgo/go/os/export_unix_test.go | 9 + libgo/go/os/file.go | 104 +- libgo/go/os/file_plan9.go | 8 +- libgo/go/os/file_posix.go | 20 - libgo/go/os/file_unix.go | 41 +- libgo/go/os/os_test.go | 64 +- libgo/go/os/os_unix_test.go | 47 +- libgo/go/os/path.go | 3 + libgo/go/os/path_unix.go | 18 +- libgo/go/os/pipe_test.go | 30 +- libgo/go/os/proc.go | 2 + libgo/go/os/removeall_at.go | 48 +- libgo/go/os/removeall_noat.go | 40 +- libgo/go/os/removeall_test.go | 61 +- libgo/go/os/signal/internal/pty/pty.go | 2 + libgo/go/os/signal/signal_cgo_test.go | 11 + libgo/go/os/sticky_bsd.go | 2 +- libgo/go/os/sticky_notbsd.go | 1 + libgo/go/os/timeout_test.go | 4 +- libgo/go/os/types_windows.go | 15 + libgo/go/os/user/lookup_stubs.go | 22 +- libgo/go/os/user/user_test.go | 2 +- libgo/go/path/filepath/example_unix_test.go | 71 + libgo/go/path/filepath/path_test.go | 10 - libgo/go/path/filepath/symlink.go | 3 +- libgo/go/path/filepath/symlink_unix.go | 9 - libgo/go/path/filepath/symlink_windows.go | 99 +- libgo/go/plugin/plugin_dlopen.go | 16 +- libgo/go/reflect/all_test.go | 276 +- libgo/go/reflect/makefunc_ffi.go | 11 +- libgo/go/reflect/swapper.go | 2 +- libgo/go/reflect/type.go | 81 +- libgo/go/reflect/value.go | 85 +- libgo/go/regexp/all_test.go | 47 + libgo/go/regexp/exec.go | 4 + libgo/go/regexp/exec_test.go | 1 + libgo/go/regexp/find_test.go | 20 +- libgo/go/regexp/onepass_test.go | 10 - libgo/go/regexp/regexp.go | 53 +- libgo/go/regexp/syntax/parse_test.go | 1 + libgo/go/regexp/syntax/regexp.go | 2 +- libgo/go/runtime/alg.go | 22 + libgo/go/runtime/auxv_none.go | 1 + libgo/go/runtime/cgocall.go | 4 +- libgo/go/runtime/cgocheck.go | 6 +- libgo/go/runtime/chan.go | 16 +- libgo/go/runtime/cpuprof.go | 2 +- libgo/go/runtime/crash_cgo_test.go | 6 +- libgo/go/runtime/crash_unix_test.go | 8 +- libgo/go/runtime/debug.go | 11 + libgo/go/runtime/debug/mod.go | 12 +- libgo/go/runtime/debuglog.go | 813 ++ libgo/go/runtime/debuglog_off.go | 19 + libgo/go/runtime/debuglog_on.go | 45 + libgo/go/runtime/debuglog_test.go | 158 + libgo/go/runtime/export_debuglog_test.go | 46 + libgo/go/runtime/export_mmap_test.go | 2 + libgo/go/runtime/export_test.go | 182 +- libgo/go/runtime/extern.go | 3 + libgo/go/runtime/gc_test.go | 19 + libgo/go/runtime/heapdump.go | 2 +- libgo/go/runtime/iface.go | 10 + .../go/runtime/internal/atomic/atomic_test.go | 10 +- libgo/go/runtime/lock_js.go | 18 +- libgo/go/runtime/lock_sema.go | 10 +- libgo/go/runtime/malloc.go | 113 +- libgo/go/runtime/map.go | 212 +- libgo/go/runtime/map_fast32.go | 46 +- libgo/go/runtime/map_fast64.go | 46 +- libgo/go/runtime/map_faststr.go | 51 +- libgo/go/runtime/mbarrier.go | 19 +- libgo/go/runtime/mbitmap.go | 5 +- libgo/go/runtime/mcache.go | 11 +- libgo/go/runtime/mcentral.go | 8 +- libgo/go/runtime/mem_gccgo.go | 47 +- libgo/go/runtime/memmove_test.go | 6 + libgo/go/runtime/mfinal.go | 2 +- libgo/go/runtime/mgc.go | 125 +- libgo/go/runtime/mgclarge.go | 519 +- libgo/go/runtime/mgcscavenge.go | 367 + libgo/go/runtime/mgcsweep.go | 1 - libgo/go/runtime/mheap.go | 471 +- libgo/go/runtime/mksizeclasses.go | 4 +- libgo/go/runtime/mstats.go | 3 + libgo/go/runtime/netpoll.go | 18 +- libgo/go/runtime/netpoll_aix.go | 43 +- libgo/go/runtime/netpoll_epoll.go | 5 +- libgo/go/runtime/netpoll_kqueue.go | 7 +- libgo/go/runtime/netpoll_solaris.go | 5 + libgo/go/runtime/os_darwin.go | 2 +- libgo/go/runtime/os_freebsd.go | 2 +- libgo/go/runtime/os_hurd.go | 3 +- libgo/go/runtime/os_linux.go | 17 +- libgo/go/runtime/os_netbsd.go | 4 +- libgo/go/runtime/os_netbsd_arm64.go | 24 + libgo/go/runtime/os_openbsd.go | 5 +- libgo/go/runtime/os_openbsd_arm64.go | 24 + libgo/go/runtime/os_solaris.go | 3 +- libgo/go/runtime/panic.go | 17 +- .../runtime/pprof/internal/profile/profile.go | 4 +- libgo/go/runtime/pprof/label.go | 2 + libgo/go/runtime/pprof/pprof_test.go | 31 +- libgo/go/runtime/pprof/proto_test.go | 8 +- .../pprof/testdata/mappingtest/main.go | 2 +- libgo/go/runtime/proc.go | 320 +- libgo/go/runtime/proc_test.go | 67 + libgo/go/runtime/runtime-lldb_test.go | 9 +- libgo/go/runtime/runtime1.go | 1 + libgo/go/runtime/runtime2.go | 85 +- libgo/go/runtime/runtime_mmap_test.go | 2 + libgo/go/runtime/runtime_test.go | 12 + libgo/go/runtime/sema.go | 28 +- libgo/go/runtime/semasleep_test.go | 41 +- libgo/go/runtime/signal_sighandler.go | 2 + libgo/go/runtime/signal_unix.go | 23 +- libgo/go/runtime/sizeclasses.go | 2 +- libgo/go/runtime/slice.go | 6 +- libgo/go/runtime/stack_test.go | 813 +- libgo/go/runtime/string.go | 2 + libgo/go/runtime/stubs.go | 22 - libgo/go/runtime/symtab.go | 31 - .../go/runtime/testdata/testprog/deadlock.go | 4 + libgo/go/runtime/testdata/testprog/gc.go | 99 +- libgo/go/runtime/testdata/testprog/sleep.go | 17 + .../testdata/testprogcgo/dll_windows.go | 2 +- .../runtime/testdata/testprogcgo/sigstack.go | 15 +- libgo/go/runtime/trace/trace_test.go | 25 +- libgo/go/runtime/treap_test.go | 270 + libgo/go/runtime/type.go | 4 +- libgo/go/runtime/typekind.go | 1 - libgo/go/runtime/unaligned1.go | 17 - libgo/go/runtime/unaligned2.go | 20 - libgo/go/runtime/write_err_android.go | 2 +- libgo/go/sort/slice.go | 14 +- libgo/go/sort/slice_go113.go | 12 + libgo/go/sort/slice_go14.go | 22 + libgo/go/sort/slice_go18.go | 12 + libgo/go/sort/sort_test.go | 10 +- libgo/go/strconv/atof.go | 230 +- libgo/go/strconv/atof_test.go | 213 + libgo/go/strconv/atoi.go | 109 +- libgo/go/strconv/atoi_test.go | 120 +- libgo/go/strconv/example_test.go | 29 + libgo/go/strconv/extfloat.go | 15 +- libgo/go/strconv/ftoa.go | 161 +- libgo/go/strconv/ftoa_test.go | 31 +- libgo/go/strconv/isprint.go | 94 +- libgo/go/strconv/quote.go | 12 +- libgo/go/strconv/strconv_test.go | 10 + libgo/go/strings/example_test.go | 6 +- libgo/go/strings/replace.go | 2 + libgo/go/strings/strings.go | 147 +- libgo/go/strings/strings_test.go | 145 +- libgo/go/sync/export_test.go | 42 + libgo/go/sync/mutex.go | 18 +- libgo/go/sync/mutex_test.go | 2 +- libgo/go/sync/once.go | 16 +- libgo/go/sync/pool.go | 136 +- libgo/go/sync/pool_test.go | 180 +- libgo/go/sync/poolqueue.go | 309 + libgo/go/sync/runtime.go | 8 +- libgo/go/sync/runtime_sema_test.go | 6 +- libgo/go/sync/rwmutex.go | 29 +- libgo/go/sync/waitgroup.go | 2 +- libgo/go/syscall/dirent_bsd_test.go | 71 +- libgo/go/syscall/exec_bsd.go | 40 +- libgo/go/syscall/exec_darwin.go | 36 +- libgo/go/syscall/exec_linux.go | 194 +- libgo/go/syscall/exec_linux_test.go | 123 +- libgo/go/syscall/exec_unix.go | 28 +- libgo/go/syscall/exec_windows.go | 14 +- libgo/go/syscall/fs_js.go | 47 +- libgo/go/syscall/getdirentries_test.go | 85 + libgo/go/syscall/js/js.go | 102 +- libgo/go/syscall/js/js_test.go | 157 +- libgo/go/syscall/js/typedarray.go | 104 - libgo/go/syscall/sockcmsg_unix.go | 9 +- libgo/go/syscall/socket.go | 6 +- libgo/go/syscall/syscall_errno.go | 18 + libgo/go/syscall/syscall_js.go | 64 +- libgo/go/syscall/syscall_linux_s390x.go | 4 +- libgo/go/syscall/syscall_netbsd_arm64.go | 31 + libgo/go/syscall/syscall_openbsd_arm64.go | 38 + libgo/go/syscall/syscall_ptrace_test.go | 37 + libgo/go/syscall/syscall_unix.go | 6 +- libgo/go/syscall/syscall_unix_test.go | 31 +- libgo/go/testing/benchmark.go | 232 +- libgo/go/testing/benchmark_test.go | 122 +- libgo/go/testing/cover.go | 3 +- libgo/go/testing/example.go | 92 +- libgo/go/testing/export_test.go | 5 +- libgo/go/testing/internal/testdeps/deps.go | 1 - libgo/go/testing/quick/quick.go | 3 +- libgo/go/testing/quick/quick_test.go | 2 +- libgo/go/testing/run_example.go | 64 + libgo/go/testing/run_example_js.go | 74 + libgo/go/testing/sub_test.go | 5 +- libgo/go/testing/testing.go | 126 +- libgo/go/text/scanner/scanner.go | 282 +- libgo/go/text/scanner/scanner_test.go | 282 +- libgo/go/text/tabwriter/tabwriter.go | 26 +- libgo/go/text/tabwriter/tabwriter_test.go | 24 + libgo/go/text/template/doc.go | 5 + libgo/go/text/template/exec.go | 34 +- libgo/go/text/template/exec_test.go | 129 +- libgo/go/text/template/funcs.go | 97 +- libgo/go/text/template/helper.go | 15 +- libgo/go/text/template/parse/lex.go | 90 +- libgo/go/text/template/parse/lex_test.go | 12 +- libgo/go/text/template/parse/node.go | 2 +- libgo/go/text/template/parse/parse_test.go | 13 + libgo/go/text/template/template.go | 4 + libgo/go/time/example_test.go | 22 +- libgo/go/time/export_test.go | 57 + libgo/go/time/format.go | 112 +- libgo/go/time/format_test.go | 112 + libgo/go/time/time.go | 43 +- libgo/go/time/time_test.go | 69 +- libgo/go/time/zoneinfo_ios.go | 35 +- libgo/go/time/zoneinfo_read.go | 104 +- libgo/go/time/zoneinfo_test.go | 31 + libgo/go/unicode/letter.go | 3 - libgo/go/unicode/script_test.go | 180 - libgo/go/unicode/tables.go | 1748 ++-- libgo/go/unicode/utf8/utf8.go | 43 +- libgo/goarch.sh | 10 - libgo/gotool-packages.txt | 8 +- libgo/libgo-packages.txt | 44 +- libgo/match.sh | 4 +- libgo/misc/cgo/errors/errors_test.go | 15 +- libgo/misc/cgo/errors/ptr_test.go | 493 +- libgo/misc/cgo/errors/src/err1.go | 18 - libgo/misc/cgo/errors/src/err2.go | 13 - libgo/misc/cgo/errors/src/err3.go | 18 - libgo/misc/cgo/errors/src/issue13129.go | 14 - libgo/misc/cgo/errors/src/issue13423.go | 12 - libgo/misc/cgo/errors/src/issue13467.go | 15 - libgo/misc/cgo/errors/src/issue13635.go | 24 - libgo/misc/cgo/errors/src/issue13830.go | 26 - libgo/misc/cgo/errors/src/issue16116.go | 12 - libgo/misc/cgo/errors/src/issue16591.go | 17 - libgo/misc/cgo/errors/src/issue26745.go | 17 - libgo/misc/cgo/errors/src/issue7757.go | 14 - libgo/misc/cgo/errors/src/issue8442.go | 17 - libgo/misc/cgo/errors/testdata/err1.go | 22 + libgo/misc/cgo/errors/testdata/err2.go | 102 + .../misc/cgo/errors/{src => testdata}/err4.go | 0 .../errors/{src => testdata}/issue11097a.go | 0 .../errors/{src => testdata}/issue11097b.go | 0 .../errors/{src => testdata}/issue14669.go | 0 .../errors/{src => testdata}/issue18452.go | 0 .../errors/{src => testdata}/issue18889.go | 0 .../errors/{src => testdata}/issue28069.go | 0 .../errors/{src => testdata}/issue28721.go | 0 .../{src => testdata}/long_double_size.go | 0 .../cgo/errors/{src => testdata}/malloc.go | 0 libgo/misc/cgo/fortran/test.bash | 7 +- libgo/misc/cgo/life/life.go | 41 - libgo/misc/cgo/life/life_test.go | 64 + libgo/misc/cgo/life/main.go | 49 - libgo/misc/cgo/life/overlaydir_test.go | 81 + libgo/misc/cgo/life/{ => testdata}/c-life.c | 0 libgo/misc/cgo/life/testdata/life.go | 41 + libgo/misc/cgo/life/{ => testdata}/life.h | 0 libgo/misc/cgo/life/testdata/main.go | 49 + libgo/misc/cgo/life/{ => testdata}/main.out | 0 libgo/misc/cgo/stdio/chain.go | 48 - libgo/misc/cgo/stdio/fib.go | 52 - libgo/misc/cgo/stdio/hello.go | 15 - libgo/misc/cgo/stdio/overlaydir_test.go | 81 + libgo/misc/cgo/stdio/stdio_test.go | 64 + libgo/misc/cgo/stdio/testdata/chain.go | 48 + libgo/misc/cgo/stdio/{ => testdata}/chain.out | 0 libgo/misc/cgo/stdio/testdata/fib.go | 52 + libgo/misc/cgo/stdio/{ => testdata}/fib.out | 0 libgo/misc/cgo/stdio/testdata/hello.go | 15 + libgo/misc/cgo/stdio/{ => testdata}/hello.out | 0 libgo/misc/cgo/stdio/{ => testdata}/run.out | 0 .../cgo/stdio/{ => testdata/stdio}/file.go | 0 .../cgo/stdio/{ => testdata/stdio}/stdio.go | 0 libgo/misc/cgo/test/align.go | 76 - libgo/misc/cgo/test/api.go | 30 - libgo/misc/cgo/test/basic.go | 181 - libgo/misc/cgo/test/callback.go | 6 +- libgo/misc/cgo/test/cflags.go | 32 - libgo/misc/cgo/test/cgo_linux_test.go | 13 +- libgo/misc/cgo/test/cgo_stubs_android_test.go | 1 - libgo/misc/cgo/test/cgo_test.go | 97 +- libgo/misc/cgo/test/checkconst.go | 33 - libgo/misc/cgo/test/complex.go | 24 - libgo/misc/cgo/test/cthread.go | 44 - libgo/misc/cgo/test/duplicate_symbol.go | 21 - libgo/misc/cgo/test/env.go | 41 - libgo/misc/cgo/test/exports.go | 18 - libgo/misc/cgo/test/fpvar.go | 50 - libgo/misc/cgo/test/gcc68255.go | 17 - libgo/misc/cgo/test/helpers.go | 35 - libgo/misc/cgo/test/issue10303.go | 76 - libgo/misc/cgo/test/issue11925.go | 37 - libgo/misc/cgo/test/issue12030.go | 35 - libgo/misc/cgo/test/issue1222.go | 29 - libgo/misc/cgo/test/issue1328.go | 30 - libgo/misc/cgo/test/issue13402.go | 10 - libgo/misc/cgo/test/issue13930.go | 13 - libgo/misc/cgo/test/issue14838.go | 37 - libgo/misc/cgo/test/issue1560.go | 50 - libgo/misc/cgo/test/issue1635.go | 38 - libgo/misc/cgo/test/issue17065.go | 29 - libgo/misc/cgo/test/issue17537.go | 58 - libgo/misc/cgo/test/issue18126.go | 26 - libgo/misc/cgo/test/issue18146.go | 6 +- libgo/misc/cgo/test/issue18720.go | 54 - libgo/misc/cgo/test/issue20129.go | 33 - libgo/misc/cgo/test/issue20369.go | 20 - libgo/misc/cgo/test/issue20910.go | 19 - libgo/misc/cgo/test/issue21668.go | 13 - libgo/misc/cgo/test/issue21708.go | 16 - libgo/misc/cgo/test/issue21809.go | 45 - libgo/misc/cgo/test/issue22958.go | 24 - libgo/misc/cgo/test/issue23356.go | 19 - libgo/misc/cgo/test/issue23555.go | 11 - libgo/misc/cgo/test/issue23720.go | 22 - libgo/misc/cgo/test/issue24161_darwin_test.go | 39 - libgo/misc/cgo/test/issue24206.go | 54 - libgo/misc/cgo/test/issue24206_generic.go | 13 - libgo/misc/cgo/test/issue2462.go | 102 - libgo/misc/cgo/test/issue25143.go | 22 - libgo/misc/cgo/test/issue26066.go | 19 - libgo/misc/cgo/test/issue26430.go | 10 - libgo/misc/cgo/test/issue26517.go | 23 - libgo/misc/cgo/test/issue26743.go | 10 - libgo/misc/cgo/test/issue27340.go | 12 - libgo/misc/cgo/test/issue28545.go | 26 - libgo/misc/cgo/test/issue28772.go | 12 - libgo/misc/cgo/test/issue28896.go | 83 - libgo/misc/cgo/test/issue29383.go | 19 - libgo/misc/cgo/test/issue29748.go | 22 - libgo/misc/cgo/test/issue29781.go | 17 - libgo/misc/cgo/test/issue30065.go | 38 - libgo/misc/cgo/test/issue3250.go | 95 - libgo/misc/cgo/test/issue3250w.go | 11 - libgo/misc/cgo/test/issue3261.go | 49 - libgo/misc/cgo/test/issue3729.go | 47 - libgo/misc/cgo/test/issue3729w.go | 16 - libgo/misc/cgo/test/issue3741.go | 22 - libgo/misc/cgo/test/issue3775.go | 39 - libgo/misc/cgo/test/issue3945.go | 22 - libgo/misc/cgo/test/issue4054a.go | 23 - libgo/misc/cgo/test/issue4054b.go | 23 - libgo/misc/cgo/test/issue4339.go | 17 - libgo/misc/cgo/test/issue4417.go | 42 - libgo/misc/cgo/test/issue4857.go | 15 - libgo/misc/cgo/test/issue5227.go | 38 - libgo/misc/cgo/test/issue5242.go | 31 - libgo/misc/cgo/test/issue5337.go | 31 - libgo/misc/cgo/test/issue5337w.go | 11 - libgo/misc/cgo/test/issue5548.go | 27 - libgo/misc/cgo/test/issue5603.go | 32 - libgo/misc/cgo/test/issue5740.go | 15 - libgo/misc/cgo/test/issue5986.go | 33 - libgo/misc/cgo/test/issue6128.go | 20 - libgo/misc/cgo/test/issue6390.go | 23 - libgo/misc/cgo/test/issue6472.go | 22 - libgo/misc/cgo/test/issue6506.go | 36 - libgo/misc/cgo/test/issue6612.go | 90 - libgo/misc/cgo/test/issue6833.go | 27 - libgo/misc/cgo/test/issue6907.go | 33 - libgo/misc/cgo/test/issue6907export.go | 30 - libgo/misc/cgo/test/issue7560.go | 44 - libgo/misc/cgo/test/issue7665.go | 25 - libgo/misc/cgo/test/issue7786.go | 51 - libgo/misc/cgo/test/issue7978.go | 115 - libgo/misc/cgo/test/issue8092.go | 36 - libgo/misc/cgo/test/issue8331a.go | 15 - libgo/misc/cgo/test/issue8331b.go | 13 - libgo/misc/cgo/test/issue8428.go | 55 - libgo/misc/cgo/test/issue8441.go | 27 - libgo/misc/cgo/test/issue8756.go | 17 - libgo/misc/cgo/test/issue8811.go | 22 - libgo/misc/cgo/test/issue8828.go | 16 - libgo/misc/cgo/test/issue9026.go | 9 - libgo/misc/cgo/test/issue9400_linux.go | 58 - libgo/misc/cgo/test/issue9510.go | 24 - libgo/misc/cgo/test/issue9557.go | 36 - libgo/misc/cgo/test/overlaydir_test.go | 81 + libgo/misc/cgo/test/pkg_test.go | 69 + libgo/misc/cgo/test/sigaltstack.go | 2 +- libgo/misc/cgo/test/test.go | 2104 +++++ libgo/misc/cgo/test/test22906.go | 74 - libgo/misc/cgo/test/test26213.go | 15 - libgo/misc/cgo/test/test27660.go | 61 - libgo/misc/cgo/test/test_unix.go | 11 + libgo/misc/cgo/test/test_windows.go | 9 + .../misc/cgo/test/testdata/cgo_linux_test.go | 9 + libgo/misc/cgo/test/testdata/cgo_test.go | 18 + libgo/misc/cgo/test/testdata/gcc68255.go | 17 + .../cgo/test/{ => testdata}/gcc68255/a.go | 0 .../misc/cgo/test/{ => testdata}/gcc68255/c.c | 0 .../misc/cgo/test/{ => testdata}/gcc68255/c.h | 0 .../cgo/test/{ => testdata}/issue20266.go | 0 .../{ => testdata}/issue20266/issue20266.h | 0 libgo/misc/cgo/test/testdata/issue23555.go | 11 + .../cgo/test/{ => testdata}/issue23555a/a.go | 0 .../cgo/test/{ => testdata}/issue23555b/a.go | 0 .../test/testdata/issue24161_darwin_test.go | 39 + .../test/{ => testdata}/issue24161arg/def.go | 0 .../test/{ => testdata}/issue24161arg/use.go | 0 .../test/{ => testdata}/issue24161e0/main.go | 0 .../test/{ => testdata}/issue24161e1/main.go | 0 .../test/{ => testdata}/issue24161e2/main.go | 0 .../{ => testdata}/issue24161res/restype.go | 0 .../cgo/test/{ => testdata}/issue26213/jni.h | 0 .../{ => testdata}/issue26213/test26213.go | 0 libgo/misc/cgo/test/testdata/issue26430.go | 10 + .../cgo/test/{ => testdata}/issue26430/a.go | 0 .../cgo/test/{ => testdata}/issue26430/b.go | 0 libgo/misc/cgo/test/testdata/issue26743.go | 10 + .../cgo/test/{ => testdata}/issue26743/a.go | 0 .../cgo/test/{ => testdata}/issue26743/b.go | 0 .../cgo/test/{ => testdata}/issue27054/egl.h | 0 .../{ => testdata}/issue27054/test27054.go | 0 libgo/misc/cgo/test/testdata/issue27340.go | 12 + .../cgo/test/{ => testdata}/issue27340/a.go | 0 libgo/misc/cgo/test/testdata/issue29563.go | 12 + .../misc/cgo/test/testdata/issue29563/weak.go | 13 + .../misc/cgo/test/testdata/issue29563/weak1.c | 11 + .../misc/cgo/test/testdata/issue29563/weak2.c | 11 + libgo/misc/cgo/test/testdata/issue8756.go | 17 + .../{ => testdata}/issue8756/issue8756.go | 0 libgo/misc/cgo/test/testdata/issue8828.go | 16 + .../test/{ => testdata}/issue8828/issue8828.c | 0 .../test/{ => testdata}/issue8828/trivial.go | 0 libgo/misc/cgo/test/testdata/issue9026.go | 9 + .../{ => testdata}/issue9026/issue9026.go | 0 .../test/{ => testdata}/issue9400/asm_386.s | 0 .../{ => testdata}/issue9400/asm_amd64x.s | 0 .../test/{ => testdata}/issue9400/asm_arm.s | 0 .../test/{ => testdata}/issue9400/asm_arm64.s | 0 .../{ => testdata}/issue9400/asm_mips64x.s | 0 .../test/{ => testdata}/issue9400/asm_mipsx.s | 0 .../{ => testdata}/issue9400/asm_ppc64x.s | 0 .../test/{ => testdata}/issue9400/asm_s390x.s | 0 .../test/{ => testdata}/issue9400/gccgo.go | 0 .../test/{ => testdata}/issue9400/stubs.go | 0 .../misc/cgo/test/testdata/issue9400_linux.go | 58 + libgo/misc/cgo/test/testdata/issue9510.go | 24 + .../cgo/test/{ => testdata}/issue9510a/a.go | 0 .../cgo/test/{ => testdata}/issue9510b/b.go | 0 libgo/misc/cgo/test/testdata/test26213.go | 15 + libgo/misc/cgo/test/testx.go | 519 ++ libgo/misc/cgo/test/twoargs.go | 22 - libgo/misc/cgo/testcarchive/carchive_test.go | 171 +- libgo/misc/cgo/testcarchive/main4.c | 197 - libgo/misc/cgo/testcarchive/main5.c | 98 - .../misc/cgo/testcarchive/overlaydir_test.go | 81 + .../misc/cgo/testcarchive/src/libgo/libgo.go | 53 - .../cgo/testcarchive/testdata/libgo/libgo.go | 53 + .../{src => testdata}/libgo2/libgo2.go | 0 .../{src => testdata}/libgo3/libgo3.go | 0 .../{src => testdata}/libgo4/libgo4.go | 0 .../{src => testdata}/libgo6/sigprof.go | 0 .../cgo/testcarchive/{ => testdata}/main.c | 0 .../cgo/testcarchive/{ => testdata}/main2.c | 0 .../cgo/testcarchive/{ => testdata}/main3.c | 0 libgo/misc/cgo/testcarchive/testdata/main4.c | 204 + libgo/misc/cgo/testcarchive/testdata/main5.c | 100 + .../cgo/testcarchive/{ => testdata}/main6.c | 0 .../testcarchive/{ => testdata}/main_unix.c | 0 .../{ => testdata}/main_windows.c | 0 .../cgo/testcarchive/{src => testdata}/p/p.go | 0 libgo/misc/cgo/testcshared/cshared_test.go | 170 +- libgo/misc/cgo/testcshared/overlaydir_test.go | 81 + libgo/misc/cgo/testcshared/src/libgo/libgo.go | 46 - libgo/misc/cgo/testcshared/src/libgo2/dup2.go | 13 - libgo/misc/cgo/testcshared/src/libgo2/dup3.go | 13 - .../{src => testdata}/go2c2go/go/shlib.go | 0 .../{src => testdata}/go2c2go/m1/c.c | 0 .../{src => testdata}/go2c2go/m1/main.go | 0 .../{src => testdata}/go2c2go/m2/main.go | 0 .../cgo/testcshared/testdata/libgo/libgo.go | 46 + .../cgo/testcshared/testdata/libgo2/dup2.go | 13 + .../cgo/testcshared/testdata/libgo2/dup3.go | 13 + .../{src => testdata}/libgo2/libgo2.go | 0 .../{src => testdata}/libgo4/libgo4.go | 0 .../{src => testdata}/libgo5/libgo5.go | 0 .../cgo/testcshared/{ => testdata}/main0.c | 0 .../cgo/testcshared/{ => testdata}/main1.c | 0 .../cgo/testcshared/{ => testdata}/main2.c | 0 .../cgo/testcshared/{ => testdata}/main3.c | 0 .../cgo/testcshared/{ => testdata}/main4.c | 0 .../cgo/testcshared/{ => testdata}/main5.c | 0 .../cgo/testcshared/{src => testdata}/p/p.go | 0 libgo/misc/cgo/testgodefs/test.bash | 4 +- .../testgodefs/{ => testdata}/anonunion.go | 0 .../testgodefs/{ => testdata}/fieldtypedef.go | 0 .../testgodefs/{ => testdata}/issue8478.go | 0 .../cgo/testgodefs/{ => testdata}/main.go | 0 .../altpath/src/plugin-mismatch/main.go | 17 - .../{src => testdata}/common/common.go | 0 .../altpath/testdata/plugin-mismatch/main.go | 17 + libgo/misc/cgo/testplugin/overlaydir_test.go | 81 + libgo/misc/cgo/testplugin/plugin_test.go | 203 + libgo/misc/cgo/testplugin/src/host/host.go | 176 - libgo/misc/cgo/testplugin/src/iface/main.go | 46 - libgo/misc/cgo/testplugin/src/iface_a/a.go | 17 - libgo/misc/cgo/testplugin/src/iface_b/b.go | 17 - .../cgo/testplugin/src/issue18676/main.go | 31 - .../cgo/testplugin/src/issue18676/plugin.go | 11 - .../cgo/testplugin/src/plugin1/plugin1.go | 56 - .../cgo/testplugin/src/plugin2/plugin2.go | 43 - .../cgo/testplugin/src/sub/plugin1/plugin1.go | 23 - libgo/misc/cgo/testplugin/test.bash | 109 - .../{src => testdata}/checkdwarf/main.go | 0 .../{src => testdata}/common/common.go | 0 .../misc/cgo/testplugin/testdata/host/host.go | 176 + .../cgo/testplugin/testdata/iface/main.go | 47 + .../misc/cgo/testplugin/testdata/iface_a/a.go | 17 + .../misc/cgo/testplugin/testdata/iface_b/b.go | 17 + .../testplugin/{src => testdata}/iface_i/i.go | 0 .../{src => testdata}/issue18584/main.go | 0 .../{src => testdata}/issue18584/plugin.go | 0 .../dynamodbstreamsevt/definition.go | 0 .../testplugin/testdata/issue18676/main.go | 31 + .../testplugin/testdata/issue18676/plugin.go | 11 + .../{src => testdata}/issue19418/main.go | 0 .../{src => testdata}/issue19418/plugin.go | 0 .../{src => testdata}/issue19529/plugin.go | 0 .../{src => testdata}/issue19534/main.go | 0 .../{src => testdata}/issue19534/plugin.go | 0 .../{src => testdata}/issue22175/main.go | 0 .../{src => testdata}/issue22175/plugin1.go | 0 .../{src => testdata}/issue22175/plugin2.go | 0 .../{src => testdata}/issue22295.pkg/main.go | 0 .../issue22295.pkg/plugin.go | 0 .../{src => testdata}/issue24351/main.go | 0 .../{src => testdata}/issue24351/plugin.go | 0 .../{src => testdata}/issue25756/main.go | 0 .../issue25756/plugin/c-life.c | 0 .../issue25756/plugin/life.go | 0 .../issue25756/plugin/life.h | 0 .../testplugin/testdata/plugin1/plugin1.go | 57 + .../testplugin/testdata/plugin2/plugin2.go | 44 + .../testdata/sub/plugin1/plugin1.go | 23 + .../cgo/testplugin/testdata/unnamed1/main.go | 25 + .../cgo/testplugin/testdata/unnamed2/main.go | 23 + libgo/misc/cgo/testplugin/unnamed1/main.go | 23 - libgo/misc/cgo/testplugin/unnamed2/main.go | 21 - libgo/misc/cgo/testsanitizers/cc_test.go | 2 +- .../testsanitizers/{src => testdata}/msan.go | 0 .../testsanitizers/{src => testdata}/msan2.go | 0 .../{src => testdata}/msan2_cmsan.go | 0 .../testsanitizers/{src => testdata}/msan3.go | 0 .../testsanitizers/{src => testdata}/msan4.go | 0 .../testsanitizers/{src => testdata}/msan5.go | 0 .../testsanitizers/{src => testdata}/msan6.go | 0 .../{src => testdata}/msan_fail.go | 0 .../{src => testdata}/msan_shared.go | 0 .../testsanitizers/{src => testdata}/tsan.go | 0 .../{src => testdata}/tsan10.go | 0 .../{src => testdata}/tsan11.go | 0 .../{src => testdata}/tsan12.go | 0 .../testsanitizers/{src => testdata}/tsan2.go | 0 .../testsanitizers/{src => testdata}/tsan3.go | 0 .../testsanitizers/{src => testdata}/tsan4.go | 0 .../testsanitizers/{src => testdata}/tsan5.go | 0 .../testsanitizers/{src => testdata}/tsan6.go | 0 .../testsanitizers/{src => testdata}/tsan7.go | 0 .../testsanitizers/{src => testdata}/tsan8.go | 0 .../testsanitizers/{src => testdata}/tsan9.go | 0 .../{src => testdata}/tsan_shared.go | 0 libgo/misc/cgo/testsanitizers/tsan_test.go | 4 - libgo/misc/cgo/testshared/overlaydir_test.go | 81 + libgo/misc/cgo/testshared/shared_test.go | 340 +- libgo/misc/cgo/testshared/src/dep2/dep2.go | 15 - libgo/misc/cgo/testshared/src/dep3/dep3.go | 22 - libgo/misc/cgo/testshared/src/exe/exe.go | 44 - libgo/misc/cgo/testshared/src/exe2/exe2.go | 8 - libgo/misc/cgo/testshared/src/exe3/exe3.go | 7 - .../cgo/testshared/src/explicit/explicit.go | 9 - libgo/misc/cgo/testshared/src/global/main.go | 71 - libgo/misc/cgo/testshared/src/iface/main.go | 17 - libgo/misc/cgo/testshared/src/iface_a/a.go | 17 - libgo/misc/cgo/testshared/src/iface_b/b.go | 17 - .../testshared/src/implicitcmd/implicitcmd.go | 10 - .../misc/cgo/testshared/testdata/dep2/dep2.go | 15 + .../misc/cgo/testshared/testdata/dep3/dep3.go | 22 + .../{src => testdata}/depBase/asm.s | 0 .../{src => testdata}/depBase/dep.go | 0 .../{src => testdata}/depBase/gccgo.go | 0 .../{src => testdata}/depBase/stubs.go | 0 .../{src => testdata}/division/division.go | 0 libgo/misc/cgo/testshared/testdata/exe/exe.go | 45 + .../misc/cgo/testshared/testdata/exe2/exe2.go | 8 + .../misc/cgo/testshared/testdata/exe3/exe3.go | 7 + .../{src => testdata}/execgo/exe.go | 0 .../testshared/testdata/explicit/explicit.go | 9 + .../cgo/testshared/testdata/global/main.go | 71 + .../{src => testdata}/globallib/global.go | 0 .../cgo/testshared/testdata/iface/main.go | 17 + .../misc/cgo/testshared/testdata/iface_a/a.go | 17 + .../misc/cgo/testshared/testdata/iface_b/b.go | 17 + .../testshared/{src => testdata}/iface_i/i.go | 0 .../{src => testdata}/implicit/implicit.go | 0 .../testdata/implicitcmd/implicitcmd.go | 10 + .../{src => testdata}/issue25065/a.go | 0 .../{src => testdata}/trivial/trivial.go | 0 libgo/misc/cgo/testso/cgoso.c | 14 - libgo/misc/cgo/testso/cgoso.go | 31 - libgo/misc/cgo/testso/cgoso_c.c | 30 - libgo/misc/cgo/testso/cgoso_unix.go | 20 - libgo/misc/cgo/testso/main.go | 13 - libgo/misc/cgo/testso/noso_test.go | 9 + libgo/misc/cgo/testso/overlaydir_test.go | 81 + libgo/misc/cgo/testso/so_test.go | 140 + libgo/misc/cgo/testso/testdata/cgoso.c | 14 + libgo/misc/cgo/testso/testdata/cgoso.go | 32 + libgo/misc/cgo/testso/testdata/cgoso_c.c | 39 + libgo/misc/cgo/testso/testdata/cgoso_unix.go | 20 + libgo/misc/cgo/testso/testdata/main.go | 13 + libgo/misc/cgo/testsovar/cgoso.go | 43 - libgo/misc/cgo/testsovar/main.go | 13 - libgo/misc/cgo/testsovar/noso_test.go | 9 + libgo/misc/cgo/testsovar/overlaydir_test.go | 81 + libgo/misc/cgo/testsovar/so_test.go | 140 + libgo/misc/cgo/testsovar/testdata/cgoso.go | 44 + .../cgo/testsovar/{ => testdata}/cgoso_c.c | 0 .../cgo/testsovar/{ => testdata}/cgoso_c.h | 0 libgo/misc/cgo/testsovar/testdata/main.go | 13 + libgo/mkrsysinfo.sh | 8 +- libgo/runtime/go-fieldtrack.c | 15 - libgo/runtime/panic.c | 41 +- libgo/runtime/runtime.h | 16 + libgo/runtime/runtime_c.c | 32 + libgo/testsuite/gotest | 4 +- 1843 files changed, 122494 insertions(+), 63545 deletions(-) create mode 100644 libgo/go/cmd/go/init_test.go create mode 100644 libgo/go/cmd/go/internal/auth/auth.go create mode 100644 libgo/go/cmd/go/internal/auth/netrc.go create mode 100644 libgo/go/cmd/go/internal/auth/netrc_test.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/android/a_android.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/android/b_android_arm64.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/android/c_linux.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/android/d_linux_arm64.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/android/e.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/android/f.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/android/g.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/illumos/a_illumos.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/illumos/b_illumos_amd64.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/illumos/c_solaris.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/illumos/d_solaris_amd64.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/illumos/e.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/illumos/f.go create mode 100644 libgo/go/cmd/go/internal/imports/testdata/illumos/g.go rename libgo/go/cmd/go/internal/imports/testdata/{import1 => star}/x.go (100%) rename libgo/go/cmd/go/internal/imports/testdata/{import1 => star}/x1.go (100%) rename libgo/go/cmd/go/internal/imports/testdata/{import1 => star}/x_darwin.go (100%) rename libgo/go/cmd/go/internal/imports/testdata/{import1 => star}/x_windows.go (100%) create mode 100644 libgo/go/cmd/go/internal/load/pkg_test.go create mode 100644 libgo/go/cmd/go/internal/modfetch/bootstrap.go create mode 100644 libgo/go/cmd/go/internal/modfetch/key.go delete mode 100644 libgo/go/cmd/go/internal/modfetch/noweb.go create mode 100644 libgo/go/cmd/go/internal/modfetch/sumdb.go delete mode 100644 libgo/go/cmd/go/internal/modfetch/web.go delete mode 100644 libgo/go/cmd/go/internal/modload/init_test.go create mode 100644 libgo/go/cmd/go/internal/note/example_test.go create mode 100644 libgo/go/cmd/go/internal/note/note.go create mode 100644 libgo/go/cmd/go/internal/note/note_test.go create mode 100644 libgo/go/cmd/go/internal/renameio/renameio_test.go create mode 100644 libgo/go/cmd/go/internal/renameio/umask_test.go create mode 100644 libgo/go/cmd/go/internal/robustio/robustio.go create mode 100644 libgo/go/cmd/go/internal/robustio/robustio_other.go create mode 100644 libgo/go/cmd/go/internal/robustio/robustio_windows.go create mode 100644 libgo/go/cmd/go/internal/sumweb/cache.go create mode 100644 libgo/go/cmd/go/internal/sumweb/client.go create mode 100644 libgo/go/cmd/go/internal/sumweb/client_test.go create mode 100644 libgo/go/cmd/go/internal/sumweb/encode.go create mode 100644 libgo/go/cmd/go/internal/sumweb/encode_test.go create mode 100644 libgo/go/cmd/go/internal/sumweb/server.go create mode 100644 libgo/go/cmd/go/internal/sumweb/test.go create mode 100644 libgo/go/cmd/go/internal/tlog/ct_test.go create mode 100644 libgo/go/cmd/go/internal/tlog/note.go create mode 100644 libgo/go/cmd/go/internal/tlog/note_test.go create mode 100644 libgo/go/cmd/go/internal/tlog/tile.go create mode 100644 libgo/go/cmd/go/internal/tlog/tlog.go create mode 100644 libgo/go/cmd/go/internal/tlog/tlog_test.go create mode 100644 libgo/go/cmd/go/internal/version/exe.go create mode 100644 libgo/go/cmd/go/internal/web/api.go create mode 100644 libgo/go/cmd/go/internal/web/file_test.go delete mode 100644 libgo/go/cmd/go/internal/web/security.go create mode 100644 libgo/go/cmd/go/internal/web/url.go create mode 100644 libgo/go/cmd/go/internal/web/url_other.go create mode 100644 libgo/go/cmd/go/internal/web/url_other_test.go create mode 100644 libgo/go/cmd/go/internal/web/url_test.go create mode 100644 libgo/go/cmd/go/internal/web/url_windows.go create mode 100644 libgo/go/cmd/go/internal/web/url_windows_test.go delete mode 100644 libgo/go/cmd/go/internal/web2/web.go delete mode 100644 libgo/go/cmd/go/internal/web2/web_test.go delete mode 100644 libgo/go/cmd/go/internal/webtest/test.go create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_badchain_a_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_badchain_a_v1.1.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_badchain_b_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_badchain_b_v1.1.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_badchain_c_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_downgrade_v2.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_downgrade_v2_v2.0.1.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_invalidpath_v1_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.1.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_missingpkg_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_missingpkg_v1.0.1-beta.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_nest_sub_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_nest_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_nest_v1.1.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.1.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_newcycle_b_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_noroot_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_noroot_v1.0.1.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_printversion_v0.1.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_printversion_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190430073000-30950c05d534.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.1.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.1.1-0.20190429073117-b5426c86b553.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_tools_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_usemissingpre_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_version_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_version_v1.0.1.txt create mode 100644 libgo/go/cmd/go/testdata/mod/example.com_version_v1.1.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.0.0-20190619020302-197a620e0c9a.txt create mode 100644 libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.5.0-alpha.0.20190619023908-3da23a9deb9e.txt create mode 100644 libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.5.0-alpha.txt create mode 100644 libgo/go/cmd/go/testdata/mod/patch.example.com_depofdirectpatch_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/patch.example.com_depofdirectpatch_v1.0.1.txt create mode 100644 libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.0.1.txt create mode 100644 libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.1.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.0.1.txt create mode 100644 libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.1.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/rsc.io_badsum_v1.0.0.txt create mode 100644 libgo/go/cmd/go/testdata/mod/rsc.io_badsum_v1.0.1.txt create mode 100644 libgo/go/cmd/go/testdata/mod/rsc.io_badzip_v1.0.0.txt delete mode 100644 libgo/go/cmd/go/testdata/script/binary_only.txt create mode 100644 libgo/go/cmd/go/testdata/script/bug.txt create mode 100644 libgo/go/cmd/go/testdata/script/build_acl_windows.txt create mode 100644 libgo/go/cmd/go/testdata/script/build_cache_gomips.txt create mode 100644 libgo/go/cmd/go/testdata/script/build_cache_trimpath.txt create mode 100644 libgo/go/cmd/go/testdata/script/build_multi_main.txt create mode 100644 libgo/go/cmd/go/testdata/script/build_nocache.txt create mode 100644 libgo/go/cmd/go/testdata/script/build_relative_pkgdir.txt create mode 100644 libgo/go/cmd/go/testdata/script/build_relative_tmpdir.txt create mode 100644 libgo/go/cmd/go/testdata/script/build_runtime_gcflags.txt create mode 100644 libgo/go/cmd/go/testdata/script/build_trimpath.txt create mode 100644 libgo/go/cmd/go/testdata/script/cache_unix.txt create mode 100644 libgo/go/cmd/go/testdata/script/cgo_syso_issue29253.txt create mode 100644 libgo/go/cmd/go/testdata/script/clean_testcache.txt create mode 100644 libgo/go/cmd/go/testdata/script/env_write.txt create mode 100644 libgo/go/cmd/go/testdata/script/gcflags_patterns.txt create mode 100644 libgo/go/cmd/go/testdata/script/get_404_meta.txt create mode 100644 libgo/go/cmd/go/testdata/script/get_brace.txt create mode 100644 libgo/go/cmd/go/testdata/script/get_dotfiles.txt create mode 100644 libgo/go/cmd/go/testdata/script/get_insecure_redirect.txt create mode 100644 libgo/go/cmd/go/testdata/script/get_tilde.txt create mode 100644 libgo/go/cmd/go/testdata/script/get_unicode.txt create mode 100644 libgo/go/cmd/go/testdata/script/gopath_std_vendor.txt create mode 100644 libgo/go/cmd/go/testdata/script/install_cmd_gobin.txt create mode 100644 libgo/go/cmd/go/testdata/script/list_importmap.txt create mode 100644 libgo/go/cmd/go/testdata/script/list_test_err.txt create mode 100644 libgo/go/cmd/go/testdata/script/list_test_non_go_files.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_alt_goroot.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_auth.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_build_versioned.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_clean_cache.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_concurrent.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_dir.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_download_hash.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_edit_go.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_cmd.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_hash.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_latest_pseudo.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_main.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_newcycle.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_patterns.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_private_vcs.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_pseudo_other_branch.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_pseudo_prefix.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_svn.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_tags.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_test.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_get_upgrade_pseudo.txt delete mode 100644 libgo/go/cmd/go/testdata/script/mod_get_warning.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_git_export_subst.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_gonoproxy.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_help.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_import_v1suffix.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_init_empty.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_init_glide.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_init_path.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_invalid_version.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_list_pseudo.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_list_replace_dir.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_list_std.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_list_test.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_list_upgrade_pseudo.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_load_badchain.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_load_badzip.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_missingpkg_prerelease.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_modinfo.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_off.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_off_init.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_outside.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_patterns_vendor.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_proxy_https.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_proxy_list.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_pseudo_cache.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_query_empty.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_replace_import.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_run_internal.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_run_path.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_std_vendor.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_string_alias.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_sum_replaced.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_sumdb.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_sumdb_cache.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_sumdb_file_path.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_sumdb_golang.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_sumdb_proxy.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_symlink.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_test_files.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_tidy_replace.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_vcs_missing.txt create mode 100644 libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt create mode 100644 libgo/go/cmd/go/testdata/script/prevent_sys_unix_import.txt create mode 100644 libgo/go/cmd/go/testdata/script/run_set_executable_name.txt create mode 100644 libgo/go/cmd/go/testdata/script/run_wildcard.txt create mode 100644 libgo/go/cmd/go/testdata/script/script_wait.txt create mode 100644 libgo/go/cmd/go/testdata/script/std_vendor.txt create mode 100644 libgo/go/cmd/go/testdata/script/sum_readonly.txt create mode 100644 libgo/go/cmd/go/testdata/script/test_devnull.txt create mode 100644 libgo/go/cmd/go/testdata/script/test_generated_main.txt create mode 100644 libgo/go/cmd/go/testdata/script/test_init.txt create mode 100644 libgo/go/cmd/go/testdata/script/test_status.txt create mode 100644 libgo/go/cmd/go/testdata/script/test_timeout.txt create mode 100644 libgo/go/cmd/go/testdata/script/version.txt create mode 100644 libgo/go/cmd/go/testdata/script/vet_asm.txt create mode 100644 libgo/go/cmd/go/testdata/script/vet_deps.txt create mode 100644 libgo/go/cmd/go/testdata/testcover/pkg4/a.go create mode 100644 libgo/go/cmd/go/testdata/testcover/pkg4/a_test.go create mode 100644 libgo/go/cmd/internal/objabi/line_test.go delete mode 100644 libgo/go/cmd/vet/all/main.go rename libgo/go/cmd/vet/testdata/{src => }/asm/asm.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/assign/assign.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/atomic/atomic.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/bool/bool.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/buildtag/buildtag.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/cgo/cgo.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/composite/composite.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/copylock/copylock.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/deadcode/deadcode.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/httpresponse/httpresponse.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/lostcancel/lostcancel.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/method/method.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/nilfunc/nilfunc.go (100%) create mode 100644 libgo/go/cmd/vet/testdata/print/print.go rename libgo/go/cmd/vet/testdata/{src => }/rangeloop/rangeloop.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/shift/shift.go (100%) delete mode 100644 libgo/go/cmd/vet/testdata/src/print/print.go rename libgo/go/cmd/vet/testdata/{src => }/structtag/structtag.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/tagtest/file1.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/tagtest/file2.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/testingpkg/tests.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/testingpkg/tests_test.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/unmarshal/unmarshal.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/unsafeptr/unsafeptr.go (100%) rename libgo/go/cmd/vet/testdata/{src => }/unused/unused.go (100%) create mode 100644 libgo/go/crypto/ecdsa/ecdsa_noasm.go create mode 100644 libgo/go/crypto/ecdsa/ecdsa_s390x.go create mode 100644 libgo/go/crypto/ecdsa/ecdsa_s390x_test.go create mode 100644 libgo/go/crypto/ed25519/ed25519.go create mode 100644 libgo/go/crypto/ed25519/ed25519_test.go create mode 100644 libgo/go/crypto/ed25519/internal/edwards25519/const.go create mode 100644 libgo/go/crypto/ed25519/internal/edwards25519/edwards25519.go create mode 100644 libgo/go/crypto/ed25519/testdata/sign.input.gz create mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-Ed25519 create mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv10-Ed25519 create mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv11-Ed25519 create mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-Ed25519 delete mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled delete mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled-512 create mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv12-Ed25519 create mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-Ed25519 delete mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled create mode 100644 libgo/go/crypto/tls/testdata/Client-TLSv13-Ed25519 create mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given delete mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled delete mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required create mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv12-Ed25519 delete mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled delete mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required create mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndEd25519Given delete mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled create mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv13-Ed25519 delete mode 100644 libgo/go/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled create mode 100644 libgo/go/debug/dwarf/testdata/cppunsuptypes.cc create mode 100644 libgo/go/debug/dwarf/testdata/cppunsuptypes.elf create mode 100644 libgo/go/encoding/csv/fuzz.go create mode 100644 libgo/go/encoding/json/fuzz.go create mode 100644 libgo/go/errors/wrap.go create mode 100644 libgo/go/errors/wrap_test.go create mode 100644 libgo/go/fmt/errors.go create mode 100644 libgo/go/fmt/errors_test.go delete mode 100644 libgo/go/go/doc/lazyre.go create mode 100644 libgo/go/go/doc/testdata/issue10858.0.golden create mode 100644 libgo/go/go/doc/testdata/issue10858.1.golden create mode 100644 libgo/go/go/doc/testdata/issue10858.2.golden create mode 100644 libgo/go/go/doc/testdata/issue10858.go create mode 100644 libgo/go/go/internal/gccgoimporter/testdata/issue30628.go create mode 100644 libgo/go/go/internal/gccgoimporter/testdata/issue30628.gox create mode 100644 libgo/go/go/internal/gccgoimporter/testdata/issue31540.go create mode 100644 libgo/go/go/internal/gccgoimporter/testdata/issue31540.gox create mode 100644 libgo/go/go/token/token_test.go create mode 100644 libgo/go/go/types/gccgosizes.go create mode 100644 libgo/go/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go create mode 100644 libgo/go/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go create mode 100644 libgo/go/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_generic.go rename libgo/go/{internal => golang.org}/x/crypto/chacha20poly1305/chacha20poly1305_noasm.go (100%) create mode 100644 libgo/go/golang.org/x/crypto/chacha20poly1305/xchacha20poly1305.go create mode 100644 libgo/go/golang.org/x/crypto/cryptobyte/asn1.go create mode 100644 libgo/go/golang.org/x/crypto/cryptobyte/asn1/asn1.go create mode 100644 libgo/go/golang.org/x/crypto/cryptobyte/builder.go create mode 100644 libgo/go/golang.org/x/crypto/cryptobyte/string.go create mode 100644 libgo/go/golang.org/x/crypto/curve25519/curve25519.go create mode 100644 libgo/go/golang.org/x/crypto/curve25519/doc.go rename libgo/go/{internal => golang.org}/x/crypto/curve25519/mont25519_amd64.go (100%) create mode 100644 libgo/go/golang.org/x/crypto/hkdf/hkdf.go create mode 100644 libgo/go/golang.org/x/crypto/internal/chacha20/chacha_arm64.go create mode 100644 libgo/go/golang.org/x/crypto/internal/chacha20/chacha_generic.go create mode 100644 libgo/go/golang.org/x/crypto/internal/chacha20/chacha_noasm.go create mode 100644 libgo/go/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go create mode 100644 libgo/go/golang.org/x/crypto/internal/chacha20/chacha_s390x.go rename libgo/go/{internal => golang.org}/x/crypto/internal/chacha20/xor.go (100%) create mode 100644 libgo/go/golang.org/x/crypto/internal/subtle/aliasing.go create mode 100644 libgo/go/golang.org/x/crypto/internal/subtle/aliasing_appengine.go create mode 100644 libgo/go/golang.org/x/crypto/poly1305/mac_noasm.go create mode 100644 libgo/go/golang.org/x/crypto/poly1305/poly1305.go create mode 100644 libgo/go/golang.org/x/crypto/poly1305/sum_amd64.go rename libgo/go/{internal => golang.org}/x/crypto/poly1305/sum_arm.go (100%) create mode 100644 libgo/go/golang.org/x/crypto/poly1305/sum_generic.go create mode 100644 libgo/go/golang.org/x/crypto/poly1305/sum_noasm.go create mode 100644 libgo/go/golang.org/x/crypto/poly1305/sum_ppc64le.go create mode 100644 libgo/go/golang.org/x/crypto/poly1305/sum_s390x.go create mode 100644 libgo/go/golang.org/x/net/dns/dnsmessage/message.go rename libgo/go/{internal => golang.org}/x/net/http/httpguts/guts.go (100%) create mode 100644 libgo/go/golang.org/x/net/http/httpguts/httplex.go create mode 100644 libgo/go/golang.org/x/net/http/httpproxy/proxy.go rename libgo/go/{internal => golang.org}/x/net/http2/hpack/encode.go (100%) rename libgo/go/{internal => golang.org}/x/net/http2/hpack/hpack.go (100%) rename libgo/go/{internal => golang.org}/x/net/http2/hpack/huffman.go (100%) rename libgo/go/{internal => golang.org}/x/net/http2/hpack/tables.go (100%) create mode 100644 libgo/go/golang.org/x/net/idna/idna10.0.0.go create mode 100644 libgo/go/golang.org/x/net/idna/idna9.0.0.go rename libgo/go/{internal => golang.org}/x/net/idna/punycode.go (100%) create mode 100644 libgo/go/golang.org/x/net/idna/tables10.0.0.go create mode 100644 libgo/go/golang.org/x/net/idna/tables11.0.0.go create mode 100644 libgo/go/golang.org/x/net/idna/tables9.0.0.go rename libgo/go/{internal => golang.org}/x/net/idna/trie.go (100%) create mode 100644 libgo/go/golang.org/x/net/idna/trieval.go rename libgo/go/{internal => golang.org}/x/net/lif/address.go (100%) rename libgo/go/{internal => golang.org}/x/net/lif/binary.go (100%) rename libgo/go/{internal => golang.org}/x/net/lif/lif.go (100%) rename libgo/go/{internal => golang.org}/x/net/lif/link.go (100%) rename libgo/go/{internal => golang.org}/x/net/lif/sys.go (100%) create mode 100644 libgo/go/golang.org/x/net/lif/syscall.go create mode 100644 libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go create mode 100644 libgo/go/golang.org/x/net/nettest/conntest.go create mode 100644 libgo/go/golang.org/x/net/nettest/nettest.go create mode 100644 libgo/go/golang.org/x/net/nettest/nettest_stub.go create mode 100644 libgo/go/golang.org/x/net/nettest/nettest_unix.go create mode 100644 libgo/go/golang.org/x/net/nettest/nettest_windows.go rename libgo/go/{internal => golang.org}/x/net/route/address.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/binary.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/interface.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/interface_announce.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/interface_classic.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/interface_freebsd.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/interface_multicast.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/interface_openbsd.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/message.go (100%) create mode 100644 libgo/go/golang.org/x/net/route/route.go rename libgo/go/{internal => golang.org}/x/net/route/route_classic.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/route_openbsd.go (100%) create mode 100644 libgo/go/golang.org/x/net/route/sys.go rename libgo/go/{internal => golang.org}/x/net/route/sys_darwin.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/sys_dragonfly.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/sys_freebsd.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/sys_netbsd.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/sys_openbsd.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/syscall.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/syscall_go1_11_darwin.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/syscall_go1_12_darwin.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/zsys_darwin.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/zsys_dragonfly.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/zsys_freebsd_386.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/zsys_freebsd_amd64.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/zsys_freebsd_arm.go (100%) create mode 100644 libgo/go/golang.org/x/net/route/zsys_freebsd_arm64.go rename libgo/go/{internal => golang.org}/x/net/route/zsys_netbsd.go (100%) rename libgo/go/{internal => golang.org}/x/net/route/zsys_openbsd.go (100%) create mode 100644 libgo/go/golang.org/x/sys/cpu/byteorder.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_arm.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_gc_s390x.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_gc_x86.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_gccgo.c create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_gccgo.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_gccgo_s390x.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_linux.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_linux_arm64.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_linux_ppc64x.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_linux_s390x.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_other_arm64.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_wasm.go create mode 100644 libgo/go/golang.org/x/sys/cpu/cpu_x86.go create mode 100644 libgo/go/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go create mode 100644 libgo/go/golang.org/x/text/secure/bidirule/bidirule.go create mode 100644 libgo/go/golang.org/x/text/secure/bidirule/bidirule10.0.0.go create mode 100644 libgo/go/golang.org/x/text/secure/bidirule/bidirule9.0.0.go create mode 100644 libgo/go/golang.org/x/text/transform/transform.go create mode 100644 libgo/go/golang.org/x/text/unicode/bidi/bidi.go create mode 100644 libgo/go/golang.org/x/text/unicode/bidi/bracket.go create mode 100644 libgo/go/golang.org/x/text/unicode/bidi/core.go create mode 100644 libgo/go/golang.org/x/text/unicode/bidi/prop.go create mode 100644 libgo/go/golang.org/x/text/unicode/bidi/tables10.0.0.go create mode 100644 libgo/go/golang.org/x/text/unicode/bidi/tables11.0.0.go create mode 100644 libgo/go/golang.org/x/text/unicode/bidi/tables9.0.0.go create mode 100644 libgo/go/golang.org/x/text/unicode/bidi/trieval.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/composition.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/forminfo.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/input.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/iter.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/normalize.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/readwriter.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/tables10.0.0.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/tables11.0.0.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/tables9.0.0.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/transform.go create mode 100644 libgo/go/golang.org/x/text/unicode/norm/trie.go delete mode 100644 libgo/go/golang.org/x/tools/go/analysis/internal/analysisflags/patch.go create mode 100644 libgo/go/golang.org/x/tools/go/analysis/passes/errorsas/errorsas.go create mode 100644 libgo/go/html/fuzz.go create mode 100644 libgo/go/image/png/fuzz.go create mode 100644 libgo/go/image/png/testdata/invalid-palette.png create mode 100644 libgo/go/index/suffixarray/gen.go delete mode 100644 libgo/go/index/suffixarray/qsufsort.go create mode 100644 libgo/go/index/suffixarray/sais.go create mode 100644 libgo/go/index/suffixarray/sais2.go create mode 100644 libgo/go/internal/bytealg/equal_generic.go create mode 100644 libgo/go/internal/goversion/goversion.go create mode 100644 libgo/go/internal/lazyregexp/lazyre.go create mode 100644 libgo/go/internal/lazytemplate/lazytemplate.go create mode 100644 libgo/go/internal/oserror/errors.go create mode 100644 libgo/go/internal/oserror/errors_test.go create mode 100644 libgo/go/internal/poll/errno_unix.go create mode 100644 libgo/go/internal/poll/errno_windows.go create mode 100644 libgo/go/internal/poll/error_linux_test.go create mode 100644 libgo/go/internal/poll/error_stub_test.go create mode 100644 libgo/go/internal/poll/error_test.go create mode 100644 libgo/go/internal/poll/fd_opendir_darwin.go delete mode 100644 libgo/go/internal/poll/fd_opendir_ios.go create mode 100644 libgo/go/internal/poll/read_test.go create mode 100644 libgo/go/internal/reflectlite/all_test.go create mode 100644 libgo/go/internal/reflectlite/export_test.go create mode 100644 libgo/go/internal/reflectlite/set_test.go create mode 100644 libgo/go/internal/reflectlite/swapper.go create mode 100644 libgo/go/internal/reflectlite/tostring_test.go create mode 100644 libgo/go/internal/reflectlite/type.go create mode 100644 libgo/go/internal/reflectlite/value.go delete mode 100644 libgo/go/internal/x/crypto/chacha20poly1305/chacha20poly1305.go delete mode 100644 libgo/go/internal/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go delete mode 100644 libgo/go/internal/x/crypto/chacha20poly1305/chacha20poly1305_generic.go delete mode 100644 libgo/go/internal/x/crypto/chacha20poly1305/chacha20poly1305_test.go delete mode 100644 libgo/go/internal/x/crypto/chacha20poly1305/chacha20poly1305_vectors_test.go delete mode 100644 libgo/go/internal/x/crypto/cryptobyte/asn1.go delete mode 100644 libgo/go/internal/x/crypto/cryptobyte/asn1/asn1.go delete mode 100644 libgo/go/internal/x/crypto/cryptobyte/asn1_test.go delete mode 100644 libgo/go/internal/x/crypto/cryptobyte/builder.go delete mode 100644 libgo/go/internal/x/crypto/cryptobyte/cryptobyte_test.go delete mode 100644 libgo/go/internal/x/crypto/cryptobyte/example_test.go delete mode 100644 libgo/go/internal/x/crypto/cryptobyte/string.go delete mode 100644 libgo/go/internal/x/crypto/curve25519/curve25519.go delete mode 100644 libgo/go/internal/x/crypto/curve25519/curve25519_test.go delete mode 100644 libgo/go/internal/x/crypto/curve25519/doc.go delete mode 100644 libgo/go/internal/x/crypto/hkdf/example_test.go delete mode 100644 libgo/go/internal/x/crypto/hkdf/hkdf.go delete mode 100644 libgo/go/internal/x/crypto/hkdf/hkdf_test.go delete mode 100644 libgo/go/internal/x/crypto/internal/chacha20/chacha_generic.go delete mode 100644 libgo/go/internal/x/crypto/internal/chacha20/chacha_noasm.go delete mode 100644 libgo/go/internal/x/crypto/internal/chacha20/chacha_s390x.go delete mode 100644 libgo/go/internal/x/crypto/internal/chacha20/chacha_test.go delete mode 100644 libgo/go/internal/x/crypto/internal/chacha20/vectors_test.go delete mode 100644 libgo/go/internal/x/crypto/poly1305/poly1305.go delete mode 100644 libgo/go/internal/x/crypto/poly1305/poly1305_test.go delete mode 100644 libgo/go/internal/x/crypto/poly1305/sum_amd64.go delete mode 100644 libgo/go/internal/x/crypto/poly1305/sum_noasm.go delete mode 100644 libgo/go/internal/x/crypto/poly1305/sum_ref.go delete mode 100644 libgo/go/internal/x/crypto/poly1305/sum_s390x.go delete mode 100644 libgo/go/internal/x/crypto/poly1305/vectors_test.go delete mode 100644 libgo/go/internal/x/net/dns/dnsmessage/example_test.go delete mode 100644 libgo/go/internal/x/net/dns/dnsmessage/message.go delete mode 100644 libgo/go/internal/x/net/dns/dnsmessage/message_test.go delete mode 100644 libgo/go/internal/x/net/http/httpguts/httplex.go delete mode 100644 libgo/go/internal/x/net/http/httpguts/httplex_test.go delete mode 100644 libgo/go/internal/x/net/http/httpproxy/export_test.go delete mode 100644 libgo/go/internal/x/net/http/httpproxy/proxy.go delete mode 100644 libgo/go/internal/x/net/http/httpproxy/proxy_test.go delete mode 100644 libgo/go/internal/x/net/http2/hpack/encode_test.go delete mode 100644 libgo/go/internal/x/net/http2/hpack/hpack_test.go delete mode 100644 libgo/go/internal/x/net/http2/hpack/tables_test.go delete mode 100644 libgo/go/internal/x/net/idna/idna.go delete mode 100644 libgo/go/internal/x/net/idna/punycode_test.go delete mode 100644 libgo/go/internal/x/net/idna/tables.go delete mode 100644 libgo/go/internal/x/net/idna/trieval.go delete mode 100644 libgo/go/internal/x/net/internal/nettest/helper_bsd.go delete mode 100644 libgo/go/internal/x/net/internal/nettest/helper_nobsd.go delete mode 100644 libgo/go/internal/x/net/internal/nettest/helper_posix.go delete mode 100644 libgo/go/internal/x/net/internal/nettest/helper_stub.go delete mode 100644 libgo/go/internal/x/net/internal/nettest/helper_unix.go delete mode 100644 libgo/go/internal/x/net/internal/nettest/helper_windows.go delete mode 100644 libgo/go/internal/x/net/internal/nettest/interface.go delete mode 100644 libgo/go/internal/x/net/internal/nettest/rlimit.go delete mode 100644 libgo/go/internal/x/net/internal/nettest/stack.go delete mode 100644 libgo/go/internal/x/net/lif/address_test.go delete mode 100644 libgo/go/internal/x/net/lif/defs_solaris.go delete mode 100644 libgo/go/internal/x/net/lif/link_test.go delete mode 100644 libgo/go/internal/x/net/lif/syscall.go delete mode 100644 libgo/go/internal/x/net/lif/zsys_solaris.go delete mode 100644 libgo/go/internal/x/net/nettest/conntest.go delete mode 100644 libgo/go/internal/x/net/nettest/conntest_go16.go delete mode 100644 libgo/go/internal/x/net/nettest/conntest_go17.go delete mode 100644 libgo/go/internal/x/net/nettest/conntest_test.go delete mode 100644 libgo/go/internal/x/net/route/address_darwin_test.go delete mode 100644 libgo/go/internal/x/net/route/address_test.go delete mode 100644 libgo/go/internal/x/net/route/defs_darwin.go delete mode 100644 libgo/go/internal/x/net/route/defs_dragonfly.go delete mode 100644 libgo/go/internal/x/net/route/defs_freebsd.go delete mode 100644 libgo/go/internal/x/net/route/defs_netbsd.go delete mode 100644 libgo/go/internal/x/net/route/defs_openbsd.go delete mode 100644 libgo/go/internal/x/net/route/message_darwin_test.go delete mode 100644 libgo/go/internal/x/net/route/message_freebsd_test.go delete mode 100644 libgo/go/internal/x/net/route/message_test.go delete mode 100644 libgo/go/internal/x/net/route/route.go delete mode 100644 libgo/go/internal/x/net/route/route_test.go delete mode 100644 libgo/go/internal/x/net/route/sys.go delete mode 100644 libgo/go/internal/x/text/secure/bidirule/bidirule.go delete mode 100644 libgo/go/internal/x/text/secure/doc.go delete mode 100644 libgo/go/internal/x/text/transform/examples_test.go delete mode 100644 libgo/go/internal/x/text/transform/transform.go delete mode 100644 libgo/go/internal/x/text/unicode/bidi/bidi.go delete mode 100644 libgo/go/internal/x/text/unicode/bidi/bracket.go delete mode 100644 libgo/go/internal/x/text/unicode/bidi/core.go delete mode 100644 libgo/go/internal/x/text/unicode/bidi/example_test.go delete mode 100644 libgo/go/internal/x/text/unicode/bidi/prop.go delete mode 100644 libgo/go/internal/x/text/unicode/bidi/tables.go delete mode 100644 libgo/go/internal/x/text/unicode/bidi/trieval.go delete mode 100644 libgo/go/internal/x/text/unicode/doc.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/composition.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/example_iter_test.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/example_test.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/forminfo.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/input.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/iter.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/normalize.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/readwriter.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/tables.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/transform.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/trie.go delete mode 100644 libgo/go/internal/x/text/unicode/norm/triegen.go create mode 100644 libgo/go/math/bits/bits_errors.go create mode 100644 libgo/go/math/bits/bits_errors_bootstrap.go create mode 100644 libgo/go/net/http/clone.go create mode 100644 libgo/go/net/testdata/freebsd-usevc-resolv.conf create mode 100644 libgo/go/net/testdata/linux-use-vc-resolv.conf create mode 100644 libgo/go/net/testdata/openbsd-tcp-resolv.conf create mode 100644 libgo/go/net/testdata/single-request-reopen-resolv.conf create mode 100644 libgo/go/net/testdata/single-request-resolv.conf delete mode 100644 libgo/go/os/dir_ios.go create mode 100644 libgo/go/os/env_default.go create mode 100644 libgo/go/os/env_windows.go delete mode 100644 libgo/go/os/error_plan9.go delete mode 100644 libgo/go/os/error_unix.go delete mode 100644 libgo/go/os/error_windows.go create mode 100644 libgo/go/os/exec/bench_test.go create mode 100644 libgo/go/os/export_unix_test.go create mode 100644 libgo/go/runtime/debuglog.go create mode 100644 libgo/go/runtime/debuglog_off.go create mode 100644 libgo/go/runtime/debuglog_on.go create mode 100644 libgo/go/runtime/debuglog_test.go create mode 100644 libgo/go/runtime/export_debuglog_test.go create mode 100644 libgo/go/runtime/mgcscavenge.go create mode 100644 libgo/go/runtime/os_netbsd_arm64.go create mode 100644 libgo/go/runtime/os_openbsd_arm64.go create mode 100644 libgo/go/runtime/testdata/testprog/sleep.go create mode 100644 libgo/go/runtime/treap_test.go delete mode 100644 libgo/go/runtime/unaligned1.go delete mode 100644 libgo/go/runtime/unaligned2.go create mode 100644 libgo/go/sort/slice_go113.go create mode 100644 libgo/go/sort/slice_go14.go create mode 100644 libgo/go/sort/slice_go18.go create mode 100644 libgo/go/sync/poolqueue.go create mode 100644 libgo/go/syscall/getdirentries_test.go delete mode 100644 libgo/go/syscall/js/typedarray.go create mode 100644 libgo/go/syscall/syscall_netbsd_arm64.go create mode 100644 libgo/go/syscall/syscall_openbsd_arm64.go create mode 100644 libgo/go/syscall/syscall_ptrace_test.go create mode 100644 libgo/go/testing/run_example.go create mode 100644 libgo/go/testing/run_example_js.go delete mode 100644 libgo/misc/cgo/errors/src/err1.go delete mode 100644 libgo/misc/cgo/errors/src/err2.go delete mode 100644 libgo/misc/cgo/errors/src/err3.go delete mode 100644 libgo/misc/cgo/errors/src/issue13129.go delete mode 100644 libgo/misc/cgo/errors/src/issue13423.go delete mode 100644 libgo/misc/cgo/errors/src/issue13467.go delete mode 100644 libgo/misc/cgo/errors/src/issue13635.go delete mode 100644 libgo/misc/cgo/errors/src/issue13830.go delete mode 100644 libgo/misc/cgo/errors/src/issue16116.go delete mode 100644 libgo/misc/cgo/errors/src/issue16591.go delete mode 100644 libgo/misc/cgo/errors/src/issue26745.go delete mode 100644 libgo/misc/cgo/errors/src/issue7757.go delete mode 100644 libgo/misc/cgo/errors/src/issue8442.go create mode 100644 libgo/misc/cgo/errors/testdata/err1.go create mode 100644 libgo/misc/cgo/errors/testdata/err2.go rename libgo/misc/cgo/errors/{src => testdata}/err4.go (100%) rename libgo/misc/cgo/errors/{src => testdata}/issue11097a.go (100%) rename libgo/misc/cgo/errors/{src => testdata}/issue11097b.go (100%) rename libgo/misc/cgo/errors/{src => testdata}/issue14669.go (100%) rename libgo/misc/cgo/errors/{src => testdata}/issue18452.go (100%) rename libgo/misc/cgo/errors/{src => testdata}/issue18889.go (100%) rename libgo/misc/cgo/errors/{src => testdata}/issue28069.go (100%) rename libgo/misc/cgo/errors/{src => testdata}/issue28721.go (100%) rename libgo/misc/cgo/errors/{src => testdata}/long_double_size.go (100%) rename libgo/misc/cgo/errors/{src => testdata}/malloc.go (100%) delete mode 100644 libgo/misc/cgo/life/life.go create mode 100644 libgo/misc/cgo/life/life_test.go delete mode 100644 libgo/misc/cgo/life/main.go create mode 100644 libgo/misc/cgo/life/overlaydir_test.go rename libgo/misc/cgo/life/{ => testdata}/c-life.c (100%) create mode 100644 libgo/misc/cgo/life/testdata/life.go rename libgo/misc/cgo/life/{ => testdata}/life.h (100%) create mode 100644 libgo/misc/cgo/life/testdata/main.go rename libgo/misc/cgo/life/{ => testdata}/main.out (100%) delete mode 100644 libgo/misc/cgo/stdio/chain.go delete mode 100644 libgo/misc/cgo/stdio/fib.go delete mode 100644 libgo/misc/cgo/stdio/hello.go create mode 100644 libgo/misc/cgo/stdio/overlaydir_test.go create mode 100644 libgo/misc/cgo/stdio/stdio_test.go create mode 100644 libgo/misc/cgo/stdio/testdata/chain.go rename libgo/misc/cgo/stdio/{ => testdata}/chain.out (100%) create mode 100644 libgo/misc/cgo/stdio/testdata/fib.go rename libgo/misc/cgo/stdio/{ => testdata}/fib.out (100%) create mode 100644 libgo/misc/cgo/stdio/testdata/hello.go rename libgo/misc/cgo/stdio/{ => testdata}/hello.out (100%) rename libgo/misc/cgo/stdio/{ => testdata}/run.out (100%) rename libgo/misc/cgo/stdio/{ => testdata/stdio}/file.go (100%) rename libgo/misc/cgo/stdio/{ => testdata/stdio}/stdio.go (100%) delete mode 100644 libgo/misc/cgo/test/align.go delete mode 100644 libgo/misc/cgo/test/api.go delete mode 100644 libgo/misc/cgo/test/basic.go delete mode 100644 libgo/misc/cgo/test/cflags.go delete mode 100644 libgo/misc/cgo/test/checkconst.go delete mode 100644 libgo/misc/cgo/test/complex.go delete mode 100644 libgo/misc/cgo/test/cthread.go delete mode 100644 libgo/misc/cgo/test/duplicate_symbol.go delete mode 100644 libgo/misc/cgo/test/env.go delete mode 100644 libgo/misc/cgo/test/exports.go delete mode 100644 libgo/misc/cgo/test/fpvar.go delete mode 100644 libgo/misc/cgo/test/gcc68255.go delete mode 100644 libgo/misc/cgo/test/helpers.go delete mode 100644 libgo/misc/cgo/test/issue10303.go delete mode 100644 libgo/misc/cgo/test/issue11925.go delete mode 100644 libgo/misc/cgo/test/issue12030.go delete mode 100644 libgo/misc/cgo/test/issue1222.go delete mode 100644 libgo/misc/cgo/test/issue1328.go delete mode 100644 libgo/misc/cgo/test/issue13402.go delete mode 100644 libgo/misc/cgo/test/issue13930.go delete mode 100644 libgo/misc/cgo/test/issue14838.go delete mode 100644 libgo/misc/cgo/test/issue1560.go delete mode 100644 libgo/misc/cgo/test/issue1635.go delete mode 100644 libgo/misc/cgo/test/issue17065.go delete mode 100644 libgo/misc/cgo/test/issue17537.go delete mode 100644 libgo/misc/cgo/test/issue18126.go delete mode 100644 libgo/misc/cgo/test/issue18720.go delete mode 100644 libgo/misc/cgo/test/issue20129.go delete mode 100644 libgo/misc/cgo/test/issue20369.go delete mode 100644 libgo/misc/cgo/test/issue20910.go delete mode 100644 libgo/misc/cgo/test/issue21668.go delete mode 100644 libgo/misc/cgo/test/issue21708.go delete mode 100644 libgo/misc/cgo/test/issue21809.go delete mode 100644 libgo/misc/cgo/test/issue22958.go delete mode 100644 libgo/misc/cgo/test/issue23356.go delete mode 100644 libgo/misc/cgo/test/issue23555.go delete mode 100644 libgo/misc/cgo/test/issue23720.go delete mode 100644 libgo/misc/cgo/test/issue24161_darwin_test.go delete mode 100644 libgo/misc/cgo/test/issue24206.go delete mode 100644 libgo/misc/cgo/test/issue24206_generic.go delete mode 100644 libgo/misc/cgo/test/issue2462.go delete mode 100644 libgo/misc/cgo/test/issue25143.go delete mode 100644 libgo/misc/cgo/test/issue26066.go delete mode 100644 libgo/misc/cgo/test/issue26430.go delete mode 100644 libgo/misc/cgo/test/issue26517.go delete mode 100644 libgo/misc/cgo/test/issue26743.go delete mode 100644 libgo/misc/cgo/test/issue27340.go delete mode 100644 libgo/misc/cgo/test/issue28545.go delete mode 100644 libgo/misc/cgo/test/issue28772.go delete mode 100644 libgo/misc/cgo/test/issue28896.go delete mode 100644 libgo/misc/cgo/test/issue29383.go delete mode 100644 libgo/misc/cgo/test/issue29748.go delete mode 100644 libgo/misc/cgo/test/issue29781.go delete mode 100644 libgo/misc/cgo/test/issue30065.go delete mode 100644 libgo/misc/cgo/test/issue3250.go delete mode 100644 libgo/misc/cgo/test/issue3250w.go delete mode 100644 libgo/misc/cgo/test/issue3261.go delete mode 100644 libgo/misc/cgo/test/issue3729.go delete mode 100644 libgo/misc/cgo/test/issue3729w.go delete mode 100644 libgo/misc/cgo/test/issue3741.go delete mode 100644 libgo/misc/cgo/test/issue3775.go delete mode 100644 libgo/misc/cgo/test/issue3945.go delete mode 100644 libgo/misc/cgo/test/issue4054a.go delete mode 100644 libgo/misc/cgo/test/issue4054b.go delete mode 100644 libgo/misc/cgo/test/issue4339.go delete mode 100644 libgo/misc/cgo/test/issue4417.go delete mode 100644 libgo/misc/cgo/test/issue4857.go delete mode 100644 libgo/misc/cgo/test/issue5227.go delete mode 100644 libgo/misc/cgo/test/issue5242.go delete mode 100644 libgo/misc/cgo/test/issue5337.go delete mode 100644 libgo/misc/cgo/test/issue5337w.go delete mode 100644 libgo/misc/cgo/test/issue5548.go delete mode 100644 libgo/misc/cgo/test/issue5603.go delete mode 100644 libgo/misc/cgo/test/issue5740.go delete mode 100644 libgo/misc/cgo/test/issue5986.go delete mode 100644 libgo/misc/cgo/test/issue6128.go delete mode 100644 libgo/misc/cgo/test/issue6390.go delete mode 100644 libgo/misc/cgo/test/issue6472.go delete mode 100644 libgo/misc/cgo/test/issue6506.go delete mode 100644 libgo/misc/cgo/test/issue6612.go delete mode 100644 libgo/misc/cgo/test/issue6833.go delete mode 100644 libgo/misc/cgo/test/issue6907.go delete mode 100644 libgo/misc/cgo/test/issue6907export.go delete mode 100644 libgo/misc/cgo/test/issue7560.go delete mode 100644 libgo/misc/cgo/test/issue7665.go delete mode 100644 libgo/misc/cgo/test/issue7786.go delete mode 100644 libgo/misc/cgo/test/issue7978.go delete mode 100644 libgo/misc/cgo/test/issue8092.go delete mode 100644 libgo/misc/cgo/test/issue8331a.go delete mode 100644 libgo/misc/cgo/test/issue8331b.go delete mode 100644 libgo/misc/cgo/test/issue8428.go delete mode 100644 libgo/misc/cgo/test/issue8441.go delete mode 100644 libgo/misc/cgo/test/issue8756.go delete mode 100644 libgo/misc/cgo/test/issue8811.go delete mode 100644 libgo/misc/cgo/test/issue8828.go delete mode 100644 libgo/misc/cgo/test/issue9026.go delete mode 100644 libgo/misc/cgo/test/issue9400_linux.go delete mode 100644 libgo/misc/cgo/test/issue9510.go delete mode 100644 libgo/misc/cgo/test/issue9557.go create mode 100644 libgo/misc/cgo/test/overlaydir_test.go create mode 100644 libgo/misc/cgo/test/pkg_test.go create mode 100644 libgo/misc/cgo/test/test.go delete mode 100644 libgo/misc/cgo/test/test22906.go delete mode 100644 libgo/misc/cgo/test/test26213.go delete mode 100644 libgo/misc/cgo/test/test27660.go create mode 100644 libgo/misc/cgo/test/test_unix.go create mode 100644 libgo/misc/cgo/test/test_windows.go create mode 100644 libgo/misc/cgo/test/testdata/cgo_linux_test.go create mode 100644 libgo/misc/cgo/test/testdata/cgo_test.go create mode 100644 libgo/misc/cgo/test/testdata/gcc68255.go rename libgo/misc/cgo/test/{ => testdata}/gcc68255/a.go (100%) rename libgo/misc/cgo/test/{ => testdata}/gcc68255/c.c (100%) rename libgo/misc/cgo/test/{ => testdata}/gcc68255/c.h (100%) rename libgo/misc/cgo/test/{ => testdata}/issue20266.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue20266/issue20266.h (100%) create mode 100644 libgo/misc/cgo/test/testdata/issue23555.go rename libgo/misc/cgo/test/{ => testdata}/issue23555a/a.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue23555b/a.go (100%) create mode 100644 libgo/misc/cgo/test/testdata/issue24161_darwin_test.go rename libgo/misc/cgo/test/{ => testdata}/issue24161arg/def.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue24161arg/use.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue24161e0/main.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue24161e1/main.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue24161e2/main.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue24161res/restype.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue26213/jni.h (100%) rename libgo/misc/cgo/test/{ => testdata}/issue26213/test26213.go (100%) create mode 100644 libgo/misc/cgo/test/testdata/issue26430.go rename libgo/misc/cgo/test/{ => testdata}/issue26430/a.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue26430/b.go (100%) create mode 100644 libgo/misc/cgo/test/testdata/issue26743.go rename libgo/misc/cgo/test/{ => testdata}/issue26743/a.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue26743/b.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue27054/egl.h (100%) rename libgo/misc/cgo/test/{ => testdata}/issue27054/test27054.go (100%) create mode 100644 libgo/misc/cgo/test/testdata/issue27340.go rename libgo/misc/cgo/test/{ => testdata}/issue27340/a.go (100%) create mode 100644 libgo/misc/cgo/test/testdata/issue29563.go create mode 100644 libgo/misc/cgo/test/testdata/issue29563/weak.go create mode 100644 libgo/misc/cgo/test/testdata/issue29563/weak1.c create mode 100644 libgo/misc/cgo/test/testdata/issue29563/weak2.c create mode 100644 libgo/misc/cgo/test/testdata/issue8756.go rename libgo/misc/cgo/test/{ => testdata}/issue8756/issue8756.go (100%) create mode 100644 libgo/misc/cgo/test/testdata/issue8828.go rename libgo/misc/cgo/test/{ => testdata}/issue8828/issue8828.c (100%) rename libgo/misc/cgo/test/{ => testdata}/issue8828/trivial.go (100%) create mode 100644 libgo/misc/cgo/test/testdata/issue9026.go rename libgo/misc/cgo/test/{ => testdata}/issue9026/issue9026.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/asm_386.s (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/asm_amd64x.s (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/asm_arm.s (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/asm_arm64.s (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/asm_mips64x.s (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/asm_mipsx.s (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/asm_ppc64x.s (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/asm_s390x.s (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/gccgo.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9400/stubs.go (100%) create mode 100644 libgo/misc/cgo/test/testdata/issue9400_linux.go create mode 100644 libgo/misc/cgo/test/testdata/issue9510.go rename libgo/misc/cgo/test/{ => testdata}/issue9510a/a.go (100%) rename libgo/misc/cgo/test/{ => testdata}/issue9510b/b.go (100%) create mode 100644 libgo/misc/cgo/test/testdata/test26213.go create mode 100644 libgo/misc/cgo/test/testx.go delete mode 100644 libgo/misc/cgo/test/twoargs.go delete mode 100644 libgo/misc/cgo/testcarchive/main4.c delete mode 100644 libgo/misc/cgo/testcarchive/main5.c create mode 100644 libgo/misc/cgo/testcarchive/overlaydir_test.go delete mode 100644 libgo/misc/cgo/testcarchive/src/libgo/libgo.go create mode 100644 libgo/misc/cgo/testcarchive/testdata/libgo/libgo.go rename libgo/misc/cgo/testcarchive/{src => testdata}/libgo2/libgo2.go (100%) rename libgo/misc/cgo/testcarchive/{src => testdata}/libgo3/libgo3.go (100%) rename libgo/misc/cgo/testcarchive/{src => testdata}/libgo4/libgo4.go (100%) rename libgo/misc/cgo/testcarchive/{src => testdata}/libgo6/sigprof.go (100%) rename libgo/misc/cgo/testcarchive/{ => testdata}/main.c (100%) rename libgo/misc/cgo/testcarchive/{ => testdata}/main2.c (100%) rename libgo/misc/cgo/testcarchive/{ => testdata}/main3.c (100%) create mode 100644 libgo/misc/cgo/testcarchive/testdata/main4.c create mode 100644 libgo/misc/cgo/testcarchive/testdata/main5.c rename libgo/misc/cgo/testcarchive/{ => testdata}/main6.c (100%) rename libgo/misc/cgo/testcarchive/{ => testdata}/main_unix.c (100%) rename libgo/misc/cgo/testcarchive/{ => testdata}/main_windows.c (100%) rename libgo/misc/cgo/testcarchive/{src => testdata}/p/p.go (100%) create mode 100644 libgo/misc/cgo/testcshared/overlaydir_test.go delete mode 100644 libgo/misc/cgo/testcshared/src/libgo/libgo.go delete mode 100644 libgo/misc/cgo/testcshared/src/libgo2/dup2.go delete mode 100644 libgo/misc/cgo/testcshared/src/libgo2/dup3.go rename libgo/misc/cgo/testcshared/{src => testdata}/go2c2go/go/shlib.go (100%) rename libgo/misc/cgo/testcshared/{src => testdata}/go2c2go/m1/c.c (100%) rename libgo/misc/cgo/testcshared/{src => testdata}/go2c2go/m1/main.go (100%) rename libgo/misc/cgo/testcshared/{src => testdata}/go2c2go/m2/main.go (100%) create mode 100644 libgo/misc/cgo/testcshared/testdata/libgo/libgo.go create mode 100644 libgo/misc/cgo/testcshared/testdata/libgo2/dup2.go create mode 100644 libgo/misc/cgo/testcshared/testdata/libgo2/dup3.go rename libgo/misc/cgo/testcshared/{src => testdata}/libgo2/libgo2.go (100%) rename libgo/misc/cgo/testcshared/{src => testdata}/libgo4/libgo4.go (100%) rename libgo/misc/cgo/testcshared/{src => testdata}/libgo5/libgo5.go (100%) rename libgo/misc/cgo/testcshared/{ => testdata}/main0.c (100%) rename libgo/misc/cgo/testcshared/{ => testdata}/main1.c (100%) rename libgo/misc/cgo/testcshared/{ => testdata}/main2.c (100%) rename libgo/misc/cgo/testcshared/{ => testdata}/main3.c (100%) rename libgo/misc/cgo/testcshared/{ => testdata}/main4.c (100%) rename libgo/misc/cgo/testcshared/{ => testdata}/main5.c (100%) rename libgo/misc/cgo/testcshared/{src => testdata}/p/p.go (100%) rename libgo/misc/cgo/testgodefs/{ => testdata}/anonunion.go (100%) rename libgo/misc/cgo/testgodefs/{ => testdata}/fieldtypedef.go (100%) rename libgo/misc/cgo/testgodefs/{ => testdata}/issue8478.go (100%) rename libgo/misc/cgo/testgodefs/{ => testdata}/main.go (100%) delete mode 100644 libgo/misc/cgo/testplugin/altpath/src/plugin-mismatch/main.go rename libgo/misc/cgo/testplugin/altpath/{src => testdata}/common/common.go (100%) create mode 100644 libgo/misc/cgo/testplugin/altpath/testdata/plugin-mismatch/main.go create mode 100644 libgo/misc/cgo/testplugin/overlaydir_test.go create mode 100644 libgo/misc/cgo/testplugin/plugin_test.go delete mode 100644 libgo/misc/cgo/testplugin/src/host/host.go delete mode 100644 libgo/misc/cgo/testplugin/src/iface/main.go delete mode 100644 libgo/misc/cgo/testplugin/src/iface_a/a.go delete mode 100644 libgo/misc/cgo/testplugin/src/iface_b/b.go delete mode 100644 libgo/misc/cgo/testplugin/src/issue18676/main.go delete mode 100644 libgo/misc/cgo/testplugin/src/issue18676/plugin.go delete mode 100644 libgo/misc/cgo/testplugin/src/plugin1/plugin1.go delete mode 100644 libgo/misc/cgo/testplugin/src/plugin2/plugin2.go delete mode 100644 libgo/misc/cgo/testplugin/src/sub/plugin1/plugin1.go delete mode 100644 libgo/misc/cgo/testplugin/test.bash rename libgo/misc/cgo/testplugin/{src => testdata}/checkdwarf/main.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/common/common.go (100%) create mode 100644 libgo/misc/cgo/testplugin/testdata/host/host.go create mode 100644 libgo/misc/cgo/testplugin/testdata/iface/main.go create mode 100644 libgo/misc/cgo/testplugin/testdata/iface_a/a.go create mode 100644 libgo/misc/cgo/testplugin/testdata/iface_b/b.go rename libgo/misc/cgo/testplugin/{src => testdata}/iface_i/i.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue18584/main.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue18584/plugin.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue18676/dynamodbstreamsevt/definition.go (100%) create mode 100644 libgo/misc/cgo/testplugin/testdata/issue18676/main.go create mode 100644 libgo/misc/cgo/testplugin/testdata/issue18676/plugin.go rename libgo/misc/cgo/testplugin/{src => testdata}/issue19418/main.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue19418/plugin.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue19529/plugin.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue19534/main.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue19534/plugin.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue22175/main.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue22175/plugin1.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue22175/plugin2.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue22295.pkg/main.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue22295.pkg/plugin.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue24351/main.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue24351/plugin.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue25756/main.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue25756/plugin/c-life.c (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue25756/plugin/life.go (100%) rename libgo/misc/cgo/testplugin/{src => testdata}/issue25756/plugin/life.h (100%) create mode 100644 libgo/misc/cgo/testplugin/testdata/plugin1/plugin1.go create mode 100644 libgo/misc/cgo/testplugin/testdata/plugin2/plugin2.go create mode 100644 libgo/misc/cgo/testplugin/testdata/sub/plugin1/plugin1.go create mode 100644 libgo/misc/cgo/testplugin/testdata/unnamed1/main.go create mode 100644 libgo/misc/cgo/testplugin/testdata/unnamed2/main.go delete mode 100644 libgo/misc/cgo/testplugin/unnamed1/main.go delete mode 100644 libgo/misc/cgo/testplugin/unnamed2/main.go rename libgo/misc/cgo/testsanitizers/{src => testdata}/msan.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/msan2.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/msan2_cmsan.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/msan3.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/msan4.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/msan5.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/msan6.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/msan_fail.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/msan_shared.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan10.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan11.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan12.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan2.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan3.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan4.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan5.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan6.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan7.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan8.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan9.go (100%) rename libgo/misc/cgo/testsanitizers/{src => testdata}/tsan_shared.go (100%) create mode 100644 libgo/misc/cgo/testshared/overlaydir_test.go delete mode 100644 libgo/misc/cgo/testshared/src/dep2/dep2.go delete mode 100644 libgo/misc/cgo/testshared/src/dep3/dep3.go delete mode 100644 libgo/misc/cgo/testshared/src/exe/exe.go delete mode 100644 libgo/misc/cgo/testshared/src/exe2/exe2.go delete mode 100644 libgo/misc/cgo/testshared/src/exe3/exe3.go delete mode 100644 libgo/misc/cgo/testshared/src/explicit/explicit.go delete mode 100644 libgo/misc/cgo/testshared/src/global/main.go delete mode 100644 libgo/misc/cgo/testshared/src/iface/main.go delete mode 100644 libgo/misc/cgo/testshared/src/iface_a/a.go delete mode 100644 libgo/misc/cgo/testshared/src/iface_b/b.go delete mode 100644 libgo/misc/cgo/testshared/src/implicitcmd/implicitcmd.go create mode 100644 libgo/misc/cgo/testshared/testdata/dep2/dep2.go create mode 100644 libgo/misc/cgo/testshared/testdata/dep3/dep3.go rename libgo/misc/cgo/testshared/{src => testdata}/depBase/asm.s (100%) rename libgo/misc/cgo/testshared/{src => testdata}/depBase/dep.go (100%) rename libgo/misc/cgo/testshared/{src => testdata}/depBase/gccgo.go (100%) rename libgo/misc/cgo/testshared/{src => testdata}/depBase/stubs.go (100%) rename libgo/misc/cgo/testshared/{src => testdata}/division/division.go (100%) create mode 100644 libgo/misc/cgo/testshared/testdata/exe/exe.go create mode 100644 libgo/misc/cgo/testshared/testdata/exe2/exe2.go create mode 100644 libgo/misc/cgo/testshared/testdata/exe3/exe3.go rename libgo/misc/cgo/testshared/{src => testdata}/execgo/exe.go (100%) create mode 100644 libgo/misc/cgo/testshared/testdata/explicit/explicit.go create mode 100644 libgo/misc/cgo/testshared/testdata/global/main.go rename libgo/misc/cgo/testshared/{src => testdata}/globallib/global.go (100%) create mode 100644 libgo/misc/cgo/testshared/testdata/iface/main.go create mode 100644 libgo/misc/cgo/testshared/testdata/iface_a/a.go create mode 100644 libgo/misc/cgo/testshared/testdata/iface_b/b.go rename libgo/misc/cgo/testshared/{src => testdata}/iface_i/i.go (100%) rename libgo/misc/cgo/testshared/{src => testdata}/implicit/implicit.go (100%) create mode 100644 libgo/misc/cgo/testshared/testdata/implicitcmd/implicitcmd.go rename libgo/misc/cgo/testshared/{src => testdata}/issue25065/a.go (100%) rename libgo/misc/cgo/testshared/{src => testdata}/trivial/trivial.go (100%) delete mode 100644 libgo/misc/cgo/testso/cgoso.c delete mode 100644 libgo/misc/cgo/testso/cgoso.go delete mode 100644 libgo/misc/cgo/testso/cgoso_c.c delete mode 100644 libgo/misc/cgo/testso/cgoso_unix.go delete mode 100644 libgo/misc/cgo/testso/main.go create mode 100644 libgo/misc/cgo/testso/noso_test.go create mode 100644 libgo/misc/cgo/testso/overlaydir_test.go create mode 100644 libgo/misc/cgo/testso/so_test.go create mode 100644 libgo/misc/cgo/testso/testdata/cgoso.c create mode 100644 libgo/misc/cgo/testso/testdata/cgoso.go create mode 100644 libgo/misc/cgo/testso/testdata/cgoso_c.c create mode 100644 libgo/misc/cgo/testso/testdata/cgoso_unix.go create mode 100644 libgo/misc/cgo/testso/testdata/main.go delete mode 100644 libgo/misc/cgo/testsovar/cgoso.go delete mode 100644 libgo/misc/cgo/testsovar/main.go create mode 100644 libgo/misc/cgo/testsovar/noso_test.go create mode 100644 libgo/misc/cgo/testsovar/overlaydir_test.go create mode 100644 libgo/misc/cgo/testsovar/so_test.go create mode 100644 libgo/misc/cgo/testsovar/testdata/cgoso.go rename libgo/misc/cgo/testsovar/{ => testdata}/cgoso_c.c (100%) rename libgo/misc/cgo/testsovar/{ => testdata}/cgoso_c.h (100%) create mode 100644 libgo/misc/cgo/testsovar/testdata/main.go diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index b334136cab8..7b2d17e56d9 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -ca0fdb4c7735a648b8f10f1248631adf9afb8454 +8f2b844acda70330f7c50b360f8c983d2676ecbb The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ab4b2dcd461..c910555071f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-06 Ian Lance Taylor + + * go.test/test/fixedbugs/bug369.go: Update to match libgo update + to Go 1.13beta1. + 2019-09-06 David Edelsohn * gcc.dg/torture/inf-compare-1.c: Skip AIX. diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug369.go b/gcc/testsuite/go.test/test/fixedbugs/bug369.go index 6d526228b8a..7c9583a5888 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/bug369.go +++ b/gcc/testsuite/go.test/test/fixedbugs/bug369.go @@ -38,6 +38,7 @@ func BenchmarkSlowNonASCII(b *testing.B) { } func main() { + testing.Init() os.Args = []string{os.Args[0], "-test.benchtime=100ms"} flag.Parse() diff --git a/gotools/ChangeLog b/gotools/ChangeLog index f5639057d7b..b0e612daae4 100644 --- a/gotools/ChangeLog +++ b/gotools/ChangeLog @@ -1,3 +1,9 @@ +2019-09-06 Ian Lance Taylor + + * Makefile.am (check-carchive-test): Just run "go test", not "go + test carchive_test.go". + * Makefile.in: Regenerate. + 2019-05-27 Ian Lance Taylor * Makefile.am (check-go-tool): Only chmod check-go-dir if it diff --git a/gotools/Makefile.am b/gotools/Makefile.am index 4fd07c27b19..d36b61ca88e 100644 --- a/gotools/Makefile.am +++ b/gotools/Makefile.am @@ -248,7 +248,7 @@ check-runtime: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles="$${files}" $(GOTESTFLAGS) -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v >> runtime-testlog 2>&1 || echo "--- $${fl}: go test runtime (0.00s)" >> runtime-testlog grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 -# check-cgo-test runs `go test misc/cgo/test` in our environment. +# check-cgo-test runs `go test` in misc/cgo/test. check-cgo-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc rm -rf cgo-test-dir cgo-testlog $(MKDIR_P) cgo-test-dir/misc/cgo @@ -261,18 +261,18 @@ check-cgo-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc (cd cgo-test-dir/misc/cgo/test && $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> cgo-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/test (0.00s)" >> cgo-testlog grep '^--- ' cgo-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 -# check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go` +# check-carchive-test runs `go test` in misc/cgo/testcarchive. # in our environment. check-carchive-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc rm -rf carchive-test-dir carchive-testlog $(MKDIR_P) carchive-test-dir/misc/cgo cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ - echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v carchive_test.go" > carchive-testlog + echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > carchive-testlog $(CHECK_ENV) \ LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ export LIBRARY_PATH; \ - (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v carchive_test.go) >> carchive-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/testcarchive (0.00s)" >> carchive-testlog + (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> carchive-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/testcarchive (0.00s)" >> carchive-testlog grep '^--- ' carchive-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 # check-vet runs `go test cmd/vet` in our environment. diff --git a/gotools/Makefile.in b/gotools/Makefile.in index 1c2237cca9b..b36dbfbde1b 100644 --- a/gotools/Makefile.in +++ b/gotools/Makefile.in @@ -919,7 +919,7 @@ mostlyclean-local: @NATIVE_TRUE@ $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles="$${files}" $(GOTESTFLAGS) -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v >> runtime-testlog 2>&1 || echo "--- $${fl}: go test runtime (0.00s)" >> runtime-testlog @NATIVE_TRUE@ grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 -# check-cgo-test runs `go test misc/cgo/test` in our environment. +# check-cgo-test runs `go test` in misc/cgo/test. @NATIVE_TRUE@check-cgo-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc @NATIVE_TRUE@ rm -rf cgo-test-dir cgo-testlog @NATIVE_TRUE@ $(MKDIR_P) cgo-test-dir/misc/cgo @@ -932,18 +932,18 @@ mostlyclean-local: @NATIVE_TRUE@ (cd cgo-test-dir/misc/cgo/test && $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> cgo-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/test (0.00s)" >> cgo-testlog @NATIVE_TRUE@ grep '^--- ' cgo-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 -# check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go` +# check-carchive-test runs `go test` in misc/cgo/testcarchive. # in our environment. @NATIVE_TRUE@check-carchive-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc @NATIVE_TRUE@ rm -rf carchive-test-dir carchive-testlog @NATIVE_TRUE@ $(MKDIR_P) carchive-test-dir/misc/cgo @NATIVE_TRUE@ cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/ @NATIVE_TRUE@ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ -@NATIVE_TRUE@ echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v carchive_test.go" > carchive-testlog +@NATIVE_TRUE@ echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > carchive-testlog @NATIVE_TRUE@ $(CHECK_ENV) \ @NATIVE_TRUE@ LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ @NATIVE_TRUE@ export LIBRARY_PATH; \ -@NATIVE_TRUE@ (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v carchive_test.go) >> carchive-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/testcarchive (0.00s)" >> carchive-testlog +@NATIVE_TRUE@ (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> carchive-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/testcarchive (0.00s)" >> carchive-testlog @NATIVE_TRUE@ grep '^--- ' carchive-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 # check-vet runs `go test cmd/vet` in our environment. diff --git a/libgo/MERGE b/libgo/MERGE index 37b7480a671..533c99da984 100644 --- a/libgo/MERGE +++ b/libgo/MERGE @@ -1,4 +1,4 @@ -ac02fdec7cd16ea8d3de1fc33def9cfabec5170d +60f14fddfee107dedd76c0be6b422a3d8ccc841a The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 341bac021ee..7bdfaa98513 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -187,6 +187,7 @@ toolexeclibgocrypto_DATA = \ crypto/des.gox \ crypto/dsa.gox \ crypto/ecdsa.gox \ + crypto/ed25519.gox \ crypto/elliptic.gox \ crypto/hmac.gox \ crypto/md5.gox \ @@ -399,8 +400,7 @@ toolexeclibgounicode_DATA = \ # internal packages nothing will explicitly depend on them. # Force them to be built. noinst_DATA = \ - internal/x/net/internal/nettest.gox \ - internal/x/net/nettest.gox \ + golang.org/x/net/nettest.gox \ internal/testenv.gox \ internal/trace.gox \ net/internal/socktest.gox \ @@ -482,7 +482,6 @@ s-version: Makefile echo " BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> version.go.tmp echo " CacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> version.go.tmp echo " DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp - echo " HugePageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) hugepagesize`" >> version.go.tmp echo " Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp echo " MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp echo " PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp @@ -516,14 +515,16 @@ s-objabi: Makefile rm -f objabi.go.tmp echo "package objabi" > objabi.go.tmp echo "import \"runtime\"" >> objabi.go.tmp - echo 'func init() { defaultGOROOT = `$(prefix)` }' >> objabi.go.tmp + echo 'func defaultGOROOTValue() string { return `$(prefix)` }' >> objabi.go.tmp echo 'const defaultGO386 = `sse2`' >> objabi.go.tmp echo 'const defaultGOARM = `5`' >> objabi.go.tmp echo 'const defaultGOMIPS = `hardfloat`' >> objabi.go.tmp echo 'const defaultGOMIPS64 = `hardfloat`' >> objabi.go.tmp + echo 'const defaultGOPPC64 = `power8`' >> objabi.go.tmp echo 'const defaultGOOS = runtime.GOOS' >> objabi.go.tmp echo 'const defaultGOARCH = runtime.GOARCH' >> objabi.go.tmp echo 'const defaultGO_EXTLINK_ENABLED = ``' >> objabi.go.tmp + echo 'const defaultGO_LDSO = ``' >> objabi.go.tmp echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> objabi.go.tmp echo 'const stackGuardMultiplierDefault = 1' >> objabi.go.tmp echo 'const goexperiment = ``' >> objabi.go.tmp @@ -591,7 +592,7 @@ s-zstdpkglist: Makefile echo 'package goroot' > zstdpkglist.go.tmp echo "" >> zstdpkglist.go.tmp echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp - echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_/]*_c\.lo||g' | sed 's|\([a-z0-9_/]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp + echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp echo '}' >> zstdpkglist.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go $(STAMP) $@ @@ -692,13 +693,14 @@ libgo_go_objs = \ syscall/errno.lo \ syscall/signame.lo \ syscall/wait.lo \ - $(internal_x_net_lif_lo) \ - $(internal_x_net_route_lo) \ + $(golangorg_x_net_lif_lo) \ + $(golangorg_x_net_route_lo) \ log/syslog/syslog_c.lo \ $(os_lib_inotify_lo) \ runtime/internal/atomic_c.lo \ sync/atomic_c.lo \ - internal/cpu/cpu_gccgo.lo + internal/cpu/cpu_gccgo.lo \ + golang.org/x/sys/cpu_gccgo.lo libgo_ldflags = \ -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) @@ -1020,6 +1022,11 @@ internal/cpu/cpu_gccgo.lo: go/internal/cpu/cpu_gccgo.c runtime.inc @$(MKDIR_P) internal/cpu $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/cpu/cpu_gccgo.c +# Similarly, golang.org/x/sys/cpu needs some C code. +golang.org/x/sys/cpu_gccgo.lo: go/golang.org/x/sys/cpu/cpu_gccgo.c runtime.inc + @$(MKDIR_P) golang.org/x/sys + $(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo.c + # Solaris 11.4 changed the type of fields in struct stat. # Use a build tag, based on a configure check, to cope. if LIBGO_IS_SOLARIS @@ -1038,10 +1045,10 @@ if LIBGO_IS_BSD $(eval $(call PACKAGE_template,internal/x/net/route)) -internal_x_net_route_lo = \ - internal/x/net/route.lo -internal_x_net_route_check = \ - internal/x/net/route/check +golangorg_x_net_route_lo = \ + golang.org/net/route.lo +golangorg_x_net_route_check = \ + golang.org/x/net/route/check endif @@ -1051,17 +1058,17 @@ if LIBGO_IS_SOLARIS $(eval $(call PACKAGE_template,internal/x/net/lif)) -internal_x_net_lif_lo = \ - internal/x/net/lif.lo -internal_x_net_lif_check = \ - internal/x/net/lif/check +golangorg_x_net_lif_lo = \ + golang.org/x/net/lif.lo +golangorg_x_net_lif_check = \ + golang.org/x/net/lif/check endif TPACKAGES = $(shell cat $(srcdir)/check-packages.txt) TEST_PACKAGES = $(addsuffix /check,$(TPACKAGES)) \ - $(internal_x_net_lif_check) \ - $(internal_x_net_route_check) + $(golangorg_x_net_lif_check) \ + $(golangorg_x_net_route_check) check: check-tail check-recursive: check-head diff --git a/libgo/Makefile.in b/libgo/Makefile.in index f415ca60116..751683887a3 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -218,10 +218,10 @@ LTLIBRARIES = $(toolexeclib_LTLIBRARIES) am__DEPENDENCIES_2 = $(addsuffix .lo,$(PACKAGES)) \ internal/bytealg/bytealg.lo reflect/makefunc_ffi_c.lo \ $(am__DEPENDENCIES_1) syscall/errno.lo syscall/signame.lo \ - syscall/wait.lo $(internal_x_net_lif_lo) \ - $(internal_x_net_route_lo) log/syslog/syslog_c.lo \ + syscall/wait.lo $(golangorg_x_net_lif_lo) \ + $(golangorg_x_net_route_lo) log/syslog/syslog_c.lo \ runtime/internal/atomic_c.lo sync/atomic_c.lo \ - internal/cpu/cpu_gccgo.lo + internal/cpu/cpu_gccgo.lo golang.org/x/sys/cpu_gccgo.lo am__DEPENDENCIES_3 = am__DEPENDENCIES_4 = $(am__DEPENDENCIES_2) \ ../libbacktrace/libbacktrace.la $(am__DEPENDENCIES_3) \ @@ -670,6 +670,7 @@ toolexeclibgocrypto_DATA = \ crypto/des.gox \ crypto/dsa.gox \ crypto/ecdsa.gox \ + crypto/ed25519.gox \ crypto/elliptic.gox \ crypto/hmac.gox \ crypto/md5.gox \ @@ -854,8 +855,7 @@ toolexeclibgounicode_DATA = \ # Some packages are only needed for tests, so unlike the other # internal packages nothing will explicitly depend on them. # Force them to be built. -noinst_DATA = internal/x/net/internal/nettest.gox \ - internal/x/net/nettest.gox internal/testenv.gox \ +noinst_DATA = golang.org/x/net/nettest.gox internal/testenv.gox \ internal/trace.gox net/internal/socktest.gox \ os/signal/internal/pty.gox runtime/pprof/internal/profile.gox \ zdefaultcc.go @@ -915,13 +915,14 @@ libgo_go_objs = \ syscall/errno.lo \ syscall/signame.lo \ syscall/wait.lo \ - $(internal_x_net_lif_lo) \ - $(internal_x_net_route_lo) \ + $(golangorg_x_net_lif_lo) \ + $(golangorg_x_net_route_lo) \ log/syslog/syslog_c.lo \ $(os_lib_inotify_lo) \ runtime/internal/atomic_c.lo \ sync/atomic_c.lo \ - internal/cpu/cpu_gccgo.lo + internal/cpu/cpu_gccgo.lo \ + golang.org/x/sys/cpu_gccgo.lo libgo_ldflags = \ -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) @@ -1114,22 +1115,22 @@ extra_check_libs_cmd_vet_internal_cfg = $(abs_builddir)/libgotool.a # Use a build tag, based on a configure check, to cope. @HAVE_STAT_TIMESPEC_TRUE@@LIBGO_IS_SOLARIS_TRUE@matchargs_os = --tag=solaristag @LIBGO_IS_SOLARIS_FALSE@matchargs_os = -@LIBGO_IS_BSD_TRUE@internal_x_net_route_lo = \ -@LIBGO_IS_BSD_TRUE@ internal/x/net/route.lo +@LIBGO_IS_BSD_TRUE@golangorg_x_net_route_lo = \ +@LIBGO_IS_BSD_TRUE@ golang.org/net/route.lo -@LIBGO_IS_BSD_TRUE@internal_x_net_route_check = \ -@LIBGO_IS_BSD_TRUE@ internal/x/net/route/check +@LIBGO_IS_BSD_TRUE@golangorg_x_net_route_check = \ +@LIBGO_IS_BSD_TRUE@ golang.org/x/net/route/check -@LIBGO_IS_SOLARIS_TRUE@internal_x_net_lif_lo = \ -@LIBGO_IS_SOLARIS_TRUE@ internal/x/net/lif.lo +@LIBGO_IS_SOLARIS_TRUE@golangorg_x_net_lif_lo = \ +@LIBGO_IS_SOLARIS_TRUE@ golang.org/x/net/lif.lo -@LIBGO_IS_SOLARIS_TRUE@internal_x_net_lif_check = \ -@LIBGO_IS_SOLARIS_TRUE@ internal/x/net/lif/check +@LIBGO_IS_SOLARIS_TRUE@golangorg_x_net_lif_check = \ +@LIBGO_IS_SOLARIS_TRUE@ golang.org/x/net/lif/check TPACKAGES = $(shell cat $(srcdir)/check-packages.txt) TEST_PACKAGES = $(addsuffix /check,$(TPACKAGES)) \ - $(internal_x_net_lif_check) \ - $(internal_x_net_route_check) + $(golangorg_x_net_lif_check) \ + $(golangorg_x_net_route_check) MOSTLYCLEANFILES = \ s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \ @@ -2597,7 +2598,6 @@ s-version: Makefile echo " BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> version.go.tmp echo " CacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> version.go.tmp echo " DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp - echo " HugePageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) hugepagesize`" >> version.go.tmp echo " Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp echo " MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp echo " PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp @@ -2631,14 +2631,16 @@ s-objabi: Makefile rm -f objabi.go.tmp echo "package objabi" > objabi.go.tmp echo "import \"runtime\"" >> objabi.go.tmp - echo 'func init() { defaultGOROOT = `$(prefix)` }' >> objabi.go.tmp + echo 'func defaultGOROOTValue() string { return `$(prefix)` }' >> objabi.go.tmp echo 'const defaultGO386 = `sse2`' >> objabi.go.tmp echo 'const defaultGOARM = `5`' >> objabi.go.tmp echo 'const defaultGOMIPS = `hardfloat`' >> objabi.go.tmp echo 'const defaultGOMIPS64 = `hardfloat`' >> objabi.go.tmp + echo 'const defaultGOPPC64 = `power8`' >> objabi.go.tmp echo 'const defaultGOOS = runtime.GOOS' >> objabi.go.tmp echo 'const defaultGOARCH = runtime.GOARCH' >> objabi.go.tmp echo 'const defaultGO_EXTLINK_ENABLED = ``' >> objabi.go.tmp + echo 'const defaultGO_LDSO = ``' >> objabi.go.tmp echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> objabi.go.tmp echo 'const stackGuardMultiplierDefault = 1' >> objabi.go.tmp echo 'const goexperiment = ``' >> objabi.go.tmp @@ -2700,7 +2702,7 @@ s-zstdpkglist: Makefile echo 'package goroot' > zstdpkglist.go.tmp echo "" >> zstdpkglist.go.tmp echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp - echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_/]*_c\.lo||g' | sed 's|\([a-z0-9_/]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp + echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp echo '}' >> zstdpkglist.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go $(STAMP) $@ @@ -2876,6 +2878,11 @@ internal/cpu/cpu_gccgo.lo: go/internal/cpu/cpu_gccgo.c runtime.inc @$(MKDIR_P) internal/cpu $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/cpu/cpu_gccgo.c +# Similarly, golang.org/x/sys/cpu needs some C code. +golang.org/x/sys/cpu_gccgo.lo: go/golang.org/x/sys/cpu/cpu_gccgo.c runtime.inc + @$(MKDIR_P) golang.org/x/sys + $(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo.c + # Build internal/x/net/route only on BSD systems. @LIBGO_IS_BSD_TRUE@$(eval $(call PACKAGE_template,internal/x/net/route)) diff --git a/libgo/VERSION b/libgo/VERSION index b9c64397147..a49377394fe 100644 --- a/libgo/VERSION +++ b/libgo/VERSION @@ -1 +1 @@ -go1.12.2 +go1.13beta1 diff --git a/libgo/check-packages.txt b/libgo/check-packages.txt index 298f9e06261..a13624303dd 100644 --- a/libgo/check-packages.txt +++ b/libgo/check-packages.txt @@ -21,7 +21,6 @@ cmd/go/internal/par cmd/go/internal/search cmd/go/internal/semver cmd/go/internal/txtar -cmd/go/internal/web2 cmd/go/internal/work cmd/internal/buildid cmd/internal/edit @@ -42,6 +41,7 @@ crypto/cipher crypto/des crypto/dsa crypto/ecdsa +crypto/ed25519 crypto/elliptic crypto/hmac crypto/internal/subtle @@ -106,20 +106,11 @@ image/png index/suffixarray internal/cpu internal/fmtsort +internal/oserror internal/poll +internal/reflectlite internal/singleflight internal/trace -internal/x/crypto/chacha20poly1305 -internal/x/crypto/cryptobyte -internal/x/crypto/curve25519 -internal/x/crypto/hkdf -internal/x/crypto/internal/chacha20 -internal/x/crypto/poly1305 -internal/x/net/dns/dnsmessage -internal/x/net/http/httpguts -internal/x/net/http/httpproxy -internal/x/net/http2/hpack -internal/x/net/idna internal/xcoff io io/ioutil diff --git a/libgo/configure b/libgo/configure index 22ef79c5118..ebdffa88437 100755 --- a/libgo/configure +++ b/libgo/configure @@ -2542,7 +2542,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" -libtool_VERSION=14:0:0 +libtool_VERSION=15:0:0 # Default to --enable-multilib @@ -13887,7 +13887,7 @@ go_include="-include" # All known GOOS values. This is the union of all operating systems # supported by the gofrontend and all operating systems supported by # the gc toolchain. -ALLGOOS="aix android darwin dragonfly freebsd hurd irix js linux netbsd openbsd plan9 rtems solaris windows" +ALLGOOS="aix android darwin dragonfly freebsd hurd illumos irix js linux netbsd openbsd plan9 rtems solaris windows" is_darwin=no is_freebsd=no diff --git a/libgo/configure.ac b/libgo/configure.ac index 0ae8162a1ba..8a0a04f77ab 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -10,7 +10,7 @@ AC_INIT(package-unused, version-unused,, libgo) AC_CONFIG_SRCDIR(Makefile.am) AC_CONFIG_HEADER(config.h) -libtool_VERSION=14:0:0 +libtool_VERSION=15:0:0 AC_SUBST(libtool_VERSION) AM_ENABLE_MULTILIB(, ..) @@ -154,7 +154,7 @@ AC_SUBST(go_include) # All known GOOS values. This is the union of all operating systems # supported by the gofrontend and all operating systems supported by # the gc toolchain. -ALLGOOS="aix android darwin dragonfly freebsd hurd irix js linux netbsd openbsd plan9 rtems solaris windows" +ALLGOOS="aix android darwin dragonfly freebsd hurd illumos irix js linux netbsd openbsd plan9 rtems solaris windows" is_darwin=no is_freebsd=no diff --git a/libgo/go/archive/tar/strconv.go b/libgo/go/archive/tar/strconv.go index d144485a492..0a910f33b9d 100644 --- a/libgo/go/archive/tar/strconv.go +++ b/libgo/go/archive/tar/strconv.go @@ -244,7 +244,7 @@ func formatPAXTime(ts time.Time) (s string) { if secs < 0 { sign = "-" // Remember sign secs = -(secs + 1) // Add a second to secs - nsecs = -(nsecs - 1E9) // Take that second away from nsecs + nsecs = -(nsecs - 1e9) // Take that second away from nsecs } return strings.TrimRight(fmt.Sprintf("%s%d.%09d", sign, secs, nsecs), "0") } diff --git a/libgo/go/archive/tar/strconv_test.go b/libgo/go/archive/tar/strconv_test.go index 4cc388cb0f2..dd3505a758a 100644 --- a/libgo/go/archive/tar/strconv_test.go +++ b/libgo/go/archive/tar/strconv_test.go @@ -303,27 +303,27 @@ func TestFormatPAXTime(t *testing.T) { {1350244992, 300000000, "1350244992.3"}, {1350244992, 23960100, "1350244992.0239601"}, {1350244992, 23960108, "1350244992.023960108"}, - {+1, +1E9 - 1E0, "1.999999999"}, - {+1, +1E9 - 1E3, "1.999999"}, - {+1, +1E9 - 1E6, "1.999"}, - {+1, +0E0 - 0E0, "1"}, - {+1, +1E6 - 0E0, "1.001"}, - {+1, +1E3 - 0E0, "1.000001"}, - {+1, +1E0 - 0E0, "1.000000001"}, - {0, 1E9 - 1E0, "0.999999999"}, - {0, 1E9 - 1E3, "0.999999"}, - {0, 1E9 - 1E6, "0.999"}, - {0, 0E0, "0"}, - {0, 1E6 + 0E0, "0.001"}, - {0, 1E3 + 0E0, "0.000001"}, - {0, 1E0 + 0E0, "0.000000001"}, - {-1, -1E9 + 1E0, "-1.999999999"}, - {-1, -1E9 + 1E3, "-1.999999"}, - {-1, -1E9 + 1E6, "-1.999"}, - {-1, -0E0 + 0E0, "-1"}, - {-1, -1E6 + 0E0, "-1.001"}, - {-1, -1E3 + 0E0, "-1.000001"}, - {-1, -1E0 + 0E0, "-1.000000001"}, + {+1, +1e9 - 1e0, "1.999999999"}, + {+1, +1e9 - 1e3, "1.999999"}, + {+1, +1e9 - 1e6, "1.999"}, + {+1, +0e0 - 0e0, "1"}, + {+1, +1e6 - 0e0, "1.001"}, + {+1, +1e3 - 0e0, "1.000001"}, + {+1, +1e0 - 0e0, "1.000000001"}, + {0, 1e9 - 1e0, "0.999999999"}, + {0, 1e9 - 1e3, "0.999999"}, + {0, 1e9 - 1e6, "0.999"}, + {0, 0e0, "0"}, + {0, 1e6 + 0e0, "0.001"}, + {0, 1e3 + 0e0, "0.000001"}, + {0, 1e0 + 0e0, "0.000000001"}, + {-1, -1e9 + 1e0, "-1.999999999"}, + {-1, -1e9 + 1e3, "-1.999999"}, + {-1, -1e9 + 1e6, "-1.999"}, + {-1, -0e0 + 0e0, "-1"}, + {-1, -1e6 + 0e0, "-1.001"}, + {-1, -1e3 + 0e0, "-1.000001"}, + {-1, -1e0 + 0e0, "-1.000000001"}, {-1350244992, 0, "-1350244992"}, {-1350244992, -300000000, "-1350244992.3"}, {-1350244992, -23960100, "-1350244992.0239601"}, diff --git a/libgo/go/archive/zip/struct.go b/libgo/go/archive/zip/struct.go index bd637d185b7..686e79781ac 100644 --- a/libgo/go/archive/zip/struct.go +++ b/libgo/go/archive/zip/struct.go @@ -154,10 +154,15 @@ func (fi headerFileInfo) Size() int64 { } return int64(fi.fh.UncompressedSize) } -func (fi headerFileInfo) IsDir() bool { return fi.Mode().IsDir() } -func (fi headerFileInfo) ModTime() time.Time { return fi.fh.ModTime() } -func (fi headerFileInfo) Mode() os.FileMode { return fi.fh.Mode() } -func (fi headerFileInfo) Sys() interface{} { return fi.fh } +func (fi headerFileInfo) IsDir() bool { return fi.Mode().IsDir() } +func (fi headerFileInfo) ModTime() time.Time { + if fi.fh.Modified.IsZero() { + return fi.fh.ModTime() + } + return fi.fh.Modified.UTC() +} +func (fi headerFileInfo) Mode() os.FileMode { return fi.fh.Mode() } +func (fi headerFileInfo) Sys() interface{} { return fi.fh } // FileInfoHeader creates a partially-populated FileHeader from an // os.FileInfo. diff --git a/libgo/go/archive/zip/zip_test.go b/libgo/go/archive/zip/zip_test.go index 3d5c759851a..b3a7caac7f2 100644 --- a/libgo/go/archive/zip/zip_test.go +++ b/libgo/go/archive/zip/zip_test.go @@ -11,7 +11,6 @@ import ( "errors" "fmt" "hash" - "internal/race" "internal/testenv" "io" "io/ioutil" @@ -114,6 +113,47 @@ func TestFileHeaderRoundTrip64(t *testing.T) { testHeaderRoundTrip(fh, uint32max, fh.UncompressedSize64, t) } +func TestFileHeaderRoundTripModified(t *testing.T) { + fh := &FileHeader{ + Name: "foo.txt", + UncompressedSize: 987654321, + Modified: time.Now().Local(), + ModifiedTime: 1234, + ModifiedDate: 5678, + } + fi := fh.FileInfo() + fh2, err := FileInfoHeader(fi) + if err != nil { + t.Fatal(err) + } + if got, want := fh2.Modified, fh.Modified.UTC(); got != want { + t.Errorf("Modified: got %s, want %s\n", got, want) + } + if got, want := fi.ModTime(), fh.Modified.UTC(); got != want { + t.Errorf("Modified: got %s, want %s\n", got, want) + } +} + +func TestFileHeaderRoundTripWithoutModified(t *testing.T) { + fh := &FileHeader{ + Name: "foo.txt", + UncompressedSize: 987654321, + ModifiedTime: 1234, + ModifiedDate: 5678, + } + fi := fh.FileInfo() + fh2, err := FileInfoHeader(fi) + if err != nil { + t.Fatal(err) + } + if got, want := fh2.ModTime(), fh.ModTime(); got != want { + t.Errorf("Modified: got %s, want %s\n", got, want) + } + if got, want := fi.ModTime(), fh.ModTime(); got != want { + t.Errorf("Modified: got %s, want %s\n", got, want) + } +} + type repeatedByte struct { off int64 b byte @@ -268,7 +308,7 @@ func TestZip64EdgeCase(t *testing.T) { // Tests that we generate a zip64 file if the directory at offset // 0xFFFFFFFF, but not before. func TestZip64DirectoryOffset(t *testing.T) { - if testing.Short() && race.Enabled { + if testing.Short() { t.Skip("skipping in short mode") } t.Parallel() @@ -313,7 +353,7 @@ func TestZip64DirectoryOffset(t *testing.T) { // At 16k records, we need to generate a zip64 file. func TestZip64ManyRecords(t *testing.T) { - if testing.Short() && race.Enabled { + if testing.Short() { t.Skip("skipping in short mode") } t.Parallel() diff --git a/libgo/go/bufio/bufio.go b/libgo/go/bufio/bufio.go index 0125d729d1b..0f05d3b3221 100644 --- a/libgo/go/bufio/bufio.go +++ b/libgo/go/bufio/bufio.go @@ -197,6 +197,9 @@ func (b *Reader) Discard(n int) (discarded int, err error) { func (b *Reader) Read(p []byte) (n int, err error) { n = len(p) if n == 0 { + if b.Buffered() > 0 { + return 0, nil + } return 0, b.readErr() } if b.r == b.w { diff --git a/libgo/go/bufio/bufio_test.go b/libgo/go/bufio/bufio_test.go index f7a0682e703..782ca2149aa 100644 --- a/libgo/go/bufio/bufio_test.go +++ b/libgo/go/bufio/bufio_test.go @@ -1481,6 +1481,60 @@ func newScriptedReader(steps ...func(p []byte) (n int, err error)) io.Reader { return &sr } +// eofReader returns the number of bytes read and io.EOF for the read that consumes the last of the content. +type eofReader struct { + buf []byte +} + +func (r *eofReader) Read(p []byte) (int, error) { + read := copy(p, r.buf) + r.buf = r.buf[read:] + + switch read { + case 0, len(r.buf): + // As allowed in the documentation, this will return io.EOF + // in the same call that consumes the last of the data. + // https://godoc.org/io#Reader + return read, io.EOF + } + + return read, nil +} + +func TestPartialReadEOF(t *testing.T) { + src := make([]byte, 10) + eofR := &eofReader{buf: src} + r := NewReader(eofR) + + // Start by reading 5 of the 10 available bytes. + dest := make([]byte, 5) + read, err := r.Read(dest) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if n := len(dest); read != n { + t.Fatalf("read %d bytes; wanted %d bytes", read, n) + } + + // The Reader should have buffered all the content from the io.Reader. + if n := len(eofR.buf); n != 0 { + t.Fatalf("got %d bytes left in bufio.Reader source; want 0 bytes", n) + } + // To prove the point, check that there are still 5 bytes available to read. + if n := r.Buffered(); n != 5 { + t.Fatalf("got %d bytes buffered in bufio.Reader; want 5 bytes", n) + } + + // This is the second read of 0 bytes. + read, err = r.Read([]byte{}) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if read != 0 { + t.Fatalf("read %d bytes; want 0 bytes", read) + } +} + func BenchmarkReaderCopyOptimal(b *testing.B) { // Optimal case is where the underlying reader implements io.WriterTo srcBuf := bytes.NewBuffer(make([]byte, 8192)) diff --git a/libgo/go/bufio/example_test.go b/libgo/go/bufio/example_test.go index 4666e6d9855..8885d40549f 100644 --- a/libgo/go/bufio/example_test.go +++ b/libgo/go/bufio/example_test.go @@ -31,6 +31,19 @@ func ExampleScanner_lines() { } } +// Return the most recent call to Scan as a []byte. +func ExampleScanner_Bytes() { + scanner := bufio.NewScanner(strings.NewReader("gopher")) + for scanner.Scan() { + fmt.Println(len(scanner.Bytes()) == 6) + } + if err := scanner.Err(); err != nil { + fmt.Fprintln(os.Stderr, "shouldn't see an error scanning a string") + } + // Output: + // true +} + // Use a Scanner to implement a simple word-count utility by scanning the // input as a sequence of space-delimited tokens. func ExampleScanner_words() { @@ -94,6 +107,9 @@ func ExampleScanner_emptyFinalToken() { return i + 1, data[:i], nil } } + if !atEOF { + return 0, nil, nil + } // There is one final token to be delivered, which may be the empty string. // Returning bufio.ErrFinalToken here tells Scan there are no more tokens after this // but does not trigger an error to be returned from Scan itself. diff --git a/libgo/go/bufio/scan.go b/libgo/go/bufio/scan.go index cefd2614647..4e787c4b0a4 100644 --- a/libgo/go/bufio/scan.go +++ b/libgo/go/bufio/scan.go @@ -73,7 +73,7 @@ var ( const ( // MaxScanTokenSize is the maximum size used to buffer a token - // unless the user provides an explicit buffer with Scan.Buffer. + // unless the user provides an explicit buffer with Scanner.Buffer. // The actual maximum token size may be smaller as the buffer // may need to include, for instance, a newline. MaxScanTokenSize = 64 * 1024 diff --git a/libgo/go/builtin/builtin.go b/libgo/go/builtin/builtin.go index c78fe09ea66..01190e99002 100644 --- a/libgo/go/builtin/builtin.go +++ b/libgo/go/builtin/builtin.go @@ -151,7 +151,7 @@ func delete(m map[Type]Type1, key Type) // Slice, or map: the number of elements in v; if v is nil, len(v) is zero. // String: the number of bytes in v. // Channel: the number of elements queued (unread) in the channel buffer; -// if v is nil, len(v) is zero. +// if v is nil, len(v) is zero. // For some arguments, such as a string literal or a simple array expression, the // result can be a constant. See the Go language specification's "Length and // capacity" section for details. @@ -226,10 +226,9 @@ func close(c chan<- Type) // invocation of F then behaves like a call to panic, terminating G's // execution and running any deferred functions. This continues until all // functions in the executing goroutine have stopped, in reverse order. At -// that point, the program is terminated and the error condition is reported, -// including the value of the argument to panic. This termination sequence -// is called panicking and can be controlled by the built-in function -// recover. +// that point, the program is terminated with a non-zero exit code. This +// termination sequence is called panicking and can be controlled by the +// built-in function recover. func panic(v interface{}) // The recover built-in function allows a program to manage behavior of a diff --git a/libgo/go/bytes/buffer.go b/libgo/go/bytes/buffer.go index aff2db5084f..f19a4cfff09 100644 --- a/libgo/go/bytes/buffer.go +++ b/libgo/go/bytes/buffer.go @@ -21,9 +21,6 @@ type Buffer struct { buf []byte // contents are the bytes buf[off : len(buf)] off int // read at &buf[off], write at &buf[len(buf)] lastRead readOp // last read operation, so that Unread* can work correctly. - - // FIXME: it would be advisable to align Buffer to cachelines to avoid false - // sharing. } // The readOp constants describe the last action performed on @@ -385,13 +382,15 @@ func (b *Buffer) UnreadRune() error { return nil } +var errUnreadByte = errors.New("bytes.Buffer: UnreadByte: previous operation was not a successful read") + // UnreadByte unreads the last byte returned by the most recent successful // read operation that read at least one byte. If a write has happened since // the last read, if the last read returned an error, or if the read read zero // bytes, UnreadByte returns an error. func (b *Buffer) UnreadByte() error { if b.lastRead == opInvalid { - return errors.New("bytes.Buffer: UnreadByte: previous operation was not a successful read") + return errUnreadByte } b.lastRead = opInvalid if b.off > 0 { diff --git a/libgo/go/bytes/buffer_test.go b/libgo/go/bytes/buffer_test.go index 6e9d6952a51..7626d277d4f 100644 --- a/libgo/go/bytes/buffer_test.go +++ b/libgo/go/bytes/buffer_test.go @@ -131,11 +131,8 @@ func TestBasicOperations(t *testing.T) { check(t, "TestBasicOperations (3)", &buf, "") n, err := buf.Write(testBytes[0:1]) - if n != 1 { - t.Errorf("wrote 1 byte, but n == %d", n) - } - if err != nil { - t.Errorf("err should always be nil, but err == %s", err) + if want := 1; err != nil || n != want { + t.Errorf("Write: got (%d, %v), want (%d, %v)", n, err, want, nil) } check(t, "TestBasicOperations (4)", &buf, "a") @@ -143,8 +140,8 @@ func TestBasicOperations(t *testing.T) { check(t, "TestBasicOperations (5)", &buf, "ab") n, err = buf.Write(testBytes[2:26]) - if n != 24 { - t.Errorf("wrote 24 bytes, but n == %d", n) + if want := 24; err != nil || n != want { + t.Errorf("Write: got (%d, %v), want (%d, %v)", n, err, want, nil) } check(t, "TestBasicOperations (6)", &buf, testString[0:26]) @@ -159,15 +156,12 @@ func TestBasicOperations(t *testing.T) { buf.WriteByte(testString[1]) c, err := buf.ReadByte() - if err != nil { - t.Error("ReadByte unexpected eof") - } - if c != testString[1] { - t.Errorf("ReadByte wrong value c=%v", c) + if want := testString[1]; err != nil || c != want { + t.Errorf("ReadByte: got (%q, %v), want (%q, %v)", c, err, want, nil) } c, err = buf.ReadByte() - if err == nil { - t.Error("ReadByte unexpected not eof") + if err != io.EOF { + t.Errorf("ReadByte: got (%q, %v), want (%q, %v)", c, err, byte(0), io.EOF) } } } diff --git a/libgo/go/bytes/bytes.go b/libgo/go/bytes/bytes.go index daf4a32f26f..eb132123849 100644 --- a/libgo/go/bytes/bytes.go +++ b/libgo/go/bytes/bytes.go @@ -12,23 +12,12 @@ import ( "unicode/utf8" ) -// Equal returns a boolean reporting whether a and b +// Equal reports whether a and b // are the same length and contain the same bytes. // A nil argument is equivalent to an empty slice. func Equal(a, b []byte) bool { - return bytealg.Equal(a, b) -} - -func equalPortable(a, b []byte) bool { - if len(a) != len(b) { - return false - } - for i, c := range a { - if c != b[i] { - return false - } - } - return true + // Neither cmd/compile nor gccgo allocates for these string conversions. + return string(a) == string(b) } // Compare returns an integer comparing two byte slices lexicographically. @@ -114,12 +103,34 @@ func indexBytePortable(s []byte, c byte) int { // LastIndex returns the index of the last instance of sep in s, or -1 if sep is not present in s. func LastIndex(s, sep []byte) int { n := len(sep) - if n == 0 { + switch { + case n == 0: return len(s) + case n == 1: + return LastIndexByte(s, sep[0]) + case n == len(s): + if Equal(s, sep) { + return 0 + } + return -1 + case n > len(s): + return -1 } - c := sep[0] - for i := len(s) - n; i >= 0; i-- { - if s[i] == c && (n == 1 || Equal(s[i:i+n], sep)) { + // Rabin-Karp search from the end of the string + hashss, pow := hashStrRev(sep) + last := len(s) - n + var h uint32 + for i := len(s) - 1; i >= last; i-- { + h = h*primeRK + uint32(s[i]) + } + if h == hashss && Equal(s[last:], sep) { + return last + } + for i := last - 1; i >= 0; i-- { + h *= primeRK + h += uint32(s[i]) + h -= pow * uint32(s[i+n]) + if h == hashss && Equal(s[i:i+n], sep) { return i } } @@ -477,13 +488,16 @@ func Map(mapping func(r rune) rune, s []byte) []byte { // It panics if count is negative or if // the result of (len(b) * count) overflows. func Repeat(b []byte, count int) []byte { + if count == 0 { + return []byte{} + } // Since we cannot return an error on overflow, // we should panic if the repeat will generate // an overflow. // See Issue golang.org/issue/16237. if count < 0 { panic("bytes: negative Repeat count") - } else if count > 0 && len(b)*count/count != len(b) { + } else if len(b)*count/count != len(b) { panic("bytes: Repeat count causes overflow") } @@ -496,11 +510,66 @@ func Repeat(b []byte, count int) []byte { return nb } -// ToUpper treats s as UTF-8-encoded bytes and returns a copy with all the Unicode letters within it mapped to their upper case. -func ToUpper(s []byte) []byte { return Map(unicode.ToUpper, s) } +// ToUpper returns a copy of the byte slice s with all Unicode letters mapped to +// their upper case. +func ToUpper(s []byte) []byte { + isASCII, hasLower := true, false + for i := 0; i < len(s); i++ { + c := s[i] + if c >= utf8.RuneSelf { + isASCII = false + break + } + hasLower = hasLower || ('a' <= c && c <= 'z') + } + + if isASCII { // optimize for ASCII-only byte slices. + if !hasLower { + // Just return a copy. + return append([]byte(""), s...) + } + b := make([]byte, len(s)) + for i := 0; i < len(s); i++ { + c := s[i] + if 'a' <= c && c <= 'z' { + c -= 'a' - 'A' + } + b[i] = c + } + return b + } + return Map(unicode.ToUpper, s) +} -// ToLower treats s as UTF-8-encoded bytes and returns a copy with all the Unicode letters mapped to their lower case. -func ToLower(s []byte) []byte { return Map(unicode.ToLower, s) } +// ToLower returns a copy of the byte slice s with all Unicode letters mapped to +// their lower case. +func ToLower(s []byte) []byte { + isASCII, hasUpper := true, false + for i := 0; i < len(s); i++ { + c := s[i] + if c >= utf8.RuneSelf { + isASCII = false + break + } + hasUpper = hasUpper || ('A' <= c && c <= 'Z') + } + + if isASCII { // optimize for ASCII-only byte slices. + if !hasUpper { + return append([]byte(""), s...) + } + b := make([]byte, len(s)) + for i := 0; i < len(s); i++ { + c := s[i] + if 'A' <= c && c <= 'Z' { + c += 'a' - 'A' + } + b[i] = c + } + return b + } + return Map(unicode.ToLower, s) +} // ToTitle treats s as UTF-8-encoded bytes and returns a copy with all the Unicode letters mapped to their title case. func ToTitle(s []byte) []byte { return Map(unicode.ToTitle, s) } @@ -523,6 +592,35 @@ func ToTitleSpecial(c unicode.SpecialCase, s []byte) []byte { return Map(c.ToTitle, s) } +// ToValidUTF8 treats s as UTF-8-encoded bytes and returns a copy with each run of bytes +// representing invalid UTF-8 replaced with the bytes in replacement, which may be empty. +func ToValidUTF8(s, replacement []byte) []byte { + b := make([]byte, 0, len(s)+len(replacement)) + invalid := false // previous byte was from an invalid UTF-8 sequence + for i := 0; i < len(s); { + c := s[i] + if c < utf8.RuneSelf { + i++ + invalid = false + b = append(b, byte(c)) + continue + } + _, wid := utf8.DecodeRune(s[i:]) + if wid == 1 { + i++ + if !invalid { + invalid = true + b = append(b, replacement...) + } + continue + } + invalid = false + b = append(b, s[i:i+wid]...) + i += wid + } + return b +} + // isSeparator reports whether the rune could mark a word boundary. // TODO: update when package unicode captures more of the properties. func isSeparator(r rune) bool { @@ -734,7 +832,41 @@ func TrimRight(s []byte, cutset string) []byte { // TrimSpace returns a subslice of s by slicing off all leading and // trailing white space, as defined by Unicode. func TrimSpace(s []byte) []byte { - return TrimFunc(s, unicode.IsSpace) + // Fast path for ASCII: look for the first ASCII non-space byte + start := 0 + for ; start < len(s); start++ { + c := s[start] + if c >= utf8.RuneSelf { + // If we run into a non-ASCII byte, fall back to the + // slower unicode-aware method on the remaining bytes + return TrimFunc(s[start:], unicode.IsSpace) + } + if asciiSpace[c] == 0 { + break + } + } + + // Now look for the first ASCII non-space byte from the end + stop := len(s) + for ; stop > start; stop-- { + c := s[stop-1] + if c >= utf8.RuneSelf { + return TrimFunc(s[start:stop], unicode.IsSpace) + } + if asciiSpace[c] == 0 { + break + } + } + + // At this point s[start:stop] starts and ends with an ASCII + // non-space bytes, so we're done. Non-ASCII cases have already + // been handled above. + if start == stop { + // Special case to preserve previous TrimLeftFunc behavior, + // returning nil instead of empty slice if all spaces. + return nil + } + return s[start:stop] } // Runes interprets s as a sequence of UTF-8-encoded code points. @@ -987,3 +1119,20 @@ func hashStr(sep []byte) (uint32, uint32) { } return hash, pow } + +// hashStrRev returns the hash of the reverse of sep and the +// appropriate multiplicative factor for use in Rabin-Karp algorithm. +func hashStrRev(sep []byte) (uint32, uint32) { + hash := uint32(0) + for i := len(sep) - 1; i >= 0; i-- { + hash = hash*primeRK + uint32(sep[i]) + } + var pow, sq uint32 = 1, primeRK + for i := len(sep); i > 0; i >>= 1 { + if i&1 != 0 { + pow *= sq + } + sq *= sq + } + return hash, pow +} diff --git a/libgo/go/bytes/bytes_test.go b/libgo/go/bytes/bytes_test.go index ec4ecf31032..ebff5f00e58 100644 --- a/libgo/go/bytes/bytes_test.go +++ b/libgo/go/bytes/bytes_test.go @@ -52,15 +52,17 @@ type BinOpTest struct { } func TestEqual(t *testing.T) { - for _, tt := range compareTests { - eql := Equal(tt.a, tt.b) - if eql != (tt.i == 0) { - t.Errorf(`Equal(%q, %q) = %v`, tt.a, tt.b, eql) - } - eql = EqualPortable(tt.a, tt.b) - if eql != (tt.i == 0) { - t.Errorf(`EqualPortable(%q, %q) = %v`, tt.a, tt.b, eql) + // Run the tests and check for allocation at the same time. + allocs := testing.AllocsPerRun(10, func() { + for _, tt := range compareTests { + eql := Equal(tt.a, tt.b) + if eql != (tt.i == 0) { + t.Errorf(`Equal(%q, %q) = %v`, tt.a, tt.b, eql) + } } + }) + if allocs > 0 { + t.Errorf("Equal allocated %v times", allocs) } } @@ -577,11 +579,6 @@ func BenchmarkEqual(b *testing.B) { benchBytes(b, sizes, bmEqual(Equal)) } -func BenchmarkEqualPort(b *testing.B) { - sizes := []int{1, 6, 32, 4 << 10, 4 << 20, 64 << 20} - benchBytes(b, sizes, bmEqual(EqualPortable)) -} - func bmEqual(equal func([]byte, []byte) bool) func(b *testing.B, n int) { return func(b *testing.B, n int) { if len(bmbuf) < 2*n { @@ -682,34 +679,6 @@ func BenchmarkCountSingle(b *testing.B) { }) } -type ExplodeTest struct { - s string - n int - a []string -} - -var explodetests = []ExplodeTest{ - {"", -1, []string{}}, - {abcd, -1, []string{"a", "b", "c", "d"}}, - {faces, -1, []string{"☺", "☻", "☹"}}, - {abcd, 2, []string{"a", "bcd"}}, -} - -func TestExplode(t *testing.T) { - for _, tt := range explodetests { - a := SplitN([]byte(tt.s), nil, tt.n) - result := sliceOfString(a) - if !eq(result, tt.a) { - t.Errorf(`Explode("%s", %d) = %v; want %v`, tt.s, tt.n, result, tt.a) - continue - } - s := Join(a, []byte{}) - if string(s) != tt.s { - t.Errorf(`Join(Explode("%s", %d), "") = "%s"`, tt.s, tt.n, s) - } - } -} - type SplitTest struct { s string sep string @@ -718,7 +687,9 @@ type SplitTest struct { } var splittests = []SplitTest{ + {"", "", -1, []string{}}, {abcd, "a", 0, nil}, + {abcd, "", 2, []string{"a", "bcd"}}, {abcd, "a", -1, []string{"", "bcd"}}, {abcd, "z", -1, []string{"abcd"}}, {abcd, "", -1, []string{"a", "b", "c", "d"}}, @@ -748,7 +719,7 @@ func TestSplit(t *testing.T) { t.Errorf(`Split(%q, %q, %d) = %v; want %v`, tt.s, tt.sep, tt.n, result, tt.a) continue } - if tt.n == 0 { + if tt.n == 0 || len(a) == 0 { continue } @@ -914,54 +885,72 @@ func TestFieldsFunc(t *testing.T) { } // Test case for any function which accepts and returns a byte slice. -// For ease of creation, we write the byte slices as strings. +// For ease of creation, we write the input byte slice as a string. type StringTest struct { - in, out string + in string + out []byte } var upperTests = []StringTest{ - {"", ""}, - {"abc", "ABC"}, - {"AbC123", "ABC123"}, - {"azAZ09_", "AZAZ09_"}, - {"\u0250\u0250\u0250\u0250\u0250", "\u2C6F\u2C6F\u2C6F\u2C6F\u2C6F"}, // grows one byte per char + {"", []byte("")}, + {"ONLYUPPER", []byte("ONLYUPPER")}, + {"abc", []byte("ABC")}, + {"AbC123", []byte("ABC123")}, + {"azAZ09_", []byte("AZAZ09_")}, + {"longStrinGwitHmixofsmaLLandcAps", []byte("LONGSTRINGWITHMIXOFSMALLANDCAPS")}, + {"long\u0250string\u0250with\u0250nonascii\u2C6Fchars", []byte("LONG\u2C6FSTRING\u2C6FWITH\u2C6FNONASCII\u2C6FCHARS")}, + {"\u0250\u0250\u0250\u0250\u0250", []byte("\u2C6F\u2C6F\u2C6F\u2C6F\u2C6F")}, // grows one byte per char + {"a\u0080\U0010FFFF", []byte("A\u0080\U0010FFFF")}, // test utf8.RuneSelf and utf8.MaxRune } var lowerTests = []StringTest{ - {"", ""}, - {"abc", "abc"}, - {"AbC123", "abc123"}, - {"azAZ09_", "azaz09_"}, - {"\u2C6D\u2C6D\u2C6D\u2C6D\u2C6D", "\u0251\u0251\u0251\u0251\u0251"}, // shrinks one byte per char + {"", []byte("")}, + {"abc", []byte("abc")}, + {"AbC123", []byte("abc123")}, + {"azAZ09_", []byte("azaz09_")}, + {"longStrinGwitHmixofsmaLLandcAps", []byte("longstringwithmixofsmallandcaps")}, + {"LONG\u2C6FSTRING\u2C6FWITH\u2C6FNONASCII\u2C6FCHARS", []byte("long\u0250string\u0250with\u0250nonascii\u0250chars")}, + {"\u2C6D\u2C6D\u2C6D\u2C6D\u2C6D", []byte("\u0251\u0251\u0251\u0251\u0251")}, // shrinks one byte per char + {"A\u0080\U0010FFFF", []byte("a\u0080\U0010FFFF")}, // test utf8.RuneSelf and utf8.MaxRune } const space = "\t\v\r\f\n\u0085\u00a0\u2000\u3000" var trimSpaceTests = []StringTest{ - {"", ""}, - {"abc", "abc"}, - {space + "abc" + space, "abc"}, - {" ", ""}, - {" \t\r\n \t\t\r\r\n\n ", ""}, - {" \t\r\n x\t\t\r\r\n\n ", "x"}, - {" \u2000\t\r\n x\t\t\r\r\ny\n \u3000", "x\t\t\r\r\ny"}, - {"1 \t\r\n2", "1 \t\r\n2"}, - {" x\x80", "x\x80"}, - {" x\xc0", "x\xc0"}, - {"x \xc0\xc0 ", "x \xc0\xc0"}, - {"x \xc0", "x \xc0"}, - {"x \xc0 ", "x \xc0"}, - {"x \xc0\xc0 ", "x \xc0\xc0"}, - {"x ☺\xc0\xc0 ", "x ☺\xc0\xc0"}, - {"x ☺ ", "x ☺"}, + {"", nil}, + {" a", []byte("a")}, + {"b ", []byte("b")}, + {"abc", []byte("abc")}, + {space + "abc" + space, []byte("abc")}, + {" ", nil}, + {"\u3000 ", nil}, + {" \u3000", nil}, + {" \t\r\n \t\t\r\r\n\n ", nil}, + {" \t\r\n x\t\t\r\r\n\n ", []byte("x")}, + {" \u2000\t\r\n x\t\t\r\r\ny\n \u3000", []byte("x\t\t\r\r\ny")}, + {"1 \t\r\n2", []byte("1 \t\r\n2")}, + {" x\x80", []byte("x\x80")}, + {" x\xc0", []byte("x\xc0")}, + {"x \xc0\xc0 ", []byte("x \xc0\xc0")}, + {"x \xc0", []byte("x \xc0")}, + {"x \xc0 ", []byte("x \xc0")}, + {"x \xc0\xc0 ", []byte("x \xc0\xc0")}, + {"x ☺\xc0\xc0 ", []byte("x ☺\xc0\xc0")}, + {"x ☺ ", []byte("x ☺")}, } // Execute f on each test case. funcName should be the name of f; it's used // in failure reports. func runStringTests(t *testing.T, f func([]byte) []byte, funcName string, testCases []StringTest) { for _, tc := range testCases { - actual := string(f([]byte(tc.in))) - if actual != tc.out { + actual := f([]byte(tc.in)) + if actual == nil && tc.out != nil { + t.Errorf("%s(%q) = nil; want %q", funcName, tc.in, tc.out) + } + if actual != nil && tc.out == nil { + t.Errorf("%s(%q) = %q; want nil", funcName, tc.in, actual) + } + if !Equal(actual, tc.out) { t.Errorf("%s(%q) = %q; want %q", funcName, tc.in, actual, tc.out) } } @@ -1049,6 +1038,64 @@ func TestToUpper(t *testing.T) { runStringTests(t, ToUpper, "ToUpper", upperTest func TestToLower(t *testing.T) { runStringTests(t, ToLower, "ToLower", lowerTests) } +func BenchmarkToUpper(b *testing.B) { + for _, tc := range upperTests { + tin := []byte(tc.in) + b.Run(tc.in, func(b *testing.B) { + for i := 0; i < b.N; i++ { + actual := ToUpper(tin) + if !Equal(actual, tc.out) { + b.Errorf("ToUpper(%q) = %q; want %q", tc.in, actual, tc.out) + } + } + }) + } +} + +func BenchmarkToLower(b *testing.B) { + for _, tc := range lowerTests { + tin := []byte(tc.in) + b.Run(tc.in, func(b *testing.B) { + for i := 0; i < b.N; i++ { + actual := ToLower(tin) + if !Equal(actual, tc.out) { + b.Errorf("ToLower(%q) = %q; want %q", tc.in, actual, tc.out) + } + } + }) + } +} + +var toValidUTF8Tests = []struct { + in string + repl string + out string +}{ + {"", "\uFFFD", ""}, + {"abc", "\uFFFD", "abc"}, + {"\uFDDD", "\uFFFD", "\uFDDD"}, + {"a\xffb", "\uFFFD", "a\uFFFDb"}, + {"a\xffb\uFFFD", "X", "aXb\uFFFD"}, + {"a☺\xffb☺\xC0\xAFc☺\xff", "", "a☺b☺c☺"}, + {"a☺\xffb☺\xC0\xAFc☺\xff", "日本語", "a☺日本語b☺日本語c☺日本語"}, + {"\xC0\xAF", "\uFFFD", "\uFFFD"}, + {"\xE0\x80\xAF", "\uFFFD", "\uFFFD"}, + {"\xed\xa0\x80", "abc", "abc"}, + {"\xed\xbf\xbf", "\uFFFD", "\uFFFD"}, + {"\xF0\x80\x80\xaf", "☺", "☺"}, + {"\xF8\x80\x80\x80\xAF", "\uFFFD", "\uFFFD"}, + {"\xFC\x80\x80\x80\x80\xAF", "\uFFFD", "\uFFFD"}, +} + +func TestToValidUTF8(t *testing.T) { + for _, tc := range toValidUTF8Tests { + got := ToValidUTF8([]byte(tc.in), []byte(tc.repl)) + if !Equal(got, []byte(tc.out)) { + t.Errorf("ToValidUTF8(%q, %q) = %q; want %q", tc.in, tc.repl, got, tc.out) + } + } +} + func TestTrimSpace(t *testing.T) { runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests) } type RepeatTest struct { @@ -1255,8 +1302,11 @@ var isValidRune = predicate{ } type TrimFuncTest struct { - f predicate - in, out string + f predicate + in string + trimOut []byte + leftOut []byte + rightOut []byte } func not(p predicate) predicate { @@ -1269,20 +1319,68 @@ func not(p predicate) predicate { } var trimFuncTests = []TrimFuncTest{ - {isSpace, space + " hello " + space, "hello"}, - {isDigit, "\u0e50\u0e5212hello34\u0e50\u0e51", "hello"}, - {isUpper, "\u2C6F\u2C6F\u2C6F\u2C6FABCDhelloEF\u2C6F\u2C6FGH\u2C6F\u2C6F", "hello"}, - {not(isSpace), "hello" + space + "hello", space}, - {not(isDigit), "hello\u0e50\u0e521234\u0e50\u0e51helo", "\u0e50\u0e521234\u0e50\u0e51"}, - {isValidRune, "ab\xc0a\xc0cd", "\xc0a\xc0"}, - {not(isValidRune), "\xc0a\xc0", "a"}, + {isSpace, space + " hello " + space, + []byte("hello"), + []byte("hello " + space), + []byte(space + " hello")}, + {isDigit, "\u0e50\u0e5212hello34\u0e50\u0e51", + []byte("hello"), + []byte("hello34\u0e50\u0e51"), + []byte("\u0e50\u0e5212hello")}, + {isUpper, "\u2C6F\u2C6F\u2C6F\u2C6FABCDhelloEF\u2C6F\u2C6FGH\u2C6F\u2C6F", + []byte("hello"), + []byte("helloEF\u2C6F\u2C6FGH\u2C6F\u2C6F"), + []byte("\u2C6F\u2C6F\u2C6F\u2C6FABCDhello")}, + {not(isSpace), "hello" + space + "hello", + []byte(space), + []byte(space + "hello"), + []byte("hello" + space)}, + {not(isDigit), "hello\u0e50\u0e521234\u0e50\u0e51helo", + []byte("\u0e50\u0e521234\u0e50\u0e51"), + []byte("\u0e50\u0e521234\u0e50\u0e51helo"), + []byte("hello\u0e50\u0e521234\u0e50\u0e51")}, + {isValidRune, "ab\xc0a\xc0cd", + []byte("\xc0a\xc0"), + []byte("\xc0a\xc0cd"), + []byte("ab\xc0a\xc0")}, + {not(isValidRune), "\xc0a\xc0", + []byte("a"), + []byte("a\xc0"), + []byte("\xc0a")}, + // The nils returned by TrimLeftFunc are odd behavior, but we need + // to preserve backwards compatibility. + {isSpace, "", + nil, + nil, + []byte("")}, + {isSpace, " ", + nil, + nil, + []byte("")}, } func TestTrimFunc(t *testing.T) { for _, tc := range trimFuncTests { - actual := string(TrimFunc([]byte(tc.in), tc.f.f)) - if actual != tc.out { - t.Errorf("TrimFunc(%q, %q) = %q; want %q", tc.in, tc.f.name, actual, tc.out) + trimmers := []struct { + name string + trim func(s []byte, f func(r rune) bool) []byte + out []byte + }{ + {"TrimFunc", TrimFunc, tc.trimOut}, + {"TrimLeftFunc", TrimLeftFunc, tc.leftOut}, + {"TrimRightFunc", TrimRightFunc, tc.rightOut}, + } + for _, trimmer := range trimmers { + actual := trimmer.trim([]byte(tc.in), tc.f.f) + if actual == nil && trimmer.out != nil { + t.Errorf("%s(%q, %q) = nil; want %q", trimmer.name, tc.in, tc.f.name, trimmer.out) + } + if actual != nil && trimmer.out == nil { + t.Errorf("%s(%q, %q) = %q; want nil", trimmer.name, tc.in, tc.f.name, actual) + } + if !Equal(actual, trimmer.out) { + t.Errorf("%s(%q, %q) = %q; want %q", trimmer.name, tc.in, tc.f.name, actual, trimmer.out) + } } } } @@ -1622,9 +1720,41 @@ func BenchmarkFieldsFunc(b *testing.B) { } func BenchmarkTrimSpace(b *testing.B) { - s := []byte(" Some text. \n") - for i := 0; i < b.N; i++ { - TrimSpace(s) + tests := []struct { + name string + input []byte + }{ + {"NoTrim", []byte("typical")}, + {"ASCII", []byte(" foo bar ")}, + {"SomeNonASCII", []byte(" \u2000\t\r\n x\t\t\r\r\ny\n \u3000 ")}, + {"JustNonASCII", []byte("\u2000\u2000\u2000☺☺☺☺\u3000\u3000\u3000")}, + } + for _, test := range tests { + b.Run(test.name, func(b *testing.B) { + for i := 0; i < b.N; i++ { + TrimSpace(test.input) + } + }) + } +} + +func BenchmarkToValidUTF8(b *testing.B) { + tests := []struct { + name string + input []byte + }{ + {"Valid", []byte("typical")}, + {"InvalidASCII", []byte("foo\xffbar")}, + {"InvalidNonASCII", []byte("日本語\xff日本語")}, + } + replacement := []byte("\uFFFD") + b.ResetTimer() + for _, test := range tests { + b.Run(test.name, func(b *testing.B) { + for i := 0; i < b.N; i++ { + ToValidUTF8(test.input, replacement) + } + }) } } @@ -1647,6 +1777,39 @@ func makeBenchInputHard() []byte { var benchInputHard = makeBenchInputHard() +func benchmarkIndexHard(b *testing.B, sep []byte) { + for i := 0; i < b.N; i++ { + Index(benchInputHard, sep) + } +} + +func benchmarkLastIndexHard(b *testing.B, sep []byte) { + for i := 0; i < b.N; i++ { + LastIndex(benchInputHard, sep) + } +} + +func benchmarkCountHard(b *testing.B, sep []byte) { + for i := 0; i < b.N; i++ { + Count(benchInputHard, sep) + } +} + +func BenchmarkIndexHard1(b *testing.B) { benchmarkIndexHard(b, []byte("<>")) } +func BenchmarkIndexHard2(b *testing.B) { benchmarkIndexHard(b, []byte("")) } +func BenchmarkIndexHard3(b *testing.B) { benchmarkIndexHard(b, []byte("hello world")) } +func BenchmarkIndexHard4(b *testing.B) { + benchmarkIndexHard(b, []byte("
helloworld
")) +} + +func BenchmarkLastIndexHard1(b *testing.B) { benchmarkLastIndexHard(b, []byte("<>")) } +func BenchmarkLastIndexHard2(b *testing.B) { benchmarkLastIndexHard(b, []byte("")) } +func BenchmarkLastIndexHard3(b *testing.B) { benchmarkLastIndexHard(b, []byte("hello world")) } + +func BenchmarkCountHard1(b *testing.B) { benchmarkCountHard(b, []byte("<>")) } +func BenchmarkCountHard2(b *testing.B) { benchmarkCountHard(b, []byte("")) } +func BenchmarkCountHard3(b *testing.B) { benchmarkCountHard(b, []byte("hello world")) } + func BenchmarkSplitEmptySeparator(b *testing.B) { for i := 0; i < b.N; i++ { Split(benchInputHard, nil) diff --git a/libgo/go/bytes/example_test.go b/libgo/go/bytes/example_test.go index 6d328378fab..5ba7077c1de 100644 --- a/libgo/go/bytes/example_test.go +++ b/libgo/go/bytes/example_test.go @@ -365,6 +365,16 @@ func ExampleToTitle() { // ХЛЕБ } +func ExampleToTitleSpecial() { + str := []byte("ahoj vývojári golang") + totitle := bytes.ToTitleSpecial(unicode.AzeriCase, str) + fmt.Println("Original : " + string(str)) + fmt.Println("ToTitle : " + string(totitle)) + // Output: + // Original : ahoj vývojári golang + // ToTitle : AHOJ VÝVOJÁRİ GOLANG +} + func ExampleTrim() { fmt.Printf("[%q]", bytes.Trim([]byte(" !!! Achtung! Achtung! !!! "), "! ")) // Output: ["Achtung! Achtung"] @@ -438,11 +448,31 @@ func ExampleToUpper() { // Output: GOPHER } +func ExampleToUpperSpecial() { + str := []byte("ahoj vývojári golang") + totitle := bytes.ToUpperSpecial(unicode.AzeriCase, str) + fmt.Println("Original : " + string(str)) + fmt.Println("ToUpper : " + string(totitle)) + // Output: + // Original : ahoj vývojári golang + // ToUpper : AHOJ VÝVOJÁRİ GOLANG +} + func ExampleToLower() { fmt.Printf("%s", bytes.ToLower([]byte("Gopher"))) // Output: gopher } +func ExampleToLowerSpecial() { + str := []byte("AHOJ VÝVOJÁRİ GOLANG") + totitle := bytes.ToLowerSpecial(unicode.AzeriCase, str) + fmt.Println("Original : " + string(str)) + fmt.Println("ToLower : " + string(totitle)) + // Output: + // Original : AHOJ VÝVOJÁRİ GOLANG + // ToLower : ahoj vývojári golang +} + func ExampleReader_Len() { fmt.Println(bytes.NewReader([]byte("Hi!")).Len()) fmt.Println(bytes.NewReader([]byte("こんにちは!")).Len()) diff --git a/libgo/go/bytes/export_test.go b/libgo/go/bytes/export_test.go index f61523e60bb..b65428d9ce8 100644 --- a/libgo/go/bytes/export_test.go +++ b/libgo/go/bytes/export_test.go @@ -6,4 +6,3 @@ package bytes // Export func for testing var IndexBytePortable = indexBytePortable -var EqualPortable = equalPortable diff --git a/libgo/go/cmd/cgo/doc.go b/libgo/go/cmd/cgo/doc.go index cceb33edbdb..f227d7f8502 100644 --- a/libgo/go/cmd/cgo/doc.go +++ b/libgo/go/cmd/cgo/doc.go @@ -296,7 +296,7 @@ Go functions can be exported for use by C code in the following way: They will be available in the C code as: - extern int64 MyFunction(int arg1, int arg2, GoString arg3); + extern GoInt64 MyFunction(int arg1, int arg2, GoString arg3); extern struct MyFunction2_return MyFunction2(int arg1, int arg2, GoString arg3); found in the _cgo_export.h generated header, after any preambles @@ -710,7 +710,7 @@ _cgo_main.c: int main() { return 0; } void crosscall2(void(*fn)(void*, int, uintptr_t), void *a, int c, uintptr_t ctxt) { } - uintptr_t _cgo_wait_runtime_init_done() { return 0; } + uintptr_t _cgo_wait_runtime_init_done(void) { return 0; } void _cgo_release_context(uintptr_t ctxt) { } char* _cgo_topofstack(void) { return (char*)0; } void _cgo_allocate(void *a, int c) { } diff --git a/libgo/go/cmd/cgo/gcc.go b/libgo/go/cmd/cgo/gcc.go index e56207acaa7..70be6dc9a92 100644 --- a/libgo/go/cmd/cgo/gcc.go +++ b/libgo/go/cmd/cgo/gcc.go @@ -1274,6 +1274,8 @@ func (p *Package) isVariable(x ast.Expr) bool { return true case *ast.SelectorExpr: return p.isVariable(x.X) + case *ast.IndexExpr: + return true } return false } @@ -1609,6 +1611,7 @@ func (p *Package) gccCmd() []string { c = append(c, p.gccMachine()...) if goos == "aix" { c = append(c, "-maix64") + c = append(c, "-mcmodel=large") } c = append(c, "-") //read input from standard input return c diff --git a/libgo/go/cmd/cgo/godefs.go b/libgo/go/cmd/cgo/godefs.go index 64384a606b2..b4fd9c5a6e3 100644 --- a/libgo/go/cmd/cgo/godefs.go +++ b/libgo/go/cmd/cgo/godefs.go @@ -136,21 +136,31 @@ func gofmt(n interface{}) string { // (due to the printer possibly inserting newlines because of position // information) operators. var gofmtLineReplacer = strings.NewReplacer( - "{\n", "{", - ",\n", ",", + // Want to replace \n without ; after everything from + // https://golang.org/ref/spec#Operators_and_punctuation + // EXCEPT ++ -- ) ] } "++\n", "++;", "--\n", "--;", - "+\n", "+", - "-\n", "-", - "*\n", "*", - "/\n", "/", - "%\n", "%", - "&\n", "&", - "|\n", "|", - "^\n", "^", - "<\n", "<", - ">\n", ">", - "=\n", "=", + + "+\n", "+ ", + "-\n", "- ", + "*\n", "* ", + "/\n", "/ ", + "%\n", "% ", + "&\n", "& ", + "|\n", "| ", + "^\n", "^ ", + "<\n", "< ", + ">\n", "> ", + "=\n", "= ", + "!\n", "! ", // not possible in gofmt today + "(\n", "(", + "[\n", "[", // not possible in gofmt today + "{\n", "{", + ",\n", ",", + ".\n", ". ", + ":\n", ": ", // not possible in gofmt today + "\n", ";", ) diff --git a/libgo/go/cmd/cgo/out.go b/libgo/go/cmd/cgo/out.go index 9e6fe6f1d01..77e9108dd23 100644 --- a/libgo/go/cmd/cgo/out.go +++ b/libgo/go/cmd/cgo/out.go @@ -64,14 +64,14 @@ func (p *Package) writeDefs() { fmt.Fprintf(fm, "int main() { return 0; }\n") if *importRuntimeCgo { fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt) { }\n") - fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done() { return 0; }\n") + fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done(void) { return 0; }\n") fmt.Fprintf(fm, "void _cgo_release_context(__SIZE_TYPE__ ctxt) { }\n") fmt.Fprintf(fm, "char* _cgo_topofstack(void) { return (char*)0; }\n") } else { // If we're not importing runtime/cgo, we *are* runtime/cgo, // which provides these functions. We just need a prototype. fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt);\n") - fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done();\n") + fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done(void);\n") fmt.Fprintf(fm, "void _cgo_release_context(__SIZE_TYPE__);\n") } fmt.Fprintf(fm, "void _cgo_allocate(void *a, int c) { }\n") @@ -341,6 +341,12 @@ func dynimport(obj string) { fatalf("cannot load imported symbols from XCOFF file %s: %v", obj, err) } for _, s := range sym { + if s.Name == "runtime_rt0_go" || s.Name == "_rt0_ppc64_aix_lib" { + // These symbols are imported by runtime/cgo but + // must not be added to _cgo_import.go as there are + // Go symbols. + continue + } fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", s.Name, s.Name, s.Library) } lib, err := f.ImportedLibraries() @@ -782,14 +788,14 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) { fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n\n") // We use packed structs, but they are always aligned. - // The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first. - // remove as part of #27619 (all: drop support for FreeBSD 10). + // The pragmas and address-of-packed-member are only recognized as + // warning groups in clang 4.0+, so ignore unknown pragmas first. fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n") fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wpragmas\"\n") fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Waddress-of-packed-member\"\n") fmt.Fprintf(fgcc, "extern void crosscall2(void (*fn)(void *, int, __SIZE_TYPE__), void *, int, __SIZE_TYPE__);\n") - fmt.Fprintf(fgcc, "extern __SIZE_TYPE__ _cgo_wait_runtime_init_done();\n") + fmt.Fprintf(fgcc, "extern __SIZE_TYPE__ _cgo_wait_runtime_init_done(void);\n") fmt.Fprintf(fgcc, "extern void _cgo_release_context(__SIZE_TYPE__);\n\n") fmt.Fprintf(fgcc, "extern char* _cgo_topofstack(void);") fmt.Fprintf(fgcc, "%s\n", tsanProlog) @@ -1485,10 +1491,11 @@ __cgo_size_assert(double, 8) extern char* _cgo_topofstack(void); -/* We use packed structs, but they are always aligned. */ -/* The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first. */ -/* remove as part of #27619 (all: drop support for FreeBSD 10). */ - +/* + We use packed structs, but they are always aligned. + The pragmas and address-of-packed-member are only recognized as warning + groups in clang 4.0+, so ignore unknown pragmas first. +*/ #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Waddress-of-packed-member" @@ -1929,5 +1936,5 @@ static void GoInit(void) { runtime_iscgo = 1; } -extern __SIZE_TYPE__ _cgo_wait_runtime_init_done() __attribute__ ((weak)); +extern __SIZE_TYPE__ _cgo_wait_runtime_init_done(void) __attribute__ ((weak)); ` diff --git a/libgo/go/cmd/go/alldocs.go b/libgo/go/cmd/go/alldocs.go index 186f42156a2..fa60fb63b57 100644 --- a/libgo/go/cmd/go/alldocs.go +++ b/libgo/go/cmd/go/alldocs.go @@ -21,7 +21,7 @@ // fix update packages to use new APIs // fmt gofmt (reformat) package sources // generate generate Go files by processing source -// get download and install packages and dependencies +// get add dependencies to current module and install them // install compile and install packages and dependencies // list list packages or modules // mod module maintenance @@ -47,6 +47,8 @@ // importpath import path syntax // modules modules, module versions, and more // module-get module-aware go get +// module-auth module authentication using go.sum +// module-private module configuration for non-public modules // packages package lists and patterns // testflag testing flags // testfunc testing functions @@ -73,8 +75,8 @@ // Build compiles the packages named by the import paths, // along with their dependencies, but it does not install the results. // -// If the arguments to build are a list of .go files, build treats -// them as a list of source files specifying a single package. +// If the arguments to build are a list of .go files from a single directory, +// build treats them as a list of source files specifying a single package. // // When compiling a single main package, build writes // the resulting executable to an output file named after @@ -88,10 +90,10 @@ // // When compiling packages, build ignores files that end in '_test.go'. // -// The -o flag, only allowed when compiling a single package, -// forces build to write the resulting executable or object -// to the named output file, instead of the default behavior described -// in the last two paragraphs. +// The -o flag forces build to write the resulting executable or object +// to the named output file or directory, instead of the default behavior described +// in the last two paragraphs. If the named output is a directory that exists, +// then any resulting executables will be written to that directory. // // The -i flag installs the packages that are dependencies of the target. // @@ -150,10 +152,18 @@ // install and load all packages from dir instead of the usual locations. // For example, when building with a non-standard configuration, // use -pkgdir to keep generated packages in a separate location. -// -tags 'tag list' -// a space-separated list of build tags to consider satisfied during the +// -tags tag,list +// a comma-separated list of build tags to consider satisfied during the // build. For more information about build tags, see the description of // build constraints in the documentation for the go/build package. +// (Earlier versions of Go used a space-separated list, and that form +// is deprecated but still recognized.) +// -trimpath +// remove all file system paths from the resulting executable. +// Instead of absolute file system paths, the recorded file names +// will begin with either "go" (for the standard library), +// or a module path@version (when using modules), +// or a plain import path (when using GOPATH). // -toolexec 'cmd args' // a program to use to invoke toolchain programs like vet and asm. // For example, instead of running asm, the go command will run @@ -201,7 +211,8 @@ // so go clean is mainly concerned with object files left by other // tools or by manual invocations of go build. // -// Specifically, clean removes the following files from each of the +// If a package argument is given or the -i or -r flag is set, +// clean removes the following files from each of the // source directories corresponding to the import paths: // // _obj/ old object directory, left from Makefiles @@ -366,7 +377,7 @@ // // Usage: // -// go env [-json] [var ...] +// go env [-json] [-u] [-w] [var ...] // // Env prints Go environment information. // @@ -378,6 +389,14 @@ // The -json flag prints the environment in JSON format // instead of as a shell script. // +// The -u flag requires one or more arguments and unsets +// the default setting for the named environment variables, +// if one has been set with 'go env -w'. +// +// The -w flag requires one or more arguments of the +// form NAME=VALUE and changes the default settings +// of the named environment variables to the given values. +// // For more about environment variables, see 'go help environment'. // // @@ -503,11 +522,13 @@ // "go tool foo". // // Generate processes packages in the order given on the command line, -// one at a time. If the command line lists .go files, they are treated -// as a single package. Within a package, generate processes the +// one at a time. If the command line lists .go files from a single directory, +// they are treated as a single package. Within a package, generate processes the // source files in a package in file name order, one at a time. Within // a source file, generate runs generators in the order they appear -// in the file, one at a time. +// in the file, one at a time. The go generate tool also sets the build +// tag "generate" so that files may be examined by go generate but ignored +// during build. // // If any generator returns an error exit status, "go generate" skips // all further processing for that package. @@ -533,67 +554,116 @@ // For more about specifying packages, see 'go help packages'. // // -// Download and install packages and dependencies +// Add dependencies to current module and install them // // Usage: // -// go get [-d] [-f] [-t] [-u] [-v] [-fix] [-insecure] [build flags] [packages] +// go get [-d] [-t] [-u] [-v] [-insecure] [build flags] [packages] // -// Get downloads the packages named by the import paths, along with their -// dependencies. It then installs the named packages, like 'go install'. +// Get resolves and adds dependencies to the current development module +// and then builds and installs them. // -// The -d flag instructs get to stop after downloading the packages; that is, -// it instructs get not to install the packages. +// The first step is to resolve which dependencies to add. // -// The -f flag, valid only when -u is set, forces get -u not to verify that -// each package has been checked out from the source control repository -// implied by its import path. This can be useful if the source is a local fork -// of the original. +// For each named package or package pattern, get must decide which version of +// the corresponding module to use. By default, get chooses the latest tagged +// release version, such as v0.4.5 or v1.2.3. If there are no tagged release +// versions, get chooses the latest tagged pre-release version, such as +// v0.0.1-pre1. If there are no tagged versions at all, get chooses the latest +// known commit. // -// The -fix flag instructs get to run the fix tool on the downloaded packages -// before resolving dependencies or building the code. +// This default version selection can be overridden by adding an @version +// suffix to the package argument, as in 'go get golang.org/x/text@v0.3.0'. +// For modules stored in source control repositories, the version suffix can +// also be a commit hash, branch identifier, or other syntax known to the +// source control system, as in 'go get golang.org/x/text@master'. // -// The -insecure flag permits fetching from repositories and resolving -// custom domains using insecure schemes such as HTTP. Use with caution. +// If a module under consideration is already a dependency of the current +// development module, then get will update the required version. +// Specifying a version earlier than the current required version is valid and +// downgrades the dependency. The version suffix @none indicates that the +// dependency should be removed entirely, downgrading or removing modules +// depending on it as needed. // -// The -t flag instructs get to also download the packages required to build -// the tests for the specified packages. +// The version suffix @latest explicitly requests the latest minor release of the +// given path. The suffix @patch requests the latest patch release: if the path +// is already in the build list, the selected version will have the same minor +// version. If the path is not already in the build list, @patch is equivalent +// to @latest. Neither @latest nor @patch will cause 'go get' to downgrade a module +// in the build list if it is required at a newer pre-release version that is +// newer than the latest released version. // -// The -u flag instructs get to use the network to update the named packages -// and their dependencies. By default, get uses the network to check out -// missing packages but does not use it to look for updates to existing packages. +// Although get defaults to using the latest version of the module containing +// a named package, it does not use the latest version of that module's +// dependencies. Instead it prefers to use the specific dependency versions +// requested by that module. For example, if the latest A requires module +// B v1.2.3, while B v1.2.4 and v1.3.1 are also available, then 'go get A' +// will use the latest A but then use B v1.2.3, as requested by A. (If there +// are competing requirements for a particular module, then 'go get' resolves +// those requirements by taking the maximum requested version.) // -// The -v flag enables verbose progress and debug output. +// The -t flag instructs get to consider modules needed to build tests of +// packages specified on the command line. // -// Get also accepts build flags to control the installation. See 'go help build'. +// The -u flag instructs get to update modules providing dependencies +// of packages named on the command line to use newer minor or patch +// releases when available. Continuing the previous example, 'go get -u A' +// will use the latest A with B v1.3.1 (not B v1.2.3). If B requires module C, +// but C does not provide any packages needed to build packages in A +// (not including tests), then C will not be updated. // -// When checking out a new package, get creates the target directory -// GOPATH/src/. If the GOPATH contains multiple entries, -// get uses the first one. For more details see: 'go help gopath'. +// The -u=patch flag (not -u patch) also instructs get to update dependencies, +// but changes the default to select patch releases. +// Continuing the previous example, +// 'go get -u=patch A@latest' will use the latest A with B v1.2.4 (not B v1.2.3), +// while 'go get -u=patch A' will use a patch release of A instead. // -// When checking out or updating a package, get looks for a branch or tag -// that matches the locally installed version of Go. The most important -// rule is that if the local installation is running version "go1", get -// searches for a branch or tag named "go1". If no such version exists -// it retrieves the default branch of the package. +// When the -t and -u flags are used together, get will update +// test dependencies as well. // -// When go get checks out or updates a Git repository, -// it also updates any git submodules referenced by the repository. +// In general, adding a new dependency may require upgrading +// existing dependencies to keep a working build, and 'go get' does +// this automatically. Similarly, downgrading one dependency may +// require downgrading other dependencies, and 'go get' does +// this automatically as well. // -// Get never checks out or updates code stored in vendor directories. +// The -insecure flag permits fetching from repositories and resolving +// custom domains using insecure schemes such as HTTP. Use with caution. // -// For more about specifying packages, see 'go help packages'. +// The second step is to download (if needed), build, and install +// the named packages. // -// For more about how 'go get' finds source code to -// download, see 'go help importpath'. +// If an argument names a module but not a package (because there is no +// Go source code in the module's root directory), then the install step +// is skipped for that argument, instead of causing a build failure. +// For example 'go get golang.org/x/perf' succeeds even though there +// is no code corresponding to that import path. // -// This text describes the behavior of get when using GOPATH -// to manage source code and dependencies. -// If instead the go command is running in module-aware mode, -// the details of get's flags and effects change, as does 'go help get'. -// See 'go help modules' and 'go help module-get'. +// Note that package patterns are allowed and are expanded after resolving +// the module versions. For example, 'go get golang.org/x/perf/cmd/...' +// adds the latest golang.org/x/perf and then installs the commands in that +// latest version. // -// See also: go build, go install, go clean. +// The -d flag instructs get to download the source code needed to build +// the named packages, including downloading necessary dependencies, +// but not to build and install them. +// +// With no package arguments, 'go get' applies to Go package in the +// current directory, if any. In particular, 'go get -u' and +// 'go get -u=patch' update all the dependencies of that package. +// With no package arguments and also without -u, 'go get' is not much more +// than 'go install', and 'go get -d' not much more than 'go list'. +// +// For more about modules, see 'go help modules'. +// +// For more about specifying packages, see 'go help packages'. +// +// This text describes the behavior of get using modules to manage source +// code and dependencies. If instead the go command is running in GOPATH +// mode, the details of get's flags and effects change, as does 'go help get'. +// See 'go help modules' and 'go help gopath-get'. +// +// See also: go build, go install, go clean, go mod. // // // Compile and install packages and dependencies @@ -604,6 +674,15 @@ // // Install compiles and installs the packages named by the import paths. // +// Executables are installed in the directory named by the GOBIN environment +// variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH +// environment variable is not set. Executables in $GOROOT +// are installed in $GOROOT/bin or $GOTOOLDIR instead of $GOBIN. +// +// When module-aware mode is disabled, other packages are installed in the +// directory $GOPATH/pkg/$GOOS_$GOARCH. When module-aware mode is enabled, +// other packages are built and cached but not installed. +// // The -i flag installs the dependencies of the named packages as well. // // For more about the build flags, see 'go help build'. @@ -648,7 +727,7 @@ // StaleReason string // explanation for Stale==true // Root string // Go root or Go path dir containing this package // ConflictDir string // this directory shadows Dir in $GOPATH -// BinaryOnly bool // binary-only package: cannot be recompiled from sources +// BinaryOnly bool // binary-only package (no longer supported) // ForTest string // package is only for use in named test // Export string // file containing export data (when using -export) // Module *Module // info about package's containing module, if any (can be nil) @@ -790,17 +869,18 @@ // applied to a Go struct, but now a Module struct: // // type Module struct { -// Path string // module path -// Version string // module version -// Versions []string // available module versions (with -versions) -// Replace *Module // replaced by this module -// Time *time.Time // time version was created -// Update *Module // available update, if any (with -u) -// Main bool // is this the main module? -// Indirect bool // is this module only an indirect dependency of main module? -// Dir string // directory holding files for this module, if any -// GoMod string // path to go.mod file for this module, if any -// Error *ModuleError // error loading module +// Path string // module path +// Version string // module version +// Versions []string // available module versions (with -versions) +// Replace *Module // replaced by this module +// Time *time.Time // time version was created +// Update *Module // available update, if any (with -u) +// Main bool // is this the main module? +// Indirect bool // is this module only an indirect dependency of main module? +// Dir string // directory holding files for this module, if any +// GoMod string // path to go.mod file for this module, if any +// GoVersion string // go version used in module +// Error *ModuleError // error loading module // } // // type ModuleError struct { @@ -1129,7 +1209,7 @@ // go run [build flags] [-exec xprog] package [arguments...] // // Run compiles and runs the named main Go package. -// Typically the package is specified as a list of .go source files, +// Typically the package is specified as a list of .go source files from a single directory, // but it may also be an import path, file system path, or pattern // matching a single known package, as in 'go run .' or 'go run my/cmd'. // @@ -1213,7 +1293,10 @@ // line. If a package test fails, go test prints the full test output. // If invoked with the -bench or -v flag, go test prints the full // output even for passing package tests, in order to display the -// requested benchmark results or verbose logging. +// requested benchmark results or verbose logging. After the package +// tests for all of the listed packages finish, and their output is +// printed, go test prints a final 'FAIL' status if any package test +// has failed. // // In package list mode only, go test caches successful package test // results to avoid unnecessary repeated running of tests. When the @@ -1293,9 +1376,27 @@ // // Usage: // -// go version +// go version [-m] [-v] [file ...] +// +// Version prints the build information for Go executables. +// +// Go version reports the Go version used to build each of the named +// executable files. +// +// If no files are named on the command line, go version prints its own +// version information. +// +// If a directory is named, go version walks that directory, recursively, +// looking for recognized Go binaries and reporting their versions. +// By default, go version does not report unrecognized files found +// during a directory scan. The -v flag causes it to report unrecognized files. // -// Version prints the Go version, as reported by runtime.Version. +// The -m flag causes go version to print each executable's embedded +// module version information, when available. In the output, the module +// information consists of multiple lines following the version line, each +// indented by a leading tab character. +// +// See also: go doc runtime/debug.BuildInfo. // // // Report likely mistakes in packages @@ -1373,6 +1474,9 @@ // Build the listed main packages, plus all packages that they // import, into a Go plugin. Packages not named main are ignored. // +// On AIX, when linking a C program that uses a Go archive built with +// -buildmode=c-archive, you must pass -Wl,-bnoobjreorder to the C compiler. +// // // Calling between Go and C // @@ -1434,10 +1538,17 @@ // // Environment variables // -// The go command, and the tools it invokes, examine a few different -// environment variables. For many of these, you can see the default -// value of on your system by running 'go env NAME', where NAME is the -// name of the variable. +// The go command and the tools it invokes consult environment variables +// for configuration. If an environment variable is unset, the go command +// uses a sensible default setting. To see the effective setting of the +// variable , run 'go env '. To change the default setting, +// run 'go env -w ='. Defaults changed using 'go env -w' +// are recorded in a Go environment configuration file stored in the +// per-user configuration directory, as reported by os.UserConfigDir. +// The location of the configuration file can be changed by setting +// the environment variable GOENV, and 'go env GOENV' prints the +// effective location, but 'go env -w' cannot change the default location. +// See 'go help env' for details. // // General-purpose environment variables: // @@ -1451,10 +1562,15 @@ // GOCACHE // The directory where the go command will store cached // information for reuse in future builds. +// GOENV +// The location of the Go environment configuration file. +// Cannot be set using 'go env -w'. // GOFLAGS // A space-separated list of -flag=value settings to apply // to go commands by default, when the given flag is known by -// the current command. Flags listed on the command-line +// the current command. Each entry must be a standalone flag. +// Because the entries are space-separated, flag values must +// not contain spaces. Flags listed on the command line // are applied after this list and therefore override it. // GOOS // The operating system for which to compile code. @@ -1462,22 +1578,27 @@ // GOPATH // For more details see: 'go help gopath'. // GOPROXY -// URL of Go module proxy. See 'go help goproxy'. -// GORACE -// Options for the race detector. -// See https://golang.org/doc/articles/race_detector.html. +// URL of Go module proxy. See 'go help modules'. +// GOPRIVATE, GONOPROXY, GONOSUMDB +// Comma-separated list of glob patterns (in the syntax of Go's path.Match) +// of module path prefixes that should always be fetched directly +// or that should not be compared against the checksum database. +// See 'go help module-private'. // GOROOT // The root of the go tree. +// GOSUMDB +// The name of checksum database to use and optionally its public key and +// URL. See 'go help module-auth'. // GOTMPDIR // The directory where the go command will write // temporary source files, packages, and binaries. // -// Each entry in the GOFLAGS list must be a standalone flag. -// Because the entries are space-separated, flag values must -// not contain spaces. -// // Environment variables for use with cgo: // +// AR +// The command to use to manipulate library archives when +// building with the gccgo compiler. +// The default is 'ar'. // CC // The command to use to compile C code. // CGO_ENABLED @@ -1507,12 +1628,10 @@ // but for the linker. // CXX // The command to use to compile C++ code. +// FC +// The command to use to compile Fortran code. // PKG_CONFIG // Path to pkg-config tool. -// AR -// The command to use to manipulate library archives when -// building with the gccgo compiler. -// The default is 'ar'. // // Architecture-specific environment variables: // @@ -1528,6 +1647,9 @@ // GOMIPS64 // For GOARCH=mips64{,le}, whether to use floating point instructions. // Valid values are hardfloat (default), softfloat. +// GOWASM +// For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use. +// Valid values are satconv, signext. // // Special-purpose environment variables: // @@ -1544,14 +1666,18 @@ // when using -linkmode=auto with code that uses cgo. // Set to 0 to disable external linking mode, 1 to enable it. // GIT_ALLOW_PROTOCOL -// Defined by Git. A colon-separated list of schemes that are allowed to be used -// with git fetch/clone. If set, any scheme not explicitly mentioned will be -// considered insecure by 'go get'. +// Defined by Git. A colon-separated list of schemes that are allowed +// to be used with git fetch/clone. If set, any scheme not explicitly +// mentioned will be considered insecure by 'go get'. +// Because the variable is defined by Git, the default value cannot +// be set using 'go env -w'. // // Additional information available from 'go env' but not read from the environment: // // GOEXE // The executable file name suffix (".exe" on Windows, "" on other systems). +// GOGCCFLAGS +// A space-separated list of arguments supplied to the CC command. // GOHOSTARCH // The architecture (GOARCH) of the Go toolchain binaries. // GOHOSTOS @@ -1598,15 +1724,6 @@ // line comment. See the go/build package documentation for // more details. // -// Through the Go 1.12 release, non-test Go source files can also include -// a //go:binary-only-package comment, indicating that the package -// sources are included for documentation only and must not be used to -// build the package binary. This enables distribution of Go packages in -// their compiled form alone. Even binary-only packages require accurate -// import blocks listing required dependencies, so that those -// dependencies can be supplied when linking the resulting command. -// Note that this feature is scheduled to be removed after the Go 1.12 release. -// // // The go.mod file // @@ -1689,6 +1806,13 @@ // including go build, go get, go install, go list, go test, go mod graph, // go mod tidy, and go mod why. // +// The expected language version, set by the go directive, determines +// which language features are available when compiling the module. +// Language features available in that version will be available for use. +// Language features removed in earlier versions, or added in later versions, +// will not be available. Note that the language version does not affect +// build tags, which are determined by the Go release being used. +// // // GOPATH environment variable // @@ -1845,17 +1969,73 @@ // See https://golang.org/s/go15vendor for details. // // -// Module proxy protocol +// Legacy GOPATH go get +// +// The 'go get' command changes behavior depending on whether the +// go command is running in module-aware mode or legacy GOPATH mode. +// This help text, accessible as 'go help gopath-get' even in module-aware mode, +// describes 'go get' as it operates in legacy GOPATH mode. +// +// Usage: go get [-d] [-f] [-t] [-u] [-v] [-fix] [-insecure] [build flags] [packages] +// +// Get downloads the packages named by the import paths, along with their +// dependencies. It then installs the named packages, like 'go install'. // -// The go command by default downloads modules from version control systems -// directly, just as 'go get' always has. The GOPROXY environment variable allows -// further control over the download source. If GOPROXY is unset, is the empty string, -// or is the string "direct", downloads use the default direct connection to version -// control systems. Setting GOPROXY to "off" disallows downloading modules from -// any source. Otherwise, GOPROXY is expected to be the URL of a module proxy, -// in which case the go command will fetch all modules from that proxy. -// No matter the source of the modules, downloaded modules must match existing -// entries in go.sum (see 'go help modules' for discussion of verification). +// The -d flag instructs get to stop after downloading the packages; that is, +// it instructs get not to install the packages. +// +// The -f flag, valid only when -u is set, forces get -u not to verify that +// each package has been checked out from the source control repository +// implied by its import path. This can be useful if the source is a local fork +// of the original. +// +// The -fix flag instructs get to run the fix tool on the downloaded packages +// before resolving dependencies or building the code. +// +// The -insecure flag permits fetching from repositories and resolving +// custom domains using insecure schemes such as HTTP. Use with caution. +// +// The -t flag instructs get to also download the packages required to build +// the tests for the specified packages. +// +// The -u flag instructs get to use the network to update the named packages +// and their dependencies. By default, get uses the network to check out +// missing packages but does not use it to look for updates to existing packages. +// +// The -v flag enables verbose progress and debug output. +// +// Get also accepts build flags to control the installation. See 'go help build'. +// +// When checking out a new package, get creates the target directory +// GOPATH/src/. If the GOPATH contains multiple entries, +// get uses the first one. For more details see: 'go help gopath'. +// +// When checking out or updating a package, get looks for a branch or tag +// that matches the locally installed version of Go. The most important +// rule is that if the local installation is running version "go1", get +// searches for a branch or tag named "go1". If no such version exists +// it retrieves the default branch of the package. +// +// When go get checks out or updates a Git repository, +// it also updates any git submodules referenced by the repository. +// +// Get never checks out or updates code stored in vendor directories. +// +// For more about specifying packages, see 'go help packages'. +// +// For more about how 'go get' finds source code to +// download, see 'go help importpath'. +// +// This text describes the behavior of get when using GOPATH +// to manage source code and dependencies. +// If instead the go command is running in module-aware mode, +// the details of get's flags and effects change, as does 'go help get'. +// See 'go help modules' and 'go help module-get'. +// +// See also: go build, go install, go clean. +// +// +// Module proxy protocol // // A Go module proxy is any web server that can respond to GET requests for // URLs of a specified form. The requests have no query parameters, so even @@ -2104,34 +2284,28 @@ // Modules replace the old GOPATH-based approach to specifying // which source files are used in a given build. // -// Preliminary module support +// Module support // -// Go 1.11 includes preliminary support for Go modules, -// including a new module-aware 'go get' command. -// We intend to keep revising this support, while preserving compatibility, -// until it can be declared official (no longer preliminary), -// and then at a later point we may remove support for work -// in GOPATH and the old 'go get' command. +// Go 1.13 includes support for Go modules. Module-aware mode is active by default +// whenever a go.mod file is found in, or in a parent of, the current directory. // -// The quickest way to take advantage of the new Go 1.11 module support -// is to check out your repository into a directory outside GOPATH/src, -// create a go.mod file (described in the next section) there, and run +// The quickest way to take advantage of module support is to check out your +// repository, create a go.mod file (described in the next section) there, and run // go commands from within that file tree. // -// For more fine-grained control, the module support in Go 1.11 respects +// For more fine-grained control, Go 1.13 continues to respect // a temporary environment variable, GO111MODULE, which can be set to one // of three string values: off, on, or auto (the default). -// If GO111MODULE=off, then the go command never uses the -// new module support. Instead it looks in vendor directories and GOPATH -// to find dependencies; we now refer to this as "GOPATH mode." // If GO111MODULE=on, then the go command requires the use of modules, -// never consulting GOPATH. We refer to this as the command being -// module-aware or running in "module-aware mode". -// If GO111MODULE=auto or is unset, then the go command enables or -// disables module support based on the current directory. -// Module support is enabled only when the current directory is outside -// GOPATH/src and itself contains a go.mod file or is below a directory -// containing a go.mod file. +// never consulting GOPATH. We refer to this as the command +// being module-aware or running in "module-aware mode". +// If GO111MODULE=off, then the go command never uses +// module support. Instead it looks in vendor directories and GOPATH +// to find dependencies; we now refer to this as "GOPATH mode." +// If GO111MODULE=auto or is unset, then the go command enables or disables +// module support based on the current directory. +// Module support is enabled only when the current directory contains a +// go.mod file or is below a directory containing a go.mod file. // // In module-aware mode, GOPATH no longer defines the meaning of imports // during a build, but it still stores downloaded dependencies (in GOPATH/pkg/mod) @@ -2422,26 +2596,35 @@ // // Module downloading and verification // -// The go command maintains, in the main module's root directory alongside -// go.mod, a file named go.sum containing the expected cryptographic checksums -// of the content of specific module versions. Each time a dependency is -// used, its checksum is added to go.sum if missing or else required to match -// the existing entry in go.sum. -// -// The go command maintains a cache of downloaded packages and computes -// and records the cryptographic checksum of each package at download time. -// In normal operation, the go command checks these pre-computed checksums -// against the main module's go.sum file, instead of recomputing them on -// each command invocation. The 'go mod verify' command checks that -// the cached copies of module downloads still match both their recorded -// checksums and the entries in go.sum. -// -// The go command can fetch modules from a proxy instead of connecting -// to source control systems directly, according to the setting of the GOPROXY -// environment variable. -// -// See 'go help goproxy' for details about the proxy and also the format of -// the cached downloaded packages. +// The go command can fetch modules from a proxy or connect to source control +// servers directly, according to the setting of the GOPROXY environment +// variable (see 'go help env'). The default setting for GOPROXY is +// "https://proxy.golang.org,direct", which means to try the +// Go module mirror run by Google and fall back to a direct connection +// if the proxy reports that it does not have the module (HTTP error 404 or 410). +// See https://proxy.golang.org/privacy for the service's privacy policy. +// If GOPROXY is set to the string "direct", downloads use a direct connection +// to source control servers. Setting GOPROXY to "off" disallows downloading +// modules from any source. Otherwise, GOPROXY is expected to be a comma-separated +// list of the URLs of module proxies, in which case the go command will fetch +// modules from those proxies. For each request, the go command tries each proxy +// in sequence, only moving to the next if the current proxy returns a 404 or 410 +// HTTP response. The string "direct" may appear in the proxy list, +// to cause a direct connection to be attempted at that point in the search. +// Any proxies listed after "direct" are never consulted. +// +// The GOPRIVATE and GONOPROXY environment variables allow bypassing +// the proxy for selected modules. See 'go help module-private' for details. +// +// No matter the source of the modules, the go command checks downloads against +// known checksums, to detect unexpected changes in the content of any specific +// module version from one day to the next. This check first consults the current +// module's go.sum file but falls back to the Go checksum database, controlled by +// the GOSUMDB and GONOSUMDB environment variables. See 'go help module-auth' +// for details. +// +// See 'go help goproxy' for details about the proxy protocol and also +// the format of the cached downloaded packages. // // Modules and vendoring // @@ -2463,108 +2646,135 @@ // are still ignored. // // -// Module-aware go get -// -// The 'go get' command changes behavior depending on whether the -// go command is running in module-aware mode or legacy GOPATH mode. -// This help text, accessible as 'go help module-get' even in legacy GOPATH mode, -// describes 'go get' as it operates in module-aware mode. -// -// Usage: go get [-d] [-m] [-u] [-v] [-insecure] [build flags] [packages] -// -// Get resolves and adds dependencies to the current development module -// and then builds and installs them. +// Module authentication using go.sum // -// The first step is to resolve which dependencies to add. +// The go command tries to authenticate every downloaded module, +// checking that the bits downloaded for a specific module version today +// match bits downloaded yesterday. This ensures repeatable builds +// and detects introduction of unexpected changes, malicious or not. // -// For each named package or package pattern, get must decide which version of -// the corresponding module to use. By default, get chooses the latest tagged -// release version, such as v0.4.5 or v1.2.3. If there are no tagged release -// versions, get chooses the latest tagged prerelease version, such as -// v0.0.1-pre1. If there are no tagged versions at all, get chooses the latest -// known commit. +// In each module's root, alongside go.mod, the go command maintains +// a file named go.sum containing the cryptographic checksums of the +// module's dependencies. // -// This default version selection can be overridden by adding an @version -// suffix to the package argument, as in 'go get golang.org/x/text@v0.3.0'. -// For modules stored in source control repositories, the version suffix can -// also be a commit hash, branch identifier, or other syntax known to the -// source control system, as in 'go get golang.org/x/text@master'. -// The version suffix @latest explicitly requests the default behavior -// described above. +// The form of each line in go.sum is three fields: // -// If a module under consideration is already a dependency of the current -// development module, then get will update the required version. -// Specifying a version earlier than the current required version is valid and -// downgrades the dependency. The version suffix @none indicates that the -// dependency should be removed entirely, downgrading or removing modules -// depending on it as needed. +// [/go.mod] // -// Although get defaults to using the latest version of the module containing -// a named package, it does not use the latest version of that module's -// dependencies. Instead it prefers to use the specific dependency versions -// requested by that module. For example, if the latest A requires module -// B v1.2.3, while B v1.2.4 and v1.3.1 are also available, then 'go get A' -// will use the latest A but then use B v1.2.3, as requested by A. (If there -// are competing requirements for a particular module, then 'go get' resolves -// those requirements by taking the maximum requested version.) +// Each known module version results in two lines in the go.sum file. +// The first line gives the hash of the module version's file tree. +// The second line appends "/go.mod" to the version and gives the hash +// of only the module version's (possibly synthesized) go.mod file. +// The go.mod-only hash allows downloading and authenticating a +// module version's go.mod file, which is needed to compute the +// dependency graph, without also downloading all the module's source code. // -// The -u flag instructs get to update dependencies to use newer minor or -// patch releases when available. Continuing the previous example, -// 'go get -u A' will use the latest A with B v1.3.1 (not B v1.2.3). +// The hash begins with an algorithm prefix of the form "h:". +// The only defined algorithm prefix is "h1:", which uses SHA-256. // -// The -u=patch flag (not -u patch) instructs get to update dependencies -// to use newer patch releases when available. Continuing the previous example, -// 'go get -u=patch A' will use the latest A with B v1.2.4 (not B v1.2.3). +// Module authentication failures // -// In general, adding a new dependency may require upgrading -// existing dependencies to keep a working build, and 'go get' does -// this automatically. Similarly, downgrading one dependency may -// require downgrading other dependencies, and 'go get' does -// this automatically as well. -// -// The -m flag instructs get to stop here, after resolving, upgrading, -// and downgrading modules and updating go.mod. When using -m, -// each specified package path must be a module path as well, -// not the import path of a package below the module root. -// -// The -insecure flag permits fetching from repositories and resolving -// custom domains using insecure schemes such as HTTP. Use with caution. +// The go command maintains a cache of downloaded packages and computes +// and records the cryptographic checksum of each package at download time. +// In normal operation, the go command checks the main module's go.sum file +// against these precomputed checksums instead of recomputing them on +// each command invocation. The 'go mod verify' command checks that +// the cached copies of module downloads still match both their recorded +// checksums and the entries in go.sum. // -// The second step is to download (if needed), build, and install -// the named packages. +// In day-to-day development, the checksum of a given module version +// should never change. Each time a dependency is used by a given main +// module, the go command checks its local cached copy, freshly +// downloaded or not, against the main module's go.sum. If the checksums +// don't match, the go command reports the mismatch as a security error +// and refuses to run the build. When this happens, proceed with caution: +// code changing unexpectedly means today's build will not match +// yesterday's, and the unexpected change may not be beneficial. +// +// If the go command reports a mismatch in go.sum, the downloaded code +// for the reported module version does not match the one used in a +// previous build of the main module. It is important at that point +// to find out what the right checksum should be, to decide whether +// go.sum is wrong or the downloaded code is wrong. Usually go.sum is right: +// you want to use the same code you used yesterday. +// +// If a downloaded module is not yet included in go.sum and it is a publicly +// available module, the go command consults the Go checksum database to fetch +// the expected go.sum lines. If the downloaded code does not match those +// lines, the go command reports the mismatch and exits. Note that the +// database is not consulted for module versions already listed in go.sum. +// +// If a go.sum mismatch is reported, it is always worth investigating why +// the code downloaded today differs from what was downloaded yesterday. +// +// The GOSUMDB environment variable identifies the name of checksum database +// to use and optionally its public key and URL, as in: +// +// GOSUMDB="sum.golang.org" +// GOSUMDB="sum.golang.org+" +// GOSUMDB="sum.golang.org+ https://sum.golang.org" +// +// The go command knows the public key of sum.golang.org; use of any other +// database requires giving the public key explicitly. The URL defaults to +// "https://" followed by the database name. +// +// GOSUMDB defaults to "sum.golang.org", the Go checksum database run by Google. +// See https://sum.golang.org/privacy for the service's privacy policy. +// +// If GOSUMDB is set to "off", or if "go get" is invoked with the -insecure flag, +// the checksum database is not consulted, and all unrecognized modules are +// accepted, at the cost of giving up the security guarantee of verified repeatable +// downloads for all modules. A better way to bypass the checksum database +// for specific modules is to use the GOPRIVATE or GONOSUMDB environment +// variables. See 'go help module-private' for details. +// +// The 'go env -w' command (see 'go help env') can be used to set these variables +// for future go command invocations. +// +// +// Module configuration for non-public modules +// +// The go command defaults to downloading modules from the public Go module +// mirror at proxy.golang.org. It also defaults to validating downloaded modules, +// regardless of source, against the public Go checksum database at sum.golang.org. +// These defaults work well for publicly available source code. +// +// The GOPRIVATE environment variable controls which modules the go command +// considers to be private (not available publicly) and should therefore not use the +// proxy or checksum database. The variable is a comma-separated list of +// glob patterns (in the syntax of Go's path.Match) of module path prefixes. +// For example, // -// If an argument names a module but not a package (because there is no -// Go source code in the module's root directory), then the install step -// is skipped for that argument, instead of causing a build failure. -// For example 'go get golang.org/x/perf' succeeds even though there -// is no code corresponding to that import path. +// GOPRIVATE=*.corp.example.com,rsc.io/private // -// Note that package patterns are allowed and are expanded after resolving -// the module versions. For example, 'go get golang.org/x/perf/cmd/...' -// adds the latest golang.org/x/perf and then installs the commands in that -// latest version. +// causes the go command to treat as private any module with a path prefix +// matching either pattern, including git.corp.example.com/xyzzy, rsc.io/private, +// and rsc.io/private/quux. // -// The -d flag instructs get to download the source code needed to build -// the named packages, including downloading necessary dependencies, -// but not to build and install them. +// The GOPRIVATE environment variable may be used by other tools as well to +// identify non-public modules. For example, an editor could use GOPRIVATE +// to decide whether to hyperlink a package import to a godoc.org page. // -// With no package arguments, 'go get' applies to the main module, -// and to the Go package in the current directory, if any. In particular, -// 'go get -u' and 'go get -u=patch' update all the dependencies of the -// main module. With no package arguments and also without -u, -// 'go get' is not much more than 'go install', and 'go get -d' not much -// more than 'go list'. +// For fine-grained control over module download and validation, the GONOPROXY +// and GONOSUMDB environment variables accept the same kind of glob list +// and override GOPRIVATE for the specific decision of whether to use the proxy +// and checksum database, respectively. // -// For more about modules, see 'go help modules'. +// For example, if a company ran a module proxy serving private modules, +// users would configure go using: // -// For more about specifying packages, see 'go help packages'. +// GOPRIVATE=*.corp.example.com +// GOPROXY=proxy.example.com +// GONOPROXY=none // -// This text describes the behavior of get using modules to manage source -// code and dependencies. If instead the go command is running in GOPATH -// mode, the details of get's flags and effects change, as does 'go help get'. -// See 'go help modules' and 'go help gopath-get'. +// This would tell the go command and other tools that modules beginning with +// a corp.example.com subdomain are private but that the company proxy should +// be used for downloading both public and private modules, because +// GONOPROXY has been set to a pattern that won't match any modules, +// overriding GOPRIVATE. // -// See also: go build, go install, go clean, go mod. +// The 'go env -w' command (see 'go help env') can be used to set these variables +// for future go command invocations. // // // Package lists and patterns diff --git a/libgo/go/cmd/go/go_test.go b/libgo/go/cmd/go/go_test.go index d1166b1ed15..0ae2fa297eb 100644 --- a/libgo/go/cmd/go/go_test.go +++ b/libgo/go/cmd/go/go_test.go @@ -6,7 +6,6 @@ package main_test import ( "bytes" - "cmd/internal/sys" "context" "debug/elf" "debug/macho" @@ -27,6 +26,11 @@ import ( "strings" "testing" "time" + + "cmd/go/internal/cache" + "cmd/go/internal/cfg" + "cmd/go/internal/robustio" + "cmd/internal/sys" ) var ( @@ -118,6 +122,8 @@ var testCtx = context.Background() // The TestMain function creates a go command for testing purposes and // deletes it after the tests have been run. func TestMain(m *testing.M) { + // $GO_GCFLAGS a compiler debug flag known to cmd/dist, make.bash, etc. + // It is not a standard go command flag; use os.Getenv, not cfg.Getenv. if os.Getenv("GO_GCFLAGS") != "" { fmt.Fprintf(os.Stderr, "testing: warning: no tests to run\n") // magic string for cmd/go fmt.Printf("cmd/go test is not compatible with $GO_GCFLAGS being set\n") @@ -166,6 +172,7 @@ func TestMain(m *testing.M) { defer removeAll(testTmpDir) } + testGOCACHE = cache.DefaultDir() if canRun { testBin = filepath.Join(testTmpDir, "testbin") if err := os.Mkdir(testBin, 0777); err != nil { @@ -212,7 +219,9 @@ func TestMain(m *testing.M) { return } - out, err := exec.Command(gotool, args...).CombinedOutput() + buildCmd := exec.Command(gotool, args...) + buildCmd.Env = append(os.Environ(), "GOFLAGS=-mod=vendor") + out, err := buildCmd.CombinedOutput() if err != nil { fmt.Fprintf(os.Stderr, "building testgo failed: %v\n%s", err, out) os.Exit(2) @@ -252,6 +261,7 @@ func TestMain(m *testing.M) { } } // Don't let these environment variables confuse the test. + os.Setenv("GOENV", "off") os.Unsetenv("GOBIN") os.Unsetenv("GOPATH") os.Unsetenv("GIT_ALLOW_PROTOCOL") @@ -260,7 +270,7 @@ func TestMain(m *testing.M) { // Setting HOME to a non-existent directory will break // those systems. Disable ccache and use real compiler. Issue 17668. os.Setenv("CCACHE_DISABLE", "1") - if os.Getenv("GOCACHE") == "" { + if cfg.Getenv("GOCACHE") == "" { os.Setenv("GOCACHE", testGOCACHE) // because $HOME is gone } @@ -422,6 +432,7 @@ func (tg *testgoData) setenv(name, val string) { func (tg *testgoData) unsetenv(name string) { if tg.env == nil { tg.env = append([]string(nil), os.Environ()...) + tg.env = append(tg.env, "GO111MODULE=off") } for i, v := range tg.env { if strings.HasPrefix(v, name+"=") { @@ -675,7 +686,7 @@ func (tg *testgoData) creatingTemp(path string) { if tg.wd != "" && !filepath.IsAbs(path) { path = filepath.Join(tg.pwd(), path) } - tg.must(os.RemoveAll(path)) + tg.must(robustio.RemoveAll(path)) tg.temps = append(tg.temps, path) } @@ -877,7 +888,7 @@ func removeAll(dir string) error { } return nil }) - return os.RemoveAll(dir) + return robustio.RemoveAll(dir) } // failSSH puts an ssh executable in the PATH that always fails. @@ -1171,7 +1182,7 @@ func testMove(t *testing.T, vcs, url, base, config string) { case "svn": // SVN doesn't believe in text files so we can't just edit the config. // Check out a different repo into the wrong place. - tg.must(os.RemoveAll(tg.path("src/code.google.com/p/rsc-svn"))) + tg.must(robustio.RemoveAll(tg.path("src/code.google.com/p/rsc-svn"))) tg.run("get", "-d", "-u", "code.google.com/p/rsc-svn2/trunk") tg.must(os.Rename(tg.path("src/code.google.com/p/rsc-svn2"), tg.path("src/code.google.com/p/rsc-svn"))) default: @@ -1212,10 +1223,12 @@ func TestInternalCache(t *testing.T) { } func TestMoveGit(t *testing.T) { + testenv.MustHaveExecPath(t, "git") testMove(t, "git", "rsc.io/pdf", "pdf", "rsc.io/pdf/.git/config") } func TestMoveHG(t *testing.T) { + testenv.MustHaveExecPath(t, "hg") testMove(t, "hg", "vcs-test.golang.org/go/custom-hg-hello", "custom-hg-hello", "vcs-test.golang.org/go/custom-hg-hello/.hg/hgrc") } @@ -1277,9 +1290,7 @@ func TestImportCycle(t *testing.T) { // cmd/go: custom import path checking should not apply to Go packages without import comment. func TestIssue10952(t *testing.T) { testenv.MustHaveExternalNetwork(t) - if _, err := exec.LookPath("git"); err != nil { - t.Skip("skipping because git binary not found") - } + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -1295,9 +1306,7 @@ func TestIssue10952(t *testing.T) { func TestIssue16471(t *testing.T) { testenv.MustHaveExternalNetwork(t) - if _, err := exec.LookPath("git"); err != nil { - t.Skip("skipping because git binary not found") - } + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -1313,9 +1322,7 @@ func TestIssue16471(t *testing.T) { // Test git clone URL that uses SCP-like syntax and custom import path checking. func TestIssue11457(t *testing.T) { testenv.MustHaveExternalNetwork(t) - if _, err := exec.LookPath("git"); err != nil { - t.Skip("skipping because git binary not found") - } + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -1340,9 +1347,7 @@ func TestIssue11457(t *testing.T) { func TestGetGitDefaultBranch(t *testing.T) { testenv.MustHaveExternalNetwork(t) - if _, err := exec.LookPath("git"); err != nil { - t.Skip("skipping because git binary not found") - } + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -1368,9 +1373,7 @@ func TestGetGitDefaultBranch(t *testing.T) { // Security issue. Don't disable. See golang.org/issue/22125. func TestAccidentalGitCheckout(t *testing.T) { testenv.MustHaveExternalNetwork(t) - if _, err := exec.LookPath("git"); err != nil { - t.Skip("skipping because git binary not found") - } + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -1644,6 +1647,7 @@ func TestInstallToGOBINCommandLinePackage(t *testing.T) { func TestGoGetNonPkg(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -1660,6 +1664,7 @@ func TestGoGetNonPkg(t *testing.T) { func TestGoGetTestOnlyPkg(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -1690,7 +1695,7 @@ func TestInstalls(t *testing.T) { goarch := strings.TrimSpace(tg.getStdout()) tg.setenv("GOARCH", goarch) fixbin := filepath.Join(goroot, "pkg", "tool", goos+"_"+goarch, "fix") + exeSuffix - tg.must(os.RemoveAll(fixbin)) + tg.must(robustio.RemoveAll(fixbin)) tg.run("install", "cmd/fix") tg.wantExecutable(fixbin, "did not install cmd/fix to $GOROOT/pkg/tool") tg.must(os.Remove(fixbin)) @@ -1884,11 +1889,12 @@ func TestGoListTest(t *testing.T) { tg.grepStdout(`^runtime/cgo$`, "missing runtime/cgo") tg.run("list", "-deps", "-f", "{{if .DepOnly}}{{.ImportPath}}{{end}}", "sort") - tg.grepStdout(`^reflect$`, "missing reflect") + tg.grepStdout(`^internal/reflectlite$`, "missing internal/reflectlite") tg.grepStdoutNot(`^sort`, "unexpected sort") } func TestGoListCompiledCgo(t *testing.T) { + tooSlow(t) tg := testgo(t) defer tg.cleanup() tg.parallel() @@ -2048,6 +2054,7 @@ func TestDefaultGOPATH(t *testing.T) { func TestDefaultGOPATHGet(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -2060,13 +2067,13 @@ func TestDefaultGOPATHGet(t *testing.T) { tg.grepStderr("created GOPATH="+regexp.QuoteMeta(tg.path("home/go"))+"; see 'go help gopath'", "did not create GOPATH") // no warning if directory already exists - tg.must(os.RemoveAll(tg.path("home/go"))) + tg.must(robustio.RemoveAll(tg.path("home/go"))) tg.tempDir("home/go") tg.run("get", "github.com/golang/example/hello") tg.grepStderrNot(".", "expected no output on standard error") // error if $HOME/go is a file - tg.must(os.RemoveAll(tg.path("home/go"))) + tg.must(robustio.RemoveAll(tg.path("home/go"))) tg.tempFile("home/go", "") tg.runFail("get", "github.com/golang/example/hello") tg.grepStderr(`mkdir .*[/\\]go: .*(not a directory|cannot find the path)`, "expected error because $HOME/go is a file") @@ -2429,6 +2436,7 @@ func TestSymlinkWarning(t *testing.T) { // Issue 8181. func TestGoGetDashTIssue8181(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -2443,6 +2451,7 @@ func TestGoGetDashTIssue8181(t *testing.T) { func TestIssue11307(t *testing.T) { // go get -u was not working except in checkout directory testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -2528,6 +2537,7 @@ func TestCoverageRuns(t *testing.T) { func TestCoverageDotImport(t *testing.T) { skipIfGccgo(t, "gccgo has no cover tool") + tooSlow(t) tg := testgo(t) defer tg.cleanup() tg.parallel() @@ -2610,6 +2620,14 @@ func TestCoverageDepLoop(t *testing.T) { tg.grepStdout("coverage: 100.0% of statements", "expected 100.0% coverage") } +func TestCoverageNoStatements(t *testing.T) { + tooSlow(t) + tg := testgo(t) + defer tg.cleanup() + tg.run("test", "-cover", "./testdata/testcover/pkg4") + tg.grepStdout("[no statements]", "expected [no statements] for pkg4") +} + func TestCoverageImportMainLoop(t *testing.T) { skipIfGccgo(t, "gccgo has no cover tool") tg := testgo(t) @@ -2699,6 +2717,7 @@ func TestCoverageFunc(t *testing.T) { // Issue 24588. func TestCoverageDashC(t *testing.T) { skipIfGccgo(t, "gccgo has no cover tool") + tooSlow(t) tg := testgo(t) defer tg.cleanup() tg.parallel() @@ -2855,7 +2874,7 @@ func TestCgoDependsOnSyscall(t *testing.T) { files, err := filepath.Glob(filepath.Join(runtime.GOROOT(), "pkg", "*_race")) tg.must(err) for _, file := range files { - tg.check(os.RemoveAll(file)) + tg.check(robustio.RemoveAll(file)) } tg.tempFile("src/foo/foo.go", ` package foo @@ -2911,6 +2930,7 @@ func TestCgoPkgConfig(t *testing.T) { tg.run("env", "PKG_CONFIG") pkgConfig := strings.TrimSpace(tg.getStdout()) + testenv.MustHaveExecPath(t, pkgConfig) if out, err := exec.Command(pkgConfig, "--atleast-pkgconfig-version", "0.24").CombinedOutput(); err != nil { t.Skipf("%s --atleast-pkgconfig-version 0.24: %v\n%s", pkgConfig, err, out) } @@ -3013,9 +3033,7 @@ func TestIssue7573(t *testing.T) { if !canCgo { t.Skip("skipping because cgo not enabled") } - if _, err := exec.LookPath("gccgo"); err != nil { - t.Skip("skipping because no gccgo compiler found") - } + testenv.MustHaveExecPath(t, "gccgo") tg := testgo(t) defer tg.cleanup() @@ -3304,6 +3322,7 @@ func TestGoGenerateBadImports(t *testing.T) { func TestGoGetCustomDomainWildcard(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -3315,6 +3334,7 @@ func TestGoGetCustomDomainWildcard(t *testing.T) { func TestGoGetInternalWildcard(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -3374,6 +3394,7 @@ func TestVetWithOnlyCgoFiles(t *testing.T) { if !canCgo { t.Skip("skipping because cgo not enabled") } + tooSlow(t) tg := testgo(t) defer tg.cleanup() @@ -3386,6 +3407,7 @@ func TestVetWithOnlyCgoFiles(t *testing.T) { // Issue 9767, 19769. func TestGoGetDotSlashDownload(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -3395,22 +3417,6 @@ func TestGoGetDotSlashDownload(t *testing.T) { tg.run("get", "./pprof_mac_fix") } -// Issue 13037: Was not parsing tags in 404 served over HTTPS -func TestGoGetHTTPS404(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - switch runtime.GOOS { - case "darwin", "linux", "freebsd": - default: - t.Skipf("test case does not work on %s", runtime.GOOS) - } - - tg := testgo(t) - defer tg.cleanup() - tg.tempDir("src") - tg.setenv("GOPATH", tg.path(".")) - tg.run("get", "bazil.org/fuse/fs/fstestutil") -} - // Test that you cannot import a main package. // See golang.org/issue/4210 and golang.org/issue/17475. func TestImportMain(t *testing.T) { @@ -3625,7 +3631,7 @@ func TestImportLocal(t *testing.T) { var _ = x.X `) tg.runFail("build", "dir/x") - tg.grepStderr("local import.*in non-local package", "did not diagnose local import") + tg.grepStderr("cannot import current directory", "did not diagnose import current directory") // ... even in a test. tg.tempFile("src/dir/x/xx.go", `package x @@ -3638,7 +3644,7 @@ func TestImportLocal(t *testing.T) { `) tg.run("build", "dir/x") tg.runFail("test", "dir/x") - tg.grepStderr("local import.*in non-local package", "did not diagnose local import") + tg.grepStderr("cannot import current directory", "did not diagnose import current directory") // ... even in an xtest. tg.tempFile("src/dir/x/xx.go", `package x @@ -3651,12 +3657,13 @@ func TestImportLocal(t *testing.T) { `) tg.run("build", "dir/x") tg.runFail("test", "dir/x") - tg.grepStderr("local import.*in non-local package", "did not diagnose local import") + tg.grepStderr("cannot import current directory", "did not diagnose import current directory") } func TestGoGetInsecure(t *testing.T) { test := func(t *testing.T, modules bool) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -3668,6 +3675,7 @@ func TestGoGetInsecure(t *testing.T) { tg.tempFile("go.mod", "module m") tg.cd(tg.path(".")) tg.setenv("GO111MODULE", "on") + tg.setenv("GOPROXY", "") } else { tg.setenv("GOPATH", tg.path(".")) tg.setenv("GO111MODULE", "off") @@ -3696,6 +3704,7 @@ func TestGoGetInsecure(t *testing.T) { func TestGoGetUpdateInsecure(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -3720,6 +3729,7 @@ func TestGoGetUpdateInsecure(t *testing.T) { func TestGoGetUpdateUnknownProtocol(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -3754,6 +3764,7 @@ func TestGoGetUpdateUnknownProtocol(t *testing.T) { func TestGoGetInsecureCustomDomain(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -3856,6 +3867,7 @@ func TestGoGetUpdate(t *testing.T) { // former dependencies, not current ones. testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -3883,6 +3895,7 @@ func TestGoGetUpdate(t *testing.T) { // Issue #20512. func TestGoGetRace(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") if !canRace { t.Skip("skipping because race detector not supported") } @@ -3899,6 +3912,7 @@ func TestGoGetDomainRoot(t *testing.T) { // go get foo.io (not foo.io/subdir) was not working consistently. testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -3913,10 +3927,10 @@ func TestGoGetDomainRoot(t *testing.T) { tg.run("get", "go-get-issue-9357.appspot.com") tg.run("get", "-u", "go-get-issue-9357.appspot.com") - tg.must(os.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com"))) + tg.must(robustio.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com"))) tg.run("get", "go-get-issue-9357.appspot.com") - tg.must(os.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com"))) + tg.must(robustio.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com"))) tg.run("get", "-u", "go-get-issue-9357.appspot.com") } @@ -4131,7 +4145,7 @@ func TestCgoConsistentResults(t *testing.T) { t.Skip("skipping because cgo not enabled") } switch runtime.GOOS { - case "solaris": + case "solaris", "illumos": testenv.SkipFlaky(t, 13247) } @@ -4203,9 +4217,9 @@ func TestBinaryOnlyPackages(t *testing.T) { package p1 `) - tg.wantStale("p1", "missing or invalid binary-only package", "p1 is binary-only but has no binary, should be stale") + tg.wantStale("p1", "binary-only packages are no longer supported", "p1 is binary-only, and this message should always be printed") tg.runFail("install", "p1") - tg.grepStderr("missing or invalid binary-only package", "did not report attempt to compile binary-only package") + tg.grepStderr("binary-only packages are no longer supported", "did not report attempt to compile binary-only package") tg.tempFile("src/p1/p1.go", ` package p1 @@ -4231,48 +4245,13 @@ func TestBinaryOnlyPackages(t *testing.T) { import _ "fmt" func G() `) - tg.wantNotStale("p1", "binary-only package", "should NOT want to rebuild p1 (first)") - tg.run("install", "-x", "p1") // no-op, up to date - tg.grepBothNot(`[\\/]compile`, "should not have run compiler") - tg.run("install", "p2") // does not rebuild p1 (or else p2 will fail) - tg.wantNotStale("p2", "", "should NOT want to rebuild p2") - - // changes to the non-source-code do not matter, - // and only one file needs the special comment. - tg.tempFile("src/p1/missing2.go", ` - package p1 - func H() - `) - tg.wantNotStale("p1", "binary-only package", "should NOT want to rebuild p1 (second)") - tg.wantNotStale("p2", "", "should NOT want to rebuild p2") - - tg.tempFile("src/p3/p3.go", ` - package main - import ( - "p1" - "p2" - ) - func main() { - p1.F(false) - p2.F() - } - `) - tg.run("install", "p3") - - tg.run("run", tg.path("src/p3/p3.go")) - tg.grepStdout("hello from p1", "did not see message from p1") - - tg.tempFile("src/p4/p4.go", `package main`) - // The odd string split below avoids vet complaining about - // a // +build line appearing too late in this source file. - tg.tempFile("src/p4/p4not.go", `//go:binary-only-package - - /`+`/ +build asdf + tg.wantStale("p1", "binary-only package", "should NOT want to rebuild p1 (first)") + tg.runFail("install", "p2") + tg.grepStderr("p1: binary-only packages are no longer supported", "did not report error for binary-only p1") - package main - `) - tg.run("list", "-f", "{{.BinaryOnly}}", "p4") - tg.grepStdout("false", "did not see BinaryOnly=false for p4") + tg.run("list", "-deps", "-f", "{{.ImportPath}}: {{.BinaryOnly}}", "p2") + tg.grepStdout("p1: true", "p1 not listed as BinaryOnly") + tg.grepStdout("p2: false", "p2 listed as BinaryOnly") } // Issue 16050. @@ -4324,6 +4303,7 @@ func TestGenerateUsesBuildContext(t *testing.T) { // Issue 14450: go get -u .../ tried to import not downloaded package func TestGoGetUpdateWithWildcard(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -4535,8 +4515,9 @@ func TestLinkXImportPathEscape(t *testing.T) { tg := testgo(t) defer tg.cleanup() tg.parallel() + tg.makeTempdir() tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - exe := "./linkx" + exeSuffix + exe := tg.path("linkx" + exeSuffix) tg.creatingTemp(exe) tg.run("build", "-o", exe, "-ldflags", "-X=my.pkg.Text=linkXworked", "my.pkg/main") out, err := exec.Command(exe).CombinedOutput() @@ -4677,7 +4658,7 @@ func TestBuildTagsNoComma(t *testing.T) { tg.makeTempdir() tg.setenv("GOPATH", tg.path("go")) tg.run("build", "-tags", "tag1 tag2", "math") - tg.runFail("build", "-tags", "tag1,tag2", "math") + tg.runFail("build", "-tags", "tag1,tag2 tag3", "math") tg.grepBoth("space-separated list contains comma", "-tags with a comma-separated list didn't error") } @@ -4772,7 +4753,7 @@ func TestExecutableGOROOT(t *testing.T) { check(t, symGoTool, newRoot) }) - tg.must(os.RemoveAll(tg.path("new/pkg"))) + tg.must(robustio.RemoveAll(tg.path("new/pkg"))) // Binaries built in the new tree should report the // new tree when they call runtime.GOROOT. @@ -4969,14 +4950,14 @@ func TestTestRegexps(t *testing.T) { x_test.go:15: LOG: Y running N=10000 x_test.go:15: LOG: Y running N=1000000 x_test.go:15: LOG: Y running N=100000000 - x_test.go:15: LOG: Y running N=2000000000 + x_test.go:15: LOG: Y running N=1000000000 --- BENCH: BenchmarkX/Y x_test.go:15: LOG: Y running N=1 x_test.go:15: LOG: Y running N=100 x_test.go:15: LOG: Y running N=10000 x_test.go:15: LOG: Y running N=1000000 x_test.go:15: LOG: Y running N=100000000 - x_test.go:15: LOG: Y running N=2000000000 + x_test.go:15: LOG: Y running N=1000000000 --- BENCH: BenchmarkX x_test.go:13: LOG: X running N=1 --- BENCH: BenchmarkXX @@ -5072,9 +5053,8 @@ func TestExecBuildX(t *testing.T) { t.Skip("skipping because cgo not enabled") } - if runtime.GOOS == "plan9" || runtime.GOOS == "windows" { - t.Skipf("skipping because unix shell is not supported on %s", runtime.GOOS) - } + testenv.MustHaveExecPath(t, "/usr/bin/env") + testenv.MustHaveExecPath(t, "bash") tg := testgo(t) defer tg.cleanup() @@ -5082,6 +5062,11 @@ func TestExecBuildX(t *testing.T) { tg.tempDir("cache") tg.setenv("GOCACHE", tg.path("cache")) + // Before building our test main.go, ensure that an up-to-date copy of + // runtime/cgo is present in the cache. If it isn't, the 'go build' step below + // will fail with "can't open import". See golang.org/issue/29004. + tg.run("build", "runtime/cgo") + tg.tempFile("main.go", `package main; import "C"; func main() { print("hello") }`) src := tg.path("main.go") obj := tg.path("main") @@ -5124,7 +5109,7 @@ func TestExecBuildX(t *testing.T) { if len(matches) == 0 { t.Fatal("no WORK directory") } - tg.must(os.RemoveAll(matches[1])) + tg.must(robustio.RemoveAll(matches[1])) } func TestParallelNumber(t *testing.T) { @@ -5155,9 +5140,10 @@ func TestUpxCompression(t *testing.T) { t.Skipf("skipping upx test on %s/%s", runtime.GOOS, runtime.GOARCH) } + testenv.MustHaveExecPath(t, "upx") out, err := exec.Command("upx", "--version").CombinedOutput() if err != nil { - t.Skip("skipping because upx is not available") + t.Fatalf("upx --version failed: %v", err) } // upx --version prints `upx ` in the first line of output: @@ -5166,13 +5152,13 @@ func TestUpxCompression(t *testing.T) { re := regexp.MustCompile(`([[:digit:]]+)\.([[:digit:]]+)`) upxVersion := re.FindStringSubmatch(string(out)) if len(upxVersion) != 3 { - t.Errorf("bad upx version string: %s", upxVersion) + t.Fatalf("bad upx version string: %s", upxVersion) } major, err1 := strconv.Atoi(upxVersion[1]) minor, err2 := strconv.Atoi(upxVersion[2]) if err1 != nil || err2 != nil { - t.Errorf("bad upx version string: %s", upxVersion[0]) + t.Fatalf("bad upx version string: %s", upxVersion[0]) } // Anything below 3.94 is known not to work with go binaries @@ -5225,26 +5211,29 @@ func TestQEMUUserMode(t *testing.T) { src, obj := tg.path("main.go"), tg.path("main") for _, arch := range testArchs { - out, err := exec.Command("qemu-"+arch.qemu, "--version").CombinedOutput() - if err != nil { - t.Logf("Skipping %s test (qemu-%s not available)", arch.g, arch.qemu) - continue - } + arch := arch + t.Run(arch.g, func(t *testing.T) { + qemu := "qemu-" + arch.qemu + testenv.MustHaveExecPath(t, qemu) - tg.setenv("GOARCH", arch.g) - tg.run("build", "-o", obj, src) + out, err := exec.Command(qemu, "--version").CombinedOutput() + if err != nil { + t.Fatalf("%s --version failed: %v", qemu, err) + } - out, err = exec.Command("qemu-"+arch.qemu, obj).CombinedOutput() - if err != nil { - t.Logf("qemu-%s output:\n%s\n", arch.qemu, out) - t.Errorf("qemu-%s failed with %v", arch.qemu, err) - continue - } - if want := "hello qemu-user"; string(out) != want { - t.Errorf("bad output from qemu-%s:\ngot %s; want %s", arch.qemu, out, want) - } - } + tg.setenv("GOARCH", arch.g) + tg.run("build", "-o", obj, src) + out, err = exec.Command(qemu, obj).CombinedOutput() + if err != nil { + t.Logf("%s output:\n%s\n", qemu, out) + t.Fatalf("%s failed with %v", qemu, err) + } + if want := "hello qemu-user"; string(out) != want { + t.Errorf("bad output from %s:\ngot %s; want %s", qemu, out, want) + } + }) + } } func TestCacheListStale(t *testing.T) { @@ -5296,8 +5285,14 @@ func TestCacheVet(t *testing.T) { if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") { t.Skip("GODEBUG gocacheverify") } - if os.Getenv("GOCACHE") == "off" { - tooSlow(t) + if testing.Short() { + // In short mode, reuse cache. + // Test failures may be masked if the cache has just the right entries already + // (not a concern during all.bash, which runs in a clean cache). + if cfg.Getenv("GOCACHE") == "off" { + tooSlow(t) + } + } else { tg.makeTempdir() tg.setenv("GOCACHE", tg.path("cache")) } @@ -5681,6 +5676,7 @@ func TestTestSkipVetAfterFailedBuild(t *testing.T) { } func TestTestVetRebuild(t *testing.T) { + tooSlow(t) tg := testgo(t) defer tg.cleanup() tg.parallel() @@ -5960,6 +5956,7 @@ func TestBadCgoDirectives(t *testing.T) { if !canCgo { t.Skip("no cgo") } + tooSlow(t) tg := testgo(t) defer tg.cleanup() @@ -5992,7 +5989,7 @@ func TestBadCgoDirectives(t *testing.T) { if runtime.Compiler == "gc" { tg.runFail("build", tg.path("src/x/_cgo_yy.go")) // ... but if forced, the comment is rejected // Actually, today there is a separate issue that _ files named - // on the command-line are ignored. Once that is fixed, + // on the command line are ignored. Once that is fixed, // we want to see the cgo_ldflag error. tg.grepStderr("//go:cgo_ldflag only allowed in cgo-generated code|no Go files", "did not reject //go:cgo_ldflag directive") } @@ -6074,6 +6071,7 @@ func TestTwoPkgConfigs(t *testing.T) { if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { t.Skipf("no shell scripts on %s", runtime.GOOS) } + tooSlow(t) tg := testgo(t) defer tg.cleanup() tg.parallel() @@ -6104,6 +6102,8 @@ func TestCgoCache(t *testing.T) { if !canCgo { t.Skip("no cgo") } + tooSlow(t) + tg := testgo(t) defer tg.cleanup() tg.parallel() @@ -6154,6 +6154,7 @@ func TestLinkerTmpDirIsDeleted(t *testing.T) { if !canCgo { t.Skip("skipping because cgo not enabled") } + tooSlow(t) tg := testgo(t) defer tg.cleanup() @@ -6243,6 +6244,7 @@ func TestGoTestWithoutTests(t *testing.T) { // Issue 25579. func TestGoBuildDashODevNull(t *testing.T) { + tooSlow(t) tg := testgo(t) defer tg.cleanup() tg.parallel() @@ -6255,6 +6257,7 @@ func TestGoBuildDashODevNull(t *testing.T) { // Issue 25093. func TestCoverpkgTestOnly(t *testing.T) { skipIfGccgo(t, "gccgo has no cover tool") + tooSlow(t) tg := testgo(t) defer tg.cleanup() tg.parallel() diff --git a/libgo/go/cmd/go/go_windows_test.go b/libgo/go/cmd/go/go_windows_test.go index 99af3d43dcc..3999166ed98 100644 --- a/libgo/go/cmd/go/go_windows_test.go +++ b/libgo/go/cmd/go/go_windows_test.go @@ -5,7 +5,6 @@ package main import ( - "fmt" "internal/testenv" "io/ioutil" "os" @@ -13,14 +12,18 @@ import ( "path/filepath" "strings" "testing" + + "cmd/go/internal/robustio" ) func TestAbsolutePath(t *testing.T) { + t.Parallel() + tmp, err := ioutil.TempDir("", "TestAbsolutePath") if err != nil { t.Fatal(err) } - defer os.RemoveAll(tmp) + defer robustio.RemoveAll(tmp) file := filepath.Join(tmp, "a.go") err = ioutil.WriteFile(file, []byte{}, 0644) @@ -33,21 +36,11 @@ func TestAbsolutePath(t *testing.T) { t.Fatal(err) } - wd, err := os.Getwd() - if err != nil { - t.Fatal(err) - } - defer os.Chdir(wd) - - // Chdir so current directory and a.go reside on the same drive. - err = os.Chdir(dir) - if err != nil { - t.Fatal(err) - } - noVolume := file[len(filepath.VolumeName(file)):] wrongPath := filepath.Join(dir, noVolume) - output, err := exec.Command(testenv.GoToolPath(t), "build", noVolume).CombinedOutput() + cmd := exec.Command(testenv.GoToolPath(t), "build", noVolume) + cmd.Dir = dir + output, err := cmd.CombinedOutput() if err == nil { t.Fatal("build should fail") } @@ -55,69 +48,3 @@ func TestAbsolutePath(t *testing.T) { t.Fatalf("wrong output found: %v %v", err, string(output)) } } - -func runIcacls(t *testing.T, args ...string) string { - t.Helper() - out, err := exec.Command("icacls", args...).CombinedOutput() - if err != nil { - t.Fatalf("icacls failed: %v\n%v", err, string(out)) - } - return string(out) -} - -func runGetACL(t *testing.T, path string) string { - t.Helper() - cmd := fmt.Sprintf(`Get-Acl "%s" | Select -expand AccessToString`, path) - out, err := exec.Command("powershell", "-Command", cmd).CombinedOutput() - if err != nil { - t.Fatalf("Get-Acl failed: %v\n%v", err, string(out)) - } - return string(out) -} - -// For issue 22343: verify that executable file created by "go build" command -// has discretionary access control list (DACL) set as if the file -// was created in the destination directory. -func TestACL(t *testing.T) { - tmpdir, err := ioutil.TempDir("", "TestACL") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpdir) - - newtmpdir := filepath.Join(tmpdir, "tmp") - err = os.Mkdir(newtmpdir, 0777) - if err != nil { - t.Fatal(err) - } - - // When TestACL/tmp directory is created, it will have - // the same security attributes as TestACL. - // Add Guest account full access to TestACL/tmp - this - // will make all files created in TestACL/tmp have different - // security attributes to the files created in TestACL. - runIcacls(t, newtmpdir, - "/grant", "*S-1-5-32-546:(oi)(ci)f", // add Guests group to have full access - ) - - src := filepath.Join(tmpdir, "main.go") - err = ioutil.WriteFile(src, []byte("package main; func main() { }\n"), 0644) - if err != nil { - t.Fatal(err) - } - exe := filepath.Join(tmpdir, "main.exe") - cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", exe, src) - cmd.Env = append(os.Environ(), - "TMP="+newtmpdir, - "TEMP="+newtmpdir, - ) - out, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("go command failed: %v\n%v", err, string(out)) - } - - // exe file is expected to have the same security attributes as the src. - if got, expected := runGetACL(t, exe), runGetACL(t, src); got != expected { - t.Fatalf("expected Get-Acl output of \n%v\n, got \n%v\n", expected, got) - } -} diff --git a/libgo/go/cmd/go/help_test.go b/libgo/go/cmd/go/help_test.go index ec6a9d11cbe..9c0fa8411ee 100644 --- a/libgo/go/cmd/go/help_test.go +++ b/libgo/go/cmd/go/help_test.go @@ -12,9 +12,14 @@ import ( "testing" "cmd/go/internal/help" + "cmd/go/internal/modload" ) func TestDocsUpToDate(t *testing.T) { + if !modload.Enabled() { + t.Skipf("help.Help in GOPATH mode is configured by main.main") + } + buf := new(bytes.Buffer) // Match the command in mkalldocs.sh that generates alldocs.go. help.Help(buf, []string{"documentation"}) diff --git a/libgo/go/cmd/go/init_test.go b/libgo/go/cmd/go/init_test.go new file mode 100644 index 00000000000..ed90a778416 --- /dev/null +++ b/libgo/go/cmd/go/init_test.go @@ -0,0 +1,34 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main_test + +import ( + "internal/testenv" + "os/exec" + "testing" +) + +// BenchmarkExecGoEnv measures how long it takes for 'go env GOARCH' to run. +// Since 'go' is executed, remember to run 'go install cmd/go' before running +// the benchmark if any changes were done. +func BenchmarkExecGoEnv(b *testing.B) { + testenv.MustHaveExec(b) + b.StopTimer() + gotool, err := testenv.GoTool() + if err != nil { + b.Fatal(err) + } + for i := 0; i < b.N; i++ { + cmd := exec.Command(gotool, "env", "GOARCH") + + b.StartTimer() + err := cmd.Run() + b.StopTimer() + + if err != nil { + b.Fatal(err) + } + } +} diff --git a/libgo/go/cmd/go/internal/auth/auth.go b/libgo/go/cmd/go/internal/auth/auth.go new file mode 100644 index 00000000000..12e3c74dcc7 --- /dev/null +++ b/libgo/go/cmd/go/internal/auth/auth.go @@ -0,0 +1,23 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package auth provides access to user-provided authentication credentials. +package auth + +import "net/http" + +// AddCredentials fills in the user's credentials for req, if any. +// The return value reports whether any matching credentials were found. +func AddCredentials(req *http.Request) (added bool) { + // TODO(golang.org/issue/26232): Support arbitrary user-provided credentials. + netrcOnce.Do(readNetrc) + for _, l := range netrc { + if l.machine == req.URL.Host { + req.SetBasicAuth(l.login, l.password) + return true + } + } + + return false +} diff --git a/libgo/go/cmd/go/internal/auth/netrc.go b/libgo/go/cmd/go/internal/auth/netrc.go new file mode 100644 index 00000000000..7a9bdbb72c8 --- /dev/null +++ b/libgo/go/cmd/go/internal/auth/netrc.go @@ -0,0 +1,111 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package auth + +import ( + "io/ioutil" + "os" + "path/filepath" + "runtime" + "strings" + "sync" +) + +type netrcLine struct { + machine string + login string + password string +} + +var ( + netrcOnce sync.Once + netrc []netrcLine + netrcErr error +) + +func parseNetrc(data string) []netrcLine { + // See https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html + // for documentation on the .netrc format. + var nrc []netrcLine + var l netrcLine + inMacro := false + for _, line := range strings.Split(data, "\n") { + if inMacro { + if line == "" { + inMacro = false + } + continue + } + + f := strings.Fields(line) + i := 0 + for ; i < len(f)-1; i += 2 { + // Reset at each "machine" token. + // “The auto-login process searches the .netrc file for a machine token + // that matches […]. Once a match is made, the subsequent .netrc tokens + // are processed, stopping when the end of file is reached or another + // machine or a default token is encountered.” + switch f[i] { + case "machine": + l = netrcLine{machine: f[i+1]} + case "default": + break + case "login": + l.login = f[i+1] + case "password": + l.password = f[i+1] + case "macdef": + // “A macro is defined with the specified name; its contents begin with + // the next .netrc line and continue until a null line (consecutive + // new-line characters) is encountered.” + inMacro = true + } + if l.machine != "" && l.login != "" && l.password != "" { + nrc = append(nrc, l) + l = netrcLine{} + } + } + + if i < len(f) && f[i] == "default" { + // “There can be only one default token, and it must be after all machine tokens.” + break + } + } + + return nrc +} + +func netrcPath() (string, error) { + if env := os.Getenv("NETRC"); env != "" { + return env, nil + } + dir, err := os.UserHomeDir() + if err != nil { + return "", err + } + base := ".netrc" + if runtime.GOOS == "windows" { + base = "_netrc" + } + return filepath.Join(dir, base), nil +} + +func readNetrc() { + path, err := netrcPath() + if err != nil { + netrcErr = err + return + } + + data, err := ioutil.ReadFile(path) + if err != nil { + if !os.IsNotExist(err) { + netrcErr = err + } + return + } + + netrc = parseNetrc(string(data)) +} diff --git a/libgo/go/cmd/go/internal/auth/netrc_test.go b/libgo/go/cmd/go/internal/auth/netrc_test.go new file mode 100644 index 00000000000..e06c545390e --- /dev/null +++ b/libgo/go/cmd/go/internal/auth/netrc_test.go @@ -0,0 +1,58 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package auth + +import ( + "reflect" + "testing" +) + +var testNetrc = ` +machine incomplete +password none + +machine api.github.com + login user + password pwd + +machine incomlete.host + login justlogin + +machine test.host +login user2 +password pwd2 + +machine oneline login user3 password pwd3 + +machine ignore.host macdef ignore + login nobody + password nothing + +machine hasmacro.too macdef ignore-next-lines login user4 password pwd4 + login nobody + password nothing + +default +login anonymous +password gopher@golang.org + +machine after.default +login oops +password too-late-in-file +` + +func TestParseNetrc(t *testing.T) { + lines := parseNetrc(testNetrc) + want := []netrcLine{ + {"api.github.com", "user", "pwd"}, + {"test.host", "user2", "pwd2"}, + {"oneline", "user3", "pwd3"}, + {"hasmacro.too", "user4", "pwd4"}, + } + + if !reflect.DeepEqual(lines, want) { + t.Errorf("parseNetrc:\nhave %q\nwant %q", lines, want) + } +} diff --git a/libgo/go/cmd/go/internal/base/base.go b/libgo/go/cmd/go/internal/base/base.go index bf810ff7622..272da556812 100644 --- a/libgo/go/cmd/go/internal/base/base.go +++ b/libgo/go/cmd/go/internal/base/base.go @@ -30,7 +30,7 @@ type Command struct { Run func(cmd *Command, args []string) // UsageLine is the one-line usage message. - // The first word in the line is taken to be the command name. + // The words between "go" and the first flag or argument in the line are taken to be the command name. UsageLine string // Short is the short description shown in the 'go help' output. @@ -132,6 +132,10 @@ func SetExitStatus(n int) { exitMu.Unlock() } +func GetExitStatus() int { + return exitStatus +} + // Run runs the command, with stdout and stderr // connected to the go command's own stdout and stderr. // If the command fails, Run reports the error using Errorf. diff --git a/libgo/go/cmd/go/internal/base/env.go b/libgo/go/cmd/go/internal/base/env.go index fcade9d84e2..077295e0eff 100644 --- a/libgo/go/cmd/go/internal/base/env.go +++ b/libgo/go/cmd/go/internal/base/env.go @@ -4,34 +4,12 @@ package base -import "strings" - -// EnvForDir returns a copy of the environment -// suitable for running in the given directory. -// The environment is the current process's environment -// but with an updated $PWD, so that an os.Getwd in the -// child will be faster. +// EnvForDir returns a modified environment suitable for running in the given +// directory. +// The environment is the supplied base environment but with an updated $PWD, so +// that an os.Getwd in the child will be faster. func EnvForDir(dir string, base []string) []string { // Internally we only use rooted paths, so dir is rooted. // Even if dir is not rooted, no harm done. - return MergeEnvLists([]string{"PWD=" + dir}, base) -} - -// MergeEnvLists merges the two environment lists such that -// variables with the same name in "in" replace those in "out". -// This always returns a newly allocated slice. -func MergeEnvLists(in, out []string) []string { - out = append([]string(nil), out...) -NextVar: - for _, inkv := range in { - k := strings.SplitAfterN(inkv, "=", 2)[0] - for i, outkv := range out { - if strings.HasPrefix(outkv, k) { - out[i] = inkv - continue NextVar - } - } - out = append(out, inkv) - } - return out + return append(base, "PWD="+dir) } diff --git a/libgo/go/cmd/go/internal/base/goflags.go b/libgo/go/cmd/go/internal/base/goflags.go index 2f50b50bfcf..187c2a14727 100644 --- a/libgo/go/cmd/go/internal/base/goflags.go +++ b/libgo/go/cmd/go/internal/base/goflags.go @@ -7,7 +7,6 @@ package base import ( "flag" "fmt" - "os" "runtime" "strings" @@ -62,7 +61,7 @@ func InitGOFLAGS() { // (Both will show the GOFLAGS setting if let succeed.) hideErrors := cfg.CmdName == "env" || cfg.CmdName == "bug" - goflags = strings.Fields(os.Getenv("GOFLAGS")) + goflags = strings.Fields(cfg.Getenv("GOFLAGS")) if goflags == nil { goflags = []string{} // avoid work on later InitGOFLAGS call } diff --git a/libgo/go/cmd/go/internal/bug/bug.go b/libgo/go/cmd/go/internal/bug/bug.go index e701f6eac9c..fe71281ef05 100644 --- a/libgo/go/cmd/go/internal/bug/bug.go +++ b/libgo/go/cmd/go/internal/bug/bug.go @@ -10,6 +10,7 @@ import ( "fmt" "io" "io/ioutil" + urlpkg "net/url" "os" "os/exec" "path/filepath" @@ -19,7 +20,6 @@ import ( "cmd/go/internal/base" "cmd/go/internal/cfg" - "cmd/go/internal/envcmd" "cmd/go/internal/web" ) @@ -43,48 +43,60 @@ func runBug(cmd *base.Command, args []string) { } var buf bytes.Buffer buf.WriteString(bugHeader) - inspectGoVersion(&buf) - fmt.Fprint(&buf, "#### System details\n\n") - fmt.Fprintln(&buf, "```") - fmt.Fprintf(&buf, "go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) - env := cfg.CmdEnv - env = append(env, envcmd.ExtraEnvVars()...) - for _, e := range env { - // Hide the TERM environment variable from "go bug". - // See issue #18128 - if e.Name != "TERM" { - fmt.Fprintf(&buf, "%s=\"%s\"\n", e.Name, e.Value) - } - } - printGoDetails(&buf) - printOSDetails(&buf) - printCDetails(&buf) - fmt.Fprintln(&buf, "```") + printGoVersion(&buf) + buf.WriteString("### Does this issue reproduce with the latest release?\n\n\n") + printEnvDetails(&buf) + buf.WriteString(bugFooter) body := buf.String() - url := "https://github.com/golang/go/issues/new?body=" + web.QueryEscape(body) + url := "https://github.com/golang/go/issues/new?body=" + urlpkg.QueryEscape(body) if !web.OpenBrowser(url) { fmt.Print("Please file a new issue at golang.org/issue/new using this template:\n\n") fmt.Print(body) } } -const bugHeader = `Please answer these questions before submitting your issue. Thanks! +const bugHeader = ` + +` +const bugFooter = `### What did you do? -#### What did you do? + + -#### What did you expect to see? +### What did you expect to see? -#### What did you see instead? +### What did you see instead? ` +func printGoVersion(w io.Writer) { + fmt.Fprintf(w, "### What version of Go are you using (`go version`)?\n\n") + fmt.Fprintf(w, "
\n")
+	fmt.Fprintf(w, "$ go version\n")
+	printCmdOut(w, "", "go", "version")
+	fmt.Fprintf(w, "
\n") + fmt.Fprintf(w, "\n") +} + +func printEnvDetails(w io.Writer) { + fmt.Fprintf(w, "### What operating system and processor architecture are you using (`go env`)?\n\n") + fmt.Fprintf(w, "
go env Output
\n")
+	fmt.Fprintf(w, "$ go env\n")
+	printCmdOut(w, "", "go", "env")
+	printGoDetails(w)
+	printOSDetails(w)
+	printCDetails(w)
+	fmt.Fprintf(w, "
\n\n") +} + func printGoDetails(w io.Writer) { printCmdOut(w, "GOROOT/bin/go version: ", filepath.Join(runtime.GOROOT(), "bin/go"), "version") printCmdOut(w, "GOROOT/bin/go tool compile -V: ", filepath.Join(runtime.GOROOT(), "bin/go"), "tool", "compile", "-V") @@ -101,7 +113,9 @@ func printOSDetails(w io.Writer) { printGlibcVersion(w) case "openbsd", "netbsd", "freebsd", "dragonfly": printCmdOut(w, "uname -v: ", "uname", "-v") - case "solaris": + case "illumos", "solaris": + // Be sure to use the OS-supplied uname, in "/usr/bin": + printCmdOut(w, "uname -srv: ", "/usr/bin/uname", "-srv") out, err := ioutil.ReadFile("/etc/release") if err == nil { fmt.Fprintf(w, "/etc/release: %s\n", out) @@ -129,30 +143,6 @@ func printCDetails(w io.Writer) { } } -func inspectGoVersion(w io.Writer) { - data, err := web.Get("https://golang.org/VERSION?m=text") - if err != nil { - if cfg.BuildV { - fmt.Printf("failed to read from golang.org/VERSION: %v\n", err) - } - return - } - - // golang.org/VERSION currently returns a whitespace-free string, - // but just in case, protect against that changing. - // Similarly so for runtime.Version. - release := string(bytes.TrimSpace(data)) - vers := strings.TrimSpace(runtime.Version()) - - if vers == release { - // Up to date - return - } - - // Devel version or outdated release. Either way, this request is apropos. - fmt.Fprintf(w, "#### Does this issue reproduce with the latest release (%s)?\n\n\n", release) -} - // printCmdOut prints the output of running the given command. // It ignores failures; 'go bug' is best effort. func printCmdOut(w io.Writer, prefix, path string, args ...string) { diff --git a/libgo/go/cmd/go/internal/cache/cache.go b/libgo/go/cmd/go/internal/cache/cache.go index ab84cf6302c..116279c977d 100644 --- a/libgo/go/cmd/go/internal/cache/cache.go +++ b/libgo/go/cmd/go/internal/cache/cache.go @@ -33,7 +33,6 @@ type OutputID [HashSize]byte // A Cache is a package cache, backed by a file system directory tree. type Cache struct { dir string - log *os.File now func() time.Time } @@ -63,13 +62,8 @@ func Open(dir string) (*Cache, error) { return nil, err } } - f, err := os.OpenFile(filepath.Join(dir, "log.txt"), os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666) - if err != nil { - return nil, err - } c := &Cache{ dir: dir, - log: f, now: time.Now, } return c, nil @@ -141,7 +135,6 @@ type Entry struct { // get is Get but does not respect verify mode, so that Put can use it. func (c *Cache) get(id ActionID) (Entry, error) { missing := func() (Entry, error) { - fmt.Fprintf(c.log, "%d miss %x\n", c.now().Unix(), id) return Entry{}, errMissing } f, err := os.Open(c.fileName(id, "a")) @@ -184,8 +177,6 @@ func (c *Cache) get(id ActionID) (Entry, error) { return missing() } - fmt.Fprintf(c.log, "%d get %x\n", c.now().Unix(), id) - c.used(c.fileName(id, "a")) return Entry{buf, size, time.Unix(0, tm)}, nil @@ -270,7 +261,7 @@ func (c *Cache) Trim() { // We maintain in dir/trim.txt the time of the last completed cache trim. // If the cache has been trimmed recently enough, do nothing. // This is the common case. - data, _ := ioutil.ReadFile(filepath.Join(c.dir, "trim.txt")) + data, _ := renameio.ReadFile(filepath.Join(c.dir, "trim.txt")) t, err := strconv.ParseInt(strings.TrimSpace(string(data)), 10, 64) if err == nil && now.Sub(time.Unix(t, 0)) < trimInterval { return @@ -287,7 +278,7 @@ func (c *Cache) Trim() { // Ignore errors from here: if we don't write the complete timestamp, the // cache will appear older than it is, and we'll trim it again next time. - renameio.WriteFile(filepath.Join(c.dir, "trim.txt"), []byte(fmt.Sprintf("%d", now.Unix()))) + renameio.WriteFile(filepath.Join(c.dir, "trim.txt"), []byte(fmt.Sprintf("%d", now.Unix())), 0666) } // trimSubdir trims a single cache subdirectory. @@ -349,7 +340,6 @@ func (c *Cache) putIndexEntry(id ActionID, out OutputID, size int64, allowVerify } os.Chtimes(file, c.now(), c.now()) // mainly for tests - fmt.Fprintf(c.log, "%d put %x %x %d\n", c.now().Unix(), id, out, size) return nil } diff --git a/libgo/go/cmd/go/internal/cache/cache_test.go b/libgo/go/cmd/go/internal/cache/cache_test.go index d3dafccd137..1988c345023 100644 --- a/libgo/go/cmd/go/internal/cache/cache_test.go +++ b/libgo/go/cmd/go/internal/cache/cache_test.go @@ -78,7 +78,7 @@ func TestGrowth(t *testing.T) { n := 10000 if testing.Short() { - n = 1000 + n = 10 } for i := 0; i < n; i++ { @@ -144,55 +144,6 @@ func TestVerifyPanic(t *testing.T) { t.Fatal("mismatched Put did not panic in verify mode") } -func TestCacheLog(t *testing.T) { - dir, err := ioutil.TempDir("", "cachetest-") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(dir) - - c, err := Open(dir) - if err != nil { - t.Fatalf("Open: %v", err) - } - c.now = func() time.Time { return time.Unix(1e9, 0) } - - id := ActionID(dummyID(1)) - c.Get(id) - c.PutBytes(id, []byte("abc")) - c.Get(id) - - c, err = Open(dir) - if err != nil { - t.Fatalf("Open #2: %v", err) - } - c.now = func() time.Time { return time.Unix(1e9+1, 0) } - c.Get(id) - - id2 := ActionID(dummyID(2)) - c.Get(id2) - c.PutBytes(id2, []byte("abc")) - c.Get(id2) - c.Get(id) - - data, err := ioutil.ReadFile(filepath.Join(dir, "log.txt")) - if err != nil { - t.Fatal(err) - } - want := `1000000000 miss 0100000000000000000000000000000000000000000000000000000000000000 -1000000000 put 0100000000000000000000000000000000000000000000000000000000000000 ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad 3 -1000000000 get 0100000000000000000000000000000000000000000000000000000000000000 -1000000001 get 0100000000000000000000000000000000000000000000000000000000000000 -1000000001 miss 0200000000000000000000000000000000000000000000000000000000000000 -1000000001 put 0200000000000000000000000000000000000000000000000000000000000000 ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad 3 -1000000001 get 0200000000000000000000000000000000000000000000000000000000000000 -1000000001 get 0100000000000000000000000000000000000000000000000000000000000000 -` - if string(data) != want { - t.Fatalf("log:\n%s\nwant:\n%s", string(data), want) - } -} - func dummyID(x int) [HashSize]byte { var out [HashSize]byte binary.LittleEndian.PutUint64(out[:], uint64(x)) diff --git a/libgo/go/cmd/go/internal/cache/default.go b/libgo/go/cmd/go/internal/cache/default.go index 7d389c3c1af..9f8dd8af4b6 100644 --- a/libgo/go/cmd/go/internal/cache/default.go +++ b/libgo/go/cmd/go/internal/cache/default.go @@ -12,6 +12,7 @@ import ( "sync" "cmd/go/internal/base" + "cmd/go/internal/cfg" ) // Default returns the default cache to use, or nil if no cache should be used. @@ -73,7 +74,7 @@ func DefaultDir() string { // otherwise distinguish between an explicit "off" and a UserCacheDir error. defaultDirOnce.Do(func() { - defaultDir = os.Getenv("GOCACHE") + defaultDir = cfg.Getenv("GOCACHE") if filepath.IsAbs(defaultDir) || defaultDir == "off" { return } diff --git a/libgo/go/cmd/go/internal/cfg/cfg.go b/libgo/go/cmd/go/internal/cfg/cfg.go index 8dc4d1fbd29..a0b51a72c33 100644 --- a/libgo/go/cmd/go/internal/cfg/cfg.go +++ b/libgo/go/cmd/go/internal/cfg/cfg.go @@ -7,11 +7,15 @@ package cfg import ( + "bytes" "fmt" "go/build" + "io/ioutil" "os" "path/filepath" "runtime" + "strings" + "sync" "cmd/internal/objabi" ) @@ -34,11 +38,12 @@ var ( BuildToolchainName string BuildToolchainCompiler func() string BuildToolchainLinker func() string + BuildTrimpath bool // -trimpath flag BuildV bool // -v flag BuildWork bool // -work flag BuildX bool // -x flag - CmdName string // "build", "install", "list", etc. + CmdName string // "build", "install", "list", "mod tidy", etc. DebugActiongraph string // -debug-actiongraph flag (undocumented, unstable) ) @@ -46,6 +51,50 @@ var ( func defaultContext() build.Context { ctxt := build.Default ctxt.JoinPath = filepath.Join // back door to say "do not use go command" + + ctxt.GOROOT = findGOROOT() + if runtime.Compiler != "gccgo" { + // Note that we must use runtime.GOOS and runtime.GOARCH here, + // as the tool directory does not move based on environment + // variables. This matches the initialization of ToolDir in + // go/build, except for using ctxt.GOROOT rather than + // runtime.GOROOT. + build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) + } + + ctxt.GOPATH = envOr("GOPATH", ctxt.GOPATH) + + // Override defaults computed in go/build with defaults + // from go environment configuration file, if known. + ctxt.GOOS = envOr("GOOS", ctxt.GOOS) + ctxt.GOARCH = envOr("GOARCH", ctxt.GOARCH) + + // The go/build rule for whether cgo is enabled is: + // 1. If $CGO_ENABLED is set, respect it. + // 2. Otherwise, if this is a cross-compile, disable cgo. + // 3. Otherwise, use built-in default for GOOS/GOARCH. + // Recreate that logic here with the new GOOS/GOARCH setting. + if v := Getenv("CGO_ENABLED"); v == "0" || v == "1" { + ctxt.CgoEnabled = v[0] == '1' + } else if ctxt.GOOS != runtime.GOOS || ctxt.GOARCH != runtime.GOARCH { + ctxt.CgoEnabled = false + } else { + // Use built-in default cgo setting for GOOS/GOARCH. + // Note that ctxt.GOOS/GOARCH are derived from the preference list + // (1) environment, (2) go/env file, (3) runtime constants, + // while go/build.Default.GOOS/GOARCH are derived from the preference list + // (1) environment, (2) runtime constants. + // We know ctxt.GOOS/GOARCH == runtime.GOOS/GOARCH; + // no matter how that happened, go/build.Default will make the + // same decision (either the environment variables are set explicitly + // to match the runtime constants, or else they are unset, in which + // case go/build falls back to the runtime constants), so + // go/build.Default.GOOS/GOARCH == runtime.GOOS/GOARCH. + // So ctxt.CgoEnabled (== go/build.Default.CgoEnabled) is correct + // as is and can be left unmodified. + // Nothing to do here. + } + return ctxt } @@ -70,54 +119,215 @@ var CmdEnv []EnvVar // Global build parameters (used during package load) var ( - Goarch = BuildContext.GOARCH - Goos = BuildContext.GOOS - ExeSuffix string - Gopath = filepath.SplitList(BuildContext.GOPATH) + Goarch = BuildContext.GOARCH + Goos = BuildContext.GOOS + + ExeSuffix = exeSuffix() // ModulesEnabled specifies whether the go command is running // in module-aware mode (as opposed to GOPATH mode). // It is equal to modload.Enabled, but not all packages can import modload. ModulesEnabled bool - - // GoModInGOPATH records whether we've found a go.mod in GOPATH/src - // in GO111MODULE=auto mode. In that case, we don't use modules - // but people might expect us to, so 'go get' warns. - GoModInGOPATH string ) -func init() { +func exeSuffix() string { if Goos == "windows" { - ExeSuffix = ".exe" + return ".exe" + } + return "" +} + +var envCache struct { + once sync.Once + m map[string]string +} + +// EnvFile returns the name of the Go environment configuration file. +func EnvFile() (string, error) { + if file := os.Getenv("GOENV"); file != "" { + if file == "off" { + return "", fmt.Errorf("GOENV=off") + } + return file, nil + } + dir, err := os.UserConfigDir() + if err != nil { + return "", err + } + if dir == "" { + return "", fmt.Errorf("missing user-config dir") + } + return filepath.Join(dir, "go/env"), nil +} + +func initEnvCache() { + envCache.m = make(map[string]string) + file, _ := EnvFile() + if file == "" { + return + } + data, err := ioutil.ReadFile(file) + if err != nil { + return + } + + for len(data) > 0 { + // Get next line. + line := data + i := bytes.IndexByte(data, '\n') + if i >= 0 { + line, data = line[:i], data[i+1:] + } else { + data = nil + } + + i = bytes.IndexByte(line, '=') + if i < 0 || line[0] < 'A' || 'Z' < line[0] { + // Line is missing = (or empty) or a comment or not a valid env name. Ignore. + // (This should not happen, since the file should be maintained almost + // exclusively by "go env -w", but better to silently ignore than to make + // the go command unusable just because somehow the env file has + // gotten corrupted.) + continue + } + key, val := line[:i], line[i+1:] + envCache.m[string(key)] = string(val) + } +} + +// Getenv gets the value for the configuration key. +// It consults the operating system environment +// and then the go/env file. +// If Getenv is called for a key that cannot be set +// in the go/env file (for example GODEBUG), it panics. +// This ensures that CanGetenv is accurate, so that +// 'go env -w' stays in sync with what Getenv can retrieve. +func Getenv(key string) string { + if !CanGetenv(key) { + switch key { + case "CGO_TEST_ALLOW", "CGO_TEST_DISALLOW", "CGO_test_ALLOW", "CGO_test_DISALLOW": + // used by internal/work/security_test.go; allow + default: + panic("internal error: invalid Getenv " + key) + } + } + val := os.Getenv(key) + if val != "" { + return val } + envCache.once.Do(initEnvCache) + return envCache.m[key] } +// CanGetenv reports whether key is a valid go/env configuration key. +func CanGetenv(key string) bool { + return strings.Contains(knownEnv, "\t"+key+"\n") +} + +var knownEnv = ` + AR + CC + CGO_CFLAGS + CGO_CFLAGS_ALLOW + CGO_CFLAGS_DISALLOW + CGO_CPPFLAGS + CGO_CPPFLAGS_ALLOW + CGO_CPPFLAGS_DISALLOW + CGO_CXXFLAGS + CGO_CXXFLAGS_ALLOW + CGO_CXXFLAGS_DISALLOW + CGO_ENABLED + CGO_FFLAGS + CGO_FFLAGS_ALLOW + CGO_FFLAGS_DISALLOW + CGO_LDFLAGS + CGO_LDFLAGS_ALLOW + CGO_LDFLAGS_DISALLOW + CXX + FC + GCCGO + GO111MODULE + GO386 + GOARCH + GOARM + GOBIN + GOCACHE + GOENV + GOEXE + GOFLAGS + GOGCCFLAGS + GOHOSTARCH + GOHOSTOS + GOMIPS + GOMIPS64 + GONOPROXY + GONOSUMDB + GOOS + GOPATH + GOPPC64 + GOPRIVATE + GOPROXY + GOROOT + GOSUMDB + GOTMPDIR + GOTOOLDIR + GOWASM + GO_EXTLINK_ENABLED + PKG_CONFIG +` + var ( - GOROOT = findGOROOT() - GOBIN = os.Getenv("GOBIN") + GOROOT = BuildContext.GOROOT + GOBIN = Getenv("GOBIN") GOROOTbin = filepath.Join(GOROOT, "bin") GOROOTpkg = filepath.Join(GOROOT, "pkg") GOROOTsrc = filepath.Join(GOROOT, "src") GOROOT_FINAL = findGOROOT_FINAL() // Used in envcmd.MkEnv and build ID computations. - GOARM = fmt.Sprint(objabi.GOARM) - GO386 = objabi.GO386 - GOMIPS = objabi.GOMIPS - GOMIPS64 = objabi.GOMIPS64 + GOARM = envOr("GOARM", fmt.Sprint(objabi.GOARM)) + GO386 = envOr("GO386", objabi.GO386) + GOMIPS = envOr("GOMIPS", objabi.GOMIPS) + GOMIPS64 = envOr("GOMIPS64", objabi.GOMIPS64) + GOPPC64 = envOr("GOPPC64", fmt.Sprintf("%s%d", "power", objabi.GOPPC64)) + GOWASM = envOr("GOWASM", fmt.Sprint(objabi.GOWASM)) + + GOPROXY = envOr("GOPROXY", "https://proxy.golang.org,direct") + GOSUMDB = envOr("GOSUMDB", "sum.golang.org") + GOPRIVATE = Getenv("GOPRIVATE") + GONOPROXY = envOr("GONOPROXY", GOPRIVATE) + GONOSUMDB = envOr("GONOSUMDB", GOPRIVATE) ) -// Update build context to use our computed GOROOT. -func init() { - BuildContext.GOROOT = GOROOT - if runtime.Compiler != "gccgo" { - // Note that we must use runtime.GOOS and runtime.GOARCH here, - // as the tool directory does not move based on environment - // variables. This matches the initialization of ToolDir in - // go/build, except for using GOROOT rather than - // runtime.GOROOT. - build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) +// GetArchEnv returns the name and setting of the +// GOARCH-specific architecture environment variable. +// If the current architecture has no GOARCH-specific variable, +// GetArchEnv returns empty key and value. +func GetArchEnv() (key, val string) { + switch Goarch { + case "arm": + return "GOARM", GOARM + case "386": + return "GO386", GO386 + case "mips", "mipsle": + return "GOMIPS", GOMIPS + case "mips64", "mips64le": + return "GOMIPS64", GOMIPS64 + case "ppc64", "ppc64le": + return "GOPPC64", GOPPC64 + case "wasm": + return "GOWASM", GOWASM + } + return "", "" +} + +// envOr returns Getenv(key) if set, or else def. +func envOr(key, def string) string { + val := Getenv(key) + if val == "" { + val = def } + return val } // There is a copy of findGOROOT, isSameDir, and isGOROOT in @@ -131,7 +341,7 @@ func init() { // // There is a copy of this code in x/tools/cmd/godoc/goroot.go. func findGOROOT() string { - if env := os.Getenv("GOROOT"); env != "" { + if env := Getenv("GOROOT"); env != "" { return filepath.Clean(env) } def := filepath.Clean(runtime.GOROOT()) @@ -167,6 +377,8 @@ func findGOROOT() string { } func findGOROOT_FINAL() string { + // $GOROOT_FINAL is only for use during make.bash + // so it is not settable using go/env, so we use os.Getenv here. def := GOROOT if env := os.Getenv("GOROOT_FINAL"); env != "" { def = filepath.Clean(env) diff --git a/libgo/go/cmd/go/internal/clean/clean.go b/libgo/go/cmd/go/internal/clean/clean.go index 27121ed2ae6..f7d80ff6dc8 100644 --- a/libgo/go/cmd/go/internal/clean/clean.go +++ b/libgo/go/cmd/go/internal/clean/clean.go @@ -33,7 +33,8 @@ The go command builds most objects in a temporary directory, so go clean is mainly concerned with object files left by other tools or by manual invocations of go build. -Specifically, clean removes the following files from each of the +If a package argument is given or the -i or -r flag is set, +clean removes the following files from each of the source directories corresponding to the import paths: _obj/ old object directory, left from Makefiles @@ -105,7 +106,16 @@ func init() { } func runClean(cmd *base.Command, args []string) { - if len(args) > 0 || !modload.Enabled() || modload.HasModRoot() { + // golang.org/issue/29925: only load packages before cleaning if + // either the flags and arguments explicitly imply a package, + // or no other target (such as a cache) was requested to be cleaned. + cleanPkg := len(args) > 0 || cleanI || cleanR + if (!modload.Enabled() || modload.HasModRoot()) && + !cleanCache && !cleanModcache && !cleanTestcache { + cleanPkg = true + } + + if cleanPkg { for _, pkg := range load.PackagesAndErrors(args) { clean(pkg) } @@ -122,11 +132,11 @@ func runClean(cmd *base.Command, args []string) { // and not something that we want to remove. Also, we'd like to preserve // the access log for future analysis, even if the cache is cleared. subdirs, _ := filepath.Glob(filepath.Join(dir, "[0-9a-f][0-9a-f]")) + printedErrors := false if len(subdirs) > 0 { if cfg.BuildN || cfg.BuildX { b.Showcmd("", "rm -r %s", strings.Join(subdirs, " ")) } - printedErrors := false for _, d := range subdirs { // Only print the first error - there may be many. // This also mimics what os.RemoveAll(dir) would do. @@ -136,6 +146,12 @@ func runClean(cmd *base.Command, args []string) { } } } + + logFile := filepath.Join(dir, "log.txt") + if err := os.RemoveAll(logFile); err != nil && !printedErrors { + printedErrors = true + base.Errorf("go clean -cache: %v", err) + } } } diff --git a/libgo/go/cmd/go/internal/envcmd/env.go b/libgo/go/cmd/go/internal/envcmd/env.go index ae98d3999a1..17852deed1e 100644 --- a/libgo/go/cmd/go/internal/envcmd/env.go +++ b/libgo/go/cmd/go/internal/envcmd/env.go @@ -8,10 +8,13 @@ package envcmd import ( "encoding/json" "fmt" + "io/ioutil" "os" "path/filepath" "runtime" + "sort" "strings" + "unicode/utf8" "cmd/go/internal/base" "cmd/go/internal/cache" @@ -22,7 +25,7 @@ import ( ) var CmdEnv = &base.Command{ - UsageLine: "go env [-json] [var ...]", + UsageLine: "go env [-json] [-u] [-w] [var ...]", Short: "print Go environment information", Long: ` Env prints Go environment information. @@ -35,6 +38,14 @@ each named variable on its own line. The -json flag prints the environment in JSON format instead of as a shell script. +The -u flag requires one or more arguments and unsets +the default setting for the named environment variables, +if one has been set with 'go env -w'. + +The -w flag requires one or more arguments of the +form NAME=VALUE and changes the default settings +of the named environment variables to the given values. + For more about environment variables, see 'go help environment'. `, } @@ -43,26 +54,36 @@ func init() { CmdEnv.Run = runEnv // break init cycle } -var envJson = CmdEnv.Flag.Bool("json", false, "") +var ( + envJson = CmdEnv.Flag.Bool("json", false, "") + envU = CmdEnv.Flag.Bool("u", false, "") + envW = CmdEnv.Flag.Bool("w", false, "") +) func MkEnv() []cfg.EnvVar { var b work.Builder b.Init() + envFile, _ := cfg.EnvFile() env := []cfg.EnvVar{ + {Name: "GO111MODULE", Value: cfg.Getenv("GO111MODULE")}, {Name: "GOARCH", Value: cfg.Goarch}, {Name: "GOBIN", Value: cfg.GOBIN}, {Name: "GOCACHE", Value: cache.DefaultDir()}, + {Name: "GOENV", Value: envFile}, {Name: "GOEXE", Value: cfg.ExeSuffix}, - {Name: "GOFLAGS", Value: os.Getenv("GOFLAGS")}, + {Name: "GOFLAGS", Value: cfg.Getenv("GOFLAGS")}, {Name: "GOHOSTARCH", Value: runtime.GOARCH}, {Name: "GOHOSTOS", Value: runtime.GOOS}, + {Name: "GONOPROXY", Value: cfg.GONOPROXY}, + {Name: "GONOSUMDB", Value: cfg.GONOSUMDB}, {Name: "GOOS", Value: cfg.Goos}, {Name: "GOPATH", Value: cfg.BuildContext.GOPATH}, - {Name: "GOPROXY", Value: os.Getenv("GOPROXY")}, - {Name: "GORACE", Value: os.Getenv("GORACE")}, + {Name: "GOPRIVATE", Value: cfg.GOPRIVATE}, + {Name: "GOPROXY", Value: cfg.GOPROXY}, {Name: "GOROOT", Value: cfg.GOROOT}, - {Name: "GOTMPDIR", Value: os.Getenv("GOTMPDIR")}, + {Name: "GOSUMDB", Value: cfg.GOSUMDB}, + {Name: "GOTMPDIR", Value: cfg.Getenv("GOTMPDIR")}, {Name: "GOTOOLDIR", Value: base.ToolDir}, } @@ -72,25 +93,20 @@ func MkEnv() []cfg.EnvVar { env = append(env, cfg.EnvVar{Name: "GCCGO", Value: work.GccgoName}) } - switch cfg.Goarch { - case "arm": - env = append(env, cfg.EnvVar{Name: "GOARM", Value: cfg.GOARM}) - case "386": - env = append(env, cfg.EnvVar{Name: "GO386", Value: cfg.GO386}) - case "mips", "mipsle": - env = append(env, cfg.EnvVar{Name: "GOMIPS", Value: cfg.GOMIPS}) - case "mips64", "mips64le": - env = append(env, cfg.EnvVar{Name: "GOMIPS64", Value: cfg.GOMIPS64}) + key, val := cfg.GetArchEnv() + if key != "" { + env = append(env, cfg.EnvVar{Name: key, Value: val}) } cc := cfg.DefaultCC(cfg.Goos, cfg.Goarch) - if env := strings.Fields(os.Getenv("CC")); len(env) > 0 { + if env := strings.Fields(cfg.Getenv("CC")); len(env) > 0 { cc = env[0] } cxx := cfg.DefaultCXX(cfg.Goos, cfg.Goarch) - if env := strings.Fields(os.Getenv("CXX")); len(env) > 0 { + if env := strings.Fields(cfg.Getenv("CXX")); len(env) > 0 { cxx = env[0] } + env = append(env, cfg.EnvVar{Name: "AR", Value: envOr("AR", "ar")}) env = append(env, cfg.EnvVar{Name: "CC", Value: cc}) env = append(env, cfg.EnvVar{Name: "CXX", Value: cxx}) @@ -103,6 +119,14 @@ func MkEnv() []cfg.EnvVar { return env } +func envOr(name, def string) string { + val := cfg.Getenv(name) + if val != "" { + return val + } + return def +} + func findEnv(env []cfg.EnvVar, name string) string { for _, e := range env { if e.Name == name { @@ -150,7 +174,25 @@ func ExtraEnvVarsCostly() []cfg.EnvVar { } } +// argKey returns the KEY part of the arg KEY=VAL, or else arg itself. +func argKey(arg string) string { + i := strings.Index(arg, "=") + if i < 0 { + return arg + } + return arg[:i] +} + func runEnv(cmd *base.Command, args []string) { + if *envJson && *envU { + base.Fatalf("go env: cannot use -json with -u") + } + if *envJson && *envW { + base.Fatalf("go env: cannot use -json with -w") + } + if *envU && *envW { + base.Fatalf("go env: cannot use -u with -w") + } env := cfg.CmdEnv env = append(env, ExtraEnvVars()...) @@ -161,7 +203,7 @@ func runEnv(cmd *base.Command, args []string) { if len(args) > 0 { needCostly = false for _, arg := range args { - switch arg { + switch argKey(arg) { case "CGO_CFLAGS", "CGO_CPPFLAGS", "CGO_CXXFLAGS", @@ -177,6 +219,55 @@ func runEnv(cmd *base.Command, args []string) { env = append(env, ExtraEnvVarsCostly()...) } + if *envW { + // Process and sanity-check command line. + if len(args) == 0 { + base.Fatalf("go env -w: no KEY=VALUE arguments given") + } + osEnv := make(map[string]string) + for _, e := range cfg.OrigEnv { + if i := strings.Index(e, "="); i >= 0 { + osEnv[e[:i]] = e[i+1:] + } + } + add := make(map[string]string) + for _, arg := range args { + i := strings.Index(arg, "=") + if i < 0 { + base.Fatalf("go env -w: arguments must be KEY=VALUE: invalid argument: %s", arg) + } + key, val := arg[:i], arg[i+1:] + if err := checkEnvWrite(key, val, env); err != nil { + base.Fatalf("go env -w: %v", err) + } + if _, ok := add[key]; ok { + base.Fatalf("go env -w: multiple values for key: %s", key) + } + add[key] = val + if osVal := osEnv[key]; osVal != "" && osVal != val { + fmt.Fprintf(os.Stderr, "warning: go env -w %s=... does not override conflicting OS environment variable\n", key) + } + } + updateEnvFile(add, nil) + return + } + + if *envU { + // Process and sanity-check command line. + if len(args) == 0 { + base.Fatalf("go env -u: no arguments given") + } + del := make(map[string]bool) + for _, arg := range args { + if err := checkEnvWrite(arg, "", env); err != nil { + base.Fatalf("go env -u: %v", err) + } + del[arg] = true + } + updateEnvFile(nil, del) + return + } + if len(args) > 0 { if *envJson { var es []cfg.EnvVar @@ -235,6 +326,118 @@ func printEnvAsJSON(env []cfg.EnvVar) { enc := json.NewEncoder(os.Stdout) enc.SetIndent("", "\t") if err := enc.Encode(m); err != nil { - base.Fatalf("%s", err) + base.Fatalf("go env -json: %s", err) + } +} + +func checkEnvWrite(key, val string, env []cfg.EnvVar) error { + switch key { + case "GOEXE", "GOGCCFLAGS", "GOHOSTARCH", "GOHOSTOS", "GOMOD", "GOTOOLDIR": + return fmt.Errorf("%s cannot be modified", key) + case "GOENV": + return fmt.Errorf("%s can only be set using the OS environment", key) + } + + // To catch typos and the like, check that we know the variable. + if !cfg.CanGetenv(key) { + return fmt.Errorf("unknown go command variable %s", key) + } + + if !utf8.ValidString(val) { + return fmt.Errorf("invalid UTF-8 in %s=... value", key) + } + if strings.Contains(val, "\x00") { + return fmt.Errorf("invalid NUL in %s=... value", key) + } + if strings.ContainsAny(val, "\v\r\n") { + return fmt.Errorf("invalid newline in %s=... value", key) + } + return nil +} + +func updateEnvFile(add map[string]string, del map[string]bool) { + file, err := cfg.EnvFile() + if file == "" { + base.Fatalf("go env: cannot find go env config: %v", err) + } + data, err := ioutil.ReadFile(file) + if err != nil && (!os.IsNotExist(err) || len(add) == 0) { + base.Fatalf("go env: reading go env config: %v", err) } + + lines := strings.SplitAfter(string(data), "\n") + if lines[len(lines)-1] == "" { + lines = lines[:len(lines)-1] + } else { + lines[len(lines)-1] += "\n" + } + + // Delete all but last copy of any duplicated variables, + // since the last copy is the one that takes effect. + prev := make(map[string]int) + for l, line := range lines { + if key := lineToKey(line); key != "" { + if p, ok := prev[key]; ok { + lines[p] = "" + } + prev[key] = l + } + } + + // Add variables (go env -w). Update existing lines in file if present, add to end otherwise. + for key, val := range add { + if p, ok := prev[key]; ok { + lines[p] = key + "=" + val + "\n" + delete(add, key) + } + } + for key, val := range add { + lines = append(lines, key+"="+val+"\n") + } + + // Delete requested variables (go env -u). + for key := range del { + if p, ok := prev[key]; ok { + lines[p] = "" + } + } + + // Sort runs of KEY=VALUE lines + // (that is, blocks of lines where blocks are separated + // by comments, blank lines, or invalid lines). + start := 0 + for i := 0; i <= len(lines); i++ { + if i == len(lines) || lineToKey(lines[i]) == "" { + sortKeyValues(lines[start:i]) + start = i + 1 + } + } + + data = []byte(strings.Join(lines, "")) + err = ioutil.WriteFile(file, data, 0666) + if err != nil { + // Try creating directory. + os.MkdirAll(filepath.Dir(file), 0777) + err = ioutil.WriteFile(file, data, 0666) + if err != nil { + base.Fatalf("go env: writing go env config: %v", err) + } + } +} + +// lineToKey returns the KEY part of the line KEY=VALUE or else an empty string. +func lineToKey(line string) string { + i := strings.Index(line, "=") + if i < 0 || strings.Contains(line[:i], "#") { + return "" + } + return line[:i] +} + +// sortKeyValues sorts a sequence of lines by key. +// It differs from sort.Strings in that GO386= sorts after GO=. +func sortKeyValues(lines []string) { + sort.Slice(lines, func(i, j int) bool { + return lineToKey(lines[i]) < lineToKey(lines[j]) + }) } diff --git a/libgo/go/cmd/go/internal/generate/generate.go b/libgo/go/cmd/go/internal/generate/generate.go index 124dbc05f5d..f2ae80e5dc6 100644 --- a/libgo/go/cmd/go/internal/generate/generate.go +++ b/libgo/go/cmd/go/internal/generate/generate.go @@ -110,11 +110,13 @@ specifies that the command "foo" represents the generator "go tool foo". Generate processes packages in the order given on the command line, -one at a time. If the command line lists .go files, they are treated -as a single package. Within a package, generate processes the +one at a time. If the command line lists .go files from a single directory, +they are treated as a single package. Within a package, generate processes the source files in a package in file name order, one at a time. Within a source file, generate runs generators in the order they appear -in the file, one at a time. +in the file, one at a time. The go generate tool also sets the build +tag "generate" so that files may be examined by go generate but ignored +during build. If any generator returns an error exit status, "go generate" skips all further processing for that package. @@ -161,6 +163,9 @@ func runGenerate(cmd *base.Command, args []string) { log.Fatalf("generate: %s", err) } } + + cfg.BuildContext.BuildTags = append(cfg.BuildContext.BuildTags, "generate") + // Even if the arguments are .go files, this loop suffices. printed := false for _, pkg := range load.Packages(args) { @@ -374,7 +379,12 @@ Words: // Substitute command if required. if len(words) > 0 && g.commands[words[0]] != nil { // Replace 0th word by command substitution. - words = append(g.commands[words[0]], words[1:]...) + // + // Force a copy of the command definition to + // ensure words doesn't end up as a reference + // to the g.commands content. + tmpCmdWords := append([]string(nil), (g.commands[words[0]])...) + words = append(tmpCmdWords, words[1:]...) } // Substitute environment variables. for i, word := range words { @@ -428,7 +438,7 @@ func (g *Generator) exec(words []string) { cmd.Stderr = os.Stderr // Run the command in the package directory. cmd.Dir = g.dir - cmd.Env = base.MergeEnvLists(g.env, cfg.OrigEnv) + cmd.Env = append(cfg.OrigEnv, g.env...) err := cmd.Run() if err != nil { g.errorf("running %q: %s", words[0], err) diff --git a/libgo/go/cmd/go/internal/generate/generate_test.go b/libgo/go/cmd/go/internal/generate/generate_test.go index defc15387f3..b546218a3c5 100644 --- a/libgo/go/cmd/go/internal/generate/generate_test.go +++ b/libgo/go/cmd/go/internal/generate/generate_test.go @@ -5,6 +5,7 @@ package generate import ( + "os" "reflect" "runtime" "testing" @@ -15,6 +16,15 @@ type splitTest struct { out []string } +// Same as above, except including source line number to set +type splitTestWithLine struct { + in string + out []string + lineNumber int +} + +const anyLineNo = 0 + var splitTests = []splitTest{ {"", nil}, {"x", []string{"x"}}, @@ -54,3 +64,191 @@ func TestGenerateCommandParse(t *testing.T) { } } } + +// These environment variables will be undefined before the splitTestWithLine tests +var undefEnvList = []string{ + "_XYZZY_", +} + +// These environment variables will be defined before the splitTestWithLine tests +var defEnvMap = map[string]string{ + "_PLUGH_": "SomeVal", + "_X": "Y", +} + +// TestGenerateCommandShortHand - similar to TestGenerateCommandParse, +// except: +// 1. if the result starts with -command, record that shorthand +// before moving on to the next test. +// 2. If a source line number is specified, set that in the parser +// before executing the test. i.e., execute the split as if it +// processing that source line. +func TestGenerateCommandShorthand(t *testing.T) { + g := &Generator{ + r: nil, // Unused here. + path: "/usr/ken/sys/proc.go", + dir: "/usr/ken/sys", + file: "proc.go", + pkg: "sys", + commands: make(map[string][]string), + } + + var inLine string + var expected, got []string + + g.setEnv() + + // Set up the system environment variables + for i := range undefEnvList { + os.Unsetenv(undefEnvList[i]) + } + for k := range defEnvMap { + os.Setenv(k, defEnvMap[k]) + } + + // simple command from environment variable + inLine = "//go:generate -command CMD0 \"ab${_X}cd\"" + expected = []string{"-command", "CMD0", "abYcd"} + got = g.split(inLine + "\n") + + if !reflect.DeepEqual(got, expected) { + t.Errorf("split(%q): got %q expected %q", inLine, got, expected) + } + + // try again, with an extra level of indirection (should leave variable in command) + inLine = "//go:generate -command CMD0 \"ab${DOLLAR}{_X}cd\"" + expected = []string{"-command", "CMD0", "ab${_X}cd"} + got = g.split(inLine + "\n") + + if !reflect.DeepEqual(got, expected) { + t.Errorf("split(%q): got %q expected %q", inLine, got, expected) + } + + // Now the interesting part, record that output as a command + g.setShorthand(got) + + // see that the command still substitutes correctly from env. variable + inLine = "//go:generate CMD0" + expected = []string{"abYcd"} + got = g.split(inLine + "\n") + + if !reflect.DeepEqual(got, expected) { + t.Errorf("split(%q): got %q expected %q", inLine, got, expected) + } + + // Now change the value of $X and see if the recorded definition is + // still intact (vs. having the $_X already substituted out) + + os.Setenv("_X", "Z") + inLine = "//go:generate CMD0" + expected = []string{"abZcd"} + got = g.split(inLine + "\n") + + if !reflect.DeepEqual(got, expected) { + t.Errorf("split(%q): got %q expected %q", inLine, got, expected) + } + + // What if the variable is now undefined? Should be empty substitution. + + os.Unsetenv("_X") + inLine = "//go:generate CMD0" + expected = []string{"abcd"} + got = g.split(inLine + "\n") + + if !reflect.DeepEqual(got, expected) { + t.Errorf("split(%q): got %q expected %q", inLine, got, expected) + } + + // Try another undefined variable as an extra check + os.Unsetenv("_Z") + inLine = "//go:generate -command CMD1 \"ab${_Z}cd\"" + expected = []string{"-command", "CMD1", "abcd"} + got = g.split(inLine + "\n") + + if !reflect.DeepEqual(got, expected) { + t.Errorf("split(%q): got %q expected %q", inLine, got, expected) + } + + g.setShorthand(got) + + inLine = "//go:generate CMD1" + expected = []string{"abcd"} + got = g.split(inLine + "\n") + + if !reflect.DeepEqual(got, expected) { + t.Errorf("split(%q): got %q expected %q", inLine, got, expected) + } + + const val = "someNewValue" + os.Setenv("_Z", val) + + // try again with the properly-escaped variable. + + inLine = "//go:generate -command CMD2 \"ab${DOLLAR}{_Z}cd\"" + expected = []string{"-command", "CMD2", "ab${_Z}cd"} + got = g.split(inLine + "\n") + + if !reflect.DeepEqual(got, expected) { + t.Errorf("split(%q): got %q expected %q", inLine, got, expected) + } + + g.setShorthand(got) + + inLine = "//go:generate CMD2" + expected = []string{"ab" + val + "cd"} + got = g.split(inLine + "\n") + + if !reflect.DeepEqual(got, expected) { + t.Errorf("split(%q): got %q expected %q", inLine, got, expected) + } +} + +// Command-related tests for TestGenerateCommandShortHand2 +// -- Note line numbers included to check substitutions from "build-in" variable - $GOLINE +var splitTestsLines = []splitTestWithLine{ + {"-command TEST1 $GOLINE", []string{"-command", "TEST1", "22"}, 22}, + {"-command TEST2 ${DOLLAR}GOLINE", []string{"-command", "TEST2", "$GOLINE"}, 26}, + {"TEST1", []string{"22"}, 33}, + {"TEST2", []string{"66"}, 66}, + {"TEST1 ''", []string{"22", "''"}, 99}, + {"TEST2 ''", []string{"44", "''"}, 44}, +} + +// TestGenerateCommandShortHand - similar to TestGenerateCommandParse, +// except: +// 1. if the result starts with -command, record that shorthand +// before moving on to the next test. +// 2. If a source line number is specified, set that in the parser +// before executing the test. i.e., execute the split as if it +// processing that source line. +func TestGenerateCommandShortHand2(t *testing.T) { + g := &Generator{ + r: nil, // Unused here. + path: "/usr/ken/sys/proc.go", + dir: "/usr/ken/sys", + file: "proc.go", + pkg: "sys", + commands: make(map[string][]string), + } + g.setEnv() + for _, test := range splitTestsLines { + // if the test specified a line number, reflect that + if test.lineNumber != anyLineNo { + g.lineNum = test.lineNumber + g.setEnv() + } + // First with newlines. + got := g.split("//go:generate " + test.in + "\n") + if !reflect.DeepEqual(got, test.out) { + t.Errorf("split(%q): got %q expected %q", test.in, got, test.out) + } + // Then with CRLFs, thank you Windows. + got = g.split("//go:generate " + test.in + "\r\n") + if !reflect.DeepEqual(got, test.out) { + t.Errorf("split(%q): got %q expected %q", test.in, got, test.out) + } + if got[0] == "-command" { // record commands + g.setShorthand(got) + } + } +} diff --git a/libgo/go/cmd/go/internal/get/get.go b/libgo/go/cmd/go/internal/get/get.go index a314c57160b..e4945fe1440 100644 --- a/libgo/go/cmd/go/internal/get/get.go +++ b/libgo/go/cmd/go/internal/get/get.go @@ -118,11 +118,6 @@ func runGet(cmd *base.Command, args []string) { // Should not happen: main.go should install the separate module-enabled get code. base.Fatalf("go get: modules not implemented") } - if cfg.GoModInGOPATH != "" { - // Warn about not using modules with GO111MODULE=auto when go.mod exists. - // To silence the warning, users can set GO111MODULE=off. - fmt.Fprintf(os.Stderr, "go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;\n\tignoring %s;\n\tsee 'go help modules'\n", base.ShortPath(cfg.GoModInGOPATH)) - } work.BuildInit() @@ -177,12 +172,6 @@ func runGet(cmd *base.Command, args []string) { // everything. load.ClearPackageCache() - // In order to rebuild packages information completely, - // we need to clear commands cache. Command packages are - // referring to evicted packages from the package cache. - // This leads to duplicated loads of the standard packages. - load.ClearCmdCache() - pkgs := load.PackagesForBuild(args) // Phase 3. Install. @@ -240,7 +229,8 @@ func download(arg string, parent *load.Package, stk *load.ImportStack, mode int) } load1 := func(path string, mode int) *load.Package { if parent == nil { - return load.LoadPackageNoFlags(path, stk) + mode := 0 // don't do module or vendor resolution + return load.LoadImport(path, base.Cwd, nil, stk, nil, mode) } return load.LoadImport(path, parent.Dir, parent, stk, nil, mode|load.ResolveModule) } @@ -397,7 +387,7 @@ func downloadPackage(p *load.Package) error { blindRepo bool // set if the repo has unusual configuration ) - security := web.Secure + security := web.SecureOnly if Insecure { security = web.Insecure } diff --git a/libgo/go/cmd/go/internal/get/path.go b/libgo/go/cmd/go/internal/get/path.go index d443bd28a96..67d7b8a47c2 100644 --- a/libgo/go/cmd/go/internal/get/path.go +++ b/libgo/go/cmd/go/internal/get/path.go @@ -41,6 +41,9 @@ func checkPath(path string, fileName bool) error { if path == "" { return fmt.Errorf("empty string") } + if path[0] == '-' { + return fmt.Errorf("leading dash") + } if strings.Contains(path, "..") { return fmt.Errorf("double dot") } diff --git a/libgo/go/cmd/go/internal/get/vcs.go b/libgo/go/cmd/go/internal/get/vcs.go index a7a2ba32cc3..fca78b515fd 100644 --- a/libgo/go/cmd/go/internal/get/vcs.go +++ b/libgo/go/cmd/go/internal/get/vcs.go @@ -8,9 +8,10 @@ import ( "encoding/json" "errors" "fmt" + "internal/lazyregexp" "internal/singleflight" "log" - "net/url" + urlpkg "net/url" "os" "os/exec" "path/filepath" @@ -53,7 +54,7 @@ var defaultSecureScheme = map[string]bool{ } func (v *vcsCmd) isSecure(repo string) bool { - u, err := url.Parse(repo) + u, err := urlpkg.Parse(repo) if err != nil { // If repo is not a URL, it's not secure. return false @@ -111,7 +112,7 @@ var vcsHg = &vcsCmd{ name: "Mercurial", cmd: "hg", - createCmd: []string{"clone -U {repo} {dir}"}, + createCmd: []string{"clone -U -- {repo} {dir}"}, downloadCmd: []string{"pull"}, // We allow both tag and branch names as 'tags' @@ -127,7 +128,7 @@ var vcsHg = &vcsCmd{ tagSyncDefault: []string{"update default"}, scheme: []string{"https", "http", "ssh"}, - pingCmd: "identify {scheme}://{repo}", + pingCmd: "identify -- {scheme}://{repo}", remoteRepo: hgRemoteRepo, } @@ -144,7 +145,7 @@ var vcsGit = &vcsCmd{ name: "Git", cmd: "git", - createCmd: []string{"clone {repo} {dir}", "-go-internal-cd {dir} submodule update --init --recursive"}, + createCmd: []string{"clone -- {repo} {dir}", "-go-internal-cd {dir} submodule update --init --recursive"}, downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"}, tagCmd: []tagCmd{ @@ -164,13 +165,13 @@ var vcsGit = &vcsCmd{ tagSyncDefault: []string{"submodule update --init --recursive"}, scheme: []string{"git", "https", "http", "git+ssh", "ssh"}, - pingCmd: "ls-remote {scheme}://{repo}", + pingCmd: "ls-remote -- {scheme}://{repo}", remoteRepo: gitRemoteRepo, } // scpSyntaxRe matches the SCP-like addresses used by Git to access // repositories by SSH. -var scpSyntaxRe = regexp.MustCompile(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`) +var scpSyntaxRe = lazyregexp.New(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`) func gitRemoteRepo(vcsGit *vcsCmd, rootDir string) (remoteRepo string, err error) { cmd := "config remote.origin.url" @@ -187,19 +188,19 @@ func gitRemoteRepo(vcsGit *vcsCmd, rootDir string) (remoteRepo string, err error } out := strings.TrimSpace(string(outb)) - var repoURL *url.URL + var repoURL *urlpkg.URL if m := scpSyntaxRe.FindStringSubmatch(out); m != nil { // Match SCP-like syntax and convert it to a URL. // Eg, "git@github.com:user/repo" becomes // "ssh://git@github.com/user/repo". - repoURL = &url.URL{ + repoURL = &urlpkg.URL{ Scheme: "ssh", - User: url.User(m[1]), + User: urlpkg.User(m[1]), Host: m[2], Path: m[3], } } else { - repoURL, err = url.Parse(out) + repoURL, err = urlpkg.Parse(out) if err != nil { return "", err } @@ -221,7 +222,7 @@ var vcsBzr = &vcsCmd{ name: "Bazaar", cmd: "bzr", - createCmd: []string{"branch {repo} {dir}"}, + createCmd: []string{"branch -- {repo} {dir}"}, // Without --overwrite bzr will not pull tags that changed. // Replace by --overwrite-tags after http://pad.lv/681792 goes in. @@ -232,7 +233,7 @@ var vcsBzr = &vcsCmd{ tagSyncDefault: []string{"update -r revno:-1"}, scheme: []string{"https", "http", "bzr", "bzr+ssh"}, - pingCmd: "info {scheme}://{repo}", + pingCmd: "info -- {scheme}://{repo}", remoteRepo: bzrRemoteRepo, resolveRepo: bzrResolveRepo, } @@ -283,14 +284,14 @@ var vcsSvn = &vcsCmd{ name: "Subversion", cmd: "svn", - createCmd: []string{"checkout {repo} {dir}"}, + createCmd: []string{"checkout -- {repo} {dir}"}, downloadCmd: []string{"update"}, // There is no tag command in subversion. // The branch information is all in the path names. scheme: []string{"https", "http", "svn", "svn+ssh"}, - pingCmd: "info {scheme}://{repo}", + pingCmd: "info -- {scheme}://{repo}", remoteRepo: svnRemoteRepo, } @@ -333,7 +334,7 @@ var vcsFossil = &vcsCmd{ name: "Fossil", cmd: "fossil", - createCmd: []string{"-go-internal-mkdir {dir} clone {repo} " + filepath.Join("{dir}", fossilRepoName), "-go-internal-cd {dir} open .fossil"}, + createCmd: []string{"-go-internal-mkdir {dir} clone -- {repo} " + filepath.Join("{dir}", fossilRepoName), "-go-internal-cd {dir} open .fossil"}, downloadCmd: []string{"up"}, tagCmd: []tagCmd{{"tag ls", `(.*)`}}, @@ -424,8 +425,8 @@ func (v *vcsCmd) run1(dir string, cmdline string, keyval []string, verbose bool) cmd.Dir = dir cmd.Env = base.EnvForDir(cmd.Dir, os.Environ()) if cfg.BuildX { - fmt.Printf("cd %s\n", dir) - fmt.Printf("%s %s\n", v.cmd, strings.Join(args, " ")) + fmt.Fprintf(os.Stderr, "cd %s\n", dir) + fmt.Fprintf(os.Stderr, "%s %s\n", v.cmd, strings.Join(args, " ")) } out, err := cmd.Output() if err != nil { @@ -525,13 +526,11 @@ func (v *vcsCmd) tagSync(dir, tag string) error { // version control system and repository name. type vcsPath struct { prefix string // prefix this description applies to - re string // pattern for import path + regexp *lazyregexp.Regexp // compiled pattern for import path repo string // repository to use (expand with match of re) vcs string // version control system to use (expand with match of re) check func(match map[string]string) error // additional checks ping bool // ping for scheme to use to download repo - - regexp *regexp.Regexp // cached compiled form of re } // vcsFromDir inspects dir and its parents to determine the @@ -632,7 +631,14 @@ type RepoRoot struct { vcs *vcsCmd // internal: vcs command access } -var httpPrefixRE = regexp.MustCompile(`^https?:`) +func httpPrefix(s string) string { + for _, prefix := range [...]string{"http:", "https:"} { + if strings.HasPrefix(s, prefix) { + return prefix + } + } + return "" +} // ModuleMode specifies whether to prefer modules when looking up code sources. type ModuleMode int @@ -677,10 +683,10 @@ var errUnknownSite = errors.New("dynamic lookup required to find mapping") func repoRootFromVCSPaths(importPath, scheme string, security web.SecurityMode, vcsPaths []*vcsPath) (*RepoRoot, error) { // A common error is to use https://packagepath because that's what // hg and git require. Diagnose this helpfully. - if loc := httpPrefixRE.FindStringIndex(importPath); loc != nil { + if prefix := httpPrefix(importPath); prefix != "" { // The importPath has been cleaned, so has only one slash. The pattern // ignores the slashes; the error message puts them back on the RHS at least. - return nil, fmt.Errorf("%q not allowed in import path", importPath[loc[0]:loc[1]]+"//") + return nil, fmt.Errorf("%q not allowed in import path", prefix+"//") } for _, srv := range vcsPaths { if !strings.HasPrefix(importPath, srv.prefix) { @@ -724,7 +730,7 @@ func repoRootFromVCSPaths(importPath, scheme string, security web.SecurityMode, match["repo"] = scheme + "://" + match["repo"] } else { for _, scheme := range vcs.scheme { - if security == web.Secure && !vcs.isSecureScheme(scheme) { + if security == web.SecureOnly && !vcs.isSecureScheme(scheme) { continue } if vcs.pingCmd != "" && vcs.ping(scheme, match["repo"]) == nil { @@ -748,20 +754,35 @@ func repoRootFromVCSPaths(importPath, scheme string, security web.SecurityMode, return nil, errUnknownSite } -// repoRootForImportDynamic finds a *RepoRoot for a custom domain that's not -// statically known by repoRootForImportPathStatic. +// urlForImportPath returns a partially-populated URL for the given Go import path. // -// This handles custom import paths like "name.tld/pkg/foo" or just "name.tld". -func repoRootForImportDynamic(importPath string, mod ModuleMode, security web.SecurityMode) (*RepoRoot, error) { +// The URL leaves the Scheme field blank so that web.Get will try any scheme +// allowed by the selected security mode. +func urlForImportPath(importPath string) (*urlpkg.URL, error) { slash := strings.Index(importPath, "/") if slash < 0 { slash = len(importPath) } - host := importPath[:slash] + host, path := importPath[:slash], importPath[slash:] if !strings.Contains(host, ".") { return nil, errors.New("import path does not begin with hostname") } - urlStr, body, err := web.GetMaybeInsecure(importPath, security) + if len(path) == 0 { + path = "/" + } + return &urlpkg.URL{Host: host, Path: path, RawQuery: "go-get=1"}, nil +} + +// repoRootForImportDynamic finds a *RepoRoot for a custom domain that's not +// statically known by repoRootForImportPathStatic. +// +// This handles custom import paths like "name.tld/pkg/foo" or just "name.tld". +func repoRootForImportDynamic(importPath string, mod ModuleMode, security web.SecurityMode) (*RepoRoot, error) { + url, err := urlForImportPath(importPath) + if err != nil { + return nil, err + } + resp, err := web.Get(security, url) if err != nil { msg := "https fetch: %v" if security == web.Insecure { @@ -769,6 +790,7 @@ func repoRootForImportDynamic(importPath string, mod ModuleMode, security web.Se } return nil, fmt.Errorf(msg, err) } + body := resp.Body defer body.Close() imports, err := parseMetaGoImports(body, mod) if err != nil { @@ -778,12 +800,12 @@ func repoRootForImportDynamic(importPath string, mod ModuleMode, security web.Se mmi, err := matchGoImport(imports, importPath) if err != nil { if _, ok := err.(ImportMismatchError); !ok { - return nil, fmt.Errorf("parse %s: %v", urlStr, err) + return nil, fmt.Errorf("parse %s: %v", url, err) } - return nil, fmt.Errorf("parse %s: no go-import meta tags (%s)", urlStr, err) + return nil, fmt.Errorf("parse %s: no go-import meta tags (%s)", resp.URL, err) } if cfg.BuildV { - log.Printf("get %q: found meta tag %#v at %s", importPath, mmi, urlStr) + log.Printf("get %q: found meta tag %#v at %s", importPath, mmi, url) } // If the import was "uni.edu/bob/project", which said the // prefix was "uni.edu" and the RepoRoot was "evilroot.com", @@ -795,24 +817,23 @@ func repoRootForImportDynamic(importPath string, mod ModuleMode, security web.Se if cfg.BuildV { log.Printf("get %q: verifying non-authoritative meta tag", importPath) } - urlStr0 := urlStr var imports []metaImport - urlStr, imports, err = metaImportsForPrefix(mmi.Prefix, mod, security) + url, imports, err = metaImportsForPrefix(mmi.Prefix, mod, security) if err != nil { return nil, err } metaImport2, err := matchGoImport(imports, importPath) if err != nil || mmi != metaImport2 { - return nil, fmt.Errorf("%s and %s disagree about go-import for %s", urlStr0, urlStr, mmi.Prefix) + return nil, fmt.Errorf("%s and %s disagree about go-import for %s", resp.URL, url, mmi.Prefix) } } if err := validateRepoRoot(mmi.RepoRoot); err != nil { - return nil, fmt.Errorf("%s: invalid repo root %q: %v", urlStr, mmi.RepoRoot, err) + return nil, fmt.Errorf("%s: invalid repo root %q: %v", resp.URL, mmi.RepoRoot, err) } vcs := vcsByCmd(mmi.VCS) if vcs == nil && mmi.VCS != "mod" { - return nil, fmt.Errorf("%s: unknown vcs %q", urlStr, mmi.VCS) + return nil, fmt.Errorf("%s: unknown vcs %q", resp.URL, mmi.VCS) } rr := &RepoRoot{ @@ -828,13 +849,16 @@ func repoRootForImportDynamic(importPath string, mod ModuleMode, security web.Se // validateRepoRoot returns an error if repoRoot does not seem to be // a valid URL with scheme. func validateRepoRoot(repoRoot string) error { - url, err := url.Parse(repoRoot) + url, err := urlpkg.Parse(repoRoot) if err != nil { return err } if url.Scheme == "" { return errors.New("no scheme") } + if url.Scheme == "file" { + return errors.New("file scheme disallowed") + } return nil } @@ -850,9 +874,9 @@ var ( // // The importPath is of the form "golang.org/x/tools". // It is an error if no imports are found. -// urlStr will still be valid if err != nil. -// The returned urlStr will be of the form "https://golang.org/x/tools?go-get=1" -func metaImportsForPrefix(importPrefix string, mod ModuleMode, security web.SecurityMode) (urlStr string, imports []metaImport, err error) { +// url will still be valid if err != nil. +// The returned url will be of the form "https://golang.org/x/tools?go-get=1" +func metaImportsForPrefix(importPrefix string, mod ModuleMode, security web.SecurityMode) (*urlpkg.URL, []metaImport, error) { setCache := func(res fetchResult) (fetchResult, error) { fetchCacheMu.Lock() defer fetchCacheMu.Unlock() @@ -868,25 +892,31 @@ func metaImportsForPrefix(importPrefix string, mod ModuleMode, security web.Secu } fetchCacheMu.Unlock() - urlStr, body, err := web.GetMaybeInsecure(importPrefix, security) + url, err := urlForImportPath(importPrefix) + if err != nil { + return setCache(fetchResult{err: err}) + } + resp, err := web.Get(security, url) if err != nil { - return setCache(fetchResult{urlStr: urlStr, err: fmt.Errorf("fetch %s: %v", urlStr, err)}) + return setCache(fetchResult{url: url, err: fmt.Errorf("fetch %s: %v", resp.URL, err)}) } + body := resp.Body + defer body.Close() imports, err := parseMetaGoImports(body, mod) if err != nil { - return setCache(fetchResult{urlStr: urlStr, err: fmt.Errorf("parsing %s: %v", urlStr, err)}) + return setCache(fetchResult{url: url, err: fmt.Errorf("parsing %s: %v", resp.URL, err)}) } if len(imports) == 0 { - err = fmt.Errorf("fetch %s: no go-import meta tag", urlStr) + err = fmt.Errorf("fetch %s: no go-import meta tag", url) } - return setCache(fetchResult{urlStr: urlStr, imports: imports, err: err}) + return setCache(fetchResult{url: url, imports: imports, err: err}) }) res := resi.(fetchResult) - return res.urlStr, res.imports, res.err + return res.url, res.imports, res.err } type fetchResult struct { - urlStr string // e.g. "https://foo.com/x/bar?go-get=1" + url *urlpkg.URL imports []metaImport err error } @@ -975,7 +1005,7 @@ var vcsPaths = []*vcsPath{ // Github { prefix: "github.com/", - re: `^(?Pgithub\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[\p{L}0-9_.\-]+)*$`, + regexp: lazyregexp.New(`^(?Pgithub\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[\p{L}0-9_.\-]+)*$`), vcs: "git", repo: "https://{root}", check: noVCSSuffix, @@ -984,7 +1014,7 @@ var vcsPaths = []*vcsPath{ // Bitbucket { prefix: "bitbucket.org/", - re: `^(?Pbitbucket\.org/(?P[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`, + regexp: lazyregexp.New(`^(?Pbitbucket\.org/(?P[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`), repo: "https://{root}", check: bitbucketVCS, }, @@ -992,7 +1022,7 @@ var vcsPaths = []*vcsPath{ // IBM DevOps Services (JazzHub) { prefix: "hub.jazz.net/git/", - re: `^(?Phub\.jazz\.net/git/[a-z0-9]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`, + regexp: lazyregexp.New(`^(?Phub\.jazz\.net/git/[a-z0-9]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`), vcs: "git", repo: "https://{root}", check: noVCSSuffix, @@ -1001,7 +1031,7 @@ var vcsPaths = []*vcsPath{ // Git at Apache { prefix: "git.apache.org/", - re: `^(?Pgit\.apache\.org/[a-z0-9_.\-]+\.git)(/[A-Za-z0-9_.\-]+)*$`, + regexp: lazyregexp.New(`^(?Pgit\.apache\.org/[a-z0-9_.\-]+\.git)(/[A-Za-z0-9_.\-]+)*$`), vcs: "git", repo: "https://{root}", }, @@ -1009,7 +1039,7 @@ var vcsPaths = []*vcsPath{ // Git at OpenStack { prefix: "git.openstack.org/", - re: `^(?Pgit\.openstack\.org/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(\.git)?(/[A-Za-z0-9_.\-]+)*$`, + regexp: lazyregexp.New(`^(?Pgit\.openstack\.org/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(\.git)?(/[A-Za-z0-9_.\-]+)*$`), vcs: "git", repo: "https://{root}", }, @@ -1017,7 +1047,7 @@ var vcsPaths = []*vcsPath{ // chiselapp.com for fossil { prefix: "chiselapp.com/", - re: `^(?Pchiselapp\.com/user/[A-Za-z0-9]+/repository/[A-Za-z0-9_.\-]+)$`, + regexp: lazyregexp.New(`^(?Pchiselapp\.com/user/[A-Za-z0-9]+/repository/[A-Za-z0-9_.\-]+)$`), vcs: "fossil", repo: "https://{root}", }, @@ -1025,8 +1055,8 @@ var vcsPaths = []*vcsPath{ // General syntax for any server. // Must be last. { - re: `^(?P(?P([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?(/~?[A-Za-z0-9_.\-]+)+?)\.(?Pbzr|fossil|git|hg|svn))(/~?[A-Za-z0-9_.\-]+)*$`, - ping: true, + regexp: lazyregexp.New(`(?P(?P([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?(/~?[A-Za-z0-9_.\-]+)+?)\.(?Pbzr|fossil|git|hg|svn))(/~?[A-Za-z0-9_.\-]+)*$`), + ping: true, }, } @@ -1038,25 +1068,13 @@ var vcsPathsAfterDynamic = []*vcsPath{ // Launchpad. See golang.org/issue/11436. { prefix: "launchpad.net/", - re: `^(?Plaunchpad\.net/((?P[A-Za-z0-9_.\-]+)(?P/[A-Za-z0-9_.\-]+)?|~[A-Za-z0-9_.\-]+/(\+junk|[A-Za-z0-9_.\-]+)/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`, + regexp: lazyregexp.New(`^(?Plaunchpad\.net/((?P[A-Za-z0-9_.\-]+)(?P/[A-Za-z0-9_.\-]+)?|~[A-Za-z0-9_.\-]+/(\+junk|[A-Za-z0-9_.\-]+)/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`), vcs: "bzr", repo: "https://{root}", check: launchpadVCS, }, } -func init() { - // fill in cached regexps. - // Doing this eagerly discovers invalid regexp syntax - // without having to run a command that needs that regexp. - for _, srv := range vcsPaths { - srv.regexp = regexp.MustCompile(srv.re) - } - for _, srv := range vcsPathsAfterDynamic { - srv.regexp = regexp.MustCompile(srv.re) - } -} - // noVCSSuffix checks that the repository name does not // end in .foo for any version control system foo. // The usual culprit is ".git". @@ -1080,8 +1098,13 @@ func bitbucketVCS(match map[string]string) error { var resp struct { SCM string `json:"scm"` } - url := expand(match, "https://api.bitbucket.org/2.0/repositories/{bitname}?fields=scm") - data, err := web.Get(url) + url := &urlpkg.URL{ + Scheme: "https", + Host: "api.bitbucket.org", + Path: expand(match, "/2.0/repositories/{bitname}"), + RawQuery: "fields=scm", + } + data, err := web.GetBytes(url) if err != nil { if httpErr, ok := err.(*web.HTTPError); ok && httpErr.StatusCode == 403 { // this may be a private repository. If so, attempt to determine which @@ -1123,7 +1146,12 @@ func launchpadVCS(match map[string]string) error { if match["project"] == "" || match["series"] == "" { return nil } - _, err := web.Get(expand(match, "https://code.launchpad.net/{project}{series}/.bzr/branch-format")) + url := &urlpkg.URL{ + Scheme: "https", + Host: "code.launchpad.net", + Path: expand(match, "/{project}{series}/.bzr/branch-format"), + } + _, err := web.GetBytes(url) if err != nil { match["root"] = expand(match, "launchpad.net/{project}") match["repo"] = expand(match, "https://{root}") diff --git a/libgo/go/cmd/go/internal/get/vcs_test.go b/libgo/go/cmd/go/internal/get/vcs_test.go index d13721bed1a..91800baa83d 100644 --- a/libgo/go/cmd/go/internal/get/vcs_test.go +++ b/libgo/go/cmd/go/internal/get/vcs_test.go @@ -181,7 +181,7 @@ func TestRepoRootForImportPath(t *testing.T) { } for _, test := range tests { - got, err := RepoRootForImportPath(test.path, IgnoreMod, web.Secure) + got, err := RepoRootForImportPath(test.path, IgnoreMod, web.SecureOnly) want := test.want if want == nil { diff --git a/libgo/go/cmd/go/internal/help/help.go b/libgo/go/cmd/go/internal/help/help.go index 121deb70a58..d373771ab5a 100644 --- a/libgo/go/cmd/go/internal/help/help.go +++ b/libgo/go/cmd/go/internal/help/help.go @@ -17,6 +17,7 @@ import ( "unicode/utf8" "cmd/go/internal/base" + "cmd/go/internal/modload" ) // Help implements the 'help' command. @@ -35,8 +36,10 @@ func Help(w io.Writer, args []string) { usage := &base.Command{Long: buf.String()} cmds := []*base.Command{usage} for _, cmd := range base.Go.Commands { - if cmd.UsageLine == "gopath-get" { - // Avoid duplication of the "get" documentation. + // Avoid duplication of the "get" documentation. + if cmd.UsageLine == "module-get" && modload.Enabled() { + continue + } else if cmd.UsageLine == "gopath-get" && !modload.Enabled() { continue } cmds = append(cmds, cmd) diff --git a/libgo/go/cmd/go/internal/help/helpdoc.go b/libgo/go/cmd/go/internal/help/helpdoc.go index c219a45d749..c2b5fb4b830 100644 --- a/libgo/go/cmd/go/internal/help/helpdoc.go +++ b/libgo/go/cmd/go/internal/help/helpdoc.go @@ -469,10 +469,17 @@ var HelpEnvironment = &base.Command{ Short: "environment variables", Long: ` -The go command, and the tools it invokes, examine a few different -environment variables. For many of these, you can see the default -value of on your system by running 'go env NAME', where NAME is the -name of the variable. +The go command and the tools it invokes consult environment variables +for configuration. If an environment variable is unset, the go command +uses a sensible default setting. To see the effective setting of the +variable , run 'go env '. To change the default setting, +run 'go env -w ='. Defaults changed using 'go env -w' +are recorded in a Go environment configuration file stored in the +per-user configuration directory, as reported by os.UserConfigDir. +The location of the configuration file can be changed by setting +the environment variable GOENV, and 'go env GOENV' prints the +effective location, but 'go env -w' cannot change the default location. +See 'go help env' for details. General-purpose environment variables: @@ -486,10 +493,15 @@ General-purpose environment variables: GOCACHE The directory where the go command will store cached information for reuse in future builds. + GOENV + The location of the Go environment configuration file. + Cannot be set using 'go env -w'. GOFLAGS A space-separated list of -flag=value settings to apply to go commands by default, when the given flag is known by - the current command. Flags listed on the command-line + the current command. Each entry must be a standalone flag. + Because the entries are space-separated, flag values must + not contain spaces. Flags listed on the command line are applied after this list and therefore override it. GOOS The operating system for which to compile code. @@ -497,22 +509,27 @@ General-purpose environment variables: GOPATH For more details see: 'go help gopath'. GOPROXY - URL of Go module proxy. See 'go help goproxy'. - GORACE - Options for the race detector. - See https://golang.org/doc/articles/race_detector.html. + URL of Go module proxy. See 'go help modules'. + GOPRIVATE, GONOPROXY, GONOSUMDB + Comma-separated list of glob patterns (in the syntax of Go's path.Match) + of module path prefixes that should always be fetched directly + or that should not be compared against the checksum database. + See 'go help module-private'. GOROOT The root of the go tree. + GOSUMDB + The name of checksum database to use and optionally its public key and + URL. See 'go help module-auth'. GOTMPDIR The directory where the go command will write temporary source files, packages, and binaries. -Each entry in the GOFLAGS list must be a standalone flag. -Because the entries are space-separated, flag values must -not contain spaces. - Environment variables for use with cgo: + AR + The command to use to manipulate library archives when + building with the gccgo compiler. + The default is 'ar'. CC The command to use to compile C code. CGO_ENABLED @@ -542,12 +559,10 @@ Environment variables for use with cgo: but for the linker. CXX The command to use to compile C++ code. + FC + The command to use to compile Fortran code. PKG_CONFIG Path to pkg-config tool. - AR - The command to use to manipulate library archives when - building with the gccgo compiler. - The default is 'ar'. Architecture-specific environment variables: @@ -563,6 +578,9 @@ Architecture-specific environment variables: GOMIPS64 For GOARCH=mips64{,le}, whether to use floating point instructions. Valid values are hardfloat (default), softfloat. + GOWASM + For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use. + Valid values are satconv, signext. Special-purpose environment variables: @@ -579,14 +597,18 @@ Special-purpose environment variables: when using -linkmode=auto with code that uses cgo. Set to 0 to disable external linking mode, 1 to enable it. GIT_ALLOW_PROTOCOL - Defined by Git. A colon-separated list of schemes that are allowed to be used - with git fetch/clone. If set, any scheme not explicitly mentioned will be - considered insecure by 'go get'. + Defined by Git. A colon-separated list of schemes that are allowed + to be used with git fetch/clone. If set, any scheme not explicitly + mentioned will be considered insecure by 'go get'. + Because the variable is defined by Git, the default value cannot + be set using 'go env -w'. Additional information available from 'go env' but not read from the environment: GOEXE The executable file name suffix (".exe" on Windows, "" on other systems). + GOGCCFLAGS + A space-separated list of arguments supplied to the CC command. GOHOSTARCH The architecture (GOARCH) of the Go toolchain binaries. GOHOSTOS @@ -635,15 +657,6 @@ constraints, but the go command stops scanning for build constraints at the first item in the file that is not a blank line or //-style line comment. See the go/build package documentation for more details. - -Through the Go 1.12 release, non-test Go source files can also include -a //go:binary-only-package comment, indicating that the package -sources are included for documentation only and must not be used to -build the package binary. This enables distribution of Go packages in -their compiled form alone. Even binary-only packages require accurate -import blocks listing required dependencies, so that those -dependencies can be supplied when linking the resulting command. -Note that this feature is scheduled to be removed after the Go 1.12 release. `, } @@ -693,6 +706,9 @@ are: -buildmode=plugin Build the listed main packages, plus all packages that they import, into a Go plugin. Packages not named main are ignored. + +On AIX, when linking a C program that uses a Go archive built with +-buildmode=c-archive, you must pass -Wl,-bnoobjreorder to the C compiler. `, } diff --git a/libgo/go/cmd/go/internal/imports/build.go b/libgo/go/cmd/go/internal/imports/build.go index ddf425b0204..3e9fe357e07 100644 --- a/libgo/go/cmd/go/internal/imports/build.go +++ b/libgo/go/cmd/go/internal/imports/build.go @@ -138,6 +138,9 @@ func matchTag(name string, tags map[string]bool, want bool) bool { if name == "linux" { have = have || tags["android"] } + if name == "solaris" { + have = have || tags["illumos"] + } return have == want } @@ -152,7 +155,9 @@ func matchTag(name string, tags map[string]bool, want bool) bool { // name_$(GOARCH)_test.* // name_$(GOOS)_$(GOARCH)_test.* // -// An exception: if GOOS=android, then files with GOOS=linux are also matched. +// Exceptions: +// if GOOS=android, then files with GOOS=linux are also matched. +// if GOOS=illumos, then files with GOOS=solaris are also matched. // // If tags["*"] is true, then MatchFile will consider all possible // GOOS and GOARCH to be available and will consequently @@ -184,28 +189,58 @@ func MatchFile(name string, tags map[string]bool) bool { } n := len(l) if n >= 2 && KnownOS[l[n-2]] && KnownArch[l[n-1]] { - return tags[l[n-2]] && tags[l[n-1]] + return matchTag(l[n-2], tags, true) && matchTag(l[n-1], tags, true) } if n >= 1 && KnownOS[l[n-1]] { - return tags[l[n-1]] + return matchTag(l[n-1], tags, true) } if n >= 1 && KnownArch[l[n-1]] { - return tags[l[n-1]] + return matchTag(l[n-1], tags, true) } return true } -var KnownOS = make(map[string]bool) -var KnownArch = make(map[string]bool) - -func init() { - for _, v := range strings.Fields(goosList) { - KnownOS[v] = true - } - for _, v := range strings.Fields(goarchList) { - KnownArch[v] = true - } +var KnownOS = map[string]bool{ + "aix": true, + "android": true, + "darwin": true, + "dragonfly": true, + "freebsd": true, + "hurd": true, + "illumos": true, + "js": true, + "linux": true, + "nacl": true, + "netbsd": true, + "openbsd": true, + "plan9": true, + "solaris": true, + "windows": true, + "zos": true, } -const goosList = "aix android darwin dragonfly freebsd hurd js linux nacl netbsd openbsd plan9 solaris windows zos " -const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc riscv riscv64 s390 s390x sparc sparc64 wasm " +var KnownArch = map[string]bool{ + "386": true, + "amd64": true, + "amd64p32": true, + "arm": true, + "armbe": true, + "arm64": true, + "arm64be": true, + "ppc64": true, + "ppc64le": true, + "mips": true, + "mipsle": true, + "mips64": true, + "mips64le": true, + "mips64p32": true, + "mips64p32le": true, + "ppc": true, + "riscv": true, + "riscv64": true, + "s390": true, + "s390x": true, + "sparc": true, + "sparc64": true, + "wasm": true, +} diff --git a/libgo/go/cmd/go/internal/imports/scan.go b/libgo/go/cmd/go/internal/imports/scan.go index 966a38cfef3..3d9b6132b12 100644 --- a/libgo/go/cmd/go/internal/imports/scan.go +++ b/libgo/go/cmd/go/internal/imports/scan.go @@ -26,7 +26,7 @@ func ScanDir(dir string, tags map[string]bool) ([]string, []string, error) { // If the directory entry is a symlink, stat it to obtain the info for the // link target instead of the link itself. if info.Mode()&os.ModeSymlink != 0 { - info, err = os.Stat(name) + info, err = os.Stat(filepath.Join(dir, name)) if err != nil { continue // Ignore broken symlinks. } diff --git a/libgo/go/cmd/go/internal/imports/scan_test.go b/libgo/go/cmd/go/internal/imports/scan_test.go index 6a2ff62ba75..e424656cae2 100644 --- a/libgo/go/cmd/go/internal/imports/scan_test.go +++ b/libgo/go/cmd/go/internal/imports/scan_test.go @@ -5,10 +5,13 @@ package imports import ( + "bytes" "internal/testenv" + "io/ioutil" + "path" "path/filepath" - "reflect" "runtime" + "strings" "testing" ) @@ -51,17 +54,41 @@ func TestScan(t *testing.T) { t.Errorf("json missing test import net/http (%q)", testImports) } } - -func TestScanStar(t *testing.T) { +func TestScanDir(t *testing.T) { testenv.MustHaveGoBuild(t) - imports, _, err := ScanDir("testdata/import1", map[string]bool{"*": true}) + dirs, err := ioutil.ReadDir("testdata") if err != nil { t.Fatal(err) } + for _, dir := range dirs { + if !dir.IsDir() || strings.HasPrefix(dir.Name(), ".") { + continue + } + t.Run(dir.Name(), func(t *testing.T) { + tagsData, err := ioutil.ReadFile(filepath.Join("testdata", dir.Name(), "tags.txt")) + if err != nil { + t.Fatalf("error reading tags: %v", err) + } + tags := make(map[string]bool) + for _, t := range strings.Fields(string(tagsData)) { + tags[t] = true + } + + wantData, err := ioutil.ReadFile(filepath.Join("testdata", dir.Name(), "want.txt")) + if err != nil { + t.Fatalf("error reading want: %v", err) + } + want := string(bytes.TrimSpace(wantData)) - want := []string{"import1", "import2", "import3", "import4"} - if !reflect.DeepEqual(imports, want) { - t.Errorf("ScanDir testdata/import1:\nhave %v\nwant %v", imports, want) + imports, _, err := ScanDir(path.Join("testdata", dir.Name()), tags) + if err != nil { + t.Fatal(err) + } + got := strings.Join(imports, "\n") + if got != want { + t.Errorf("ScanDir: got imports:\n%s\n\nwant:\n%s", got, want) + } + }) } } diff --git a/libgo/go/cmd/go/internal/imports/tags.go b/libgo/go/cmd/go/internal/imports/tags.go index 1c22a472b80..14b4e21a024 100644 --- a/libgo/go/cmd/go/internal/imports/tags.go +++ b/libgo/go/cmd/go/internal/imports/tags.go @@ -8,6 +8,9 @@ import "cmd/go/internal/cfg" var tags map[string]bool +// Tags returns a set of build tags that are true for the target platform. +// It includes GOOS, GOARCH, the compiler, possibly "cgo", +// release tags like "go1.13", and user-specified build tags. func Tags() map[string]bool { if tags == nil { tags = loadTags() @@ -32,3 +35,15 @@ func loadTags() map[string]bool { } return tags } + +var anyTags map[string]bool + +// AnyTags returns a special set of build tags that satisfy nearly all +// build tag expressions. Only "ignore" and malformed build tag requirements +// are considered false. +func AnyTags() map[string]bool { + if anyTags == nil { + anyTags = map[string]bool{"*": true} + } + return anyTags +} diff --git a/libgo/go/cmd/go/internal/imports/testdata/android/a_android.go b/libgo/go/cmd/go/internal/imports/testdata/android/a_android.go new file mode 100644 index 00000000000..2ed972eca57 --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/android/a_android.go @@ -0,0 +1,3 @@ +package android + +import _ "a" diff --git a/libgo/go/cmd/go/internal/imports/testdata/android/b_android_arm64.go b/libgo/go/cmd/go/internal/imports/testdata/android/b_android_arm64.go new file mode 100644 index 00000000000..ee9c312b5d7 --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/android/b_android_arm64.go @@ -0,0 +1,3 @@ +package android + +import _ "b" diff --git a/libgo/go/cmd/go/internal/imports/testdata/android/c_linux.go b/libgo/go/cmd/go/internal/imports/testdata/android/c_linux.go new file mode 100644 index 00000000000..91624ce637f --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/android/c_linux.go @@ -0,0 +1,3 @@ +package android + +import _ "c" diff --git a/libgo/go/cmd/go/internal/imports/testdata/android/d_linux_arm64.go b/libgo/go/cmd/go/internal/imports/testdata/android/d_linux_arm64.go new file mode 100644 index 00000000000..34e07df2477 --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/android/d_linux_arm64.go @@ -0,0 +1,3 @@ +package android + +import _ "d" diff --git a/libgo/go/cmd/go/internal/imports/testdata/android/e.go b/libgo/go/cmd/go/internal/imports/testdata/android/e.go new file mode 100644 index 00000000000..d9b2db769b5 --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/android/e.go @@ -0,0 +1,5 @@ +// +build android + +package android + +import _ "e" diff --git a/libgo/go/cmd/go/internal/imports/testdata/android/f.go b/libgo/go/cmd/go/internal/imports/testdata/android/f.go new file mode 100644 index 00000000000..281e4dd6b98 --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/android/f.go @@ -0,0 +1,5 @@ +// +build linux + +package android + +import _ "f" diff --git a/libgo/go/cmd/go/internal/imports/testdata/android/g.go b/libgo/go/cmd/go/internal/imports/testdata/android/g.go new file mode 100644 index 00000000000..66a789c0ada --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/android/g.go @@ -0,0 +1,5 @@ +// +build !android + +package android + +import _ "g" diff --git a/libgo/go/cmd/go/internal/imports/testdata/illumos/a_illumos.go b/libgo/go/cmd/go/internal/imports/testdata/illumos/a_illumos.go new file mode 100644 index 00000000000..2e6cb50805a --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/illumos/a_illumos.go @@ -0,0 +1,3 @@ +package illumos + +import _ "a" diff --git a/libgo/go/cmd/go/internal/imports/testdata/illumos/b_illumos_amd64.go b/libgo/go/cmd/go/internal/imports/testdata/illumos/b_illumos_amd64.go new file mode 100644 index 00000000000..2834d80660c --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/illumos/b_illumos_amd64.go @@ -0,0 +1,3 @@ +package illumos + +import _ "b" diff --git a/libgo/go/cmd/go/internal/imports/testdata/illumos/c_solaris.go b/libgo/go/cmd/go/internal/imports/testdata/illumos/c_solaris.go new file mode 100644 index 00000000000..d7f9462f159 --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/illumos/c_solaris.go @@ -0,0 +1,3 @@ +package illumos + +import _ "c" diff --git a/libgo/go/cmd/go/internal/imports/testdata/illumos/d_solaris_amd64.go b/libgo/go/cmd/go/internal/imports/testdata/illumos/d_solaris_amd64.go new file mode 100644 index 00000000000..0f52c2bb484 --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/illumos/d_solaris_amd64.go @@ -0,0 +1,3 @@ +package illumos + +import _ "d" diff --git a/libgo/go/cmd/go/internal/imports/testdata/illumos/e.go b/libgo/go/cmd/go/internal/imports/testdata/illumos/e.go new file mode 100644 index 00000000000..5e1ed3cb9de --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/illumos/e.go @@ -0,0 +1,5 @@ +// +build illumos + +package illumos + +import _ "e" diff --git a/libgo/go/cmd/go/internal/imports/testdata/illumos/f.go b/libgo/go/cmd/go/internal/imports/testdata/illumos/f.go new file mode 100644 index 00000000000..f3e3f728bce --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/illumos/f.go @@ -0,0 +1,5 @@ +// +build solaris + +package illumos + +import _ "f" diff --git a/libgo/go/cmd/go/internal/imports/testdata/illumos/g.go b/libgo/go/cmd/go/internal/imports/testdata/illumos/g.go new file mode 100644 index 00000000000..b30f1eb4037 --- /dev/null +++ b/libgo/go/cmd/go/internal/imports/testdata/illumos/g.go @@ -0,0 +1,5 @@ +// +build !illumos + +package illumos + +import _ "g" diff --git a/libgo/go/cmd/go/internal/imports/testdata/import1/x.go b/libgo/go/cmd/go/internal/imports/testdata/star/x.go similarity index 100% rename from libgo/go/cmd/go/internal/imports/testdata/import1/x.go rename to libgo/go/cmd/go/internal/imports/testdata/star/x.go diff --git a/libgo/go/cmd/go/internal/imports/testdata/import1/x1.go b/libgo/go/cmd/go/internal/imports/testdata/star/x1.go similarity index 100% rename from libgo/go/cmd/go/internal/imports/testdata/import1/x1.go rename to libgo/go/cmd/go/internal/imports/testdata/star/x1.go diff --git a/libgo/go/cmd/go/internal/imports/testdata/import1/x_darwin.go b/libgo/go/cmd/go/internal/imports/testdata/star/x_darwin.go similarity index 100% rename from libgo/go/cmd/go/internal/imports/testdata/import1/x_darwin.go rename to libgo/go/cmd/go/internal/imports/testdata/star/x_darwin.go diff --git a/libgo/go/cmd/go/internal/imports/testdata/import1/x_windows.go b/libgo/go/cmd/go/internal/imports/testdata/star/x_windows.go similarity index 100% rename from libgo/go/cmd/go/internal/imports/testdata/import1/x_windows.go rename to libgo/go/cmd/go/internal/imports/testdata/star/x_windows.go diff --git a/libgo/go/cmd/go/internal/list/list.go b/libgo/go/cmd/go/internal/list/list.go index b3ba4edc650..e7e78e7c597 100644 --- a/libgo/go/cmd/go/internal/list/list.go +++ b/libgo/go/cmd/go/internal/list/list.go @@ -60,7 +60,7 @@ to -f '{{.ImportPath}}'. The struct being passed to the template is: StaleReason string // explanation for Stale==true Root string // Go root or Go path dir containing this package ConflictDir string // this directory shadows Dir in $GOPATH - BinaryOnly bool // binary-only package: cannot be recompiled from sources + BinaryOnly bool // binary-only package (no longer supported) ForTest string // package is only for use in named test Export string // file containing export data (when using -export) Module *Module // info about package's containing module, if any (can be nil) @@ -202,17 +202,18 @@ When listing modules, the -f flag still specifies a format template applied to a Go struct, but now a Module struct: type Module struct { - Path string // module path - Version string // module version - Versions []string // available module versions (with -versions) - Replace *Module // replaced by this module - Time *time.Time // time version was created - Update *Module // available update, if any (with -u) - Main bool // is this the main module? - Indirect bool // is this module only an indirect dependency of main module? - Dir string // directory holding files for this module, if any - GoMod string // path to go.mod file for this module, if any - Error *ModuleError // error loading module + Path string // module path + Version string // module version + Versions []string // available module versions (with -versions) + Replace *Module // replaced by this module + Time *time.Time // time version was created + Update *Module // available update, if any (with -u) + Main bool // is this the main module? + Indirect bool // is this module only an indirect dependency of main module? + Dir string // directory holding files for this module, if any + GoMod string // path to go.mod file for this module, if any + GoVersion string // go version used in module + Error *ModuleError // error loading module } type ModuleError struct { @@ -446,37 +447,34 @@ func runList(cmd *base.Command, args []string) { continue } if len(p.TestGoFiles)+len(p.XTestGoFiles) > 0 { - pmain, ptest, pxtest, err := load.GetTestPackagesFor(p, nil) - if err != nil { - if *listE { - pkgs = append(pkgs, &load.Package{ - PackagePublic: load.PackagePublic{ - ImportPath: p.ImportPath + ".test", - Error: &load.PackageError{Err: err.Error()}, - }, - }) - continue + var pmain, ptest, pxtest *load.Package + var err error + if *listE { + pmain, ptest, pxtest = load.TestPackagesAndErrors(p, nil) + } else { + pmain, ptest, pxtest, err = load.TestPackagesFor(p, nil) + if err != nil { + base.Errorf("can't load test package: %s", err) } - base.Errorf("can't load test package: %s", err) - continue } - pkgs = append(pkgs, pmain) - if ptest != nil { + if pmain != nil { + pkgs = append(pkgs, pmain) + data := pmain.Internal.TestmainGo + h := cache.NewHash("testmain") + h.Write([]byte("testmain\n")) + h.Write(data) + out, _, err := c.Put(h.Sum(), bytes.NewReader(data)) + if err != nil { + base.Fatalf("%s", err) + } + pmain.GoFiles[0] = c.OutputFile(out) + } + if ptest != nil && ptest != p { pkgs = append(pkgs, ptest) } if pxtest != nil { pkgs = append(pkgs, pxtest) } - - data := *pmain.Internal.TestmainGo - h := cache.NewHash("testmain") - h.Write([]byte("testmain\n")) - h.Write(data) - out, _, err := c.Put(h.Sum(), bytes.NewReader(data)) - if err != nil { - base.Fatalf("%s", err) - } - pmain.GoFiles[0] = c.OutputFile(out) } } } diff --git a/libgo/go/cmd/go/internal/load/path.go b/libgo/go/cmd/go/internal/load/path.go index 0211b284a40..584cdff8916 100644 --- a/libgo/go/cmd/go/internal/load/path.go +++ b/libgo/go/cmd/go/internal/load/path.go @@ -6,32 +6,8 @@ package load import ( "path/filepath" - "strings" ) -// hasSubdir reports whether dir is a subdirectory of -// (possibly multiple levels below) root. -// If so, it sets rel to the path fragment that must be -// appended to root to reach dir. -func hasSubdir(root, dir string) (rel string, ok bool) { - if p, err := filepath.EvalSymlinks(root); err == nil { - root = p - } - if p, err := filepath.EvalSymlinks(dir); err == nil { - dir = p - } - const sep = string(filepath.Separator) - root = filepath.Clean(root) - if !strings.HasSuffix(root, sep) { - root += sep - } - dir = filepath.Clean(dir) - if !strings.HasPrefix(dir, root) { - return "", false - } - return filepath.ToSlash(dir[len(root):]), true -} - // expandPath returns the symlink-expanded form of path. func expandPath(p string) string { x, err := filepath.EvalSymlinks(p) diff --git a/libgo/go/cmd/go/internal/load/pkg.go b/libgo/go/cmd/go/internal/load/pkg.go index 5e511dbdbd3..958356070c5 100644 --- a/libgo/go/cmd/go/internal/load/pkg.go +++ b/libgo/go/cmd/go/internal/load/pkg.go @@ -7,6 +7,7 @@ package load import ( "bytes" + "errors" "fmt" "go/build" "go/token" @@ -14,6 +15,7 @@ import ( "os" pathpkg "path" "path/filepath" + "runtime" "sort" "strconv" "strings" @@ -23,6 +25,7 @@ import ( "cmd/go/internal/base" "cmd/go/internal/cfg" "cmd/go/internal/modinfo" + "cmd/go/internal/par" "cmd/go/internal/search" "cmd/go/internal/str" ) @@ -32,14 +35,14 @@ var ( ModInit func() // module hooks; nil if module use is disabled - ModBinDir func() string // return effective bin directory - ModLookup func(path string) (dir, realPath string, err error) // lookup effective meaning of import - ModPackageModuleInfo func(path string) *modinfo.ModulePublic // return module info for Package struct - ModImportPaths func(args []string) []*search.Match // expand import paths - ModPackageBuildInfo func(main string, deps []string) string // return module info to embed in binary - ModInfoProg func(info string) []byte // wrap module info in .go code for binary - ModImportFromFiles func([]string) // update go.mod to add modules for imports in these files - ModDirImportPath func(string) string // return effective import path for directory + ModBinDir func() string // return effective bin directory + ModLookup func(parentPath string, parentIsStd bool, path string) (dir, realPath string, err error) // lookup effective meaning of import + ModPackageModuleInfo func(path string) *modinfo.ModulePublic // return module info for Package struct + ModImportPaths func(args []string) []*search.Match // expand import paths + ModPackageBuildInfo func(main string, deps []string) string // return module info to embed in binary + ModInfoProg func(info string) []byte // wrap module info in .go code for binary + ModImportFromFiles func([]string) // update go.mod to add modules for imports in these files + ModDirImportPath func(string) string // return effective import path for directory ) var IgnoreImports bool // control whether we ignore imports in packages @@ -174,7 +177,8 @@ type PackageInternal struct { OmitDebug bool // tell linker not to write debug information GobinSubdir bool // install target would be subdir of GOBIN BuildInfo string // add this info to package main - TestmainGo *[]byte // content for _testmain.go + TestinginitGo []byte // content for _testinginit.go + TestmainGo []byte // content for _testmain.go Asmflags []string // -asmflags for this package Gcflags []string // -gcflags for this package @@ -356,38 +360,56 @@ func (sp *ImportStack) shorterThan(t []string) bool { return false // they are equal } -// packageCache is a lookup cache for loadPackage, +// packageCache is a lookup cache for LoadImport, // so that if we look up a package multiple times // we return the same pointer each time. var packageCache = map[string]*Package{} +// ClearPackageCache clears the in-memory package cache and the preload caches. +// It is only for use by GOPATH-based "go get". +// TODO(jayconrod): When GOPATH-based "go get" is removed, delete this function. func ClearPackageCache() { for name := range packageCache { delete(packageCache, name) } + resolvedImportCache.Clear() + packageDataCache.Clear() } +// ClearPackageCachePartial clears packages with the given import paths from the +// in-memory package cache and the preload caches. It is only for use by +// GOPATH-based "go get". +// TODO(jayconrod): When GOPATH-based "go get" is removed, delete this function. func ClearPackageCachePartial(args []string) { + shouldDelete := make(map[string]bool) for _, arg := range args { - p := packageCache[arg] - if p != nil { - delete(packageCache, p.Dir) - delete(packageCache, p.ImportPath) + shouldDelete[arg] = true + if p := packageCache[arg]; p != nil { + delete(packageCache, arg) } } + resolvedImportCache.DeleteIf(func(key interface{}) bool { + return shouldDelete[key.(importSpec).path] + }) + packageDataCache.DeleteIf(func(key interface{}) bool { + return shouldDelete[key.(string)] + }) } -// ReloadPackageNoFlags is like LoadPackageNoFlags but makes sure +// ReloadPackageNoFlags is like LoadImport but makes sure // not to use the package cache. // It is only for use by GOPATH-based "go get". // TODO(rsc): When GOPATH-based "go get" is removed, delete this function. func ReloadPackageNoFlags(arg string, stk *ImportStack) *Package { p := packageCache[arg] if p != nil { - delete(packageCache, p.Dir) - delete(packageCache, p.ImportPath) + delete(packageCache, arg) + resolvedImportCache.DeleteIf(func(key interface{}) bool { + return key.(importSpec).path == p.ImportPath + }) + packageDataCache.Delete(p.ImportPath) } - return LoadPackageNoFlags(arg, stk) + return LoadImport(arg, base.Cwd, nil, stk, nil, 0) } // dirToImportPath returns the pseudo-import path we use for a package @@ -440,6 +462,10 @@ const ( // this package, as part of a bigger load operation, and by GOPATH-based "go get". // TODO(rsc): When GOPATH-based "go get" is removed, unexport this function. func LoadImport(path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) *Package { + return loadImport(nil, path, srcDir, parent, stk, importPos, mode) +} + +func loadImport(pre *preload, path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) *Package { if path == "" { panic("LoadImport called with empty package path") } @@ -447,125 +473,51 @@ func LoadImport(path, srcDir string, parent *Package, stk *ImportStack, importPo stk.Push(path) defer stk.Pop() - if strings.HasPrefix(path, "mod/") { - // Paths beginning with "mod/" might accidentally - // look in the module cache directory tree in $GOPATH/pkg/mod/. - // This prefix is owned by the Go core for possible use in the - // standard library (since it does not begin with a domain name), - // so it's OK to disallow entirely. - return &Package{ - PackagePublic: PackagePublic{ - ImportPath: path, - Error: &PackageError{ - ImportStack: stk.Copy(), - Err: fmt.Sprintf("disallowed import path %q", path), - }, - }, - } + var parentPath, parentRoot string + parentIsStd := false + if parent != nil { + parentPath = parent.ImportPath + parentRoot = parent.Root + parentIsStd = parent.Standard } - - if strings.Contains(path, "@") { - var text string - if cfg.ModulesEnabled { - text = "can only use path@version syntax with 'go get'" - } else { - text = "cannot use path@version syntax in GOPATH mode" - } + bp, loaded, err := loadPackageData(path, parentPath, srcDir, parentRoot, parentIsStd, mode) + if loaded && pre != nil && !IgnoreImports { + pre.preloadImports(bp.Imports, bp) + } + if bp == nil { return &Package{ PackagePublic: PackagePublic{ ImportPath: path, Error: &PackageError{ ImportStack: stk.Copy(), - Err: text, + Err: err.Error(), }, }, } } - parentPath := "" - if parent != nil { - parentPath = parent.ImportPath - } - - // Determine canonical identifier for this package. - // For a local import the identifier is the pseudo-import path - // we create from the full directory to the package. - // Otherwise it is the usual import path. - // For vendored imports, it is the expanded form. - importPath := path - origPath := path - isLocal := build.IsLocalImport(path) - var modDir string - var modErr error - if isLocal { - importPath = dirToImportPath(filepath.Join(srcDir, path)) - } else if cfg.ModulesEnabled { - var p string - modDir, p, modErr = ModLookup(path) - if modErr == nil { - importPath = p - } - } else if mode&ResolveImport != 0 { - // We do our own path resolution, because we want to - // find out the key to use in packageCache without the - // overhead of repeated calls to buildContext.Import. - // The code is also needed in a few other places anyway. - path = ResolveImportPath(parent, path) - importPath = path - } else if mode&ResolveModule != 0 { - path = ModuleImportPath(parent, path) - importPath = path - } - + importPath := bp.ImportPath p := packageCache[importPath] if p != nil { p = reusePackage(p, stk) } else { p = new(Package) - p.Internal.Local = isLocal + p.Internal.Local = build.IsLocalImport(path) p.ImportPath = importPath packageCache[importPath] = p // Load package. - // Import always returns bp != nil, even if an error occurs, + // loadPackageData may return bp != nil even if an error occurs, // in order to return partial information. - var bp *build.Package - var err error - if modDir != "" { - bp, err = cfg.BuildContext.ImportDir(modDir, 0) - } else if modErr != nil { - bp = new(build.Package) - err = fmt.Errorf("unknown import path %q: %v", importPath, modErr) - } else if cfg.ModulesEnabled && path != "unsafe" { - bp = new(build.Package) - err = fmt.Errorf("unknown import path %q: internal error: module loader did not resolve import", importPath) - } else { - buildMode := build.ImportComment - if mode&ResolveImport == 0 || path != origPath { - // Not vendoring, or we already found the vendored path. - buildMode |= build.IgnoreVendor - } - bp, err = cfg.BuildContext.Import(path, srcDir, buildMode) - } - bp.ImportPath = importPath - if cfg.GOBIN != "" { - bp.BinDir = cfg.GOBIN - } else if cfg.ModulesEnabled { - bp.BinDir = ModBinDir() - } - if modDir == "" && err == nil && !isLocal && bp.ImportComment != "" && bp.ImportComment != path && - !strings.Contains(path, "/vendor/") && !strings.HasPrefix(path, "vendor/") { - err = fmt.Errorf("code in directory %s expects import %q", bp.Dir, bp.ImportComment) - } p.load(stk, bp, err) if p.Error != nil && p.Error.Pos == "" { p = setErrorPos(p, importPos) } - if modDir == "" && origPath != cleanImport(origPath) { + if !cfg.ModulesEnabled && path != cleanImport(path) { p.Error = &PackageError{ ImportStack: stk.Copy(), - Err: fmt.Sprintf("non-canonical import path: %q should be %q", origPath, pathpkg.Clean(origPath)), + Err: fmt.Sprintf("non-canonical import path: %q should be %q", path, pathpkg.Clean(path)), } p.Incomplete = true } @@ -576,7 +528,7 @@ func LoadImport(path, srcDir string, parent *Package, stk *ImportStack, importPo return setErrorPos(perr, importPos) } if mode&ResolveImport != 0 { - if perr := disallowVendor(srcDir, parent, parentPath, origPath, p, stk); perr != p { + if perr := disallowVendor(srcDir, parent, parentPath, path, p, stk); perr != p { return setErrorPos(perr, importPos) } } @@ -592,9 +544,13 @@ func LoadImport(path, srcDir string, parent *Package, stk *ImportStack, importPo if p.Internal.Local && parent != nil && !parent.Internal.Local { perr := *p + errMsg := fmt.Sprintf("local import %q in non-local package", path) + if path == "." { + errMsg = "cannot import current directory" + } perr.Error = &PackageError{ ImportStack: stk.Copy(), - Err: fmt.Sprintf("local import %q in non-local package", path), + Err: errMsg, } return setErrorPos(&perr, importPos) } @@ -611,6 +567,250 @@ func setErrorPos(p *Package, importPos []token.Position) *Package { return p } +// loadPackageData loads information needed to construct a *Package. The result +// is cached, and later calls to loadPackageData for the same package will return +// the same data. +// +// loadPackageData returns a non-nil package even if err is non-nil unless +// the package path is malformed (for example, the path contains "mod/" or "@"). +// +// loadPackageData returns a boolean, loaded, which is true if this is the +// first time the package was loaded. Callers may preload imports in this case. +func loadPackageData(path, parentPath, parentDir, parentRoot string, parentIsStd bool, mode int) (bp *build.Package, loaded bool, err error) { + if path == "" { + panic("loadPackageData called with empty package path") + } + + if strings.HasPrefix(path, "mod/") { + // Paths beginning with "mod/" might accidentally + // look in the module cache directory tree in $GOPATH/pkg/mod/. + // This prefix is owned by the Go core for possible use in the + // standard library (since it does not begin with a domain name), + // so it's OK to disallow entirely. + return nil, false, fmt.Errorf("disallowed import path %q", path) + } + + if strings.Contains(path, "@") { + if cfg.ModulesEnabled { + return nil, false, errors.New("can only use path@version syntax with 'go get'") + } else { + return nil, false, errors.New("cannot use path@version syntax in GOPATH mode") + } + } + + // Determine canonical package path and directory. + // For a local import the identifier is the pseudo-import path + // we create from the full directory to the package. + // Otherwise it is the usual import path. + // For vendored imports, it is the expanded form. + importKey := importSpec{ + path: path, + parentPath: parentPath, + parentDir: parentDir, + parentRoot: parentRoot, + parentIsStd: parentIsStd, + mode: mode, + } + r := resolvedImportCache.Do(importKey, func() interface{} { + var r resolvedImport + if build.IsLocalImport(path) { + r.dir = filepath.Join(parentDir, path) + r.path = dirToImportPath(r.dir) + } else if cfg.ModulesEnabled { + r.dir, r.path, r.err = ModLookup(parentPath, parentIsStd, path) + } else if mode&ResolveImport != 0 { + // We do our own path resolution, because we want to + // find out the key to use in packageCache without the + // overhead of repeated calls to buildContext.Import. + // The code is also needed in a few other places anyway. + r.path = resolveImportPath(path, parentPath, parentDir, parentRoot, parentIsStd) + } else if mode&ResolveModule != 0 { + r.path = moduleImportPath(path, parentPath, parentDir, parentRoot) + } + if r.path == "" { + r.path = path + } + return r + }).(resolvedImport) + // Invariant: r.path is set to the resolved import path. If the path cannot + // be resolved, r.path is set to path, the source import path. + // r.path is never empty. + + // Load the package from its directory. If we already found the package's + // directory when resolving its import path, use that. + data := packageDataCache.Do(r.path, func() interface{} { + loaded = true + var data packageData + if r.dir != "" { + var buildMode build.ImportMode + if !cfg.ModulesEnabled { + buildMode = build.ImportComment + } + data.p, data.err = cfg.BuildContext.ImportDir(r.dir, buildMode) + } else if r.err != nil { + data.p = new(build.Package) + data.err = fmt.Errorf("unknown import path %q: %v", r.path, r.err) + } else if cfg.ModulesEnabled && path != "unsafe" { + data.p = new(build.Package) + data.err = fmt.Errorf("unknown import path %q: internal error: module loader did not resolve import", r.path) + } else { + buildMode := build.ImportComment + if mode&ResolveImport == 0 || r.path != path { + // Not vendoring, or we already found the vendored path. + buildMode |= build.IgnoreVendor + } + data.p, data.err = cfg.BuildContext.Import(r.path, parentDir, buildMode) + } + data.p.ImportPath = r.path + + // Set data.p.BinDir in cases where go/build.Context.Import + // may give us a path we don't want. + if !data.p.Goroot { + if cfg.GOBIN != "" { + data.p.BinDir = cfg.GOBIN + } else if cfg.ModulesEnabled { + data.p.BinDir = ModBinDir() + } + } + + if !cfg.ModulesEnabled && data.err == nil && + data.p.ImportComment != "" && data.p.ImportComment != path && + !strings.Contains(path, "/vendor/") && !strings.HasPrefix(path, "vendor/") { + data.err = fmt.Errorf("code in directory %s expects import %q", data.p.Dir, data.p.ImportComment) + } + return data + }).(packageData) + + return data.p, loaded, data.err +} + +// importSpec describes an import declaration in source code. It is used as a +// cache key for resolvedImportCache. +type importSpec struct { + path string + parentPath, parentDir, parentRoot string + parentIsStd bool + mode int +} + +// resolvedImport holds a canonical identifier for a package. It may also contain +// a path to the package's directory and an error if one occurred. resolvedImport +// is the value type in resolvedImportCache. +type resolvedImport struct { + path, dir string + err error +} + +// packageData holds information loaded from a package. It is the value type +// in packageDataCache. +type packageData struct { + p *build.Package + err error +} + +// resolvedImportCache maps import strings (importSpec) to canonical package names +// (resolvedImport). +var resolvedImportCache par.Cache + +// packageDataCache maps canonical package names (string) to package metadata +// (packageData). +var packageDataCache par.Cache + +// preloadWorkerCount is the number of concurrent goroutines that can load +// packages. Experimentally, there are diminishing returns with more than +// 4 workers. This was measured on the following machines. +// +// * MacBookPro with a 4-core Intel Core i7 CPU +// * Linux workstation with 6-core Intel Xeon CPU +// * Linux workstation with 24-core Intel Xeon CPU +// +// It is very likely (though not confirmed) that this workload is limited +// by memory bandwidth. We don't have a good way to determine the number of +// workers that would saturate the bus though, so runtime.GOMAXPROCS +// seems like a reasonable default. +var preloadWorkerCount = runtime.GOMAXPROCS(0) + +// preload holds state for managing concurrent preloading of package data. +// +// A preload should be created with newPreload before loading a large +// package graph. flush must be called when package loading is complete +// to ensure preload goroutines are no longer active. This is necessary +// because of global mutable state that cannot safely be read and written +// concurrently. In particular, packageDataCache may be cleared by "go get" +// in GOPATH mode, and modload.loaded (accessed via ModLookup) may be +// modified by modload.ImportPaths (ModImportPaths). +type preload struct { + cancel chan struct{} + sema chan struct{} +} + +// newPreload creates a new preloader. flush must be called later to avoid +// accessing global state while it is being modified. +func newPreload() *preload { + pre := &preload{ + cancel: make(chan struct{}), + sema: make(chan struct{}, preloadWorkerCount), + } + return pre +} + +// preloadMatches loads data for package paths matched by patterns. +// When preloadMatches returns, some packages may not be loaded yet, but +// loadPackageData and loadImport are always safe to call. +func (pre *preload) preloadMatches(matches []*search.Match) { + for _, m := range matches { + for _, pkg := range m.Pkgs { + select { + case <-pre.cancel: + return + case pre.sema <- struct{}{}: + go func(pkg string) { + mode := 0 // don't use vendoring or module import resolution + bp, loaded, err := loadPackageData(pkg, "", base.Cwd, "", false, mode) + <-pre.sema + if bp != nil && loaded && err == nil && !IgnoreImports { + pre.preloadImports(bp.Imports, bp) + } + }(pkg) + } + } + } +} + +// preloadImports queues a list of imports for preloading. +// When preloadImports returns, some packages may not be loaded yet, +// but loadPackageData and loadImport are always safe to call. +func (pre *preload) preloadImports(imports []string, parent *build.Package) { + parentIsStd := parent.Goroot && parent.ImportPath != "" && search.IsStandardImportPath(parent.ImportPath) + for _, path := range imports { + if path == "C" || path == "unsafe" { + continue + } + select { + case <-pre.cancel: + return + case pre.sema <- struct{}{}: + go func(path string) { + bp, loaded, err := loadPackageData(path, parent.ImportPath, parent.Dir, parent.Root, parentIsStd, ResolveImport) + <-pre.sema + if bp != nil && loaded && err == nil && !IgnoreImports { + pre.preloadImports(bp.Imports, bp) + } + }(path) + } + } +} + +// flush stops pending preload operations. flush blocks until preload calls to +// loadPackageData have completed. The preloader will not make any new calls +// to loadPackageData. +func (pre *preload) flush() { + close(pre.cancel) + for i := 0; i < preloadWorkerCount; i++ { + pre.sema <- struct{}{} + } +} + func cleanImport(path string) string { orig := path path = pathpkg.Clean(path) @@ -620,18 +820,13 @@ func cleanImport(path string) string { return path } -var isDirCache = map[string]bool{} +var isDirCache par.Cache func isDir(path string) bool { - result, ok := isDirCache[path] - if ok { - return result - } - - fi, err := os.Stat(path) - result = err == nil && fi.IsDir() - isDirCache[path] = result - return result + return isDirCache.Do(path, func() interface{} { + fi, err := os.Stat(path) + return err == nil && fi.IsDir() + }).(bool) } // ResolveImportPath returns the true meaning of path when it appears in parent. @@ -640,31 +835,44 @@ func isDir(path string) bool { // If vendor expansion doesn't trigger, then the path is also subject to // Go 1.11 module legacy conversion (golang.org/issue/25069). func ResolveImportPath(parent *Package, path string) (found string) { + var parentPath, parentDir, parentRoot string + parentIsStd := false + if parent != nil { + parentPath = parent.ImportPath + parentDir = parent.Dir + parentRoot = parent.Root + parentIsStd = parent.Standard + } + return resolveImportPath(path, parentPath, parentDir, parentRoot, parentIsStd) +} + +func resolveImportPath(path, parentPath, parentDir, parentRoot string, parentIsStd bool) (found string) { if cfg.ModulesEnabled { - if _, p, e := ModLookup(path); e == nil { + if _, p, e := ModLookup(parentPath, parentIsStd, path); e == nil { return p } return path } - found = VendoredImportPath(parent, path) + found = vendoredImportPath(path, parentPath, parentDir, parentRoot) if found != path { return found } - return ModuleImportPath(parent, path) + return moduleImportPath(path, parentPath, parentDir, parentRoot) } // dirAndRoot returns the source directory and workspace root // for the package p, guaranteeing that root is a path prefix of dir. -func dirAndRoot(p *Package) (dir, root string) { - dir = filepath.Clean(p.Dir) - root = filepath.Join(p.Root, "src") - if !str.HasFilePathPrefix(dir, root) || p.ImportPath != "command-line-arguments" && filepath.Join(root, p.ImportPath) != dir { +func dirAndRoot(path string, dir, root string) (string, string) { + origDir, origRoot := dir, root + dir = filepath.Clean(dir) + root = filepath.Join(root, "src") + if !str.HasFilePathPrefix(dir, root) || path != "command-line-arguments" && filepath.Join(root, path) != dir { // Look for symlinks before reporting error. dir = expandPath(dir) root = expandPath(root) } - if !str.HasFilePathPrefix(dir, root) || len(dir) <= len(root) || dir[len(root)] != filepath.Separator || p.ImportPath != "command-line-arguments" && !p.Internal.Local && filepath.Join(root, p.ImportPath) != dir { + if !str.HasFilePathPrefix(dir, root) || len(dir) <= len(root) || dir[len(root)] != filepath.Separator || path != "command-line-arguments" && !build.IsLocalImport(path) && filepath.Join(root, path) != dir { base.Fatalf("unexpected directory layout:\n"+ " import path: %s\n"+ " root: %s\n"+ @@ -672,27 +880,27 @@ func dirAndRoot(p *Package) (dir, root string) { " expand root: %s\n"+ " expand dir: %s\n"+ " separator: %s", - p.ImportPath, - filepath.Join(p.Root, "src"), - filepath.Clean(p.Dir), - root, - dir, + path, + filepath.Join(origRoot, "src"), + filepath.Clean(origDir), + origRoot, + origDir, string(filepath.Separator)) } return dir, root } -// VendoredImportPath returns the vendor-expansion of path when it appears in parent. +// vendoredImportPath returns the vendor-expansion of path when it appears in parent. // If parent is x/y/z, then path might expand to x/y/z/vendor/path, x/y/vendor/path, // x/vendor/path, vendor/path, or else stay path if none of those exist. -// VendoredImportPath returns the expanded path or, if no expansion is found, the original. -func VendoredImportPath(parent *Package, path string) (found string) { - if parent == nil || parent.Root == "" { +// vendoredImportPath returns the expanded path or, if no expansion is found, the original. +func vendoredImportPath(path, parentPath, parentDir, parentRoot string) (found string) { + if parentRoot == "" { return path } - dir, root := dirAndRoot(parent) + dir, root := dirAndRoot(parentPath, parentDir, parentRoot) vpath := "vendor/" + path for i := len(dir); i >= len(root); i-- { @@ -708,7 +916,7 @@ func VendoredImportPath(parent *Package, path string) (found string) { } targ := filepath.Join(dir[:i], vpath) if isDir(targ) && hasGoFiles(targ) { - importPath := parent.ImportPath + importPath := parentPath if importPath == "command-line-arguments" { // If parent.ImportPath is 'command-line-arguments'. // set to relative directory to root (also chopped root directory) @@ -738,54 +946,48 @@ func VendoredImportPath(parent *Package, path string) (found string) { var ( modulePrefix = []byte("\nmodule ") - goModPathCache = make(map[string]string) + goModPathCache par.Cache ) // goModPath returns the module path in the go.mod in dir, if any. func goModPath(dir string) (path string) { - path, ok := goModPathCache[dir] - if ok { - return path - } - defer func() { - goModPathCache[dir] = path - }() - - data, err := ioutil.ReadFile(filepath.Join(dir, "go.mod")) - if err != nil { - return "" - } - var i int - if bytes.HasPrefix(data, modulePrefix[1:]) { - i = 0 - } else { - i = bytes.Index(data, modulePrefix) - if i < 0 { + return goModPathCache.Do(dir, func() interface{} { + data, err := ioutil.ReadFile(filepath.Join(dir, "go.mod")) + if err != nil { return "" } - i++ - } - line := data[i:] + var i int + if bytes.HasPrefix(data, modulePrefix[1:]) { + i = 0 + } else { + i = bytes.Index(data, modulePrefix) + if i < 0 { + return "" + } + i++ + } + line := data[i:] - // Cut line at \n, drop trailing \r if present. - if j := bytes.IndexByte(line, '\n'); j >= 0 { - line = line[:j] - } - if line[len(line)-1] == '\r' { - line = line[:len(line)-1] - } - line = line[len("module "):] + // Cut line at \n, drop trailing \r if present. + if j := bytes.IndexByte(line, '\n'); j >= 0 { + line = line[:j] + } + if line[len(line)-1] == '\r' { + line = line[:len(line)-1] + } + line = line[len("module "):] - // If quoted, unquote. - path = strings.TrimSpace(string(line)) - if path != "" && path[0] == '"' { - s, err := strconv.Unquote(path) - if err != nil { - return "" + // If quoted, unquote. + path = strings.TrimSpace(string(line)) + if path != "" && path[0] == '"' { + s, err := strconv.Unquote(path) + if err != nil { + return "" + } + path = s } - path = s - } - return path + return path + }).(string) } // findVersionElement returns the slice indices of the final version element /vN in path. @@ -794,7 +996,7 @@ func findVersionElement(path string) (i, j int) { j = len(path) for i = len(path) - 1; i >= 0; i-- { if path[i] == '/' { - if isVersionElement(path[i:j]) { + if isVersionElement(path[i+1 : j]) { return i, j } j = i @@ -806,10 +1008,10 @@ func findVersionElement(path string) (i, j int) { // isVersionElement reports whether s is a well-formed path version element: // v2, v3, v10, etc, but not v0, v05, v1. func isVersionElement(s string) bool { - if len(s) < 3 || s[0] != '/' || s[1] != 'v' || s[2] == '0' || s[2] == '1' && len(s) == 3 { + if len(s) < 2 || s[0] != 'v' || s[1] == '0' || s[1] == '1' && len(s) == 2 { return false } - for i := 2; i < len(s); i++ { + for i := 1; i < len(s); i++ { if s[i] < '0' || '9' < s[i] { return false } @@ -817,7 +1019,7 @@ func isVersionElement(s string) bool { return true } -// ModuleImportPath translates import paths found in go modules +// moduleImportPath translates import paths found in go modules // back down to paths that can be resolved in ordinary builds. // // Define “new” code as code with a go.mod file in the same directory @@ -825,8 +1027,8 @@ func isVersionElement(s string) bool { // x/y/v2/z does not exist and x/y/go.mod says “module x/y/v2”, // then go build will read the import as x/y/z instead. // See golang.org/issue/25069. -func ModuleImportPath(parent *Package, path string) (found string) { - if parent == nil || parent.Root == "" { +func moduleImportPath(path, parentPath, parentDir, parentRoot string) (found string) { + if parentRoot == "" { return path } @@ -838,7 +1040,7 @@ func ModuleImportPath(parent *Package, path string) (found string) { return path } - dir, root := dirAndRoot(parent) + dir, root := dirAndRoot(parentPath, parentDir, parentRoot) // Consider dir and parents, up to and including root. for i := len(dir); i >= len(root); i-- { @@ -967,6 +1169,13 @@ func disallowInternal(srcDir string, importer *Package, importerPath string, p * } } + // The sort package depends on internal/reflectlite, but during bootstrap + // the path rewriting causes the normal internal checks to fail. + // Instead, just ignore the internal rules during bootstrap. + if p.Standard && strings.HasPrefix(importerPath, "bootstrap/") { + return p + } + // The stack includes p.ImportPath. // If that's the only thing on the stack, we started // with a name given on the command line, not an @@ -1188,26 +1397,16 @@ var foldPath = make(map[string]string) // for a package with the import path importPath. // // The default executable name is the last element of the import path. -// In module-aware mode, an additional rule is used. If the last element -// is a vN path element specifying the major version, then the second last -// element of the import path is used instead. +// In module-aware mode, an additional rule is used on import paths +// consisting of two or more path elements. If the last element is +// a vN path element specifying the major version, then the +// second last element of the import path is used instead. func DefaultExecName(importPath string) string { _, elem := pathpkg.Split(importPath) if cfg.ModulesEnabled { - // If this is example.com/mycmd/v2, it's more useful to install it as mycmd than as v2. - // See golang.org/issue/24667. - isVersion := func(v string) bool { - if len(v) < 2 || v[0] != 'v' || v[1] < '1' || '9' < v[1] { - return false - } - for i := 2; i < len(v); i++ { - if c := v[i]; c < '0' || '9' < c { - return false - } - } - return true - } - if isVersion(elem) { + // If this is example.com/mycmd/v2, it's more useful to + // install it as mycmd than as v2. See golang.org/issue/24667. + if elem != importPath && isVersionElement(elem) { _, elem = pathpkg.Split(pathpkg.Dir(importPath)) } } @@ -1254,21 +1453,7 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { p.Error = &PackageError{Err: e} return } - _, elem := filepath.Split(p.Dir) - if cfg.ModulesEnabled { - // NOTE(rsc,dmitshur): Using p.ImportPath instead of p.Dir - // makes sure we install a package in the root of a - // cached module directory as that package name - // not name@v1.2.3. - // Using p.ImportPath instead of p.Dir - // is probably correct all the time, - // even for non-module-enabled code, - // but I'm not brave enough to change the - // non-module behavior this late in the - // release cycle. Can be done for Go 1.13. - // See golang.org/issue/26869. - elem = DefaultExecName(p.ImportPath) - } + elem := DefaultExecName(p.ImportPath) full := cfg.BuildContext.GOOS + "_" + cfg.BuildContext.GOARCH + "/" + elem if cfg.BuildContext.GOOS != base.ToolGOOS || cfg.BuildContext.GOARCH != base.ToolGOARCH { // Install cross-compiled binaries to subdirectories of bin. @@ -1420,16 +1605,6 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { continue } p1 := LoadImport(path, p.Dir, p, stk, p.Internal.Build.ImportPos[path], ResolveImport) - if p.Standard && p.Error == nil && !p1.Standard && p1.Error == nil { - p.Error = &PackageError{ - ImportStack: stk.Copy(), - Err: fmt.Sprintf("non-standard import %q in standard package %q", path, p.ImportPath), - } - pos := p.Internal.Build.ImportPos[path] - if len(pos) > 0 { - p.Error.Pos = pos[0].String() - } - } path = p1.ImportPath importPaths[i] = path @@ -1443,41 +1618,7 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { } } p.Internal.Imports = imports - - deps := make(map[string]*Package) - var q []*Package - q = append(q, imports...) - for i := 0; i < len(q); i++ { - p1 := q[i] - path := p1.ImportPath - // The same import path could produce an error or not, - // depending on what tries to import it. - // Prefer to record entries with errors, so we can report them. - p0 := deps[path] - if p0 == nil || p1.Error != nil && (p0.Error == nil || len(p0.Error.ImportStack) > len(p1.Error.ImportStack)) { - deps[path] = p1 - for _, p2 := range p1.Internal.Imports { - if deps[p2.ImportPath] != p2 { - q = append(q, p2) - } - } - } - } - - p.Deps = make([]string, 0, len(deps)) - for dep := range deps { - p.Deps = append(p.Deps, dep) - } - sort.Strings(p.Deps) - for _, dep := range p.Deps { - p1 := deps[dep] - if p1 == nil { - panic("impossible: missing entry in package cache for " + dep + " imported by " + p.ImportPath) - } - if p1.Error != nil { - p.DepsErrors = append(p.DepsErrors, p1.Error) - } - } + p.collectDeps() // unsafe is a fake package. if p.Standard && (p.ImportPath == "unsafe" || cfg.BuildContext.Compiler == "gccgo") { @@ -1547,6 +1688,48 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { } } +// collectDeps populates p.Deps and p.DepsErrors by iterating over +// p.Internal.Imports. +// +// TODO(jayconrod): collectDeps iterates over transitive imports for every +// package. We should only need to visit direct imports. +func (p *Package) collectDeps() { + deps := make(map[string]*Package) + var q []*Package + q = append(q, p.Internal.Imports...) + for i := 0; i < len(q); i++ { + p1 := q[i] + path := p1.ImportPath + // The same import path could produce an error or not, + // depending on what tries to import it. + // Prefer to record entries with errors, so we can report them. + p0 := deps[path] + if p0 == nil || p1.Error != nil && (p0.Error == nil || len(p0.Error.ImportStack) > len(p1.Error.ImportStack)) { + deps[path] = p1 + for _, p2 := range p1.Internal.Imports { + if deps[p2.ImportPath] != p2 { + q = append(q, p2) + } + } + } + } + + p.Deps = make([]string, 0, len(deps)) + for dep := range deps { + p.Deps = append(p.Deps, dep) + } + sort.Strings(p.Deps) + for _, dep := range p.Deps { + p1 := deps[dep] + if p1 == nil { + panic("impossible: missing entry in package cache for " + dep + " imported by " + p.ImportPath) + } + if p1.Error != nil { + p.DepsErrors = append(p.DepsErrors, p1.Error) + } + } +} + // SafeArg reports whether arg is a "safe" command-line argument, // meaning that when it appears in a command-line, it probably // doesn't have some special meaning other than its own name. @@ -1700,7 +1883,7 @@ func PackageList(roots []*Package) []*Package { // TestPackageList returns the list of packages in the dag rooted at roots // as visited in a depth-first post-order traversal, including the test // imports of the roots. This ignores errors in test packages. -func GetTestPackageList(roots []*Package) []*Package { +func TestPackageList(roots []*Package) []*Package { seen := map[*Package]bool{} all := []*Package{} var walk func(*Package) @@ -1733,99 +1916,17 @@ func GetTestPackageList(roots []*Package) []*Package { return all } -var cmdCache = map[string]*Package{} - -func ClearCmdCache() { - for name := range cmdCache { - delete(cmdCache, name) - } -} - -// LoadPackage loads the package named by arg. -func LoadPackage(arg string, stk *ImportStack) *Package { - p := loadPackage(arg, stk) +// LoadImportWithFlags loads the package with the given import path and +// sets tool flags on that package. This function is useful loading implicit +// dependencies (like sync/atomic for coverage). +// TODO(jayconrod): delete this function and set flags automatically +// in LoadImport instead. +func LoadImportWithFlags(path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) *Package { + p := LoadImport(path, srcDir, parent, stk, importPos, mode) setToolFlags(p) return p } -// LoadPackageNoFlags is like LoadPackage -// but does not guarantee that the build tool flags are set in the result. -// It is only for use by GOPATH-based "go get" -// and is only appropriate for preliminary loading of packages. -// A real load using LoadPackage or (more likely) -// Packages, PackageAndErrors, or PackagesForBuild -// must be done before passing the package to any build -// steps, so that the tool flags can be set properly. -// TODO(rsc): When GOPATH-based "go get" is removed, delete this function. -func LoadPackageNoFlags(arg string, stk *ImportStack) *Package { - return loadPackage(arg, stk) -} - -// loadPackage is like loadImport but is used for command-line arguments, -// not for paths found in import statements. In addition to ordinary import paths, -// loadPackage accepts pseudo-paths beginning with cmd/ to denote commands -// in the Go command directory, as well as paths to those directories. -func loadPackage(arg string, stk *ImportStack) *Package { - if arg == "" { - panic("loadPackage called with empty package path") - } - if build.IsLocalImport(arg) { - dir := arg - if !filepath.IsAbs(dir) { - if abs, err := filepath.Abs(dir); err == nil { - // interpret relative to current directory - dir = abs - } - } - if sub, ok := hasSubdir(cfg.GOROOTsrc, dir); ok && strings.HasPrefix(sub, "cmd/") && !strings.Contains(sub[4:], "/") { - arg = sub - } - } - if strings.HasPrefix(arg, "cmd/") && !strings.Contains(arg[4:], "/") { - if p := cmdCache[arg]; p != nil { - return p - } - stk.Push(arg) - defer stk.Pop() - - bp, err := cfg.BuildContext.ImportDir(filepath.Join(cfg.GOROOTsrc, arg), 0) - bp.ImportPath = arg - bp.Goroot = true - bp.BinDir = cfg.GOROOTbin - bp.Root = cfg.GOROOT - bp.SrcRoot = cfg.GOROOTsrc - p := new(Package) - cmdCache[arg] = p - p.load(stk, bp, err) - if p.Error == nil && p.Name != "main" { - p.Error = &PackageError{ - ImportStack: stk.Copy(), - Err: fmt.Sprintf("expected package main but found package %s in %s", p.Name, p.Dir), - } - } - return p - } - - // Wasn't a command; must be a package. - // If it is a local import path but names a standard package, - // we treat it as if the user specified the standard package. - // This lets you run go test ./ioutil in package io and be - // referring to io/ioutil rather than a hypothetical import of - // "./ioutil". - if build.IsLocalImport(arg) || filepath.IsAbs(arg) { - dir := arg - if !filepath.IsAbs(arg) { - dir = filepath.Join(base.Cwd, arg) - } - bp, _ := cfg.BuildContext.ImportDir(dir, build.FindOnly) - if bp.ImportPath != "" && bp.ImportPath != "." { - arg = bp.ImportPath - } - } - - return LoadImport(arg, base.Cwd, nil, stk, nil, 0) -} - // Packages returns the packages named by the // command line arguments 'args'. If a named package // cannot be loaded at all (for example, if the directory does not exist), @@ -1851,8 +1952,12 @@ func Packages(args []string) []*Package { // cannot be loaded at all. // The packages that fail to load will have p.Error != nil. func PackagesAndErrors(patterns []string) []*Package { - if len(patterns) > 0 && strings.HasSuffix(patterns[0], ".go") { - return []*Package{GoFilesPackage(patterns)} + if len(patterns) > 0 { + for _, p := range patterns { + if strings.HasSuffix(p, ".go") { + return []*Package{GoFilesPackage(patterns)} + } + } } matches := ImportPaths(patterns) @@ -1862,12 +1967,16 @@ func PackagesAndErrors(patterns []string) []*Package { seenPkg = make(map[*Package]bool) ) + pre := newPreload() + defer pre.flush() + pre.preloadMatches(matches) + for _, m := range matches { for _, pkg := range m.Pkgs { if pkg == "" { panic(fmt.Sprintf("ImportPaths returned empty package for pattern %s", m.Pattern)) } - p := loadPackage(pkg, &stk) + p := loadImport(pre, pkg, base.Cwd, nil, &stk, nil, 0) p.Match = append(p.Match, m.Pattern) p.Internal.CmdlinePkg = true if m.Literal { @@ -1960,7 +2069,14 @@ func GoFilesPackage(gofiles []string) *Package { for _, f := range gofiles { if !strings.HasSuffix(f, ".go") { - base.Fatalf("named files must be .go files") + pkg := new(Package) + pkg.Internal.Local = true + pkg.Internal.CmdlineFiles = true + pkg.Name = f + pkg.Error = &PackageError{ + Err: fmt.Sprintf("named files must be .go files: %s", pkg.Name), + } + return pkg } } diff --git a/libgo/go/cmd/go/internal/load/pkg_test.go b/libgo/go/cmd/go/internal/load/pkg_test.go new file mode 100644 index 00000000000..9ddc20d0500 --- /dev/null +++ b/libgo/go/cmd/go/internal/load/pkg_test.go @@ -0,0 +1,68 @@ +package load + +import ( + "cmd/go/internal/cfg" + "testing" +) + +func TestDefaultExecName(t *testing.T) { + oldModulesEnabled := cfg.ModulesEnabled + defer func() { cfg.ModulesEnabled = oldModulesEnabled }() + for _, tt := range []struct { + in string + wantMod string + wantGopath string + }{ + {"example.com/mycmd", "mycmd", "mycmd"}, + {"example.com/mycmd/v0", "v0", "v0"}, + {"example.com/mycmd/v1", "v1", "v1"}, + {"example.com/mycmd/v2", "mycmd", "v2"}, // Semantic import versioning, use second last element in module mode. + {"example.com/mycmd/v3", "mycmd", "v3"}, // Semantic import versioning, use second last element in module mode. + {"mycmd", "mycmd", "mycmd"}, + {"mycmd/v0", "v0", "v0"}, + {"mycmd/v1", "v1", "v1"}, + {"mycmd/v2", "mycmd", "v2"}, // Semantic import versioning, use second last element in module mode. + {"v0", "v0", "v0"}, + {"v1", "v1", "v1"}, + {"v2", "v2", "v2"}, + } { + { + cfg.ModulesEnabled = true + gotMod := DefaultExecName(tt.in) + if gotMod != tt.wantMod { + t.Errorf("DefaultExecName(%q) in module mode = %v; want %v", tt.in, gotMod, tt.wantMod) + } + } + { + cfg.ModulesEnabled = false + gotGopath := DefaultExecName(tt.in) + if gotGopath != tt.wantGopath { + t.Errorf("DefaultExecName(%q) in gopath mode = %v; want %v", tt.in, gotGopath, tt.wantGopath) + } + } + } +} + +func TestIsVersionElement(t *testing.T) { + t.Parallel() + for _, tt := range []struct { + in string + want bool + }{ + {"v0", false}, + {"v05", false}, + {"v1", false}, + {"v2", true}, + {"v3", true}, + {"v9", true}, + {"v10", true}, + {"v11", true}, + {"v", false}, + {"vx", false}, + } { + got := isVersionElement(tt.in) + if got != tt.want { + t.Errorf("isVersionElement(%q) = %v; want %v", tt.in, got, tt.want) + } + } +} diff --git a/libgo/go/cmd/go/internal/load/test.go b/libgo/go/cmd/go/internal/load/test.go index 7385c4e5030..c247d56c812 100644 --- a/libgo/go/cmd/go/internal/load/test.go +++ b/libgo/go/cmd/go/internal/load/test.go @@ -15,10 +15,10 @@ import ( "go/doc" "go/parser" "go/token" + "internal/lazytemplate" "path/filepath" "sort" "strings" - "text/template" "unicode" "unicode/utf8" ) @@ -39,10 +39,43 @@ type TestCover struct { DeclVars func(*Package, ...string) map[string]*CoverVar } -// TestPackagesFor returns three packages: +// TestPackagesFor is like TestPackagesAndErrors but it returns +// an error if the test packages or their dependencies have errors. +// Only test packages without errors are returned. +func TestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Package, err error) { + pmain, ptest, pxtest = TestPackagesAndErrors(p, cover) + for _, p1 := range []*Package{ptest, pxtest, pmain} { + if p1 == nil { + // pxtest may be nil + continue + } + if p1.Error != nil { + err = p1.Error + break + } + if len(p1.DepsErrors) > 0 { + perr := p1.DepsErrors[0] + perr.Pos = "" // show full import stack + err = perr + break + } + } + if pmain.Error != nil || len(pmain.DepsErrors) > 0 { + pmain = nil + } + if ptest.Error != nil || len(ptest.DepsErrors) > 0 { + ptest = nil + } + if pxtest != nil && (pxtest.Error != nil || len(pxtest.DepsErrors) > 0) { + pxtest = nil + } + return pmain, ptest, pxtest, err +} + +// TestPackagesAndErrors returns three packages: +// - pmain, the package main corresponding to the test binary (running tests in ptest and pxtest). // - ptest, the package p compiled with added "package p" test files. // - pxtest, the result of compiling any "package p_test" (external) test files. -// - pmain, the package main corresponding to the test binary (running tests in ptest and pxtest). // // If the package has no "package p_test" test files, pxtest will be nil. // If the non-test compilation of package p can be reused @@ -50,57 +83,59 @@ type TestCover struct { // package p need not be instrumented for coverage or any other reason), // then the returned ptest == p. // +// An error is returned if the testmain source cannot be completely generated +// (for example, due to a syntax error in a test file). No error will be +// returned for errors loading packages, but the Error or DepsError fields +// of the returned packages may be set. +// // The caller is expected to have checked that len(p.TestGoFiles)+len(p.XTestGoFiles) > 0, // or else there's no point in any of this. -func GetTestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Package, err error) { +func TestPackagesAndErrors(p *Package, cover *TestCover) (pmain, ptest, pxtest *Package) { + pre := newPreload() + defer pre.flush() + allImports := append([]string{}, p.TestImports...) + allImports = append(allImports, p.XTestImports...) + pre.preloadImports(allImports, p.Internal.Build) + + var ptestErr, pxtestErr *PackageError var imports, ximports []*Package var stk ImportStack stk.Push(p.ImportPath + " (test)") rawTestImports := str.StringList(p.TestImports) + var ptestImportsTesting, pxtestImportsTesting bool for i, path := range p.TestImports { - p1 := LoadImport(path, p.Dir, p, &stk, p.Internal.Build.TestImportPos[path], ResolveImport) - if p1.Error != nil { - return nil, nil, nil, p1.Error - } - if len(p1.DepsErrors) > 0 { - err := p1.DepsErrors[0] - err.Pos = "" // show full import stack - return nil, nil, nil, err - } + p1 := loadImport(pre, path, p.Dir, p, &stk, p.Internal.Build.TestImportPos[path], ResolveImport) if str.Contains(p1.Deps, p.ImportPath) || p1.ImportPath == p.ImportPath { // Same error that loadPackage returns (via reusePackage) in pkg.go. // Can't change that code, because that code is only for loading the // non-test copy of a package. - err := &PackageError{ + ptestErr = &PackageError{ ImportStack: testImportStack(stk[0], p1, p.ImportPath), Err: "import cycle not allowed in test", IsImportCycle: true, } - return nil, nil, nil, err } p.TestImports[i] = p1.ImportPath imports = append(imports, p1) + if path == "testing" { + ptestImportsTesting = true + } } stk.Pop() stk.Push(p.ImportPath + "_test") pxtestNeedsPtest := false rawXTestImports := str.StringList(p.XTestImports) for i, path := range p.XTestImports { - p1 := LoadImport(path, p.Dir, p, &stk, p.Internal.Build.XTestImportPos[path], ResolveImport) - if p1.Error != nil { - return nil, nil, nil, p1.Error - } - if len(p1.DepsErrors) > 0 { - err := p1.DepsErrors[0] - err.Pos = "" // show full import stack - return nil, nil, nil, err - } + p1 := loadImport(pre, path, p.Dir, p, &stk, p.Internal.Build.XTestImportPos[path], ResolveImport) if p1.ImportPath == p.ImportPath { pxtestNeedsPtest = true } else { ximports = append(ximports, p1) } p.XTestImports[i] = p1.ImportPath + if path == "testing" { + pxtestImportsTesting = true + } } stk.Pop() @@ -108,7 +143,11 @@ func GetTestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Pac if len(p.TestGoFiles) > 0 || p.Name == "main" || cover != nil && cover.Local { ptest = new(Package) *ptest = *p + ptest.Error = ptestErr ptest.ForTest = p.ImportPath + if ptestImportsTesting { + ptest.Internal.TestinginitGo = formatTestinginit(p) + } ptest.GoFiles = nil ptest.GoFiles = append(ptest.GoFiles, p.GoFiles...) ptest.GoFiles = append(ptest.GoFiles, p.TestGoFiles...) @@ -140,6 +179,7 @@ func GetTestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Pac m[k] = append(m[k], v...) } ptest.Internal.Build.ImportPos = m + ptest.collectDeps() } else { ptest = p } @@ -152,9 +192,11 @@ func GetTestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Pac ImportPath: p.ImportPath + "_test", Root: p.Root, Dir: p.Dir, + Goroot: p.Goroot, GoFiles: p.XTestGoFiles, Imports: p.XTestImports, ForTest: p.ImportPath, + Error: pxtestErr, }, Internal: PackageInternal{ LocalPrefix: p.Internal.LocalPrefix, @@ -170,9 +212,13 @@ func GetTestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Pac Gccgoflags: p.Internal.Gccgoflags, }, } + if pxtestImportsTesting { + pxtest.Internal.TestinginitGo = formatTestinginit(pxtest) + } if pxtestNeedsPtest { pxtest.Internal.Imports = append(pxtest.Internal.Imports, ptest) } + pxtest.collectDeps() } // Build main package. @@ -206,10 +252,7 @@ func GetTestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Pac if dep == ptest.ImportPath { pmain.Internal.Imports = append(pmain.Internal.Imports, ptest) } else { - p1 := LoadImport(dep, "", nil, &stk, nil, 0) - if p1.Error != nil { - return nil, nil, nil, p1.Error - } + p1 := loadImport(pre, dep, "", nil, &stk, nil, 0) pmain.Internal.Imports = append(pmain.Internal.Imports, p1) } } @@ -240,8 +283,8 @@ func GetTestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Pac // The list of imports is used by recompileForTest and by the loop // afterward that gathers t.Cover information. t, err := loadTestFuncs(ptest) - if err != nil { - return nil, nil, nil, err + if err != nil && pmain.Error == nil { + pmain.Error = &PackageError{Err: err.Error()} } t.Cover = cover if len(ptest.GoFiles)+len(ptest.CgoFiles) > 0 { @@ -254,6 +297,7 @@ func GetTestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Pac pmain.Imports = append(pmain.Imports, pxtest.ImportPath) t.ImportXtest = true } + pmain.collectDeps() // Sort and dedup pmain.Imports. // Only matters for go list -test output. @@ -290,12 +334,12 @@ func GetTestPackagesFor(p *Package, cover *TestCover) (pmain, ptest, pxtest *Pac } data, err := formatTestmain(t) - if err != nil { - return nil, nil, nil, err + if err != nil && pmain.Error == nil { + pmain.Error = &PackageError{Err: err.Error()} } - pmain.Internal.TestmainGo = &data + pmain.Internal.TestmainGo = data - return pmain, ptest, pxtest, nil + return pmain, ptest, pxtest } func testImportStack(top string, p *Package, target string) []string { @@ -321,9 +365,10 @@ Search: // preal, packages that import the package under test should get ptest instead // of preal. This is particularly important if pxtest depends on functionality // exposed in test sources in ptest. Second, if there is a main package -// (other than pmain) anywhere, we need to clear p.Internal.BuildInfo in -// the test copy to prevent link conflicts. This may happen if both -coverpkg -// and the command line patterns include multiple main packages. +// (other than pmain) anywhere, we need to set p.Internal.ForceLibrary and +// clear p.Internal.BuildInfo in the test copy to prevent link conflicts. +// This may happen if both -coverpkg and the command line patterns include +// multiple main packages. func recompileForTest(pmain, preal, ptest, pxtest *Package) { // The "test copy" of preal is ptest. // For each package that depends on preal, make a "test copy" @@ -354,6 +399,7 @@ func recompileForTest(pmain, preal, ptest, pxtest *Package) { p = p1 p.Target = "" p.Internal.BuildInfo = "" + p.Internal.ForceLibrary = true } // Update p.Internal.Imports to use test copies. @@ -419,21 +465,33 @@ type coverInfo struct { } // loadTestFuncs returns the testFuncs describing the tests that will be run. +// The returned testFuncs is always non-nil, even if an error occurred while +// processing test files. func loadTestFuncs(ptest *Package) (*testFuncs, error) { t := &testFuncs{ Package: ptest, } + var err error for _, file := range ptest.TestGoFiles { - if err := t.load(filepath.Join(ptest.Dir, file), "_test", &t.ImportTest, &t.NeedTest); err != nil { - return nil, err + if lerr := t.load(filepath.Join(ptest.Dir, file), "_test", &t.ImportTest, &t.NeedTest); lerr != nil && err == nil { + err = lerr } } for _, file := range ptest.XTestGoFiles { - if err := t.load(filepath.Join(ptest.Dir, file), "_xtest", &t.ImportXtest, &t.NeedXtest); err != nil { - return nil, err + if lerr := t.load(filepath.Join(ptest.Dir, file), "_xtest", &t.ImportXtest, &t.NeedXtest); lerr != nil && err == nil { + err = lerr } } - return t, nil + return t, err +} + +// formatTestinginit returns the content of the _testinginit.go file for p. +func formatTestinginit(p *Package) []byte { + var buf bytes.Buffer + if err := testinginitTmpl.Execute(&buf, p); err != nil { + panic("testinginit template execution failed") // shouldn't be possible + } + return buf.Bytes() } // formatTestmain returns the content of the _testmain.go file for t. @@ -565,7 +623,26 @@ func checkTestFunc(fn *ast.FuncDecl, arg string) error { return nil } -var testmainTmpl = template.Must(template.New("main").Parse(` +var testinginitTmpl = lazytemplate.New("init", ` +package {{.Name}} + +import _go_testing "testing" + +{{/* +Call testing.Init before any other user initialization code runs. +(This file is passed to the compiler first.) +This provides the illusion of the old behavior where testing flags +were registered as part of the testing package's initialization. +*/}} +var _ = func() bool { + _go_testing.Init() + return true +}() +`) + +var testmainTmpl = lazytemplate.New("main", ` +// Code generated by 'go test'. DO NOT EDIT. + package main import ( @@ -666,4 +743,4 @@ func main() { {{end}} } -`)) +`) diff --git a/libgo/go/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go b/libgo/go/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go index aa67093a48a..581a978ef8e 100644 --- a/libgo/go/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go +++ b/libgo/go/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go @@ -159,7 +159,9 @@ func TestRLockExcludesOnlyLock(t *testing.T) { f2 := mustOpen(t, f.Name()) defer f2.Close() - if runtime.GOOS == "solaris" || runtime.GOOS == "aix" { + doUnlockTF := false + switch runtime.GOOS { + case "aix", "illumos", "solaris": // When using POSIX locks (as on Solaris), we can't safely read-lock the // same inode through two different descriptors at the same time: when the // first descriptor is closed, the second descriptor would still be open but @@ -167,8 +169,9 @@ func TestRLockExcludesOnlyLock(t *testing.T) { lockF2 := mustBlock(t, "RLock", f2) unlock(t, f) lockF2(t) - } else { + default: rLock(t, f2) + doUnlockTF = true } other := mustOpen(t, f.Name()) @@ -176,7 +179,7 @@ func TestRLockExcludesOnlyLock(t *testing.T) { lockOther := mustBlock(t, "Lock", other) unlock(t, f2) - if runtime.GOOS != "solaris" && runtime.GOOS != "aix" { + if doUnlockTF { unlock(t, f) } lockOther(t) diff --git a/libgo/go/cmd/go/internal/lockedfile/mutex.go b/libgo/go/cmd/go/internal/lockedfile/mutex.go index 17f3751c371..180a36c6201 100644 --- a/libgo/go/cmd/go/internal/lockedfile/mutex.go +++ b/libgo/go/cmd/go/internal/lockedfile/mutex.go @@ -7,6 +7,7 @@ package lockedfile import ( "fmt" "os" + "sync" ) // A Mutex provides mutual exclusion within and across processes by locking a @@ -21,7 +22,8 @@ import ( // must not be copied after first use. The Path field must be set before first // use and must not be change thereafter. type Mutex struct { - Path string // The path to the well-known lock file. Must be non-empty. + Path string // The path to the well-known lock file. Must be non-empty. + mu sync.Mutex // A redundant mutex. The race detector doesn't know about file locking, so in tests we may need to lock something that it understands. } // MutexAt returns a new Mutex with Path set to the given non-empty path. @@ -56,5 +58,10 @@ func (mu *Mutex) Lock() (unlock func(), err error) { if err != nil { return nil, err } - return func() { f.Close() }, nil + mu.mu.Lock() + + return func() { + mu.mu.Unlock() + f.Close() + }, nil } diff --git a/libgo/go/cmd/go/internal/modcmd/download.go b/libgo/go/cmd/go/internal/modcmd/download.go index bbaba444f50..71b660d6fde 100644 --- a/libgo/go/cmd/go/internal/modcmd/download.go +++ b/libgo/go/cmd/go/internal/modcmd/download.go @@ -5,13 +5,15 @@ package modcmd import ( + "cmd/go/internal/cfg" + "encoding/json" + "os" + "cmd/go/internal/base" "cmd/go/internal/modfetch" "cmd/go/internal/modload" "cmd/go/internal/module" "cmd/go/internal/par" - "encoding/json" - "os" ) var cmdDownload = &base.Command{ @@ -66,6 +68,13 @@ type moduleJSON struct { } func runDownload(cmd *base.Command, args []string) { + // Check whether modules are enabled and whether we're in a module. + if cfg.Getenv("GO111MODULE") == "off" { + base.Fatalf("go: modules disabled by GO111MODULE=off; see 'go help modules'") + } + if !modload.HasModRoot() && len(args) == 0 { + base.Fatalf("go mod download: no modules specified (see 'go help mod download')") + } if len(args) == 0 { args = []string{"all"} } diff --git a/libgo/go/cmd/go/internal/modcmd/edit.go b/libgo/go/cmd/go/internal/modcmd/edit.go index 5066e4ddf75..1be8b7cb2fb 100644 --- a/libgo/go/cmd/go/internal/modcmd/edit.go +++ b/libgo/go/cmd/go/internal/modcmd/edit.go @@ -385,7 +385,9 @@ type replaceJSON struct { // editPrintJSON prints the -json output. func editPrintJSON(modFile *modfile.File) { var f fileJSON - f.Module = modFile.Module.Mod + if modFile.Module != nil { + f.Module = modFile.Module.Mod + } if modFile.Go != nil { f.Go = modFile.Go.Version } diff --git a/libgo/go/cmd/go/internal/modcmd/graph.go b/libgo/go/cmd/go/internal/modcmd/graph.go index 5825c6d8ca8..8fcb84f2801 100644 --- a/libgo/go/cmd/go/internal/modcmd/graph.go +++ b/libgo/go/cmd/go/internal/modcmd/graph.go @@ -8,6 +8,7 @@ package modcmd import ( "bufio" + "cmd/go/internal/cfg" "os" "sort" @@ -33,6 +34,14 @@ func runGraph(cmd *base.Command, args []string) { if len(args) > 0 { base.Fatalf("go mod graph: graph takes no arguments") } + // Checks go mod expected behavior + if !modload.Enabled() { + if cfg.Getenv("GO111MODULE") == "off" { + base.Fatalf("go: modules disabled by GO111MODULE=off; see 'go help modules'") + } else { + base.Fatalf("go: cannot find main module; see 'go help modules'") + } + } modload.LoadBuildList() reqs := modload.MinReqs() diff --git a/libgo/go/cmd/go/internal/modcmd/init.go b/libgo/go/cmd/go/internal/modcmd/init.go index 0f7421e5849..b94453bab0c 100644 --- a/libgo/go/cmd/go/internal/modcmd/init.go +++ b/libgo/go/cmd/go/internal/modcmd/init.go @@ -35,6 +35,9 @@ func runInit(cmd *base.Command, args []string) { if len(args) == 1 { modload.CmdModModule = args[0] } + if os.Getenv("GO111MODULE") == "off" { + base.Fatalf("go mod init: modules disabled by GO111MODULE=off; see 'go help modules'") + } if _, err := os.Stat("go.mod"); err == nil { base.Fatalf("go mod init: go.mod already exists") } diff --git a/libgo/go/cmd/go/internal/modcmd/vendor.go b/libgo/go/cmd/go/internal/modcmd/vendor.go index b70f25cec39..75513f1d9ca 100644 --- a/libgo/go/cmd/go/internal/modcmd/vendor.go +++ b/libgo/go/cmd/go/internal/modcmd/vendor.go @@ -11,10 +11,12 @@ import ( "io/ioutil" "os" "path/filepath" + "sort" "strings" "cmd/go/internal/base" "cmd/go/internal/cfg" + "cmd/go/internal/imports" "cmd/go/internal/modload" "cmd/go/internal/module" ) @@ -71,6 +73,7 @@ func runVendor(cmd *base.Command, args []string) { if cfg.BuildV { fmt.Fprintf(os.Stderr, "# %s %s%s\n", m.Path, m.Version, repl) } + sort.Strings(pkgs) for _, pkg := range pkgs { fmt.Fprintf(&buf, "%s\n", pkg) if cfg.BuildV { @@ -100,7 +103,7 @@ func vendorPkg(vdir, pkg string) { if src == "" { fmt.Fprintf(os.Stderr, "internal error: no pkg for %s -> %s\n", pkg, realPath) } - copyDir(dst, src, matchNonTest) + copyDir(dst, src, matchPotentialSourceFile) if m := modload.PackageModule(realPath); m.Path != "" { copyMetadata(m.Path, realPath, dst, src) } @@ -153,7 +156,7 @@ var metaPrefixes = []string{ } // matchMetadata reports whether info is a metadata file. -func matchMetadata(info os.FileInfo) bool { +func matchMetadata(dir string, info os.FileInfo) bool { name := info.Name() for _, p := range metaPrefixes { if strings.HasPrefix(name, p) { @@ -163,13 +166,34 @@ func matchMetadata(info os.FileInfo) bool { return false } -// matchNonTest reports whether info is any non-test file (including non-Go files). -func matchNonTest(info os.FileInfo) bool { - return !strings.HasSuffix(info.Name(), "_test.go") +// matchPotentialSourceFile reports whether info may be relevant to a build operation. +func matchPotentialSourceFile(dir string, info os.FileInfo) bool { + if strings.HasSuffix(info.Name(), "_test.go") { + return false + } + if strings.HasSuffix(info.Name(), ".go") { + f, err := os.Open(filepath.Join(dir, info.Name())) + if err != nil { + base.Fatalf("go mod vendor: %v", err) + } + defer f.Close() + + content, err := imports.ReadImports(f, false, nil) + if err == nil && !imports.ShouldBuild(content, imports.AnyTags()) { + // The file is explicitly tagged "ignore", so it can't affect the build. + // Leave it out. + return false + } + return true + } + + // We don't know anything about this file, so optimistically assume that it is + // needed. + return true } // copyDir copies all regular files satisfying match(info) from src to dst. -func copyDir(dst, src string, match func(os.FileInfo) bool) { +func copyDir(dst, src string, match func(dir string, info os.FileInfo) bool) { files, err := ioutil.ReadDir(src) if err != nil { base.Fatalf("go mod vendor: %v", err) @@ -178,7 +202,7 @@ func copyDir(dst, src string, match func(os.FileInfo) bool) { base.Fatalf("go mod vendor: %v", err) } for _, file := range files { - if file.IsDir() || !file.Mode().IsRegular() || !match(file) { + if file.IsDir() || !file.Mode().IsRegular() || !match(src, file) { continue } r, err := os.Open(filepath.Join(src, file.Name())) diff --git a/libgo/go/cmd/go/internal/modcmd/verify.go b/libgo/go/cmd/go/internal/modcmd/verify.go index 381c18d58f1..81fc44dc97a 100644 --- a/libgo/go/cmd/go/internal/modcmd/verify.go +++ b/libgo/go/cmd/go/internal/modcmd/verify.go @@ -6,6 +6,7 @@ package modcmd import ( "bytes" + "cmd/go/internal/cfg" "fmt" "io/ioutil" "os" @@ -36,6 +37,14 @@ func runVerify(cmd *base.Command, args []string) { // NOTE(rsc): Could take a module pattern. base.Fatalf("go mod verify: verify takes no arguments") } + // Checks go mod expected behavior + if !modload.Enabled() { + if cfg.Getenv("GO111MODULE") == "off" { + base.Fatalf("go: modules disabled by GO111MODULE=off; see 'go help modules'") + } else { + base.Fatalf("go: cannot find main module; see 'go help modules'") + } + } ok := true for _, mod := range modload.LoadBuildList()[1:] { ok = verifyMod(mod) && ok diff --git a/libgo/go/cmd/go/internal/modconv/convert.go b/libgo/go/cmd/go/internal/modconv/convert.go index 6fc6718e473..558664a8b38 100644 --- a/libgo/go/cmd/go/internal/modconv/convert.go +++ b/libgo/go/cmd/go/internal/modconv/convert.go @@ -41,19 +41,29 @@ func ConvertLegacyConfig(f *modfile.File, file string, data []byte) error { // Convert requirements block, which may use raw SHA1 hashes as versions, // to valid semver requirement list, respecting major versions. - var work par.Work + var ( + work par.Work + mu sync.Mutex + need = make(map[string]string) + replace = make(map[string]*modfile.Replace) + ) + + for _, r := range mf.Replace { + replace[r.New.Path] = r + replace[r.Old.Path] = r + } for _, r := range mf.Require { m := r.Mod if m.Path == "" { continue } + if re, ok := replace[m.Path]; ok { + work.Add(re.New) + continue + } work.Add(r.Mod) } - var ( - mu sync.Mutex - need = make(map[string]string) - ) work.Do(10, func(item interface{}) { r := item.(module.Version) repo, info, err := modfetch.ImportRepoRev(r.Path, r.Version) @@ -76,15 +86,15 @@ func ConvertLegacyConfig(f *modfile.File, file string, data []byte) error { } sort.Strings(paths) for _, path := range paths { + if re, ok := replace[path]; ok { + err := f.AddReplace(re.Old.Path, re.Old.Version, path, need[path]) + if err != nil { + return fmt.Errorf("add replace: %v", err) + } + } f.AddNewRequire(path, need[path], false) } - for _, r := range mf.Replace { - err := f.AddReplace(r.Old.Path, r.Old.Version, r.New.Path, r.New.Version) - if err != nil { - return fmt.Errorf("add replace: %v", err) - } - } f.Cleanup() return nil } diff --git a/libgo/go/cmd/go/internal/modconv/convert_test.go b/libgo/go/cmd/go/internal/modconv/convert_test.go index 4d55d73f214..8ff229bd148 100644 --- a/libgo/go/cmd/go/internal/modconv/convert_test.go +++ b/libgo/go/cmd/go/internal/modconv/convert_test.go @@ -28,6 +28,8 @@ func TestMain(m *testing.M) { } func testMain(m *testing.M) int { + cfg.GOPROXY = "direct" + if _, err := exec.LookPath("git"); err != nil { fmt.Fprintln(os.Stderr, "skipping because git binary not found") fmt.Println("PASS") @@ -104,11 +106,11 @@ func TestConvertLegacyConfig(t *testing.T) { github.com/AdRoll/goamz v0.0.0-20150130162828-d3664b76d905 github.com/MSOpenTech/azure-sdk-for-go v0.0.0-20150323223030-d90753bcad2e github.com/Sirupsen/logrus v0.7.3 - github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd + github.com/bugsnag/bugsnag-go v1.0.3-0.20141110184014-b1d153021fcd github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b github.com/bugsnag/panicwrap v0.0.0-20141110184334-e5f9854865b9 - github.com/codegangsta/cli v0.0.0-20150131031259-6086d7927ec3 - github.com/docker/docker v0.0.0-20150204013315-165ea5c158cf + github.com/codegangsta/cli v1.4.2-0.20150131031259-6086d7927ec3 + github.com/docker/docker v1.4.2-0.20150204013315-165ea5c158cf github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7 github.com/gorilla/context v0.0.0-20140604161150-14f550f51af5 @@ -116,7 +118,7 @@ func TestConvertLegacyConfig(t *testing.T) { github.com/gorilla/mux v0.0.0-20140926153814-e444e69cbd2e github.com/jlhawn/go-crypto v0.0.0-20150401213827-cd738dde20f0 github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43 - github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50 + github.com/yvasiyarov/gorelic v0.0.7-0.20141212073537-a9bba5b9ab50 github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f golang.org/x/net v0.0.0-20150202051010-1dfe7915deaf gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789 @@ -126,7 +128,7 @@ func TestConvertLegacyConfig(t *testing.T) { { // golang.org/issue/24585 - confusion about v2.0.0 tag in legacy non-v2 module - "github.com/fishy/gcsbucket", "v0.0.0-20150410205453-618d60fe84e0", + "github.com/fishy/gcsbucket", "v0.0.0-20180217031846-618d60fe84e0", `module github.com/fishy/gcsbucket require ( @@ -136,7 +138,7 @@ func TestConvertLegacyConfig(t *testing.T) { github.com/googleapis/gax-go v2.0.0+incompatible golang.org/x/net v0.0.0-20180216171745-136a25c244d3 golang.org/x/oauth2 v0.0.0-20180207181906-543e37812f10 - golang.org/x/text v0.0.0-20180208041248-4e4a3210bb54 + golang.org/x/text v0.3.1-0.20180208041248-4e4a3210bb54 google.golang.org/api v0.0.0-20180217000815-c7a403bb5fe1 google.golang.org/appengine v1.0.0 google.golang.org/genproto v0.0.0-20180206005123-2b5a72b8730b diff --git a/libgo/go/cmd/go/internal/modconv/dep.go b/libgo/go/cmd/go/internal/modconv/dep.go index 690c206a136..ccd1fc7b759 100644 --- a/libgo/go/cmd/go/internal/modconv/dep.go +++ b/libgo/go/cmd/go/internal/modconv/dep.go @@ -6,6 +6,9 @@ package modconv import ( "fmt" + "internal/lazyregexp" + "net/url" + "path" "strconv" "strings" @@ -15,9 +18,14 @@ import ( ) func ParseGopkgLock(file string, data []byte) (*modfile.File, error) { + type pkg struct { + Path string + Version string + Source string + } mf := new(modfile.File) - var list []module.Version - var r *module.Version + var list []pkg + var r *pkg for lineno, line := range strings.Split(string(data), "\n") { lineno++ if i := strings.Index(line, "#"); i >= 0 { @@ -25,7 +33,7 @@ func ParseGopkgLock(file string, data []byte) (*modfile.File, error) { } line = strings.TrimSpace(line) if line == "[[projects]]" { - list = append(list, module.Version{}) + list = append(list, pkg{}) r = &list[len(list)-1] continue } @@ -52,6 +60,8 @@ func ParseGopkgLock(file string, data []byte) (*modfile.File, error) { switch key { case "name": r.Path = val + case "source": + r.Source = val case "revision", "version": // Note: key "version" should take priority over "revision", // and it does, because dep writes toml keys in alphabetical order, @@ -68,7 +78,55 @@ func ParseGopkgLock(file string, data []byte) (*modfile.File, error) { if r.Path == "" || r.Version == "" { return nil, fmt.Errorf("%s: empty [[projects]] stanza (%s)", file, r.Path) } - mf.Require = append(mf.Require, &modfile.Require{Mod: r}) + mf.Require = append(mf.Require, &modfile.Require{Mod: module.Version{Path: r.Path, Version: r.Version}}) + + if r.Source != "" { + // Convert "source" to import path, such as + // git@test.com:x/y.git and https://test.com/x/y.git. + // We get "test.com/x/y" at last. + source, err := decodeSource(r.Source) + if err != nil { + return nil, err + } + old := module.Version{Path: r.Path, Version: r.Version} + new := module.Version{Path: source, Version: r.Version} + mf.Replace = append(mf.Replace, &modfile.Replace{Old: old, New: new}) + } } return mf, nil } + +var scpSyntaxReg = lazyregexp.New(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`) + +func decodeSource(source string) (string, error) { + var u *url.URL + var p string + if m := scpSyntaxReg.FindStringSubmatch(source); m != nil { + // Match SCP-like syntax and convert it to a URL. + // Eg, "git@github.com:user/repo" becomes + // "ssh://git@github.com/user/repo". + u = &url.URL{ + Scheme: "ssh", + User: url.User(m[1]), + Host: m[2], + Path: "/" + m[3], + } + } else { + var err error + u, err = url.Parse(source) + if err != nil { + return "", fmt.Errorf("%q is not a valid URI", source) + } + } + + // If no scheme was passed, then the entire path will have been put into + // u.Path. Either way, construct the normalized path correctly. + if u.Host == "" { + p = source + } else { + p = path.Join(u.Host, u.Path) + } + p = strings.TrimSuffix(p, ".git") + p = strings.TrimSuffix(p, ".hg") + return p, nil +} diff --git a/libgo/go/cmd/go/internal/modconv/glide.go b/libgo/go/cmd/go/internal/modconv/glide.go index 3bc675fcc0e..18ab57814de 100644 --- a/libgo/go/cmd/go/internal/modconv/glide.go +++ b/libgo/go/cmd/go/internal/modconv/glide.go @@ -15,8 +15,7 @@ func ParseGlideLock(file string, data []byte) (*modfile.File, error) { mf := new(modfile.File) imports := false name := "" - for lineno, line := range strings.Split(string(data), "\n") { - lineno++ + for _, line := range strings.Split(string(data), "\n") { if line == "" { continue } diff --git a/libgo/go/cmd/go/internal/modconv/glock.go b/libgo/go/cmd/go/internal/modconv/glock.go index 1b786a939c7..164a8e70d99 100644 --- a/libgo/go/cmd/go/internal/modconv/glock.go +++ b/libgo/go/cmd/go/internal/modconv/glock.go @@ -13,8 +13,7 @@ import ( func ParseGLOCKFILE(file string, data []byte) (*modfile.File, error) { mf := new(modfile.File) - for lineno, line := range strings.Split(string(data), "\n") { - lineno++ + for _, line := range strings.Split(string(data), "\n") { f := strings.Fields(line) if len(f) >= 2 && f[0] != "cmd" { mf.Require = append(mf.Require, &modfile.Require{Mod: module.Version{Path: f[0], Version: f[1]}}) diff --git a/libgo/go/cmd/go/internal/modconv/modconv_test.go b/libgo/go/cmd/go/internal/modconv/modconv_test.go index 353161bc5a3..ccc4f3d576f 100644 --- a/libgo/go/cmd/go/internal/modconv/modconv_test.go +++ b/libgo/go/cmd/go/internal/modconv/modconv_test.go @@ -58,6 +58,9 @@ func Test(t *testing.T) { for _, r := range out.Require { fmt.Fprintf(&buf, "%s %s\n", r.Mod.Path, r.Mod.Version) } + for _, r := range out.Replace { + fmt.Fprintf(&buf, "replace: %s %s %s %s\n", r.Old.Path, r.Old.Version, r.New.Path, r.New.Version) + } if !bytes.Equal(buf.Bytes(), want) { t.Errorf("have:\n%s\nwant:\n%s", buf.Bytes(), want) } diff --git a/libgo/go/cmd/go/internal/modconv/tsv.go b/libgo/go/cmd/go/internal/modconv/tsv.go index feba181e052..106cddedd39 100644 --- a/libgo/go/cmd/go/internal/modconv/tsv.go +++ b/libgo/go/cmd/go/internal/modconv/tsv.go @@ -13,8 +13,7 @@ import ( func ParseDependenciesTSV(file string, data []byte) (*modfile.File, error) { mf := new(modfile.File) - for lineno, line := range strings.Split(string(data), "\n") { - lineno++ + for _, line := range strings.Split(string(data), "\n") { f := strings.Split(line, "\t") if len(f) >= 3 { mf.Require = append(mf.Require, &modfile.Require{Mod: module.Version{Path: f[0], Version: f[2]}}) diff --git a/libgo/go/cmd/go/internal/modconv/vconf.go b/libgo/go/cmd/go/internal/modconv/vconf.go index a9a8e62518f..f62eba77621 100644 --- a/libgo/go/cmd/go/internal/modconv/vconf.go +++ b/libgo/go/cmd/go/internal/modconv/vconf.go @@ -13,8 +13,7 @@ import ( func ParseVendorConf(file string, data []byte) (*modfile.File, error) { mf := new(modfile.File) - for lineno, line := range strings.Split(string(data), "\n") { - lineno++ + for _, line := range strings.Split(string(data), "\n") { if i := strings.Index(line, "#"); i >= 0 { line = line[:i] } diff --git a/libgo/go/cmd/go/internal/modconv/vyml.go b/libgo/go/cmd/go/internal/modconv/vyml.go index 0f017a3c7a6..8a06519932c 100644 --- a/libgo/go/cmd/go/internal/modconv/vyml.go +++ b/libgo/go/cmd/go/internal/modconv/vyml.go @@ -15,8 +15,7 @@ func ParseVendorYML(file string, data []byte) (*modfile.File, error) { mf := new(modfile.File) vendors := false path := "" - for lineno, line := range strings.Split(string(data), "\n") { - lineno++ + for _, line := range strings.Split(string(data), "\n") { if line == "" { continue } diff --git a/libgo/go/cmd/go/internal/modfetch/bootstrap.go b/libgo/go/cmd/go/internal/modfetch/bootstrap.go new file mode 100644 index 00000000000..8f31589ebfc --- /dev/null +++ b/libgo/go/cmd/go/internal/modfetch/bootstrap.go @@ -0,0 +1,17 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build cmd_go_bootstrap + +package modfetch + +import "cmd/go/internal/module" + +func useSumDB(mod module.Version) bool { + return false +} + +func lookupSumDB(mod module.Version) (string, []string, error) { + panic("bootstrap") +} diff --git a/libgo/go/cmd/go/internal/modfetch/cache.go b/libgo/go/cmd/go/internal/modfetch/cache.go index 1ccd43dc2ae..c0062809d17 100644 --- a/libgo/go/cmd/go/internal/modfetch/cache.go +++ b/libgo/go/cmd/go/internal/modfetch/cache.go @@ -15,6 +15,7 @@ import ( "strings" "cmd/go/internal/base" + "cmd/go/internal/cfg" "cmd/go/internal/lockedfile" "cmd/go/internal/modfetch/codehost" "cmd/go/internal/module" @@ -215,29 +216,21 @@ func (r *cachingRepo) Latest() (*RevInfo, error) { return &info, nil } -func (r *cachingRepo) GoMod(rev string) ([]byte, error) { +func (r *cachingRepo) GoMod(version string) ([]byte, error) { type cached struct { text []byte err error } - c := r.cache.Do("gomod:"+rev, func() interface{} { - file, text, err := readDiskGoMod(r.path, rev) + c := r.cache.Do("gomod:"+version, func() interface{} { + file, text, err := readDiskGoMod(r.path, version) if err == nil { // Note: readDiskGoMod already called checkGoMod. return cached{text, nil} } - // Convert rev to canonical version - // so that we use the right identifier in the go.sum check. - info, err := r.Stat(rev) - if err != nil { - return cached{nil, err} - } - rev = info.Version - - text, err = r.r.GoMod(rev) + text, err = r.r.GoMod(version) if err == nil { - checkGoMod(r.path, rev, text) + checkGoMod(r.path, version, text) if err := writeDiskGoMod(file, text); err != nil { fmt.Fprintf(os.Stderr, "go: writing go.mod cache: %v\n", err) } @@ -258,12 +251,12 @@ func (r *cachingRepo) Zip(dst io.Writer, version string) error { // Stat is like Lookup(path).Stat(rev) but avoids the // repository path resolution in Lookup if the result is // already cached on local disk. -func Stat(path, rev string) (*RevInfo, error) { +func Stat(proxy, path, rev string) (*RevInfo, error) { _, info, err := readDiskStat(path, rev) if err == nil { return info, nil } - repo, err := Lookup(path) + repo, err := Lookup(proxy, path) if err != nil { return nil, err } @@ -276,9 +269,22 @@ func InfoFile(path, version string) (string, error) { if !semver.IsValid(version) { return "", fmt.Errorf("invalid version %q", version) } - if _, err := Stat(path, version); err != nil { + + if file, _, err := readDiskStat(path, version); err == nil { + return file, nil + } + + err := TryProxies(func(proxy string) error { + repo, err := Lookup(proxy, path) + if err == nil { + _, err = repo.Stat(version) + } + return err + }) + if err != nil { return "", err } + // Stat should have populated the disk cache for us. file, _, err := readDiskStat(path, version) if err != nil { @@ -294,21 +300,39 @@ func GoMod(path, rev string) ([]byte, error) { // Convert commit hash to pseudo-version // to increase cache hit rate. if !semver.IsValid(rev) { - info, err := Stat(path, rev) - if err != nil { - return nil, err + if _, info, err := readDiskStat(path, rev); err == nil { + rev = info.Version + } else { + err := TryProxies(func(proxy string) error { + repo, err := Lookup(proxy, path) + if err != nil { + return err + } + info, err := repo.Stat(rev) + if err == nil { + rev = info.Version + } + return err + }) + if err != nil { + return nil, err + } } - rev = info.Version } + _, data, err := readDiskGoMod(path, rev) if err == nil { return data, nil } - repo, err := Lookup(path) - if err != nil { - return nil, err - } - return repo.GoMod(rev) + + err = TryProxies(func(proxy string) error { + repo, err := Lookup(proxy, path) + if err == nil { + data, err = repo.GoMod(rev) + } + return err + }) + return data, err } // GoModFile is like GoMod but returns the name of the file containing @@ -354,8 +378,29 @@ var errNotCached = fmt.Errorf("not in cache") func readDiskStat(path, rev string) (file string, info *RevInfo, err error) { file, data, err := readDiskCache(path, rev, "info") if err != nil { - if file, info, err := readDiskStatByHash(path, rev); err == nil { - return file, info, nil + // If the cache already contains a pseudo-version with the given hash, we + // would previously return that pseudo-version without checking upstream. + // However, that produced an unfortunate side-effect: if the author added a + // tag to the repository, 'go get' would not pick up the effect of that new + // tag on the existing commits, and 'go' commands that referred to those + // commits would use the previous name instead of the new one. + // + // That's especially problematic if the original pseudo-version starts with + // v0.0.0-, as was the case for all pseudo-versions during vgo development, + // since a v0.0.0- pseudo-version has lower precedence than pretty much any + // tagged version. + // + // In practice, we're only looking up by hash during initial conversion of a + // legacy config and during an explicit 'go get', and a little extra latency + // for those operations seems worth the benefit of picking up more accurate + // versions. + // + // Fall back to this resolution scheme only if the GOPROXY setting prohibits + // us from resolving upstream tags. + if cfg.GOPROXY == "off" { + if file, info, err := readDiskStatByHash(path, rev); err == nil { + return file, info, nil + } } return file, nil, err } @@ -405,13 +450,23 @@ func readDiskStatByHash(path, rev string) (file string, info *RevInfo, err error if err != nil { return "", nil, errNotCached } + + // A given commit hash may map to more than one pseudo-version, + // depending on which tags are present on the repository. + // Take the highest such version. + var maxVersion string suffix := "-" + rev + ".info" + err = errNotCached for _, name := range names { - if strings.HasSuffix(name, suffix) && IsPseudoVersion(strings.TrimSuffix(name, ".info")) { - return readDiskStat(path, strings.TrimSuffix(name, ".info")) + if strings.HasSuffix(name, suffix) { + v := strings.TrimSuffix(name, ".info") + if IsPseudoVersion(v) && semver.Max(maxVersion, v) == v { + maxVersion = v + file, info, err = readDiskStat(path, strings.TrimSuffix(name, ".info")) + } } } - return "", nil, errNotCached + return file, info, err } // oldVgoPrefix is the prefix in the old auto-generated cached go.mod files. @@ -451,7 +506,7 @@ func readDiskCache(path, rev, suffix string) (file string, data []byte, err erro if err != nil { return "", nil, errNotCached } - data, err = ioutil.ReadFile(file) + data, err = renameio.ReadFile(file) if err != nil { return file, nil, errNotCached } @@ -488,7 +543,7 @@ func writeDiskCache(file string, data []byte) error { return err } - if err := renameio.WriteFile(file, data); err != nil { + if err := renameio.WriteFile(file, data, 0666); err != nil { return err } @@ -545,12 +600,12 @@ func rewriteVersionList(dir string) { buf.WriteString(v) buf.WriteString("\n") } - old, _ := ioutil.ReadFile(listFile) + old, _ := renameio.ReadFile(listFile) if bytes.Equal(buf.Bytes(), old) { return } - if err := renameio.WriteFile(listFile, buf.Bytes()); err != nil { + if err := renameio.WriteFile(listFile, buf.Bytes(), 0666); err != nil { base.Fatalf("go: failed to write version list: %v", err) } } diff --git a/libgo/go/cmd/go/internal/modfetch/codehost/codehost.go b/libgo/go/cmd/go/internal/modfetch/codehost/codehost.go index 6c17f7886f1..a4e50d692a3 100644 --- a/libgo/go/cmd/go/internal/modfetch/codehost/codehost.go +++ b/libgo/go/cmd/go/internal/modfetch/codehost/codehost.go @@ -79,14 +79,16 @@ type Repo interface { // nested in a single top-level directory, whose name is not specified. ReadZip(rev, subdir string, maxSize int64) (zip io.ReadCloser, actualSubdir string, err error) - // RecentTag returns the most recent tag at or before the given rev - // with the given prefix. It should make a best-effort attempt to - // find a tag that is a valid semantic version (following the prefix), - // or else the result is not useful to the caller, but it need not - // incur great expense in doing so. For example, the git implementation - // of RecentTag limits git's search to tags matching the glob expression - // "v[0-9]*.[0-9]*.[0-9]*" (after the prefix). - RecentTag(rev, prefix string) (tag string, err error) + // RecentTag returns the most recent tag on rev or one of its predecessors + // with the given prefix and major version. + // An empty major string matches any major version. + RecentTag(rev, prefix, major string) (tag string, err error) + + // DescendsFrom reports whether rev or any of its ancestors has the given tag. + // + // DescendsFrom must return true for any tag returned by RecentTag for the + // same revision. + DescendsFrom(rev, tag string) (bool, error) } // A Rev describes a single revision in a source code repository. @@ -105,6 +107,32 @@ type FileRev struct { Err error // error if any; os.IsNotExist(Err)==true if rev exists but file does not exist in that rev } +// UnknownRevisionError is an error equivalent to os.ErrNotExist, but for a +// revision rather than a file. +type UnknownRevisionError struct { + Rev string +} + +func (e *UnknownRevisionError) Error() string { + return "unknown revision " + e.Rev +} +func (UnknownRevisionError) Is(err error) bool { + return err == os.ErrNotExist +} + +// ErrNoCommits is an error equivalent to os.ErrNotExist indicating that a given +// repository or module contains no commits. +var ErrNoCommits error = noCommitsError{} + +type noCommitsError struct{} + +func (noCommitsError) Error() string { + return "no commits" +} +func (noCommitsError) Is(err error) bool { + return err == os.ErrNotExist +} + // AllHex reports whether the revision rev is entirely lower-case hexadecimal digits. func AllHex(rev string) bool { for i := 0; i < len(rev); i++ { diff --git a/libgo/go/cmd/go/internal/modfetch/codehost/git.go b/libgo/go/cmd/go/internal/modfetch/codehost/git.go index 588e7496cc5..d382e8ac9a9 100644 --- a/libgo/go/cmd/go/internal/modfetch/codehost/git.go +++ b/libgo/go/cmd/go/internal/modfetch/codehost/git.go @@ -10,6 +10,7 @@ import ( "io" "io/ioutil" "os" + "os/exec" "path/filepath" "sort" "strconv" @@ -19,6 +20,7 @@ import ( "cmd/go/internal/lockedfile" "cmd/go/internal/par" + "cmd/go/internal/semver" ) // GitRepo returns the code repository at the given Git remote reference. @@ -32,7 +34,7 @@ func LocalGitRepo(remote string) (Repo, error) { return newGitRepoCached(remote, true) } -const gitWorkDirType = "git2" +const gitWorkDirType = "git3" var gitRepoCache par.Cache @@ -79,7 +81,7 @@ func newGitRepo(remote string, localOK bool) (Repo, error) { // but this lets us say git fetch origin instead, which // is a little nicer. More importantly, using a named remote // avoids a problem with Git LFS. See golang.org/issue/25605. - if _, err := Run(r.dir, "git", "remote", "add", "origin", r.remote); err != nil { + if _, err := Run(r.dir, "git", "remote", "add", "origin", "--", r.remote); err != nil { os.RemoveAll(r.dir) return nil, err } @@ -122,8 +124,10 @@ type gitRepo struct { statCache par.Cache refsOnce sync.Once - refs map[string]string - refsErr error + // refs maps branch and tag refs (e.g., "HEAD", "refs/heads/master") + // to commits (e.g., "37ffd2e798afde829a34e8955b716ab730b2a6d6") + refs map[string]string + refsErr error localTagsOnce sync.Once localTags map[string]bool @@ -166,7 +170,7 @@ func (r *gitRepo) loadRefs() { if err != nil { if rerr, ok := err.(*RunError); ok { if bytes.Contains(rerr.Stderr, []byte("fatal: could not read Username")) { - rerr.HelpText = "If this is a private repository, see https://golang.org/doc/faq#git_https for additional information." + rerr.HelpText = "Confirm the import path was entered correctly.\nIf this is a private repository, see https://golang.org/doc/faq#git_https for additional information." } } r.refsErr = err @@ -218,7 +222,7 @@ func (r *gitRepo) Latest() (*RevInfo, error) { return nil, r.refsErr } if r.refs["HEAD"] == "" { - return nil, fmt.Errorf("no commits") + return nil, ErrNoCommits } return r.Stat(r.refs["HEAD"]) } @@ -315,7 +319,7 @@ func (r *gitRepo) stat(rev string) (*RevInfo, error) { hash = rev } } else { - return nil, fmt.Errorf("unknown revision %s", rev) + return nil, &UnknownRevisionError{Rev: rev} } // Protect r.fetchLevel and the "fetch more and more" sequence. @@ -339,8 +343,14 @@ func (r *gitRepo) stat(rev string) (*RevInfo, error) { } } - // If we know a specific commit we need, fetch it. - if r.fetchLevel <= fetchSome && hash != "" && !r.local { + // If we know a specific commit we need and its ref, fetch it. + // We do NOT fetch arbitrary hashes (when we don't know the ref) + // because we want to avoid ever importing a commit that isn't + // reachable from refs/tags/* or refs/heads/* or HEAD. + // Both Gerrit and GitHub expose every CL/PR as a named ref, + // and we don't want those commits masquerading as being real + // pseudo-versions in the main repo. + if r.fetchLevel <= fetchSome && ref != "" && hash != "" && !r.local { r.fetchLevel = fetchSome var refspec string if ref != "" && ref != "HEAD" { @@ -369,17 +379,30 @@ func (r *gitRepo) stat(rev string) (*RevInfo, error) { // Last resort. // Fetch all heads and tags and hope the hash we want is in the history. + if err := r.fetchRefsLocked(); err != nil { + return nil, err + } + + return r.statLocal(rev, rev) +} + +// fetchRefsLocked fetches all heads and tags from the origin, along with the +// ancestors of those commits. +// +// We only fetch heads and tags, not arbitrary other commits: we don't want to +// pull in off-branch commits (such as rejected GitHub pull requests) that the +// server may be willing to provide. (See the comments within the stat method +// for more detail.) +// +// fetchRefsLocked requires that r.mu remain locked for the duration of the call. +func (r *gitRepo) fetchRefsLocked() error { if r.fetchLevel < fetchAll { - // TODO(bcmills): should we wait to upgrade fetchLevel until after we check - // err? If there is a temporary server error, we want subsequent fetches to - // try again instead of proceeding with an incomplete repo. - r.fetchLevel = fetchAll if err := r.fetchUnshallow("refs/heads/*:refs/heads/*", "refs/tags/*:refs/tags/*"); err != nil { - return nil, err + return err } + r.fetchLevel = fetchAll } - - return r.statLocal(rev, rev) + return nil } func (r *gitRepo) fetchUnshallow(refSpecs ...string) error { @@ -400,9 +423,9 @@ func (r *gitRepo) fetchUnshallow(refSpecs ...string) error { // statLocal returns a RevInfo describing rev in the local git repository. // It uses version as info.Version. func (r *gitRepo) statLocal(version, rev string) (*RevInfo, error) { - out, err := Run(r.dir, "git", "-c", "log.showsignature=false", "log", "-n1", "--format=format:%H %ct %D", rev) + out, err := Run(r.dir, "git", "-c", "log.showsignature=false", "log", "-n1", "--format=format:%H %ct %D", rev, "--") if err != nil { - return nil, fmt.Errorf("unknown revision %s", rev) + return nil, &UnknownRevisionError{Rev: rev} } f := strings.Fields(string(out)) if len(f) < 2 { @@ -639,23 +662,48 @@ func (r *gitRepo) readFileRevs(tags []string, file string, fileMap map[string]*F return missing, nil } -func (r *gitRepo) RecentTag(rev, prefix string) (tag string, err error) { +func (r *gitRepo) RecentTag(rev, prefix, major string) (tag string, err error) { info, err := r.Stat(rev) if err != nil { return "", err } rev = info.Name // expand hash prefixes - // describe sets tag and err using 'git describe' and reports whether the + // describe sets tag and err using 'git for-each-ref' and reports whether the // result is definitive. describe := func() (definitive bool) { var out []byte - out, err = Run(r.dir, "git", "describe", "--first-parent", "--always", "--abbrev=0", "--match", prefix+"v[0-9]*.[0-9]*.[0-9]*", "--tags", rev) + out, err = Run(r.dir, "git", "for-each-ref", "--format", "%(refname)", "refs/tags", "--merged", rev) if err != nil { - return true // Because we use "--always", describe should never fail. + return true + } + + // prefixed tags aren't valid semver tags so compare without prefix, but only tags with correct prefix + var highest string + for _, line := range strings.Split(string(out), "\n") { + line = strings.TrimSpace(line) + // git do support lstrip in for-each-ref format, but it was added in v2.13.0. Stripping here + // instead gives support for git v2.7.0. + if !strings.HasPrefix(line, "refs/tags/") { + continue + } + line = line[len("refs/tags/"):] + + if !strings.HasPrefix(line, prefix) { + continue + } + + semtag := line[len(prefix):] + // Consider only tags that are valid and complete (not just major.minor prefixes). + if c := semver.Canonical(semtag); c != "" && strings.HasPrefix(semtag, c) && (major == "" || semver.Major(c) == major) { + highest = semver.Max(highest, semtag) + } + } + + if highest != "" { + tag = prefix + highest } - tag = string(bytes.TrimSpace(out)) return tag != "" && !AllHex(tag) } @@ -682,12 +730,8 @@ func (r *gitRepo) RecentTag(rev, prefix string) (tag string, err error) { } defer unlock() - if r.fetchLevel < fetchAll { - // Fetch all heads and tags and see if that gives us enough history. - if err := r.fetchUnshallow("refs/heads/*:refs/heads/*", "refs/tags/*:refs/tags/*"); err != nil { - return "", err - } - r.fetchLevel = fetchAll + if err := r.fetchRefsLocked(); err != nil { + return "", err } // If we've reached this point, we have all of the commits that are reachable @@ -704,6 +748,67 @@ func (r *gitRepo) RecentTag(rev, prefix string) (tag string, err error) { return tag, err } +func (r *gitRepo) DescendsFrom(rev, tag string) (bool, error) { + // The "--is-ancestor" flag was added to "git merge-base" in version 1.8.0, so + // this won't work with Git 1.7.1. According to golang.org/issue/28550, cmd/go + // already doesn't work with Git 1.7.1, so at least it's not a regression. + // + // git merge-base --is-ancestor exits with status 0 if rev is an ancestor, or + // 1 if not. + _, err := Run(r.dir, "git", "merge-base", "--is-ancestor", "--", tag, rev) + + // Git reports "is an ancestor" with exit code 0 and "not an ancestor" with + // exit code 1. + // Unfortunately, if we've already fetched rev with a shallow history, git + // merge-base has been observed to report a false-negative, so don't stop yet + // even if the exit code is 1! + if err == nil { + return true, nil + } + + // See whether the tag and rev even exist. + tags, err := r.Tags(tag) + if err != nil { + return false, err + } + if len(tags) == 0 { + return false, nil + } + + // NOTE: r.stat is very careful not to fetch commits that we shouldn't know + // about, like rejected GitHub pull requests, so don't try to short-circuit + // that here. + if _, err = r.stat(rev); err != nil { + return false, err + } + + // Now fetch history so that git can search for a path. + unlock, err := r.mu.Lock() + if err != nil { + return false, err + } + defer unlock() + + if r.fetchLevel < fetchAll { + // Fetch the complete history for all refs and heads. It would be more + // efficient to only fetch the history from rev to tag, but that's much more + // complicated, and any kind of shallow fetch is fairly likely to trigger + // bugs in JGit servers and/or the go command anyway. + if err := r.fetchRefsLocked(); err != nil { + return false, err + } + } + + _, err = Run(r.dir, "git", "merge-base", "--is-ancestor", "--", tag, rev) + if err == nil { + return true, nil + } + if ee, ok := err.(*RunError).Err.(*exec.ExitError); ok && ee.ExitCode() == 1 { + return false, nil + } + return false, err +} + func (r *gitRepo) ReadZip(rev, subdir string, maxSize int64) (zip io.ReadCloser, actualSubdir string, err error) { // TODO: Use maxSize or drop it. args := []string{} diff --git a/libgo/go/cmd/go/internal/modfetch/codehost/vcs.go b/libgo/go/cmd/go/internal/modfetch/codehost/vcs.go index 59c2b15d19a..b1845f5c650 100644 --- a/libgo/go/cmd/go/internal/modfetch/codehost/vcs.go +++ b/libgo/go/cmd/go/internal/modfetch/codehost/vcs.go @@ -7,11 +7,11 @@ package codehost import ( "encoding/xml" "fmt" + "internal/lazyregexp" "io" "io/ioutil" "os" "path/filepath" - "regexp" "sort" "strconv" "strings" @@ -29,8 +29,9 @@ import ( // The caller should report this error instead of continuing to probe // other possible module paths. // -// TODO(bcmills): See if we can invert this. (Return a distinguished error for -// “repo not found” and treat everything else as terminal.) +// TODO(golang.org/issue/31730): See if we can invert this. (Return a +// distinguished error for “repo not found” and treat everything else +// as terminal.) type VCSError struct { Err error } @@ -124,10 +125,10 @@ type vcsCmd struct { vcs string // vcs name "hg" init func(remote string) []string // cmd to init repo to track remote tags func(remote string) []string // cmd to list local tags - tagRE *regexp.Regexp // regexp to extract tag names from output of tags cmd + tagRE *lazyregexp.Regexp // regexp to extract tag names from output of tags cmd branches func(remote string) []string // cmd to list local branches - branchRE *regexp.Regexp // regexp to extract branch names from output of tags cmd - badLocalRevRE *regexp.Regexp // regexp of names that must not be served out of local cache without doing fetch first + branchRE *lazyregexp.Regexp // regexp to extract branch names from output of tags cmd + badLocalRevRE *lazyregexp.Regexp // regexp of names that must not be served out of local cache without doing fetch first statLocal func(rev, remote string) []string // cmd to stat local rev parseStat func(rev, out string) (*RevInfo, error) // cmd to parse output of statLocal fetch []string // cmd to fetch everything from remote @@ -136,13 +137,13 @@ type vcsCmd struct { readZip func(rev, subdir, remote, target string) []string // cmd to read rev's subdir as zip file } -var re = regexp.MustCompile +var re = lazyregexp.New var vcsCmds = map[string]*vcsCmd{ "hg": { vcs: "hg", init: func(remote string) []string { - return []string{"hg", "clone", "-U", remote, "."} + return []string{"hg", "clone", "-U", "--", remote, "."} }, tags: func(remote string) []string { return []string{"hg", "tags", "-q"} @@ -167,7 +168,7 @@ var vcsCmds = map[string]*vcsCmd{ if subdir != "" { pattern = []string{"-I", subdir + "/**"} } - return str.StringList("hg", "archive", "-t", "zip", "--no-decode", "-r", rev, "--prefix=prefix/", pattern, target) + return str.StringList("hg", "archive", "-t", "zip", "--no-decode", "-r", rev, "--prefix=prefix/", pattern, "--", target) }, }, @@ -175,7 +176,7 @@ var vcsCmds = map[string]*vcsCmd{ vcs: "svn", init: nil, // no local checkout tags: func(remote string) []string { - return []string{"svn", "list", strings.TrimSuffix(remote, "/trunk") + "/tags"} + return []string{"svn", "list", "--", strings.TrimSuffix(remote, "/trunk") + "/tags"} }, tagRE: re(`(?m)^(.*?)/?$`), statLocal: func(rev, remote string) []string { @@ -183,12 +184,12 @@ var vcsCmds = map[string]*vcsCmd{ if rev == "latest" { suffix = "" } - return []string{"svn", "log", "-l1", "--xml", remote + suffix} + return []string{"svn", "log", "-l1", "--xml", "--", remote + suffix} }, parseStat: svnParseStat, latest: "latest", readFile: func(rev, file, remote string) []string { - return []string{"svn", "cat", remote + "/" + file + "@" + rev} + return []string{"svn", "cat", "--", remote + "/" + file + "@" + rev} }, // TODO: zip }, @@ -196,7 +197,7 @@ var vcsCmds = map[string]*vcsCmd{ "bzr": { vcs: "bzr", init: func(remote string) []string { - return []string{"bzr", "branch", "--use-existing-dir", remote, "."} + return []string{"bzr", "branch", "--use-existing-dir", "--", remote, "."} }, fetch: []string{ "bzr", "pull", "--overwrite-tags", @@ -219,14 +220,14 @@ var vcsCmds = map[string]*vcsCmd{ if subdir != "" { extra = []string{"./" + subdir} } - return str.StringList("bzr", "export", "--format=zip", "-r", rev, "--root=prefix/", target, extra) + return str.StringList("bzr", "export", "--format=zip", "-r", rev, "--root=prefix/", "--", target, extra) }, }, "fossil": { vcs: "fossil", init: func(remote string) []string { - return []string{"fossil", "clone", remote, ".fossil"} + return []string{"fossil", "clone", "--", remote, ".fossil"} }, fetch: []string{"fossil", "pull", "-R", ".fossil"}, tags: func(remote string) []string { @@ -248,7 +249,7 @@ var vcsCmds = map[string]*vcsCmd{ } // Note that vcsRepo.ReadZip below rewrites this command // to run in a different directory, to work around a fossil bug. - return str.StringList("fossil", "zip", "-R", ".fossil", "--name", "prefix", extra, rev, target) + return str.StringList("fossil", "zip", "-R", ".fossil", "--name", "prefix", extra, "--", rev, target) }, }, } @@ -346,7 +347,7 @@ func (r *vcsRepo) fetch() { func (r *vcsRepo) statLocal(rev string) (*RevInfo, error) { out, err := Run(r.dir, r.cmd.statLocal(rev, r.remote)) if err != nil { - return nil, vcsErrorf("unknown revision %s", rev) + return nil, &UnknownRevisionError{Rev: rev} } return r.cmd.parseStat(rev, string(out)) } @@ -391,7 +392,7 @@ func (r *vcsRepo) ReadFileRevs(revs []string, file string, maxSize int64) (map[s return nil, vcsErrorf("ReadFileRevs not implemented") } -func (r *vcsRepo) RecentTag(rev, prefix string) (tag string, err error) { +func (r *vcsRepo) RecentTag(rev, prefix, major string) (tag string, err error) { // We don't technically need to lock here since we're returning an error // uncondititonally, but doing so anyway will help to avoid baking in // lock-inversion bugs. @@ -404,6 +405,16 @@ func (r *vcsRepo) RecentTag(rev, prefix string) (tag string, err error) { return "", vcsErrorf("RecentTag not implemented") } +func (r *vcsRepo) DescendsFrom(rev, tag string) (bool, error) { + unlock, err := r.mu.Lock() + if err != nil { + return false, err + } + defer unlock() + + return false, vcsErrorf("DescendsFrom not implemented") +} + func (r *vcsRepo) ReadZip(rev, subdir string, maxSize int64) (zip io.ReadCloser, actualSubdir string, err error) { if r.cmd.readZip == nil { return nil, "", vcsErrorf("ReadZip not implemented for %s", r.cmd.vcs) diff --git a/libgo/go/cmd/go/internal/modfetch/coderepo.go b/libgo/go/cmd/go/internal/modfetch/coderepo.go index da9f63fec9c..267b76349dd 100644 --- a/libgo/go/cmd/go/internal/modfetch/coderepo.go +++ b/libgo/go/cmd/go/internal/modfetch/coderepo.go @@ -6,12 +6,14 @@ package modfetch import ( "archive/zip" + "errors" "fmt" "io" "io/ioutil" "os" "path" "strings" + "time" "cmd/go/internal/modfetch/codehost" "cmd/go/internal/modfile" @@ -42,12 +44,10 @@ type codeRepo struct { // It is used only for logging. pathPrefix string - // pseudoMajor is the major version prefix to use when generating - // pseudo-versions for this module, derived from the module path. - // - // TODO(golang.org/issue/29262): We can't distinguish v0 from v1 using the - // path alone: we have to compute it by examining the tags at a particular - // revision. + // pseudoMajor is the major version prefix to require when generating + // pseudo-versions for this module, derived from the module path. pseudoMajor + // is empty if the module path does not include a version suffix (that is, + // accepts either v0 or v1). pseudoMajor string } @@ -65,10 +65,7 @@ func newCodeRepo(code codehost.Repo, codeRoot, path string) (Repo, error) { if codeRoot == path { pathPrefix = path } - pseudoMajor := "v0" - if pathMajor != "" { - pseudoMajor = pathMajor[1:] - } + pseudoMajor := module.PathMajorPrefix(pathMajor) // Compute codeDir = bar, the subdirectory within the repo // corresponding to the module root. @@ -159,7 +156,7 @@ func (r *codeRepo) Versions(prefix string) ([]string, error) { if v == "" || v != module.CanonicalVersion(v) || IsPseudoVersion(v) { continue } - if !module.MatchPathMajor(v, r.pathMajor) { + if err := module.MatchPathMajor(v, r.pathMajor); err != nil { if r.codeDir == "" && r.pathMajor == "" && semver.Major(v) > "v1" { incompatible = append(incompatible, v) } @@ -208,6 +205,11 @@ func (r *codeRepo) Latest() (*RevInfo, error) { return r.convert(info, "") } +// convert converts a version as reported by the code host to a version as +// interpreted by the module system. +// +// If statVers is a valid module version, it is used for the Version field. +// Otherwise, the Version is derived from the passed-in info and recent tags. func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, error) { info2 := &RevInfo{ Name: info.Name, @@ -215,79 +217,328 @@ func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, e Time: info.Time, } - // Determine version. - if module.CanonicalVersion(statVers) == statVers && module.MatchPathMajor(statVers, r.pathMajor) { - // The original call was repo.Stat(statVers), and requestedVersion is OK, so use it. - info2.Version = statVers - } else { - // Otherwise derive a version from a code repo tag. - // Tag must have a prefix matching codeDir. - p := "" - if r.codeDir != "" { - p = r.codeDir + "/" - } - - // If this is a plain tag (no dir/ prefix) - // and the module path is unversioned, - // and if the underlying file tree has no go.mod, - // then allow using the tag with a +incompatible suffix. - canUseIncompatible := false + // If this is a plain tag (no dir/ prefix) + // and the module path is unversioned, + // and if the underlying file tree has no go.mod, + // then allow using the tag with a +incompatible suffix. + var canUseIncompatible func() bool + canUseIncompatible = func() bool { + var ok bool if r.codeDir == "" && r.pathMajor == "" { _, errGoMod := r.code.ReadFile(info.Name, "go.mod", codehost.MaxGoMod) if errGoMod != nil { - canUseIncompatible = true + ok = true + } + } + canUseIncompatible = func() bool { return ok } + return ok + } + + invalidf := func(format string, args ...interface{}) error { + return &module.ModuleError{ + Path: r.modPath, + Err: &module.InvalidVersionError{ + Version: info2.Version, + Err: fmt.Errorf(format, args...), + }, + } + } + + // checkGoMod verifies that the go.mod file for the module exists or does not + // exist as required by info2.Version and the module path represented by r. + checkGoMod := func() (*RevInfo, error) { + // If r.codeDir is non-empty, then the go.mod file must exist: the module + // author, not the module consumer, gets to decide how to carve up the repo + // into modules. + if r.codeDir != "" { + _, _, _, err := r.findDir(info2.Version) + if err != nil { + // TODO: It would be nice to return an error like "not a module". + // Right now we return "missing go.mod", which is a little confusing. + return nil, &module.ModuleError{ + Path: r.modPath, + Err: &module.InvalidVersionError{ + Version: info2.Version, + Err: notExistError(err.Error()), + }, + } } } - tagToVersion := func(v string) string { - if !strings.HasPrefix(v, p) { - return "" + // If the version is +incompatible, then the go.mod file must not exist: + // +incompatible is not an ongoing opt-out from semantic import versioning. + if strings.HasSuffix(info2.Version, "+incompatible") { + if !canUseIncompatible() { + if r.pathMajor != "" { + return nil, invalidf("+incompatible suffix not allowed: module path includes a major version suffix, so major version must match") + } else { + return nil, invalidf("+incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required") + } } - v = v[len(p):] - if module.CanonicalVersion(v) != v || IsPseudoVersion(v) { - return "" + + if err := module.MatchPathMajor(strings.TrimSuffix(info2.Version, "+incompatible"), r.pathMajor); err == nil { + return nil, invalidf("+incompatible suffix not allowed: major version %s is compatible", semver.Major(info2.Version)) } - if module.MatchPathMajor(v, r.pathMajor) { - return v + } + + return info2, nil + } + + // Determine version. + // + // If statVers is canonical, then the original call was repo.Stat(statVers). + // Since the version is canonical, we must not resolve it to anything but + // itself, possibly with a '+incompatible' annotation: we do not need to do + // the work required to look for an arbitrary pseudo-version. + if statVers != "" && statVers == module.CanonicalVersion(statVers) { + info2.Version = statVers + + if IsPseudoVersion(info2.Version) { + if err := r.validatePseudoVersion(info, info2.Version); err != nil { + return nil, err } - if canUseIncompatible { - return v + "+incompatible" + return checkGoMod() + } + + if err := module.MatchPathMajor(info2.Version, r.pathMajor); err != nil { + if canUseIncompatible() { + info2.Version += "+incompatible" + return checkGoMod() + } else { + if vErr, ok := err.(*module.InvalidVersionError); ok { + // We're going to describe why the version is invalid in more detail, + // so strip out the existing “invalid version” wrapper. + err = vErr.Err + } + return nil, invalidf("module contains a go.mod file, so major version must be compatible: %v", err) } - return "" } - // If info.Version is OK, use it. - if v := tagToVersion(info.Version); v != "" { - info2.Version = v - } else { - // Otherwise look through all known tags for latest in semver ordering. - for _, tag := range info.Tags { - if v := tagToVersion(tag); v != "" && semver.Compare(info2.Version, v) < 0 { + return checkGoMod() + } + + // statVers is empty or non-canonical, so we need to resolve it to a canonical + // version or pseudo-version. + + // Derive or verify a version from a code repo tag. + // Tag must have a prefix matching codeDir. + tagPrefix := "" + if r.codeDir != "" { + tagPrefix = r.codeDir + "/" + } + + // tagToVersion returns the version obtained by trimming tagPrefix from tag. + // If the tag is invalid or a pseudo-version, tagToVersion returns an empty + // version. + tagToVersion := func(tag string) (v string, tagIsCanonical bool) { + if !strings.HasPrefix(tag, tagPrefix) { + return "", false + } + trimmed := tag[len(tagPrefix):] + // Tags that look like pseudo-versions would be confusing. Ignore them. + if IsPseudoVersion(tag) { + return "", false + } + + v = semver.Canonical(trimmed) // Not module.Canonical: we don't want to pick up an explicit "+incompatible" suffix from the tag. + if v == "" || !strings.HasPrefix(trimmed, v) { + return "", false // Invalid or incomplete version (just vX or vX.Y). + } + if v == trimmed { + tagIsCanonical = true + } + + if err := module.MatchPathMajor(v, r.pathMajor); err != nil { + if canUseIncompatible() { + return v + "+incompatible", tagIsCanonical + } + return "", false + } + + return v, tagIsCanonical + } + + // If the VCS gave us a valid version, use that. + if v, tagIsCanonical := tagToVersion(info.Version); tagIsCanonical { + info2.Version = v + return checkGoMod() + } + + // Look through the tags on the revision for either a usable canonical version + // or an appropriate base for a pseudo-version. + var pseudoBase string + for _, pathTag := range info.Tags { + v, tagIsCanonical := tagToVersion(pathTag) + if tagIsCanonical { + if statVers != "" && semver.Compare(v, statVers) == 0 { + // The user requested a non-canonical version, but the tag for the + // canonical equivalent refers to the same revision. Use it. + info2.Version = v + return checkGoMod() + } else { + // Save the highest canonical tag for the revision. If we don't find a + // better match, we'll use it as the canonical version. + // + // NOTE: Do not replace this with semver.Max. Despite the name, + // semver.Max *also* canonicalizes its arguments, which uses + // semver.Canonical instead of module.CanonicalVersion and thereby + // strips our "+incompatible" suffix. + if semver.Compare(info2.Version, v) < 0 { info2.Version = v } } - // Otherwise make a pseudo-version. - if info2.Version == "" { - tag, _ := r.code.RecentTag(statVers, p) - v = tagToVersion(tag) - // TODO: Check that v is OK for r.pseudoMajor or else is OK for incompatible. - info2.Version = PseudoVersion(r.pseudoMajor, v, info.Time, info.Short) + } else if v != "" && semver.Compare(v, statVers) == 0 { + // The user explicitly requested something equivalent to this tag. We + // can't use the version from the tag directly: since the tag is not + // canonical, it could be ambiguous. For example, tags v0.0.1+a and + // v0.0.1+b might both exist and refer to different revisions. + // + // The tag is otherwise valid for the module, so we can at least use it as + // the base of an unambiguous pseudo-version. + // + // If multiple tags match, tagToVersion will canonicalize them to the same + // base version. + pseudoBase = v + } + } + + // If we found any canonical tag for the revision, return it. + // Even if we found a good pseudo-version base, a canonical version is better. + if info2.Version != "" { + return checkGoMod() + } + + if pseudoBase == "" { + var tag string + if r.pseudoMajor != "" || canUseIncompatible() { + tag, _ = r.code.RecentTag(info.Name, tagPrefix, r.pseudoMajor) + } else { + // Allow either v1 or v0, but not incompatible higher versions. + tag, _ = r.code.RecentTag(info.Name, tagPrefix, "v1") + if tag == "" { + tag, _ = r.code.RecentTag(info.Name, tagPrefix, "v0") } } + pseudoBase, _ = tagToVersion(tag) // empty if the tag is invalid } - // Do not allow a successful stat of a pseudo-version for a subdirectory - // unless the subdirectory actually does have a go.mod. - if IsPseudoVersion(info2.Version) && r.codeDir != "" { - _, _, _, err := r.findDir(info2.Version) + info2.Version = PseudoVersion(r.pseudoMajor, pseudoBase, info.Time, info.Short) + return checkGoMod() +} + +// validatePseudoVersion checks that version has a major version compatible with +// r.modPath and encodes a base version and commit metadata that agrees with +// info. +// +// Note that verifying a nontrivial base version in particular may be somewhat +// expensive: in order to do so, r.code.DescendsFrom will need to fetch at least +// enough of the commit history to find a path between version and its base. +// Fortunately, many pseudo-versions — such as those for untagged repositories — +// have trivial bases! +func (r *codeRepo) validatePseudoVersion(info *codehost.RevInfo, version string) (err error) { + defer func() { if err != nil { - // TODO: It would be nice to return an error like "not a module". - // Right now we return "missing go.mod", which is a little confusing. - return nil, err + if _, ok := err.(*module.ModuleError); !ok { + if _, ok := err.(*module.InvalidVersionError); !ok { + err = &module.InvalidVersionError{Version: version, Pseudo: true, Err: err} + } + err = &module.ModuleError{Path: r.modPath, Err: err} + } + } + }() + + if err := module.MatchPathMajor(version, r.pathMajor); err != nil { + return err + } + + rev, err := PseudoVersionRev(version) + if err != nil { + return err + } + if rev != info.Short { + switch { + case strings.HasPrefix(rev, info.Short): + return fmt.Errorf("revision is longer than canonical (%s)", info.Short) + case strings.HasPrefix(info.Short, rev): + return fmt.Errorf("revision is shorter than canonical (%s)", info.Short) + default: + return fmt.Errorf("does not match short name of revision (%s)", info.Short) + } + } + + t, err := PseudoVersionTime(version) + if err != nil { + return err + } + if !t.Equal(info.Time.Truncate(time.Second)) { + return fmt.Errorf("does not match version-control timestamp (%s)", info.Time.UTC().Format(time.RFC3339)) + } + + // A pseudo-version should have a precedence just above its parent revisions, + // and no higher. Otherwise, it would be possible for library authors to "pin" + // dependency versions (and bypass the usual minimum version selection) by + // naming an extremely high pseudo-version rather than an accurate one. + // + // Moreover, if we allow a pseudo-version to use any arbitrary pre-release + // tag, we end up with infinitely many possible names for each commit. Each + // name consumes resources in the module cache and proxies, so we want to + // restrict them to a finite set under control of the module author. + // + // We address both of these issues by requiring the tag upon which the + // pseudo-version is based to refer to some ancestor of the revision. We + // prefer the highest such tag when constructing a new pseudo-version, but do + // not enforce that property when resolving existing pseudo-versions: we don't + // know when the parent tags were added, and the highest-tagged parent may not + // have existed when the pseudo-version was first resolved. + base, err := PseudoVersionBase(strings.TrimSuffix(version, "+incompatible")) + if err != nil { + return err + } + if base == "" { + if r.pseudoMajor == "" && semver.Major(version) == "v1" { + return fmt.Errorf("major version without preceding tag must be v0, not v1") } + return nil + } + + tagPrefix := "" + if r.codeDir != "" { + tagPrefix = r.codeDir + "/" + } + + tags, err := r.code.Tags(tagPrefix + base) + if err != nil { + return err + } + + var lastTag string // Prefer to log some real tag rather than a canonically-equivalent base. + ancestorFound := false + for _, tag := range tags { + versionOnly := strings.TrimPrefix(tag, tagPrefix) + if semver.Compare(versionOnly, base) == 0 { + lastTag = tag + ancestorFound, err = r.code.DescendsFrom(info.Name, tag) + if ancestorFound { + break + } + } + } + + if lastTag == "" { + return fmt.Errorf("preceding tag (%s) not found", base) } - return info2, nil + if !ancestorFound { + if err != nil { + return err + } + rev, err := PseudoVersionRev(version) + if err != nil { + return fmt.Errorf("not a descendent of preceding tag (%s)", lastTag) + } + return fmt.Errorf("revision %s is not a descendent of preceding tag (%s)", rev, lastTag) + } + return nil } func (r *codeRepo) revToRev(rev string) string { @@ -309,7 +560,13 @@ func (r *codeRepo) revToRev(rev string) string { func (r *codeRepo) versionToRev(version string) (rev string, err error) { if !semver.IsValid(version) { - return "", fmt.Errorf("malformed semantic version %q", version) + return "", &module.ModuleError{ + Path: r.modPath, + Err: &module.InvalidVersionError{ + Version: version, + Err: errors.New("syntax error"), + }, + } } return r.revToRev(version), nil } @@ -419,6 +676,21 @@ func isMajor(mpath, pathMajor string) bool { } func (r *codeRepo) GoMod(version string) (data []byte, err error) { + if version != module.CanonicalVersion(version) { + return nil, fmt.Errorf("version %s is not canonical", version) + } + + if IsPseudoVersion(version) { + // findDir ignores the metadata encoded in a pseudo-version, + // only using the revision at the end. + // Invoke Stat to verify the metadata explicitly so we don't return + // a bogus file for an invalid version. + _, err := r.Stat(version) + if err != nil { + return nil, err + } + } + rev, dir, gomod, err := r.findDir(version) if err != nil { return nil, err @@ -452,6 +724,21 @@ func (r *codeRepo) modPrefix(rev string) string { } func (r *codeRepo) Zip(dst io.Writer, version string) error { + if version != module.CanonicalVersion(version) { + return fmt.Errorf("version %s is not canonical", version) + } + + if IsPseudoVersion(version) { + // findDir ignores the metadata encoded in a pseudo-version, + // only using the revision at the end. + // Invoke Stat to verify the metadata explicitly so we don't return + // a bogus file for an invalid version. + _, err := r.Stat(version) + if err != nil { + return err + } + } + rev, dir, _, err := r.findDir(version) if err != nil { return err @@ -585,6 +872,9 @@ func (r *codeRepo) Zip(dst io.Writer, version string) error { return err } w, err := zw.Create(r.modPrefix(version) + "/" + name) + if err != nil { + return err + } lr := &io.LimitedReader{R: rc, N: size + 1} if _, err := io.Copy(w, lr); err != nil { return err @@ -631,6 +921,19 @@ func isVendoredPackage(name string) bool { if strings.HasPrefix(name, "vendor/") { i += len("vendor/") } else if j := strings.Index(name, "/vendor/"); j >= 0 { + // This offset looks incorrect; this should probably be + // + // i = j + len("/vendor/") + // + // (See https://golang.org/issue/31562.) + // + // Unfortunately, we can't fix it without invalidating checksums. + // Fortunately, the error appears to be strictly conservative: we'll retain + // vendored packages that we should have pruned, but we won't prune + // non-vendored packages that we should have retained. + // + // Since this defect doesn't seem to break anything, it's not worth fixing + // for now. i += len("/vendor/") } else { return false diff --git a/libgo/go/cmd/go/internal/modfetch/coderepo_test.go b/libgo/go/cmd/go/internal/modfetch/coderepo_test.go index 7a419576ced..5fc9bc34397 100644 --- a/libgo/go/cmd/go/internal/modfetch/coderepo_test.go +++ b/libgo/go/cmd/go/internal/modfetch/coderepo_test.go @@ -7,7 +7,6 @@ package modfetch import ( "archive/zip" "internal/testenv" - "io" "io/ioutil" "log" "os" @@ -16,6 +15,7 @@ import ( "testing" "time" + "cmd/go/internal/cfg" "cmd/go/internal/modfetch/codehost" ) @@ -24,6 +24,14 @@ func TestMain(m *testing.M) { } func testMain(m *testing.M) int { + cfg.GOPROXY = "direct" + + // The sum database is populated using a released version of the go command, + // but this test may include fixes for additional modules that previously + // could not be fetched. Since this test isn't executing any of the resolved + // code, bypass the sum database. + cfg.GOSUMDB = "off" + dir, err := ioutil.TempDir("", "gitrepo-test-") if err != nil { log.Fatal(err) @@ -39,11 +47,12 @@ const ( vgotest1hg = "vcs-test.golang.org/hg/vgotest1.hg" ) -var altVgotests = []string{ - vgotest1hg, +var altVgotests = map[string]string{ + "hg": vgotest1hg, } -var codeRepoTests = []struct { +type codeRepoTest struct { + vcs string path string lookerr string mpath string @@ -57,8 +66,11 @@ var codeRepoTests = []struct { gomoderr string zip []string ziperr string -}{ +} + +var codeRepoTests = []codeRepoTest{ { + vcs: "git", path: "github.com/rsc/vgotest1", rev: "v0.0.0", version: "v0.0.0", @@ -72,6 +84,7 @@ var codeRepoTests = []struct { }, }, { + vcs: "git", path: "github.com/rsc/vgotest1", rev: "v1.0.0", version: "v1.0.0", @@ -85,6 +98,7 @@ var codeRepoTests = []struct { }, }, { + vcs: "git", path: "github.com/rsc/vgotest1/v2", rev: "v2.0.0", version: "v2.0.0", @@ -94,6 +108,7 @@ var codeRepoTests = []struct { ziperr: "missing github.com/rsc/vgotest1/go.mod and .../v2/go.mod at revision v2.0.0", }, { + vcs: "git", path: "github.com/rsc/vgotest1", rev: "80d85c5", version: "v1.0.0", @@ -107,6 +122,7 @@ var codeRepoTests = []struct { }, }, { + vcs: "git", path: "github.com/rsc/vgotest1", rev: "mytag", version: "v1.0.0", @@ -120,6 +136,7 @@ var codeRepoTests = []struct { }, }, { + vcs: "git", path: "github.com/rsc/vgotest1/v2", rev: "45f53230a", version: "v2.0.0", @@ -130,6 +147,7 @@ var codeRepoTests = []struct { ziperr: "missing github.com/rsc/vgotest1/go.mod and .../v2/go.mod at revision v2.0.0", }, { + vcs: "git", path: "github.com/rsc/vgotest1/v54321", rev: "80d85c5", version: "v54321.0.0-20180219231006-80d85c5d4d17", @@ -139,16 +157,19 @@ var codeRepoTests = []struct { ziperr: "missing github.com/rsc/vgotest1/go.mod and .../v54321/go.mod at revision 80d85c5d4d17", }, { + vcs: "git", path: "github.com/rsc/vgotest1/submod", rev: "v1.0.0", err: "unknown revision submod/v1.0.0", }, { + vcs: "git", path: "github.com/rsc/vgotest1/submod", rev: "v1.0.3", err: "unknown revision submod/v1.0.3", }, { + vcs: "git", path: "github.com/rsc/vgotest1/submod", rev: "v1.0.4", version: "v1.0.4", @@ -163,6 +184,7 @@ var codeRepoTests = []struct { }, }, { + vcs: "git", path: "github.com/rsc/vgotest1", rev: "v1.1.0", version: "v1.1.0", @@ -178,6 +200,7 @@ var codeRepoTests = []struct { }, }, { + vcs: "git", path: "github.com/rsc/vgotest1/v2", rev: "v2.0.1", version: "v2.0.1", @@ -187,6 +210,7 @@ var codeRepoTests = []struct { gomod: "module \"github.com/rsc/vgotest1/v2\" // root go.mod\n", }, { + vcs: "git", path: "github.com/rsc/vgotest1/v2", rev: "v2.0.3", version: "v2.0.3", @@ -196,6 +220,7 @@ var codeRepoTests = []struct { gomoderr: "github.com/rsc/vgotest1/v2/go.mod has non-.../v2 module path \"github.com/rsc/vgotest\" at revision v2.0.3", }, { + vcs: "git", path: "github.com/rsc/vgotest1/v2", rev: "v2.0.4", version: "v2.0.4", @@ -205,6 +230,7 @@ var codeRepoTests = []struct { gomoderr: "github.com/rsc/vgotest1/go.mod and .../v2/go.mod both have .../v2 module paths at revision v2.0.4", }, { + vcs: "git", path: "github.com/rsc/vgotest1/v2", rev: "v2.0.5", version: "v2.0.5", @@ -215,6 +241,7 @@ var codeRepoTests = []struct { }, { // redirect to github + vcs: "git", path: "rsc.io/quote", rev: "v1.0.0", version: "v1.0.0", @@ -225,6 +252,7 @@ var codeRepoTests = []struct { }, { // redirect to static hosting proxy + vcs: "mod", path: "swtch.com/testmod", rev: "v1.0.0", version: "v1.0.0", @@ -234,6 +262,7 @@ var codeRepoTests = []struct { }, { // redirect to googlesource + vcs: "git", path: "golang.org/x/text", rev: "4e4a3210bb", version: "v0.3.1-0.20180208041248-4e4a3210bb54", @@ -242,6 +271,7 @@ var codeRepoTests = []struct { time: time.Date(2018, 2, 8, 4, 12, 48, 0, time.UTC), }, { + vcs: "git", path: "github.com/pkg/errors", rev: "v0.8.0", version: "v0.8.0", @@ -253,17 +283,20 @@ var codeRepoTests = []struct { // package in subdirectory - custom domain // In general we can't reject these definitively in Lookup, // but gopkg.in is special. + vcs: "git", path: "gopkg.in/yaml.v2/abc", lookerr: "invalid module path \"gopkg.in/yaml.v2/abc\"", }, { // package in subdirectory - github // Because it's a package, Stat should fail entirely. + vcs: "git", path: "github.com/rsc/quote/buggy", rev: "c4d4236f", err: "missing github.com/rsc/quote/buggy/go.mod at revision c4d4236f9242", }, { + vcs: "git", path: "gopkg.in/yaml.v2", rev: "d670f940", version: "v2.0.0", @@ -273,6 +306,7 @@ var codeRepoTests = []struct { gomod: "module gopkg.in/yaml.v2\n", }, { + vcs: "git", path: "gopkg.in/check.v1", rev: "20d25e280405", version: "v1.0.0-20161208181325-20d25e280405", @@ -282,15 +316,17 @@ var codeRepoTests = []struct { gomod: "module gopkg.in/check.v1\n", }, { + vcs: "git", path: "gopkg.in/yaml.v2", rev: "v2", - version: "v2.2.2", - name: "51d6538a90f86fe93ac480b35f37b2be17fef232", - short: "51d6538a90f8", - time: time.Date(2018, 11, 15, 11, 05, 04, 0, time.UTC), + version: "v2.2.3-0.20190319135612-7b8349ac747c", + name: "7b8349ac747c6a24702b762d2c4fd9266cf4f1d6", + short: "7b8349ac747c", + time: time.Date(2019, 03, 19, 13, 56, 12, 0, time.UTC), gomod: "module \"gopkg.in/yaml.v2\"\n\nrequire (\n\t\"gopkg.in/check.v1\" v0.0.0-20161208181325-20d25e280405\n)\n", }, { + vcs: "git", path: "vcs-test.golang.org/go/mod/gitrepo1", rev: "master", version: "v1.2.4-annotated", @@ -300,6 +336,7 @@ var codeRepoTests = []struct { gomod: "module vcs-test.golang.org/go/mod/gitrepo1\n", }, { + vcs: "git", path: "gopkg.in/natefinch/lumberjack.v2", rev: "latest", version: "v2.0.0-20170531160350-a96e63847dc3", @@ -309,6 +346,7 @@ var codeRepoTests = []struct { gomod: "module gopkg.in/natefinch/lumberjack.v2\n", }, { + vcs: "git", path: "gopkg.in/natefinch/lumberjack.v2", // This repo has a v2.1 tag. // We only allow semver references to tags that are fully qualified, as in v2.1.0. @@ -324,144 +362,156 @@ var codeRepoTests = []struct { gomod: "module gopkg.in/natefinch/lumberjack.v2\n", }, { - path: "nanomsg.org/go/mangos/v2", - rev: "v2.0.2", - version: "v2.0.2", - name: "63f66a65137b9a648ac9f7bf0160b4a4d17d7999", - short: "63f66a65137b", - time: time.Date(2018, 12, 1, 15, 7, 40, 0, time.UTC), - gomod: "module nanomsg.org/go/mangos/v2\n\nrequire (\n\tgithub.com/Microsoft/go-winio v0.4.11\n\tgithub.com/droundy/goopt v0.0.0-20170604162106-0b8effe182da\n\tgithub.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect\n\tgithub.com/gorilla/websocket v1.4.0\n\tgithub.com/jtolds/gls v4.2.1+incompatible // indirect\n\tgithub.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect\n\tgithub.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c\n\tgolang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35 // indirect\n)\n", + vcs: "git", + path: "vcs-test.golang.org/go/v2module/v2", + rev: "v2.0.0", + version: "v2.0.0", + name: "203b91c896acd173aa719e4cdcb7d463c4b090fa", + short: "203b91c896ac", + time: time.Date(2019, 4, 3, 15, 52, 15, 0, time.UTC), + gomod: "module vcs-test.golang.org/go/v2module/v2\n\ngo 1.12\n", }, } func TestCodeRepo(t *testing.T) { testenv.MustHaveExternalNetwork(t) - tmpdir, err := ioutil.TempDir("", "vgo-modfetch-test-") + tmpdir, err := ioutil.TempDir("", "modfetch-test-") if err != nil { t.Fatal(err) } defer os.RemoveAll(tmpdir) - for _, tt := range codeRepoTests { - f := func(t *testing.T) { - repo, err := Lookup(tt.path) - if tt.lookerr != "" { - if err != nil && err.Error() == tt.lookerr { - return - } - t.Errorf("Lookup(%q): %v, want error %q", tt.path, err, tt.lookerr) - } - if err != nil { - t.Fatalf("Lookup(%q): %v", tt.path, err) - } - if tt.mpath == "" { - tt.mpath = tt.path - } - if mpath := repo.ModulePath(); mpath != tt.mpath { - t.Errorf("repo.ModulePath() = %q, want %q", mpath, tt.mpath) - } - info, err := repo.Stat(tt.rev) - if err != nil { - if tt.err != "" { - if !strings.Contains(err.Error(), tt.err) { - t.Fatalf("repoStat(%q): %v, wanted %q", tt.rev, err, tt.err) + + t.Run("parallel", func(t *testing.T) { + for _, tt := range codeRepoTests { + f := func(tt codeRepoTest) func(t *testing.T) { + return func(t *testing.T) { + t.Parallel() + if tt.vcs != "mod" { + testenv.MustHaveExecPath(t, tt.vcs) } - return - } - t.Fatalf("repo.Stat(%q): %v", tt.rev, err) - } - if tt.err != "" { - t.Errorf("repo.Stat(%q): success, wanted error", tt.rev) - } - if info.Version != tt.version { - t.Errorf("info.Version = %q, want %q", info.Version, tt.version) - } - if info.Name != tt.name { - t.Errorf("info.Name = %q, want %q", info.Name, tt.name) - } - if info.Short != tt.short { - t.Errorf("info.Short = %q, want %q", info.Short, tt.short) - } - if !info.Time.Equal(tt.time) { - t.Errorf("info.Time = %v, want %v", info.Time, tt.time) - } - if tt.gomod != "" || tt.gomoderr != "" { - data, err := repo.GoMod(tt.version) - if err != nil && tt.gomoderr == "" { - t.Errorf("repo.GoMod(%q): %v", tt.version, err) - } else if err != nil && tt.gomoderr != "" { - if err.Error() != tt.gomoderr { - t.Errorf("repo.GoMod(%q): %v, want %q", tt.version, err, tt.gomoderr) + + repo, err := Lookup("direct", tt.path) + if tt.lookerr != "" { + if err != nil && err.Error() == tt.lookerr { + return + } + t.Errorf("Lookup(%q): %v, want error %q", tt.path, err, tt.lookerr) } - } else if tt.gomoderr != "" { - t.Errorf("repo.GoMod(%q) = %q, want error %q", tt.version, data, tt.gomoderr) - } else if string(data) != tt.gomod { - t.Errorf("repo.GoMod(%q) = %q, want %q", tt.version, data, tt.gomod) - } - } - if tt.zip != nil || tt.ziperr != "" { - f, err := ioutil.TempFile(tmpdir, tt.version+".zip.") - if err != nil { - t.Fatalf("ioutil.TempFile: %v", err) - } - zipfile := f.Name() - err = repo.Zip(f, tt.version) - f.Close() - if err != nil { - if tt.ziperr != "" { - if err.Error() == tt.ziperr { + if err != nil { + t.Fatalf("Lookup(%q): %v", tt.path, err) + } + if tt.mpath == "" { + tt.mpath = tt.path + } + if mpath := repo.ModulePath(); mpath != tt.mpath { + t.Errorf("repo.ModulePath() = %q, want %q", mpath, tt.mpath) + } + info, err := repo.Stat(tt.rev) + if err != nil { + if tt.err != "" { + if !strings.Contains(err.Error(), tt.err) { + t.Fatalf("repoStat(%q): %v, wanted %q", tt.rev, err, tt.err) + } return } - t.Fatalf("repo.Zip(%q): %v, want error %q", tt.version, err, tt.ziperr) + t.Fatalf("repo.Stat(%q): %v", tt.rev, err) } - t.Fatalf("repo.Zip(%q): %v", tt.version, err) - } - if tt.ziperr != "" { - t.Errorf("repo.Zip(%q): success, want error %q", tt.version, tt.ziperr) - } - prefix := tt.path + "@" + tt.version + "/" - z, err := zip.OpenReader(zipfile) - if err != nil { - t.Fatalf("open zip %s: %v", zipfile, err) - } - var names []string - for _, file := range z.File { - if !strings.HasPrefix(file.Name, prefix) { - t.Errorf("zip entry %v does not start with prefix %v", file.Name, prefix) - continue + if tt.err != "" { + t.Errorf("repo.Stat(%q): success, wanted error", tt.rev) + } + if info.Version != tt.version { + t.Errorf("info.Version = %q, want %q", info.Version, tt.version) + } + if info.Name != tt.name { + t.Errorf("info.Name = %q, want %q", info.Name, tt.name) + } + if info.Short != tt.short { + t.Errorf("info.Short = %q, want %q", info.Short, tt.short) + } + if !info.Time.Equal(tt.time) { + t.Errorf("info.Time = %v, want %v", info.Time, tt.time) + } + if tt.gomod != "" || tt.gomoderr != "" { + data, err := repo.GoMod(tt.version) + if err != nil && tt.gomoderr == "" { + t.Errorf("repo.GoMod(%q): %v", tt.version, err) + } else if err != nil && tt.gomoderr != "" { + if err.Error() != tt.gomoderr { + t.Errorf("repo.GoMod(%q): %v, want %q", tt.version, err, tt.gomoderr) + } + } else if tt.gomoderr != "" { + t.Errorf("repo.GoMod(%q) = %q, want error %q", tt.version, data, tt.gomoderr) + } else if string(data) != tt.gomod { + t.Errorf("repo.GoMod(%q) = %q, want %q", tt.version, data, tt.gomod) + } + } + if tt.zip != nil || tt.ziperr != "" { + f, err := ioutil.TempFile(tmpdir, tt.version+".zip.") + if err != nil { + t.Fatalf("ioutil.TempFile: %v", err) + } + zipfile := f.Name() + err = repo.Zip(f, tt.version) + f.Close() + if err != nil { + if tt.ziperr != "" { + if err.Error() == tt.ziperr { + return + } + t.Fatalf("repo.Zip(%q): %v, want error %q", tt.version, err, tt.ziperr) + } + t.Fatalf("repo.Zip(%q): %v", tt.version, err) + } + if tt.ziperr != "" { + t.Errorf("repo.Zip(%q): success, want error %q", tt.version, tt.ziperr) + } + prefix := tt.path + "@" + tt.version + "/" + z, err := zip.OpenReader(zipfile) + if err != nil { + t.Fatalf("open zip %s: %v", zipfile, err) + } + var names []string + for _, file := range z.File { + if !strings.HasPrefix(file.Name, prefix) { + t.Errorf("zip entry %v does not start with prefix %v", file.Name, prefix) + continue + } + names = append(names, file.Name[len(prefix):]) + } + z.Close() + if !reflect.DeepEqual(names, tt.zip) { + t.Fatalf("zip = %v\nwant %v\n", names, tt.zip) + } } - names = append(names, file.Name[len(prefix):]) - } - z.Close() - if !reflect.DeepEqual(names, tt.zip) { - t.Fatalf("zip = %v\nwant %v\n", names, tt.zip) } } - } - t.Run(strings.ReplaceAll(tt.path, "/", "_")+"/"+tt.rev, f) - if strings.HasPrefix(tt.path, vgotest1git) { - for _, alt := range altVgotests { - // Note: Communicating with f through tt; should be cleaned up. - old := tt - tt.path = alt + strings.TrimPrefix(tt.path, vgotest1git) - if strings.HasPrefix(tt.mpath, vgotest1git) { - tt.mpath = alt + strings.TrimPrefix(tt.mpath, vgotest1git) - } - var m map[string]string - if alt == vgotest1hg { - m = hgmap + t.Run(strings.ReplaceAll(tt.path, "/", "_")+"/"+tt.rev, f(tt)) + if strings.HasPrefix(tt.path, vgotest1git) { + for vcs, alt := range altVgotests { + // Note: Communicating with f through tt; should be cleaned up. + old := tt + tt.vcs = vcs + tt.path = alt + strings.TrimPrefix(tt.path, vgotest1git) + if strings.HasPrefix(tt.mpath, vgotest1git) { + tt.mpath = alt + strings.TrimPrefix(tt.mpath, vgotest1git) + } + var m map[string]string + if alt == vgotest1hg { + m = hgmap + } + tt.version = remap(tt.version, m) + tt.name = remap(tt.name, m) + tt.short = remap(tt.short, m) + tt.rev = remap(tt.rev, m) + tt.gomoderr = remap(tt.gomoderr, m) + tt.ziperr = remap(tt.ziperr, m) + t.Run(strings.ReplaceAll(tt.path, "/", "_")+"/"+tt.rev, f(tt)) + tt = old } - tt.version = remap(tt.version, m) - tt.name = remap(tt.name, m) - tt.short = remap(tt.short, m) - tt.rev = remap(tt.rev, m) - tt.gomoderr = remap(tt.gomoderr, m) - tt.ziperr = remap(tt.ziperr, m) - t.Run(strings.ReplaceAll(tt.path, "/", "_")+"/"+tt.rev, f) - tt = old } } - } + }) } var hgmap = map[string]string{ @@ -497,32 +547,39 @@ func remap(name string, m map[string]string) string { } var codeRepoVersionsTests = []struct { + vcs string path string prefix string versions []string }{ { + vcs: "git", path: "github.com/rsc/vgotest1", versions: []string{"v0.0.0", "v0.0.1", "v1.0.0", "v1.0.1", "v1.0.2", "v1.0.3", "v1.1.0", "v2.0.0+incompatible"}, }, { + vcs: "git", path: "github.com/rsc/vgotest1", prefix: "v1.0", versions: []string{"v1.0.0", "v1.0.1", "v1.0.2", "v1.0.3"}, }, { + vcs: "git", path: "github.com/rsc/vgotest1/v2", versions: []string{"v2.0.0", "v2.0.1", "v2.0.2", "v2.0.3", "v2.0.4", "v2.0.5", "v2.0.6"}, }, { + vcs: "mod", path: "swtch.com/testmod", versions: []string{"v1.0.0", "v1.1.1"}, }, { + vcs: "git", path: "gopkg.in/russross/blackfriday.v2", versions: []string{"v2.0.0", "v2.0.1"}, }, { + vcs: "git", path: "gopkg.in/natefinch/lumberjack.v2", versions: []string{"v2.0.0"}, }, @@ -536,41 +593,55 @@ func TestCodeRepoVersions(t *testing.T) { t.Fatal(err) } defer os.RemoveAll(tmpdir) - for _, tt := range codeRepoVersionsTests { - t.Run(strings.ReplaceAll(tt.path, "/", "_"), func(t *testing.T) { - repo, err := Lookup(tt.path) - if err != nil { - t.Fatalf("Lookup(%q): %v", tt.path, err) - } - list, err := repo.Versions(tt.prefix) - if err != nil { - t.Fatalf("Versions(%q): %v", tt.prefix, err) - } - if !reflect.DeepEqual(list, tt.versions) { - t.Fatalf("Versions(%q):\nhave %v\nwant %v", tt.prefix, list, tt.versions) - } - }) - } + + t.Run("parallel", func(t *testing.T) { + for _, tt := range codeRepoVersionsTests { + t.Run(strings.ReplaceAll(tt.path, "/", "_"), func(t *testing.T) { + tt := tt + t.Parallel() + if tt.vcs != "mod" { + testenv.MustHaveExecPath(t, tt.vcs) + } + + repo, err := Lookup("direct", tt.path) + if err != nil { + t.Fatalf("Lookup(%q): %v", tt.path, err) + } + list, err := repo.Versions(tt.prefix) + if err != nil { + t.Fatalf("Versions(%q): %v", tt.prefix, err) + } + if !reflect.DeepEqual(list, tt.versions) { + t.Fatalf("Versions(%q):\nhave %v\nwant %v", tt.prefix, list, tt.versions) + } + }) + } + }) } var latestTests = []struct { + vcs string path string version string err string }{ { + vcs: "git", path: "github.com/rsc/empty", err: "no commits", }, { + vcs: "git", path: "github.com/rsc/vgotest1", version: "v0.0.0-20180219223237-a08abb797a67", }, { + vcs: "git", path: "github.com/rsc/vgotest1/subdir", - err: "missing github.com/rsc/vgotest1/subdir/go.mod at revision a08abb797a67", + err: "github.com/rsc/vgotest1/subdir@v0.0.0-20180219223237-a08abb797a67: invalid version: missing github.com/rsc/vgotest1/subdir/go.mod at revision a08abb797a67", }, { + vcs: "mod", path: "swtch.com/testmod", version: "v1.1.1", }, @@ -584,51 +655,49 @@ func TestLatest(t *testing.T) { t.Fatal(err) } defer os.RemoveAll(tmpdir) - for _, tt := range latestTests { - name := strings.ReplaceAll(tt.path, "/", "_") - t.Run(name, func(t *testing.T) { - repo, err := Lookup(tt.path) - if err != nil { - t.Fatalf("Lookup(%q): %v", tt.path, err) - } - info, err := repo.Latest() - if err != nil { - if tt.err != "" { - if err.Error() == tt.err { - return + + t.Run("parallel", func(t *testing.T) { + for _, tt := range latestTests { + name := strings.ReplaceAll(tt.path, "/", "_") + t.Run(name, func(t *testing.T) { + tt := tt + t.Parallel() + if tt.vcs != "mod" { + testenv.MustHaveExecPath(t, tt.vcs) + } + + repo, err := Lookup("direct", tt.path) + if err != nil { + t.Fatalf("Lookup(%q): %v", tt.path, err) + } + info, err := repo.Latest() + if err != nil { + if tt.err != "" { + if err.Error() == tt.err { + return + } + t.Fatalf("Latest(): %v, want %q", err, tt.err) } - t.Fatalf("Latest(): %v, want %q", err, tt.err) + t.Fatalf("Latest(): %v", err) } - t.Fatalf("Latest(): %v", err) - } - if tt.err != "" { - t.Fatalf("Latest() = %v, want error %q", info.Version, tt.err) - } - if info.Version != tt.version { - t.Fatalf("Latest() = %v, want %v", info.Version, tt.version) - } - }) - } + if tt.err != "" { + t.Fatalf("Latest() = %v, want error %q", info.Version, tt.err) + } + if info.Version != tt.version { + t.Fatalf("Latest() = %v, want %v", info.Version, tt.version) + } + }) + } + }) } // fixedTagsRepo is a fake codehost.Repo that returns a fixed list of tags type fixedTagsRepo struct { tags []string + codehost.Repo } -func (ch *fixedTagsRepo) Tags(string) ([]string, error) { return ch.tags, nil } -func (ch *fixedTagsRepo) Latest() (*codehost.RevInfo, error) { panic("not impl") } -func (ch *fixedTagsRepo) ReadFile(string, string, int64) ([]byte, error) { panic("not impl") } -func (ch *fixedTagsRepo) ReadFileRevs([]string, string, int64) (map[string]*codehost.FileRev, error) { - panic("not impl") -} -func (ch *fixedTagsRepo) ReadZip(string, string, int64) (io.ReadCloser, string, error) { - panic("not impl") -} -func (ch *fixedTagsRepo) RecentTag(string, string) (string, error) { - panic("not impl") -} -func (ch *fixedTagsRepo) Stat(string) (*codehost.RevInfo, error) { panic("not impl") } +func (ch *fixedTagsRepo) Tags(string) ([]string, error) { return ch.tags, nil } func TestNonCanonicalSemver(t *testing.T) { root := "golang.org/x/issue24476" diff --git a/libgo/go/cmd/go/internal/modfetch/fetch.go b/libgo/go/cmd/go/internal/modfetch/fetch.go index 81a6c843abc..74e36cc6fc1 100644 --- a/libgo/go/cmd/go/internal/modfetch/fetch.go +++ b/libgo/go/cmd/go/internal/modfetch/fetch.go @@ -48,7 +48,7 @@ func Download(mod module.Version) (dir string, err error) { if err := download(mod, dir); err != nil { return cached{"", err} } - checkSum(mod) + checkMod(mod) return cached{dir, nil} }).(cached) return c.dir, c.err @@ -205,13 +205,16 @@ func downloadZip(mod module.Version, zipfile string) (err error) { } }() - repo, err := Lookup(mod.Path) + err = TryProxies(func(proxy string) error { + repo, err := Lookup(proxy, mod.Path) + if err != nil { + return err + } + return repo.Zip(f, mod.Version) + }) if err != nil { return err } - if err := repo.Zip(f, mod.Version); err != nil { - return err - } // Double-check that the paths within the zip file are well-formed. // @@ -246,9 +249,9 @@ func downloadZip(mod module.Version, zipfile string) (err error) { if err != nil { return err } - checkOneSum(mod, hash) + checkModSum(mod, hash) - if err := renameio.WriteFile(zipfile+"hash", []byte(hash)); err != nil { + if err := renameio.WriteFile(zipfile+"hash", []byte(hash), 0666); err != nil { return err } if err := os.Rename(f.Name(), zipfile); err != nil { @@ -290,7 +293,7 @@ func initGoSum() bool { goSum.m = make(map[module.Version][]string) goSum.checked = make(map[modSum]bool) - data, err := ioutil.ReadFile(GoSumFile) + data, err := renameio.ReadFile(GoSumFile) if err != nil && !os.IsNotExist(err) { base.Fatalf("go: %v", err) } @@ -300,12 +303,12 @@ func initGoSum() bool { // Add old go.modverify file. // We'll delete go.modverify in WriteGoSum. alt := strings.TrimSuffix(GoSumFile, ".sum") + ".modverify" - if data, err := ioutil.ReadFile(alt); err == nil { + if data, err := renameio.ReadFile(alt); err == nil { migrate := make(map[module.Version][]string) readGoSum(migrate, alt, data) for mod, sums := range migrate { for _, sum := range sums { - checkOneSumLocked(mod, sum) + addModSumLocked(mod, sum) } } goSum.modverify = alt @@ -348,8 +351,8 @@ func readGoSum(dst map[module.Version][]string, file string, data []byte) { } } -// checkSum checks the given module's checksum. -func checkSum(mod module.Version) { +// checkMod checks the given module's checksum. +func checkMod(mod module.Version) { if PkgMod == "" { // Do not use current directory. return @@ -360,7 +363,7 @@ func checkSum(mod module.Version) { if err != nil { base.Fatalf("verifying %s@%s: %v", mod.Path, mod.Version, err) } - data, err := ioutil.ReadFile(ziphash) + data, err := renameio.ReadFile(ziphash) if err != nil { if os.IsNotExist(err) { // This can happen if someone does rm -rf GOPATH/src/cache/download. So it goes. @@ -373,7 +376,7 @@ func checkSum(mod module.Version) { base.Fatalf("verifying %s@%s: unexpected ziphash: %q", mod.Path, mod.Version, h) } - checkOneSum(mod, h) + checkModSum(mod, h) } // goModSum returns the checksum for the go.mod contents. @@ -391,36 +394,90 @@ func checkGoMod(path, version string, data []byte) { base.Fatalf("verifying %s %s go.mod: %v", path, version, err) } - checkOneSum(module.Version{Path: path, Version: version + "/go.mod"}, h) + checkModSum(module.Version{Path: path, Version: version + "/go.mod"}, h) } -// checkOneSum checks that the recorded hash for mod is h. -func checkOneSum(mod module.Version, h string) { +// checkModSum checks that the recorded checksum for mod is h. +func checkModSum(mod module.Version, h string) { + // We lock goSum when manipulating it, + // but we arrange to release the lock when calling checkSumDB, + // so that parallel calls to checkModHash can execute parallel calls + // to checkSumDB. + + // Check whether mod+h is listed in go.sum already. If so, we're done. goSum.mu.Lock() - defer goSum.mu.Unlock() - if initGoSum() { - checkOneSumLocked(mod, h) + inited := initGoSum() + done := inited && haveModSumLocked(mod, h) + goSum.mu.Unlock() + + if done { + return + } + + // Not listed, so we want to add them. + // Consult checksum database if appropriate. + if useSumDB(mod) { + // Calls base.Fatalf if mismatch detected. + checkSumDB(mod, h) + } + + // Add mod+h to go.sum, if it hasn't appeared already. + if inited { + goSum.mu.Lock() + addModSumLocked(mod, h) + goSum.mu.Unlock() } } -func checkOneSumLocked(mod module.Version, h string) { +// haveModSumLocked reports whether the pair mod,h is already listed in go.sum. +// If it finds a conflicting pair instead, it calls base.Fatalf. +// goSum.mu must be locked. +func haveModSumLocked(mod module.Version, h string) bool { goSum.checked[modSum{mod, h}] = true - for _, vh := range goSum.m[mod] { if h == vh { - return + return true } if strings.HasPrefix(vh, "h1:") { - base.Fatalf("verifying %s@%s: checksum mismatch\n\tdownloaded: %v\n\tgo.sum: %v", mod.Path, mod.Version, h, vh) + base.Fatalf("verifying %s@%s: checksum mismatch\n\tdownloaded: %v\n\tgo.sum: %v"+goSumMismatch, mod.Path, mod.Version, h, vh) } } + return false +} + +// addModSumLocked adds the pair mod,h to go.sum. +// goSum.mu must be locked. +func addModSumLocked(mod module.Version, h string) { + if haveModSumLocked(mod, h) { + return + } if len(goSum.m[mod]) > 0 { - fmt.Fprintf(os.Stderr, "warning: verifying %s@%s: unknown hashes in go.sum: %v; adding %v", mod.Path, mod.Version, strings.Join(goSum.m[mod], ", "), h) + fmt.Fprintf(os.Stderr, "warning: verifying %s@%s: unknown hashes in go.sum: %v; adding %v"+hashVersionMismatch, mod.Path, mod.Version, strings.Join(goSum.m[mod], ", "), h) } goSum.m[mod] = append(goSum.m[mod], h) goSum.dirty = true } +// checkSumDB checks the mod, h pair against the Go checksum database. +// It calls base.Fatalf if the hash is to be rejected. +func checkSumDB(mod module.Version, h string) { + db, lines, err := lookupSumDB(mod) + if err != nil { + base.Fatalf("verifying %s@%s: %v", mod.Path, mod.Version, err) + } + + have := mod.Path + " " + mod.Version + " " + h + prefix := mod.Path + " " + mod.Version + " h1:" + for _, line := range lines { + if line == have { + return + } + if strings.HasPrefix(line, prefix) { + base.Fatalf("verifying %s@%s: checksum mismatch\n\tdownloaded: %v\n\t%s: %v"+sumdbMismatch, mod.Path, mod.Version, h, db, line[len(prefix)-len("h1:"):]) + } + } +} + // Sum returns the checksum for the downloaded copy of the given module, // if present in the download cache. func Sum(mod module.Version) string { @@ -433,7 +490,7 @@ func Sum(mod module.Version) string { if err != nil { return "" } - data, err := ioutil.ReadFile(ziphash) + data, err := renameio.ReadFile(ziphash) if err != nil { return "" } @@ -455,6 +512,9 @@ func WriteGoSum() { // Don't bother opening the go.sum file if we don't have anything to add. return } + if cfg.BuildMod == "readonly" { + base.Fatalf("go: updates to go.sum needed, disabled by -mod=readonly") + } // We want to avoid races between creating the lockfile and deleting it, but // we also don't want to leave a permanent lockfile in the user's repository. @@ -478,7 +538,7 @@ func WriteGoSum() { if !goSum.overwrite { // Re-read the go.sum file to incorporate any sums added by other processes // in the meantime. - data, err := ioutil.ReadFile(GoSumFile) + data, err := renameio.ReadFile(GoSumFile) if err != nil && !os.IsNotExist(err) { base.Fatalf("go: re-reading go.sum: %v", err) } @@ -489,7 +549,8 @@ func WriteGoSum() { goSum.m = make(map[module.Version][]string, len(goSum.m)) readGoSum(goSum.m, GoSumFile, data) for ms := range goSum.checked { - checkOneSumLocked(ms.mod, ms.sum) + addModSumLocked(ms.mod, ms.sum) + goSum.dirty = true } } @@ -507,7 +568,7 @@ func WriteGoSum() { } } - if err := renameio.WriteFile(GoSumFile, buf.Bytes()); err != nil { + if err := renameio.WriteFile(GoSumFile, buf.Bytes(), 0666); err != nil { base.Fatalf("go: writing go.sum: %v", err) } @@ -539,3 +600,170 @@ func TrimGoSum(keep map[module.Version]bool) { } } } + +const goSumMismatch = ` + +SECURITY ERROR +This download does NOT match an earlier download recorded in go.sum. +The bits may have been replaced on the origin server, or an attacker may +have intercepted the download attempt. + +For more information, see 'go help module-auth'. +` + +const sumdbMismatch = ` + +SECURITY ERROR +This download does NOT match the one reported by the checksum server. +The bits may have been replaced on the origin server, or an attacker may +have intercepted the download attempt. + +For more information, see 'go help module-auth'. +` + +const hashVersionMismatch = ` + +SECURITY WARNING +This download is listed in go.sum, but using an unknown hash algorithm. +The download cannot be verified. + +For more information, see 'go help module-auth'. + +` + +var HelpModuleAuth = &base.Command{ + UsageLine: "module-auth", + Short: "module authentication using go.sum", + Long: ` +The go command tries to authenticate every downloaded module, +checking that the bits downloaded for a specific module version today +match bits downloaded yesterday. This ensures repeatable builds +and detects introduction of unexpected changes, malicious or not. + +In each module's root, alongside go.mod, the go command maintains +a file named go.sum containing the cryptographic checksums of the +module's dependencies. + +The form of each line in go.sum is three fields: + + [/go.mod] + +Each known module version results in two lines in the go.sum file. +The first line gives the hash of the module version's file tree. +The second line appends "/go.mod" to the version and gives the hash +of only the module version's (possibly synthesized) go.mod file. +The go.mod-only hash allows downloading and authenticating a +module version's go.mod file, which is needed to compute the +dependency graph, without also downloading all the module's source code. + +The hash begins with an algorithm prefix of the form "h:". +The only defined algorithm prefix is "h1:", which uses SHA-256. + +Module authentication failures + +The go command maintains a cache of downloaded packages and computes +and records the cryptographic checksum of each package at download time. +In normal operation, the go command checks the main module's go.sum file +against these precomputed checksums instead of recomputing them on +each command invocation. The 'go mod verify' command checks that +the cached copies of module downloads still match both their recorded +checksums and the entries in go.sum. + +In day-to-day development, the checksum of a given module version +should never change. Each time a dependency is used by a given main +module, the go command checks its local cached copy, freshly +downloaded or not, against the main module's go.sum. If the checksums +don't match, the go command reports the mismatch as a security error +and refuses to run the build. When this happens, proceed with caution: +code changing unexpectedly means today's build will not match +yesterday's, and the unexpected change may not be beneficial. + +If the go command reports a mismatch in go.sum, the downloaded code +for the reported module version does not match the one used in a +previous build of the main module. It is important at that point +to find out what the right checksum should be, to decide whether +go.sum is wrong or the downloaded code is wrong. Usually go.sum is right: +you want to use the same code you used yesterday. + +If a downloaded module is not yet included in go.sum and it is a publicly +available module, the go command consults the Go checksum database to fetch +the expected go.sum lines. If the downloaded code does not match those +lines, the go command reports the mismatch and exits. Note that the +database is not consulted for module versions already listed in go.sum. + +If a go.sum mismatch is reported, it is always worth investigating why +the code downloaded today differs from what was downloaded yesterday. + +The GOSUMDB environment variable identifies the name of checksum database +to use and optionally its public key and URL, as in: + + GOSUMDB="sum.golang.org" + GOSUMDB="sum.golang.org+" + GOSUMDB="sum.golang.org+ https://sum.golang.org" + +The go command knows the public key of sum.golang.org; use of any other +database requires giving the public key explicitly. The URL defaults to +"https://" followed by the database name. + +GOSUMDB defaults to "sum.golang.org", the Go checksum database run by Google. +See https://sum.golang.org/privacy for the service's privacy policy. + +If GOSUMDB is set to "off", or if "go get" is invoked with the -insecure flag, +the checksum database is not consulted, and all unrecognized modules are +accepted, at the cost of giving up the security guarantee of verified repeatable +downloads for all modules. A better way to bypass the checksum database +for specific modules is to use the GOPRIVATE or GONOSUMDB environment +variables. See 'go help module-private' for details. + +The 'go env -w' command (see 'go help env') can be used to set these variables +for future go command invocations. +`, +} + +var HelpModulePrivate = &base.Command{ + UsageLine: "module-private", + Short: "module configuration for non-public modules", + Long: ` +The go command defaults to downloading modules from the public Go module +mirror at proxy.golang.org. It also defaults to validating downloaded modules, +regardless of source, against the public Go checksum database at sum.golang.org. +These defaults work well for publicly available source code. + +The GOPRIVATE environment variable controls which modules the go command +considers to be private (not available publicly) and should therefore not use the +proxy or checksum database. The variable is a comma-separated list of +glob patterns (in the syntax of Go's path.Match) of module path prefixes. +For example, + + GOPRIVATE=*.corp.example.com,rsc.io/private + +causes the go command to treat as private any module with a path prefix +matching either pattern, including git.corp.example.com/xyzzy, rsc.io/private, +and rsc.io/private/quux. + +The GOPRIVATE environment variable may be used by other tools as well to +identify non-public modules. For example, an editor could use GOPRIVATE +to decide whether to hyperlink a package import to a godoc.org page. + +For fine-grained control over module download and validation, the GONOPROXY +and GONOSUMDB environment variables accept the same kind of glob list +and override GOPRIVATE for the specific decision of whether to use the proxy +and checksum database, respectively. + +For example, if a company ran a module proxy serving private modules, +users would configure go using: + + GOPRIVATE=*.corp.example.com + GOPROXY=proxy.example.com + GONOPROXY=none + +This would tell the go command and other tools that modules beginning with +a corp.example.com subdomain are private but that the company proxy should +be used for downloading both public and private modules, because +GONOPROXY has been set to a pattern that won't match any modules, +overriding GOPRIVATE. + +The 'go env -w' command (see 'go help env') can be used to set these variables +for future go command invocations. +`, +} diff --git a/libgo/go/cmd/go/internal/modfetch/key.go b/libgo/go/cmd/go/internal/modfetch/key.go new file mode 100644 index 00000000000..06f9989b9d4 --- /dev/null +++ b/libgo/go/cmd/go/internal/modfetch/key.go @@ -0,0 +1,9 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package modfetch + +var knownGOSUMDB = map[string]string{ + "sum.golang.org": "sum.golang.org+033de0ae+Ac4zctda0e5eza+HJyk9SxEdh+s3Ux18htTTAD8OuAn8", +} diff --git a/libgo/go/cmd/go/internal/modfetch/noweb.go b/libgo/go/cmd/go/internal/modfetch/noweb.go deleted file mode 100644 index 9d713dcc669..00000000000 --- a/libgo/go/cmd/go/internal/modfetch/noweb.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build cmd_go_bootstrap - -package modfetch - -import ( - "fmt" - "io" -) - -func webGetGoGet(url string, body *io.ReadCloser) error { - return fmt.Errorf("no network in go_bootstrap") -} - -func webGetBytes(url string, body *[]byte) error { - return fmt.Errorf("no network in go_bootstrap") -} - -func webGetBody(url string, body *io.ReadCloser) error { - return fmt.Errorf("no network in go_bootstrap") -} diff --git a/libgo/go/cmd/go/internal/modfetch/proxy.go b/libgo/go/cmd/go/internal/modfetch/proxy.go index 60ed2a37966..6049ccfd30a 100644 --- a/libgo/go/cmd/go/internal/modfetch/proxy.go +++ b/libgo/go/cmd/go/internal/modfetch/proxy.go @@ -6,33 +6,31 @@ package modfetch import ( "encoding/json" + "errors" "fmt" "io" + "io/ioutil" "net/url" "os" + "path" + pathpkg "path" + "path/filepath" "strings" + "sync" "time" "cmd/go/internal/base" + "cmd/go/internal/cfg" "cmd/go/internal/modfetch/codehost" "cmd/go/internal/module" "cmd/go/internal/semver" + "cmd/go/internal/web" ) var HelpGoproxy = &base.Command{ UsageLine: "goproxy", Short: "module proxy protocol", Long: ` -The go command by default downloads modules from version control systems -directly, just as 'go get' always has. The GOPROXY environment variable allows -further control over the download source. If GOPROXY is unset, is the empty string, -or is the string "direct", downloads use the default direct connection to version -control systems. Setting GOPROXY to "off" disallows downloading modules from -any source. Otherwise, GOPROXY is expected to be the URL of a module proxy, -in which case the go command will fetch all modules from that proxy. -No matter the source of the modules, downloaded modules must match existing -entries in go.sum (see 'go help modules' for discussion of verification). - A Go module proxy is any web server that can respond to GET requests for URLs of a specified form. The requests have no query parameters, so even a site serving from a fixed file system (including a file:/// URL) @@ -85,47 +83,175 @@ cached module versions with GOPROXY=https://example.com/proxy. `, } -var proxyURL = os.Getenv("GOPROXY") +var proxyOnce struct { + sync.Once + list []string + err error +} + +func proxyURLs() ([]string, error) { + proxyOnce.Do(func() { + if cfg.GONOPROXY != "" && cfg.GOPROXY != "direct" { + proxyOnce.list = append(proxyOnce.list, "noproxy") + } + for _, proxyURL := range strings.Split(cfg.GOPROXY, ",") { + proxyURL = strings.TrimSpace(proxyURL) + if proxyURL == "" { + continue + } + if proxyURL == "off" { + // "off" always fails hard, so can stop walking list. + proxyOnce.list = append(proxyOnce.list, "off") + break + } + if proxyURL == "direct" { + proxyOnce.list = append(proxyOnce.list, "direct") + // For now, "direct" is the end of the line. We may decide to add some + // sort of fallback behavior for them in the future, so ignore + // subsequent entries for forward-compatibility. + break + } + + // Single-word tokens are reserved for built-in behaviors, and anything + // containing the string ":/" or matching an absolute file path must be a + // complete URL. For all other paths, implicitly add "https://". + if strings.ContainsAny(proxyURL, ".:/") && !strings.Contains(proxyURL, ":/") && !filepath.IsAbs(proxyURL) && !path.IsAbs(proxyURL) { + proxyURL = "https://" + proxyURL + } + + // Check that newProxyRepo accepts the URL. + // It won't do anything with the path. + _, err := newProxyRepo(proxyURL, "golang.org/x/text") + if err != nil { + proxyOnce.err = err + return + } + proxyOnce.list = append(proxyOnce.list, proxyURL) + } + }) + + return proxyOnce.list, proxyOnce.err +} -func lookupProxy(path string) (Repo, error) { - if strings.Contains(proxyURL, ",") { - return nil, fmt.Errorf("invalid $GOPROXY setting: cannot have comma") +// TryProxies iterates f over each configured proxy (including "noproxy" and +// "direct" if applicable) until f returns an error that is not +// equivalent to os.ErrNotExist. +// +// TryProxies then returns that final error. +// +// If GOPROXY is set to "off", TryProxies invokes f once with the argument +// "off". +func TryProxies(f func(proxy string) error) error { + proxies, err := proxyURLs() + if err != nil { + return err } - u, err := url.Parse(proxyURL) - if err != nil || u.Scheme != "http" && u.Scheme != "https" && u.Scheme != "file" { - // Don't echo $GOPROXY back in case it has user:password in it (sigh). - return nil, fmt.Errorf("invalid $GOPROXY setting: malformed URL or invalid scheme (must be http, https, file)") + if len(proxies) == 0 { + return f("off") + } + + for _, proxy := range proxies { + err = f(proxy) + if !errors.Is(err, os.ErrNotExist) { + break + } } - return newProxyRepo(u.String(), path) + return err } type proxyRepo struct { - url string + url *url.URL path string } func newProxyRepo(baseURL, path string) (Repo, error) { + base, err := url.Parse(baseURL) + if err != nil { + return nil, err + } + switch base.Scheme { + case "http", "https": + // ok + case "file": + if *base != (url.URL{Scheme: base.Scheme, Path: base.Path, RawPath: base.RawPath}) { + return nil, fmt.Errorf("invalid file:// proxy URL with non-path elements: %s", web.Redacted(base)) + } + case "": + return nil, fmt.Errorf("invalid proxy URL missing scheme: %s", web.Redacted(base)) + default: + return nil, fmt.Errorf("invalid proxy URL scheme (must be https, http, file): %s", web.Redacted(base)) + } + enc, err := module.EncodePath(path) if err != nil { return nil, err } - return &proxyRepo{strings.TrimSuffix(baseURL, "/") + "/" + pathEscape(enc), path}, nil + + base.Path = strings.TrimSuffix(base.Path, "/") + "/" + enc + base.RawPath = strings.TrimSuffix(base.RawPath, "/") + "/" + pathEscape(enc) + return &proxyRepo{base, path}, nil } func (p *proxyRepo) ModulePath() string { return p.path } -func (p *proxyRepo) Versions(prefix string) ([]string, error) { - var data []byte - err := webGetBytes(p.url+"/@v/list", &data) +// versionError returns err wrapped in a ModuleError for p.path. +func (p *proxyRepo) versionError(version string, err error) error { + if version != "" && version != module.CanonicalVersion(version) { + return &module.ModuleError{ + Path: p.path, + Err: &module.InvalidVersionError{ + Version: version, + Pseudo: IsPseudoVersion(version), + Err: err, + }, + } + } + + return &module.ModuleError{ + Path: p.path, + Version: version, + Err: err, + } +} + +func (p *proxyRepo) getBytes(path string) ([]byte, error) { + body, err := p.getBody(path) if err != nil { return nil, err } + defer body.Close() + return ioutil.ReadAll(body) +} + +func (p *proxyRepo) getBody(path string) (io.ReadCloser, error) { + fullPath := pathpkg.Join(p.url.Path, path) + + target := *p.url + target.Path = fullPath + target.RawPath = pathpkg.Join(target.RawPath, pathEscape(path)) + + resp, err := web.Get(web.DefaultSecurity, &target) + if err != nil { + return nil, err + } + if err := resp.Err(); err != nil { + resp.Body.Close() + return nil, err + } + return resp.Body, nil +} + +func (p *proxyRepo) Versions(prefix string) ([]string, error) { + data, err := p.getBytes("@v/list") + if err != nil { + return nil, p.versionError("", err) + } var list []string for _, line := range strings.Split(string(data), "\n") { f := strings.Fields(line) - if len(f) >= 1 && semver.IsValid(f[0]) && strings.HasPrefix(f[0], prefix) { + if len(f) >= 1 && semver.IsValid(f[0]) && strings.HasPrefix(f[0], prefix) && !IsPseudoVersion(f[0]) { list = append(list, f[0]) } } @@ -134,98 +260,138 @@ func (p *proxyRepo) Versions(prefix string) ([]string, error) { } func (p *proxyRepo) latest() (*RevInfo, error) { - var data []byte - err := webGetBytes(p.url+"/@v/list", &data) + data, err := p.getBytes("@v/list") if err != nil { - return nil, err + return nil, p.versionError("", err) } - var best time.Time - var bestVersion string + + var ( + bestTime time.Time + bestTimeIsFromPseudo bool + bestVersion string + ) + for _, line := range strings.Split(string(data), "\n") { f := strings.Fields(line) - if len(f) >= 2 && semver.IsValid(f[0]) { - ft, err := time.Parse(time.RFC3339, f[1]) - if err == nil && best.Before(ft) { - best = ft + if len(f) >= 1 && semver.IsValid(f[0]) { + // If the proxy includes timestamps, prefer the timestamp it reports. + // Otherwise, derive the timestamp from the pseudo-version. + var ( + ft time.Time + ftIsFromPseudo = false + ) + if len(f) >= 2 { + ft, _ = time.Parse(time.RFC3339, f[1]) + } else if IsPseudoVersion(f[0]) { + ft, _ = PseudoVersionTime(f[0]) + ftIsFromPseudo = true + } else { + // Repo.Latest promises that this method is only called where there are + // no tagged versions. Ignore any tagged versions that were added in the + // meantime. + continue + } + if bestTime.Before(ft) { + bestTime = ft + bestTimeIsFromPseudo = ftIsFromPseudo bestVersion = f[0] } } } if bestVersion == "" { - return nil, fmt.Errorf("no commits") + return nil, p.versionError("", codehost.ErrNoCommits) + } + + if bestTimeIsFromPseudo { + // We parsed bestTime from the pseudo-version, but that's in UTC and we're + // supposed to report the timestamp as reported by the VCS. + // Stat the selected version to canonicalize the timestamp. + // + // TODO(bcmills): Should we also stat other versions to ensure that we + // report the correct Name and Short for the revision? + return p.Stat(bestVersion) } - info := &RevInfo{ + + return &RevInfo{ Version: bestVersion, Name: bestVersion, Short: bestVersion, - Time: best, - } - return info, nil + Time: bestTime, + }, nil } func (p *proxyRepo) Stat(rev string) (*RevInfo, error) { - var data []byte encRev, err := module.EncodeVersion(rev) if err != nil { - return nil, err + return nil, p.versionError(rev, err) } - err = webGetBytes(p.url+"/@v/"+pathEscape(encRev)+".info", &data) + data, err := p.getBytes("@v/" + encRev + ".info") if err != nil { - return nil, err + return nil, p.versionError(rev, err) } info := new(RevInfo) if err := json.Unmarshal(data, info); err != nil { - return nil, err + return nil, p.versionError(rev, err) + } + if info.Version != rev && rev == module.CanonicalVersion(rev) && module.Check(p.path, rev) == nil { + // If we request a correct, appropriate version for the module path, the + // proxy must return either exactly that version or an error — not some + // arbitrary other version. + return nil, p.versionError(rev, fmt.Errorf("proxy returned info for version %s instead of requested version", info.Version)) } return info, nil } func (p *proxyRepo) Latest() (*RevInfo, error) { - var data []byte - u := p.url + "/@latest" - err := webGetBytes(u, &data) + data, err := p.getBytes("@latest") if err != nil { // TODO return err if not 404 return p.latest() } info := new(RevInfo) if err := json.Unmarshal(data, info); err != nil { - return nil, err + return nil, p.versionError("", err) } return info, nil } func (p *proxyRepo) GoMod(version string) ([]byte, error) { - var data []byte + if version != module.CanonicalVersion(version) { + return nil, p.versionError(version, fmt.Errorf("internal error: version passed to GoMod is not canonical")) + } + encVer, err := module.EncodeVersion(version) if err != nil { - return nil, err + return nil, p.versionError(version, err) } - err = webGetBytes(p.url+"/@v/"+pathEscape(encVer)+".mod", &data) + data, err := p.getBytes("@v/" + encVer + ".mod") if err != nil { - return nil, err + return nil, p.versionError(version, err) } return data, nil } func (p *proxyRepo) Zip(dst io.Writer, version string) error { - var body io.ReadCloser + if version != module.CanonicalVersion(version) { + return p.versionError(version, fmt.Errorf("internal error: version passed to Zip is not canonical")) + } + encVer, err := module.EncodeVersion(version) if err != nil { - return err + return p.versionError(version, err) } - err = webGetBody(p.url+"/@v/"+pathEscape(encVer)+".zip", &body) + body, err := p.getBody("@v/" + encVer + ".zip") if err != nil { - return err + return p.versionError(version, err) } defer body.Close() lr := &io.LimitedReader{R: body, N: codehost.MaxZipFile + 1} if _, err := io.Copy(dst, lr); err != nil { - return err + return p.versionError(version, err) } if lr.N <= 0 { - return fmt.Errorf("downloaded zip file too large") + return p.versionError(version, fmt.Errorf("downloaded zip file too large")) } return nil } diff --git a/libgo/go/cmd/go/internal/modfetch/pseudo.go b/libgo/go/cmd/go/internal/modfetch/pseudo.go index 32c7bf883be..8c063b9107f 100644 --- a/libgo/go/cmd/go/internal/modfetch/pseudo.go +++ b/libgo/go/cmd/go/internal/modfetch/pseudo.go @@ -35,13 +35,18 @@ package modfetch import ( - "cmd/go/internal/semver" + "errors" "fmt" - "regexp" "strings" "time" + + "cmd/go/internal/module" + "cmd/go/internal/semver" + "internal/lazyregexp" ) +var pseudoVersionRE = lazyregexp.New(`^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$`) + // PseudoVersion returns a pseudo-version for the given major version ("v1") // preexisting older tagged version ("" or "v1.2.3" or "v1.2.3-pre"), revision time, // and revision identifier (usually a 12-byte commit hash prefix). @@ -49,7 +54,6 @@ func PseudoVersion(major, older string, t time.Time, rev string) string { if major == "" { major = "v0" } - major = strings.TrimSuffix(major, "-unstable") // make gopkg.in/macaroon-bakery.v2-unstable use "v2" segment := fmt.Sprintf("%s-%s", t.UTC().Format("20060102150405"), rev) build := semver.Build(older) older = semver.Canonical(older) @@ -62,15 +66,19 @@ func PseudoVersion(major, older string, t time.Time, rev string) string { // Form (2), (3). // Extract patch from vMAJOR.MINOR.PATCH - v := older[:len(older)] - i := strings.LastIndex(v, ".") + 1 - v, patch := v[:i], v[i:] - - // Increment PATCH by adding 1 to decimal: - // scan right to left turning 9s to 0s until you find a digit to increment. - // (Number might exceed int64, but math/big is overkill.) - digits := []byte(patch) - for i = len(digits) - 1; i >= 0 && digits[i] == '9'; i-- { + i := strings.LastIndex(older, ".") + 1 + v, patch := older[:i], older[i:] + + // Reassemble. + return v + incDecimal(patch) + "-0." + segment + build +} + +// incDecimal returns the decimal string incremented by 1. +func incDecimal(decimal string) string { + // Scan right to left turning 9s to 0s until you find a digit to increment. + digits := []byte(decimal) + i := len(digits) - 1 + for ; i >= 0 && digits[i] == '9'; i-- { digits[i] = '0' } if i >= 0 { @@ -80,13 +88,29 @@ func PseudoVersion(major, older string, t time.Time, rev string) string { digits[0] = '1' digits = append(digits, '0') } - patch = string(digits) - - // Reassemble. - return v + patch + "-0." + segment + build + return string(digits) } -var pseudoVersionRE = regexp.MustCompile(`^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+incompatible)?$`) +// decDecimal returns the decimal string decremented by 1, or the empty string +// if the decimal is all zeroes. +func decDecimal(decimal string) string { + // Scan right to left turning 0s to 9s until you find a digit to decrement. + digits := []byte(decimal) + i := len(digits) - 1 + for ; i >= 0 && digits[i] == '0'; i-- { + digits[i] = '9' + } + if i < 0 { + // decimal is all zeros + return "" + } + if i == 0 && digits[i] == '1' && len(digits) > 1 { + digits = digits[1:] + } else { + digits[i]-- + } + return string(digits) +} // IsPseudoVersion reports whether v is a pseudo-version. func IsPseudoVersion(v string) bool { @@ -97,10 +121,17 @@ func IsPseudoVersion(v string) bool { // It returns an error if v is not a pseudo-version or if the time stamp // embedded in the pseudo-version is not a valid time. func PseudoVersionTime(v string) (time.Time, error) { - timestamp, _, err := parsePseudoVersion(v) + _, timestamp, _, _, err := parsePseudoVersion(v) + if err != nil { + return time.Time{}, err + } t, err := time.Parse("20060102150405", timestamp) if err != nil { - return time.Time{}, fmt.Errorf("pseudo-version with malformed time %s: %q", timestamp, v) + return time.Time{}, &module.InvalidVersionError{ + Version: v, + Pseudo: true, + Err: fmt.Errorf("malformed time %q", timestamp), + } } return t, nil } @@ -108,22 +139,99 @@ func PseudoVersionTime(v string) (time.Time, error) { // PseudoVersionRev returns the revision identifier of the pseudo-version v. // It returns an error if v is not a pseudo-version. func PseudoVersionRev(v string) (rev string, err error) { - _, rev, err = parsePseudoVersion(v) + _, _, rev, _, err = parsePseudoVersion(v) return } -func parsePseudoVersion(v string) (timestamp, rev string, err error) { +// PseudoVersionBase returns the canonical parent version, if any, upon which +// the pseudo-version v is based. +// +// If v has no parent version (that is, if it is "vX.0.0-[…]"), +// PseudoVersionBase returns the empty string and a nil error. +func PseudoVersionBase(v string) (string, error) { + base, _, _, build, err := parsePseudoVersion(v) + if err != nil { + return "", err + } + + switch pre := semver.Prerelease(base); pre { + case "": + // vX.0.0-yyyymmddhhmmss-abcdef123456 → "" + if build != "" { + // Pseudo-versions of the form vX.0.0-yyyymmddhhmmss-abcdef123456+incompatible + // are nonsensical: the "vX.0.0-" prefix implies that there is no parent tag, + // but the "+incompatible" suffix implies that the major version of + // the parent tag is not compatible with the module's import path. + // + // There are a few such entries in the index generated by proxy.golang.org, + // but we believe those entries were generated by the proxy itself. + return "", &module.InvalidVersionError{ + Version: v, + Pseudo: true, + Err: fmt.Errorf("lacks base version, but has build metadata %q", build), + } + } + return "", nil + + case "-0": + // vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 → vX.Y.Z + // vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456+incompatible → vX.Y.Z+incompatible + base = strings.TrimSuffix(base, pre) + i := strings.LastIndexByte(base, '.') + if i < 0 { + panic("base from parsePseudoVersion missing patch number: " + base) + } + patch := decDecimal(base[i+1:]) + if patch == "" { + // vX.0.0-0 is invalid, but has been observed in the wild in the index + // generated by requests to proxy.golang.org. + // + // NOTE(bcmills): I cannot find a historical bug that accounts for + // pseudo-versions of this form, nor have I seen such versions in any + // actual go.mod files. If we find actual examples of this form and a + // reasonable theory of how they came into existence, it seems fine to + // treat them as equivalent to vX.0.0 (especially since the invalid + // pseudo-versions have lower precedence than the real ones). For now, we + // reject them. + return "", &module.InvalidVersionError{ + Version: v, + Pseudo: true, + Err: fmt.Errorf("version before %s would have negative patch number", base), + } + } + return base[:i+1] + patch + build, nil + + default: + // vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456 → vX.Y.Z-pre + // vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456+incompatible → vX.Y.Z-pre+incompatible + if !strings.HasSuffix(base, ".0") { + panic(`base from parsePseudoVersion missing ".0" before date: ` + base) + } + return strings.TrimSuffix(base, ".0") + build, nil + } +} + +var errPseudoSyntax = errors.New("syntax error") + +func parsePseudoVersion(v string) (base, timestamp, rev, build string, err error) { if !IsPseudoVersion(v) { - return "", "", fmt.Errorf("malformed pseudo-version %q", v) + return "", "", "", "", &module.InvalidVersionError{ + Version: v, + Pseudo: true, + Err: errPseudoSyntax, + } } - v = strings.TrimSuffix(v, "+incompatible") + build = semver.Build(v) + v = strings.TrimSuffix(v, build) j := strings.LastIndex(v, "-") v, rev = v[:j], v[j+1:] i := strings.LastIndex(v, "-") if j := strings.LastIndex(v, "."); j > i { + base = v[:j] // "vX.Y.Z-pre.0" or "vX.Y.(Z+1)-0" timestamp = v[j+1:] } else { + base = v[:i] // "vX.0.0" timestamp = v[i+1:] } - return timestamp, rev, nil + return base, timestamp, rev, build, nil } diff --git a/libgo/go/cmd/go/internal/modfetch/pseudo_test.go b/libgo/go/cmd/go/internal/modfetch/pseudo_test.go index 3c2fa514689..4483f8e962f 100644 --- a/libgo/go/cmd/go/internal/modfetch/pseudo_test.go +++ b/libgo/go/cmd/go/internal/modfetch/pseudo_test.go @@ -23,6 +23,10 @@ var pseudoTests = []struct { {"unused", "v1.2.99999999999999999", "v1.2.100000000000000000-0.20060102150405-hash"}, {"unused", "v1.2.3-pre", "v1.2.3-pre.0.20060102150405-hash"}, {"unused", "v1.3.0-pre", "v1.3.0-pre.0.20060102150405-hash"}, + {"unused", "v0.0.0--", "v0.0.0--.0.20060102150405-hash"}, + {"unused", "v1.0.0+metadata", "v1.0.1-0.20060102150405-hash+metadata"}, + {"unused", "v2.0.0+incompatible", "v2.0.1-0.20060102150405-hash+incompatible"}, + {"unused", "v2.3.0-pre+incompatible", "v2.3.0-pre.0.20060102150405-hash+incompatible"}, } var pseudoTime = time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC) @@ -60,6 +64,13 @@ func TestPseudoVersionTime(t *testing.T) { } } +func TestInvalidPseudoVersionTime(t *testing.T) { + const v = "---" + if _, err := PseudoVersionTime(v); err == nil { + t.Error("expected error, got nil instead") + } +} + func TestPseudoVersionRev(t *testing.T) { for _, tt := range pseudoTests { rev, err := PseudoVersionRev(tt.version) @@ -72,3 +83,72 @@ func TestPseudoVersionRev(t *testing.T) { } } } + +func TestPseudoVersionBase(t *testing.T) { + for _, tt := range pseudoTests { + base, err := PseudoVersionBase(tt.version) + if err != nil { + t.Errorf("PseudoVersionBase(%q): %v", tt.version, err) + } else if base != tt.older { + t.Errorf("PseudoVersionBase(%q) = %q; want %q", tt.version, base, tt.older) + } + } +} + +func TestInvalidPseudoVersionBase(t *testing.T) { + for _, in := range []string{ + "v0.0.0", + "v0.0.0-", // malformed: empty prerelease + "v0.0.0-0.20060102150405-hash", // Z+1 == 0 + "v0.1.0-0.20060102150405-hash", // Z+1 == 0 + "v1.0.0-0.20060102150405-hash", // Z+1 == 0 + "v0.0.0-20060102150405-hash+incompatible", // "+incompatible without base version + "v0.0.0-20060102150405-hash+metadata", // other metadata without base version + } { + base, err := PseudoVersionBase(in) + if err == nil || base != "" { + t.Errorf(`PseudoVersionBase(%q) = %q, %v; want "", error`, in, base, err) + } + } +} + +func TestIncDecimal(t *testing.T) { + cases := []struct { + in, want string + }{ + {"0", "1"}, + {"1", "2"}, + {"99", "100"}, + {"100", "101"}, + {"101", "102"}, + } + + for _, tc := range cases { + got := incDecimal(tc.in) + if got != tc.want { + t.Fatalf("incDecimal(%q) = %q; want %q", tc.in, tc.want, got) + } + } +} + +func TestDecDecimal(t *testing.T) { + cases := []struct { + in, want string + }{ + {"", ""}, + {"0", ""}, + {"00", ""}, + {"1", "0"}, + {"2", "1"}, + {"99", "98"}, + {"100", "99"}, + {"101", "100"}, + } + + for _, tc := range cases { + got := decDecimal(tc.in) + if got != tc.want { + t.Fatalf("decDecimal(%q) = %q; want %q", tc.in, tc.want, got) + } + } +} diff --git a/libgo/go/cmd/go/internal/modfetch/repo.go b/libgo/go/cmd/go/internal/modfetch/repo.go index c63f6b04221..95351269dbe 100644 --- a/libgo/go/cmd/go/internal/modfetch/repo.go +++ b/libgo/go/cmd/go/internal/modfetch/repo.go @@ -5,6 +5,7 @@ package modfetch import ( + "errors" "fmt" "io" "os" @@ -17,6 +18,7 @@ import ( "cmd/go/internal/modfetch/codehost" "cmd/go/internal/par" "cmd/go/internal/semver" + "cmd/go/internal/str" web "cmd/go/internal/web" ) @@ -160,12 +162,6 @@ type RevInfo struct { // To avoid version control access except when absolutely necessary, // Lookup does not attempt to connect to the repository itself. // -// The Import function takes an import path found in source code and -// determines which module to add to the requirement list to satisfy -// that import. It checks successive truncations of the import path -// to determine possible modules and stops when it finds a module -// in which the latest version satisfies the import path. -// // The ImportRepoRev function is a variant of Import which is limited // to code in a source code repository at a particular revision identifier // (usually a commit hash or source code repository tag, not necessarily @@ -177,20 +173,32 @@ type RevInfo struct { var lookupCache par.Cache -// Lookup returns the module with the given module path. +type lookupCacheKey struct { + proxy, path string +} + +// Lookup returns the module with the given module path, +// fetched through the given proxy. +// +// The distinguished proxy "direct" indicates that the path should be fetched +// from its origin, and "noproxy" indicates that the patch should be fetched +// directly only if GONOPROXY matches the given path. +// +// For the distinguished proxy "off", Lookup always returns a non-nil error. +// // A successful return does not guarantee that the module // has any defined versions. -func Lookup(path string) (Repo, error) { +func Lookup(proxy, path string) (Repo, error) { if traceRepo { - defer logCall("Lookup(%q)", path)() + defer logCall("Lookup(%q, %q)", proxy, path)() } type cached struct { r Repo err error } - c := lookupCache.Do(path, func() interface{} { - r, err := lookup(path) + c := lookupCache.Do(lookupCacheKey{proxy, path}, func() interface{} { + r, err := lookup(proxy, path) if err == nil { if traceRepo { r = newLoggingRepo(r) @@ -204,25 +212,48 @@ func Lookup(path string) (Repo, error) { } // lookup returns the module with the given module path. -func lookup(path string) (r Repo, err error) { +func lookup(proxy, path string) (r Repo, err error) { if cfg.BuildMod == "vendor" { - return nil, fmt.Errorf("module lookup disabled by -mod=%s", cfg.BuildMod) + return nil, errModVendor } - if proxyURL == "off" { - return nil, fmt.Errorf("module lookup disabled by GOPROXY=%s", proxyURL) + + if str.GlobsMatchPath(cfg.GONOPROXY, path) { + switch proxy { + case "noproxy", "direct": + return lookupDirect(path) + default: + return nil, errNoproxy + } } - if proxyURL != "" && proxyURL != "direct" { - return lookupProxy(path) + + switch proxy { + case "off": + return nil, errProxyOff + case "direct": + return lookupDirect(path) + case "noproxy": + return nil, errUseProxy + default: + return newProxyRepo(proxy, path) } +} + +var ( + errModVendor = errors.New("module lookup disabled by -mod=vendor") + errProxyOff = errors.New("module lookup disabled by GOPROXY=off") + errNoproxy error = notExistError("disabled by GOPRIVATE/GONOPROXY") + errUseProxy error = notExistError("path does not match GOPRIVATE/GONOPROXY") +) - security := web.Secure +func lookupDirect(path string) (Repo, error) { + security := web.SecureOnly if get.Insecure { security = web.Insecure } rr, err := get.RepoRootForImportPath(path, get.PreferMod, security) if err != nil { // We don't know where to find code for a module with this path. - return nil, err + return nil, notExistError(err.Error()) } if rr.VCS == "mod" { @@ -260,7 +291,7 @@ func ImportRepoRev(path, rev string) (Repo, *RevInfo, error) { // Note: Because we are converting a code reference from a legacy // version control system, we ignore meta tags about modules // and use only direct source control entries (get.IgnoreMod). - security := web.Secure + security := web.SecureOnly if get.Insecure { security = web.Insecure } @@ -288,7 +319,7 @@ func ImportRepoRev(path, rev string) (Repo, *RevInfo, error) { return nil, nil, err } - info, err := repo.(*codeRepo).convert(revInfo, "") + info, err := repo.(*codeRepo).convert(revInfo, rev) if err != nil { return nil, nil, err } @@ -364,3 +395,13 @@ func (l *loggingRepo) Zip(dst io.Writer, version string) error { defer logCall("Repo[%s]: Zip(%s, %q)", l.r.ModulePath(), dstName, version)() return l.r.Zip(dst, version) } + +// A notExistError is like os.ErrNotExist, but with a custom message +type notExistError string + +func (e notExistError) Error() string { + return string(e) +} +func (notExistError) Is(target error) bool { + return target == os.ErrNotExist +} diff --git a/libgo/go/cmd/go/internal/modfetch/sumdb.go b/libgo/go/cmd/go/internal/modfetch/sumdb.go new file mode 100644 index 00000000000..66a09d32c27 --- /dev/null +++ b/libgo/go/cmd/go/internal/modfetch/sumdb.go @@ -0,0 +1,263 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Go checksum database lookup + +// +build !cmd_go_bootstrap + +package modfetch + +import ( + "bytes" + "errors" + "fmt" + "io/ioutil" + "net/url" + "os" + "path/filepath" + "strings" + "sync" + "time" + + "cmd/go/internal/base" + "cmd/go/internal/cfg" + "cmd/go/internal/get" + "cmd/go/internal/lockedfile" + "cmd/go/internal/module" + "cmd/go/internal/note" + "cmd/go/internal/str" + "cmd/go/internal/sumweb" + "cmd/go/internal/web" +) + +// useSumDB reports whether to use the Go checksum database for the given module. +func useSumDB(mod module.Version) bool { + return cfg.GOSUMDB != "off" && !get.Insecure && !str.GlobsMatchPath(cfg.GONOSUMDB, mod.Path) +} + +// lookupSumDB returns the Go checksum database's go.sum lines for the given module, +// along with the name of the database. +func lookupSumDB(mod module.Version) (dbname string, lines []string, err error) { + dbOnce.Do(func() { + dbName, db, dbErr = dbDial() + }) + if dbErr != nil { + return "", nil, dbErr + } + lines, err = db.Lookup(mod.Path, mod.Version) + return dbName, lines, err +} + +var ( + dbOnce sync.Once + dbName string + db *sumweb.Conn + dbErr error +) + +func dbDial() (dbName string, db *sumweb.Conn, err error) { + // $GOSUMDB can be "key" or "key url", + // and the key can be a full verifier key + // or a host on our list of known keys. + key := strings.Fields(cfg.GOSUMDB) + if len(key) >= 1 { + if k := knownGOSUMDB[key[0]]; k != "" { + key[0] = k + } + } + if len(key) == 0 { + return "", nil, fmt.Errorf("missing GOSUMDB") + } + if len(key) > 2 { + return "", nil, fmt.Errorf("invalid GOSUMDB: too many fields") + } + vkey, err := note.NewVerifier(key[0]) + if err != nil { + return "", nil, fmt.Errorf("invalid GOSUMDB: %v", err) + } + name := vkey.Name() + + // No funny business in the database name. + direct, err := url.Parse("https://" + name) + if err != nil || strings.HasSuffix(name, "/") || *direct != (url.URL{Scheme: "https", Host: direct.Host, Path: direct.Path, RawPath: direct.RawPath}) || direct.RawPath != "" || direct.Host == "" { + return "", nil, fmt.Errorf("invalid sumdb name (must be host[/path]): %s %+v", name, *direct) + } + + // Determine how to get to database. + var base *url.URL + if len(key) >= 2 { + // Use explicit alternate URL listed in $GOSUMDB, + // bypassing both the default URL derivation and any proxies. + u, err := url.Parse(key[1]) + if err != nil { + return "", nil, fmt.Errorf("invalid GOSUMDB URL: %v", err) + } + base = u + } + + return name, sumweb.NewConn(&dbClient{key: key[0], name: name, direct: direct, base: base}), nil +} + +type dbClient struct { + key string + name string + direct *url.URL + + once sync.Once + base *url.URL + baseErr error +} + +func (c *dbClient) ReadRemote(path string) ([]byte, error) { + c.once.Do(c.initBase) + if c.baseErr != nil { + return nil, c.baseErr + } + + var data []byte + start := time.Now() + targ := web.Join(c.base, path) + data, err := web.GetBytes(targ) + if false { + fmt.Fprintf(os.Stderr, "%.3fs %s\n", time.Since(start).Seconds(), web.Redacted(targ)) + } + return data, err +} + +// initBase determines the base URL for connecting to the database. +// Determining the URL requires sending network traffic to proxies, +// so this work is delayed until we need to download something from +// the database. If everything we need is in the local cache and +// c.ReadRemote is never called, we will never do this work. +func (c *dbClient) initBase() { + if c.base != nil { + return + } + + // Try proxies in turn until we find out how to connect to this database. + urls, err := proxyURLs() + if err != nil { + c.baseErr = err + return + } + for _, proxyURL := range urls { + if proxyURL == "noproxy" { + continue + } + if proxyURL == "direct" || proxyURL == "off" { + break + } + proxy, err := url.Parse(proxyURL) + if err != nil { + c.baseErr = err + return + } + // Quoting https://golang.org/design/25530-sumdb#proxying-a-checksum-database: + // + // Before accessing any checksum database URL using a proxy, + // the proxy client should first fetch /sumdb//supported. + // If that request returns a successful (HTTP 200) response, then the proxy supports + // proxying checksum database requests. In that case, the client should use + // the proxied access method only, never falling back to a direct connection to the database. + // If the /sumdb//supported check fails with a “not found” (HTTP 404) + // or “gone” (HTTP 410) response, the proxy is unwilling to proxy the checksum database, + // and the client should connect directly to the database. + // Any other response is treated as the database being unavailable. + _, err = web.GetBytes(web.Join(proxy, "sumdb/"+c.name+"/supported")) + if err == nil { + // Success! This proxy will help us. + c.base = web.Join(proxy, "sumdb/"+c.name) + return + } + // If the proxy serves a non-404/410, give up. + if !errors.Is(err, os.ErrNotExist) { + c.baseErr = err + return + } + } + + // No proxies, or all proxies said 404, or we reached an explicit "direct". + c.base = c.direct +} + +// ReadConfig reads the key from c.key +// and otherwise reads the config (a latest tree head) from GOPATH/pkg/sumdb/. +func (c *dbClient) ReadConfig(file string) (data []byte, err error) { + if file == "key" { + return []byte(c.key), nil + } + + // GOPATH/pkg is PkgMod/.. + targ := filepath.Join(PkgMod, "../sumdb/"+file) + data, err = lockedfile.Read(targ) + if errors.Is(err, os.ErrNotExist) { + // Treat non-existent as empty, to bootstrap the "latest" file + // the first time we connect to a given database. + return []byte{}, nil + } + return data, err +} + +// WriteConfig rewrites the latest tree head. +func (*dbClient) WriteConfig(file string, old, new []byte) error { + if file == "key" { + // Should not happen. + return fmt.Errorf("cannot write key") + } + targ := filepath.Join(PkgMod, "../sumdb/"+file) + os.MkdirAll(filepath.Dir(targ), 0777) + f, err := lockedfile.Edit(targ) + if err != nil { + return err + } + defer f.Close() + data, err := ioutil.ReadAll(f) + if err != nil { + return err + } + if len(data) > 0 && !bytes.Equal(data, old) { + return sumweb.ErrWriteConflict + } + if _, err := f.Seek(0, 0); err != nil { + return err + } + if err := f.Truncate(0); err != nil { + return err + } + if _, err := f.Write(new); err != nil { + return err + } + return f.Close() +} + +// ReadCache reads cached lookups or tiles from +// GOPATH/pkg/mod/download/cache/sumdb, +// which will be deleted by "go clean -modcache". +func (*dbClient) ReadCache(file string) ([]byte, error) { + targ := filepath.Join(PkgMod, "download/cache/sumdb", file) + data, err := lockedfile.Read(targ) + // lockedfile.Write does not atomically create the file with contents. + // There is a moment between file creation and locking the file for writing, + // during which the empty file can be locked for reading. + // Treat observing an empty file as file not found. + if err == nil && len(data) == 0 { + err = &os.PathError{Op: "read", Path: targ, Err: os.ErrNotExist} + } + return data, err +} + +// WriteCache updates cached lookups or tiles. +func (*dbClient) WriteCache(file string, data []byte) { + targ := filepath.Join(PkgMod, "download/cache/sumdb", file) + os.MkdirAll(filepath.Dir(targ), 0777) + lockedfile.Write(targ, bytes.NewReader(data), 0666) +} + +func (*dbClient) Log(msg string) { + // nothing for now +} + +func (*dbClient) SecurityError(msg string) { + base.Fatalf("%s", msg) +} diff --git a/libgo/go/cmd/go/internal/modfetch/web.go b/libgo/go/cmd/go/internal/modfetch/web.go deleted file mode 100644 index b327bf293d1..00000000000 --- a/libgo/go/cmd/go/internal/modfetch/web.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !cmd_go_bootstrap - -package modfetch - -import ( - "io" - - web "cmd/go/internal/web2" -) - -// webGetGoGet fetches a go-get=1 URL and returns the body in *body. -// It allows non-200 responses, as usual for these URLs. -func webGetGoGet(url string, body *io.ReadCloser) error { - return web.Get(url, web.Non200OK(), web.Body(body)) -} - -// webGetBytes returns the body returned by an HTTP GET, as a []byte. -// It insists on a 200 response. -func webGetBytes(url string, body *[]byte) error { - return web.Get(url, web.ReadAllBody(body)) -} - -// webGetBody returns the body returned by an HTTP GET, as a io.ReadCloser. -// It insists on a 200 response. -func webGetBody(url string, body *io.ReadCloser) error { - return web.Get(url, web.Body(body)) -} diff --git a/libgo/go/cmd/go/internal/modfile/rule.go b/libgo/go/cmd/go/internal/modfile/rule.go index 7f9a18c6c2a..6e1a22f3caa 100644 --- a/libgo/go/cmd/go/internal/modfile/rule.go +++ b/libgo/go/cmd/go/internal/modfile/rule.go @@ -8,15 +8,14 @@ import ( "bytes" "errors" "fmt" + "internal/lazyregexp" "path/filepath" - "regexp" "sort" "strconv" "strings" "unicode" "cmd/go/internal/module" - "cmd/go/internal/semver" ) // A File is the parsed, interpreted form of a go.mod file. @@ -154,7 +153,7 @@ func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (*File return f, nil } -var GoVersionRE = regexp.MustCompile(`([1-9][0-9]*)\.(0|[1-9][0-9]*)`) +var GoVersionRE = lazyregexp.New(`([1-9][0-9]*)\.(0|[1-9][0-9]*)`) func (f *File) add(errs *bytes.Buffer, line *Line, verb string, args []string, fix VersionFixer, strict bool) { // If strict is false, this module is a dependency. @@ -195,7 +194,7 @@ func (f *File) add(errs *bytes.Buffer, line *Line, verb string, args []string, f f.Module = &Module{Syntax: line} if len(args) != 1 { - fmt.Fprintf(errs, "%s:%d: usage: module module/path [version]\n", f.Syntax.Name, line.Start.Line) + fmt.Fprintf(errs, "%s:%d: usage: module module/path\n", f.Syntax.Name, line.Start.Line) return } s, err := parseString(&args[0]) @@ -214,10 +213,9 @@ func (f *File) add(errs *bytes.Buffer, line *Line, verb string, args []string, f fmt.Fprintf(errs, "%s:%d: invalid quoted string: %v\n", f.Syntax.Name, line.Start.Line, err) return } - old := args[1] - v, err := parseVersion(s, &args[1], fix) + v, err := parseVersion(verb, s, &args[1], fix) if err != nil { - fmt.Fprintf(errs, "%s:%d: invalid module version %q: %v\n", f.Syntax.Name, line.Start.Line, old, err) + fmt.Fprintf(errs, "%s:%d: %v\n", f.Syntax.Name, line.Start.Line, err) return } pathMajor, err := modulePathMajor(s) @@ -225,11 +223,8 @@ func (f *File) add(errs *bytes.Buffer, line *Line, verb string, args []string, f fmt.Fprintf(errs, "%s:%d: %v\n", f.Syntax.Name, line.Start.Line, err) return } - if !module.MatchPathMajor(v, pathMajor) { - if pathMajor == "" { - pathMajor = "v0 or v1" - } - fmt.Fprintf(errs, "%s:%d: invalid module: %s should be %s, not %s (%s)\n", f.Syntax.Name, line.Start.Line, s, pathMajor, semver.Major(v), v) + if err := module.MatchPathMajor(v, pathMajor); err != nil { + fmt.Fprintf(errs, "%s:%d: %v\n", f.Syntax.Name, line.Start.Line, &Error{Verb: verb, ModPath: s, Err: err}) return } if verb == "require" { @@ -265,17 +260,13 @@ func (f *File) add(errs *bytes.Buffer, line *Line, verb string, args []string, f } var v string if arrow == 2 { - old := args[1] - v, err = parseVersion(s, &args[1], fix) + v, err = parseVersion(verb, s, &args[1], fix) if err != nil { - fmt.Fprintf(errs, "%s:%d: invalid module version %v: %v\n", f.Syntax.Name, line.Start.Line, old, err) + fmt.Fprintf(errs, "%s:%d: %v\n", f.Syntax.Name, line.Start.Line, err) return } - if !module.MatchPathMajor(v, pathMajor) { - if pathMajor == "" { - pathMajor = "v0 or v1" - } - fmt.Fprintf(errs, "%s:%d: invalid module: %s should be %s, not %s (%s)\n", f.Syntax.Name, line.Start.Line, s, pathMajor, semver.Major(v), v) + if err := module.MatchPathMajor(v, pathMajor); err != nil { + fmt.Fprintf(errs, "%s:%d: %v\n", f.Syntax.Name, line.Start.Line, &Error{Verb: verb, ModPath: s, Err: err}) return } } @@ -296,10 +287,9 @@ func (f *File) add(errs *bytes.Buffer, line *Line, verb string, args []string, f } } if len(args) == arrow+3 { - old := args[arrow+1] - nv, err = parseVersion(ns, &args[arrow+2], fix) + nv, err = parseVersion(verb, ns, &args[arrow+2], fix) if err != nil { - fmt.Fprintf(errs, "%s:%d: invalid module version %v: %v\n", f.Syntax.Name, line.Start.Line, old, err) + fmt.Fprintf(errs, "%s:%d: %v\n", f.Syntax.Name, line.Start.Line, err) return } if IsDirectoryPath(ns) { @@ -411,15 +401,41 @@ func parseString(s *string) (string, error) { return t, nil } -func parseVersion(path string, s *string, fix VersionFixer) (string, error) { +type Error struct { + Verb string + ModPath string + Err error +} + +func (e *Error) Error() string { + return fmt.Sprintf("%s %s: %v", e.Verb, e.ModPath, e.Err) +} + +func (e *Error) Unwrap() error { return e.Err } + +func parseVersion(verb string, path string, s *string, fix VersionFixer) (string, error) { t, err := parseString(s) if err != nil { - return "", err + return "", &Error{ + Verb: verb, + ModPath: path, + Err: &module.InvalidVersionError{ + Version: *s, + Err: err, + }, + } } if fix != nil { var err error t, err = fix(path, t) if err != nil { + if err, ok := err.(*module.ModuleError); ok { + return "", &Error{ + Verb: verb, + ModPath: path, + Err: err.Err, + } + } return "", err } } @@ -427,7 +443,14 @@ func parseVersion(path string, s *string, fix VersionFixer) (string, error) { *s = v return *s, nil } - return "", fmt.Errorf("version must be of the form v1.2.3") + return "", &Error{ + Verb: verb, + ModPath: path, + Err: &module.InvalidVersionError{ + Version: t, + Err: errors.New("must be of the form v1.2.3"), + }, + } } func modulePathMajor(path string) (string, error) { diff --git a/libgo/go/cmd/go/internal/modget/get.go b/libgo/go/cmd/go/internal/modget/get.go index 17a0ed45e21..491d2891c7e 100644 --- a/libgo/go/cmd/go/internal/modget/get.go +++ b/libgo/go/cmd/go/internal/modget/get.go @@ -9,27 +9,28 @@ import ( "cmd/go/internal/base" "cmd/go/internal/cfg" "cmd/go/internal/get" + "cmd/go/internal/imports" "cmd/go/internal/load" - "cmd/go/internal/modfetch" "cmd/go/internal/modload" "cmd/go/internal/module" "cmd/go/internal/mvs" "cmd/go/internal/par" "cmd/go/internal/search" "cmd/go/internal/semver" - "cmd/go/internal/str" "cmd/go/internal/work" + "errors" "fmt" "os" - pathpkg "path" "path/filepath" + "sort" "strings" + "sync" ) var CmdGet = &base.Command{ - // Note: -d -m -u are listed explicitly because they are the most common get flags. + // Note: -d -u are listed explicitly because they are the most common get flags. // Do not send CLs removing them because they're covered by [get flags]. - UsageLine: "go get [-d] [-m] [-u] [-v] [-insecure] [build flags] [packages]", + UsageLine: "go get [-d] [-t] [-u] [-v] [-insecure] [build flags] [packages]", Short: "add dependencies to current module and install them", Long: ` Get resolves and adds dependencies to the current development module @@ -40,7 +41,7 @@ The first step is to resolve which dependencies to add. For each named package or package pattern, get must decide which version of the corresponding module to use. By default, get chooses the latest tagged release version, such as v0.4.5 or v1.2.3. If there are no tagged release -versions, get chooses the latest tagged prerelease version, such as +versions, get chooses the latest tagged pre-release version, such as v0.0.1-pre1. If there are no tagged versions at all, get chooses the latest known commit. @@ -49,8 +50,6 @@ suffix to the package argument, as in 'go get golang.org/x/text@v0.3.0'. For modules stored in source control repositories, the version suffix can also be a commit hash, branch identifier, or other syntax known to the source control system, as in 'go get golang.org/x/text@master'. -The version suffix @latest explicitly requests the default behavior -described above. If a module under consideration is already a dependency of the current development module, then get will update the required version. @@ -59,6 +58,14 @@ downgrades the dependency. The version suffix @none indicates that the dependency should be removed entirely, downgrading or removing modules depending on it as needed. +The version suffix @latest explicitly requests the latest minor release of the +given path. The suffix @patch requests the latest patch release: if the path +is already in the build list, the selected version will have the same minor +version. If the path is not already in the build list, @patch is equivalent +to @latest. Neither @latest nor @patch will cause 'go get' to downgrade a module +in the build list if it is required at a newer pre-release version that is +newer than the latest released version. + Although get defaults to using the latest version of the module containing a named package, it does not use the latest version of that module's dependencies. Instead it prefers to use the specific dependency versions @@ -68,13 +75,24 @@ will use the latest A but then use B v1.2.3, as requested by A. (If there are competing requirements for a particular module, then 'go get' resolves those requirements by taking the maximum requested version.) -The -u flag instructs get to update dependencies to use newer minor or -patch releases when available. Continuing the previous example, -'go get -u A' will use the latest A with B v1.3.1 (not B v1.2.3). +The -t flag instructs get to consider modules needed to build tests of +packages specified on the command line. + +The -u flag instructs get to update modules providing dependencies +of packages named on the command line to use newer minor or patch +releases when available. Continuing the previous example, 'go get -u A' +will use the latest A with B v1.3.1 (not B v1.2.3). If B requires module C, +but C does not provide any packages needed to build packages in A +(not including tests), then C will not be updated. + +The -u=patch flag (not -u patch) also instructs get to update dependencies, +but changes the default to select patch releases. +Continuing the previous example, +'go get -u=patch A@latest' will use the latest A with B v1.2.4 (not B v1.2.3), +while 'go get -u=patch A' will use a patch release of A instead. -The -u=patch flag (not -u patch) instructs get to update dependencies -to use newer patch releases when available. Continuing the previous example, -'go get -u=patch A' will use the latest A with B v1.2.4 (not B v1.2.3). +When the -t and -u flags are used together, get will update +test dependencies as well. In general, adding a new dependency may require upgrading existing dependencies to keep a working build, and 'go get' does @@ -82,11 +100,6 @@ this automatically. Similarly, downgrading one dependency may require downgrading other dependencies, and 'go get' does this automatically as well. -The -m flag instructs get to stop here, after resolving, upgrading, -and downgrading modules and updating go.mod. When using -m, -each specified package path must be a module path as well, -not the import path of a package below the module root. - The -insecure flag permits fetching from repositories and resolving custom domains using insecure schemes such as HTTP. Use with caution. @@ -108,12 +121,11 @@ The -d flag instructs get to download the source code needed to build the named packages, including downloading necessary dependencies, but not to build and install them. -With no package arguments, 'go get' applies to the main module, -and to the Go package in the current directory, if any. In particular, -'go get -u' and 'go get -u=patch' update all the dependencies of the -main module. With no package arguments and also without -u, -'go get' is not much more than 'go install', and 'go get -d' not much -more than 'go list'. +With no package arguments, 'go get' applies to Go package in the +current directory, if any. In particular, 'go get -u' and +'go get -u=patch' update all the dependencies of that package. +With no package arguments and also without -u, 'go get' is not much more +than 'go install', and 'go get -d' not much more than 'go list'. For more about modules, see 'go help modules'. @@ -165,6 +177,9 @@ func (v *upgradeFlag) Set(s string) error { if s == "false" { s = "" } + if s == "true" { + s = "latest" + } *v = upgradeFlag(s) return nil } @@ -178,15 +193,53 @@ func init() { CmdGet.Flag.Var(&getU, "u", "") } -// A task holds the state for processing a single get argument (path@vers). -type task struct { - arg string // original argument - index int - path string // package path part of arg - forceModulePath bool // path must be interpreted as a module path - vers string // version part of arg - m module.Version // module version indicated by argument - req []module.Version // m's requirement list (not upgraded) +// A getArg holds a parsed positional argument for go get (path@vers). +type getArg struct { + // raw is the original argument, to be printed in error messages. + raw string + + // path is the part of the argument before "@" (or the whole argument + // if there is no "@"). path specifies the modules or packages to get. + path string + + // vers is the part of the argument after "@" (or "" if there is no "@"). + // vers specifies the module version to get. + vers string +} + +// querySpec describes a query for a specific module. path may be a +// module path, package path, or package pattern. vers is a version +// query string from a command line argument. +type querySpec struct { + // path is a module path, package path, or package pattern that + // specifies which module to query. + path string + + // vers specifies what version of the module to get. + vers string + + // forceModulePath is true if path should be interpreted as a module path. + // If forceModulePath is true, prevM must be set. + forceModulePath bool + + // prevM is the previous version of the module. prevM is needed + // to determine the minor version number if vers is "patch". It's also + // used to avoid downgrades from prerelease versions newer than + // "latest" and "patch". If prevM is set, forceModulePath must be true. + prevM module.Version +} + +// query holds the state for a query made for a specific module. +// After a query is performed, we know the actual module path and +// version and whether any packages were matched by the query path. +type query struct { + querySpec + + // arg is the command line argument that matched the specified module. + arg string + + // m is the module path and version found by the query. + m module.Version } func runGet(cmd *base.Command, args []string) { @@ -196,7 +249,7 @@ func runGet(cmd *base.Command, args []string) { } switch getU { - case "", "patch", "true": + case "", "latest", "patch": // ok default: base.Fatalf("go get: unknown upgrade flag -u=%s", getU) @@ -207,29 +260,32 @@ func runGet(cmd *base.Command, args []string) { if *getFix { fmt.Fprintf(os.Stderr, "go get: -fix flag is a no-op when using modules\n") } - if *getT { - fmt.Fprintf(os.Stderr, "go get: -t flag is a no-op when using modules\n") + if *getM { + base.Fatalf("go get: -m flag is no longer supported; consider -d to skip building packages") } + modload.LoadTests = *getT if cfg.BuildMod == "vendor" { base.Fatalf("go get: disabled by -mod=%s", cfg.BuildMod) } - modload.LoadBuildList() + buildList := modload.LoadBuildList() + buildList = buildList[:len(buildList):len(buildList)] // copy on append + versionByPath := make(map[string]string) + for _, m := range buildList { + versionByPath[m.Path] = m.Version + } // Do not allow any updating of go.mod until we've applied // all the requested changes and checked that the result matches // what was requested. modload.DisallowWriteGoMod() - // Build task and install lists. - // The command-line arguments are of the form path@version - // or simply path, with implicit @latest. path@none is "downgrade away". - // At the end of the loop, we've resolved the list of arguments into - // a list of tasks (a path@vers that needs further processing) - // and a list of install targets (for the "go install" at the end). - var tasks []*task - var install []string + // Parse command-line arguments and report errors. The command-line + // arguments are of the form path@version or simply path, with implicit + // @latest. path@none is "downgrade away". + var gets []getArg + var queries []*query for _, arg := range search.CleanPatterns(args) { // Argument is module query path@vers, or else path with implicit @latest. path := arg @@ -241,226 +297,306 @@ func runGet(cmd *base.Command, args []string) { base.Errorf("go get %s: invalid module version syntax", arg) continue } - if vers != "none" { - install = append(install, path) - } - - // Deciding which module to upgrade/downgrade for a particular argument is difficult. - // Patterns only make it more difficult. - // We impose restrictions to avoid needing to interlace pattern expansion, - // like in modload.ImportPaths. - // Specifically, these patterns are supported: - // - // - Relative paths like ../../foo or ../../foo... are restricted to matching directories - // in the current module and therefore map to the current module. - // It's possible that the pattern matches no packages, but we will still treat it - // as mapping to the current module. - // TODO: In followup, could just expand the full list and remove the discrepancy. - // - The pattern "all" has its usual package meaning and maps to the list of modules - // from which the matched packages are drawn. This is potentially a subset of the - // module pattern "all". If module A requires B requires C but A does not import - // the parts of B that import C, the packages matched by "all" are only from A and B, - // so only A and B end up on the tasks list. - // TODO: Even in -m mode? - // - The patterns "std" and "cmd" expand to packages in the standard library, - // which aren't upgradable, so we skip over those. - // In -m mode they expand to non-module-paths, so they are disallowed. - // - Import path patterns like foo/bar... are matched against the module list, - // assuming any package match would imply a module pattern match. - // TODO: What about -m mode? - // - Import paths without patterns are left as is, for resolution by getQuery (eventually modload.Import). - // - if search.IsRelativePath(path) { - // Check that this relative pattern only matches directories in the current module, - // and then record the current module as the target. - dir := path - if i := strings.Index(path, "..."); i >= 0 { - dir, _ = pathpkg.Split(path[:i]) - } - abs, err := filepath.Abs(dir) - if err != nil { - base.Errorf("go get %s: %v", arg, err) - continue - } - if !str.HasFilePathPrefix(abs, modload.ModRoot()) { - base.Errorf("go get %s: directory %s is outside module root %s", arg, abs, modload.ModRoot()) - continue - } - // TODO: Check if abs is inside a nested module. - tasks = append(tasks, &task{arg: arg, path: modload.Target.Path, vers: ""}) - continue + + // If the user runs 'go get -u=patch some/module', update some/module to a + // patch release, not a minor version. + if vers == "" && getU != "" { + vers = string(getU) } - if path == "all" { - // TODO: If *getM, should this be the module pattern "all"? - - // This is the package pattern "all" not the module pattern "all": - // enumerate all the modules actually needed by builds of the packages - // in the main module, not incidental modules that happen to be - // in the package graph (and therefore build list). - // Note that LoadALL may add new modules to the build list to - // satisfy new imports, but vers == "latest" implicitly anyway, - // so we'll assume that's OK. - seen := make(map[module.Version]bool) - pkgs := modload.LoadALL() - for _, pkg := range pkgs { - m := modload.PackageModule(pkg) - if m.Path != "" && !seen[m] { - seen[m] = true - tasks = append(tasks, &task{arg: arg, path: m.Path, vers: "latest", forceModulePath: true}) + + gets = append(gets, getArg{raw: arg, path: path, vers: vers}) + + // Determine the modules that path refers to, and create queries + // to lookup modules at target versions before loading packages. + // This is an imprecise process, but it helps reduce unnecessary + // queries and package loading. It's also necessary for handling + // patterns like golang.org/x/tools/..., which can't be expanded + // during package loading until they're in the build list. + switch { + case search.IsRelativePath(path): + // Relative paths like ../../foo or ../../foo... are restricted to + // matching packages in the main module. If the path is explicit and + // contains no wildcards (...), check that it is a package in + // the main module. If the path contains wildcards but matches no + // packages, we'll warn after package loading. + if !strings.Contains(path, "...") { + pkgPath := modload.DirImportPath(filepath.FromSlash(path)) + if pkgs := modload.TargetPackages(pkgPath); len(pkgs) == 0 { + abs, err := filepath.Abs(path) + if err != nil { + abs = path + } + base.Errorf("go get %s: path %s is not a package in module rooted at %s", arg, abs, modload.ModRoot()) + continue } } - continue - } - if search.IsMetaPackage(path) { - // Already handled "all", so this must be "std" or "cmd", - // which are entirely in the standard library. + if path != arg { - base.Errorf("go get %s: cannot use pattern %q with explicit version", arg, arg) - } - if *getM { - base.Errorf("go get %s: cannot use pattern %q with -m", arg, arg) + base.Errorf("go get %s: can't request explicit version of path in main module", arg) continue } + + case strings.Contains(path, "..."): + // Wait until we load packages to look up modules. + // We don't know yet whether any modules in the build list provide + // packages matching the pattern. For example, suppose + // golang.org/x/tools and golang.org/x/tools/playground are separate + // modules, and only golang.org/x/tools is in the build list. If the + // user runs 'go get golang.org/x/tools/playground/...', we should + // add a requirement for golang.org/x/tools/playground. We should not + // upgrade golang.org/x/tools. + + case path == "all": + // Don't query modules until we load packages. We'll automatically + // look up any missing modules. + + case search.IsMetaPackage(path): + base.Errorf("go get %s: explicit requirement on standard-library module %s not allowed", path, path) continue - } - if strings.Contains(path, "...") { - // Apply to modules in build list matched by pattern (golang.org/x/...), if any. - match := search.MatchPattern(path) - matched := false - for _, m := range modload.BuildList() { - if match(m.Path) || str.HasPathPrefix(path, m.Path) { - tasks = append(tasks, &task{arg: arg, path: m.Path, vers: vers, forceModulePath: true}) - matched = true + + default: + // The argument is a package path. + if pkgs := modload.TargetPackages(path); len(pkgs) != 0 { + // The path is in the main module. Nothing to query. + if vers != "" && vers != "latest" && vers != "patch" { + base.Errorf("go get %s: can't request explicit version of path in main module", arg) } - } - // If matched, we're done. - // Otherwise assume pattern is inside a single module - // (golang.org/x/text/unicode/...) and leave for usual lookup. - // Unless we're using -m. - if matched { continue } - if *getM { - base.Errorf("go get %s: pattern matches no modules in build list", arg) + + first := path + if i := strings.IndexByte(first, '/'); i >= 0 { + first = path + } + if !strings.Contains(first, ".") { + // The path doesn't have a dot in the first component and cannot be + // queried as a module. It may be a package in the standard library, + // which is fine, so don't report an error unless we encounter + // a problem loading packages below. continue } + + // If we're querying "latest" or "patch", we need to know the current + // version of the module. For "latest", we want to avoid accidentally + // downgrading from a newer prerelease. For "patch", we need to query + // the correct minor version. + // Here, we check if "path" is the name of a module in the build list + // (other than the main module) and set prevM if so. If "path" isn't + // a module in the build list, the current version doesn't matter + // since it's either an unknown module or a package within a module + // that we'll discover later. + q := &query{querySpec: querySpec{path: path, vers: vers}, arg: arg} + if v, ok := versionByPath[path]; ok && path != modload.Target.Path { + q.prevM = module.Version{Path: path, Version: v} + q.forceModulePath = true + } + queries = append(queries, q) } - tasks = append(tasks, &task{arg: arg, path: path, vers: vers}) } base.ExitIfErrors() - // Now we've reduced the upgrade/downgrade work to a list of path@vers pairs (tasks). - // Resolve each one in parallel. - reqs := modload.Reqs() - var lookup par.Work - for _, t := range tasks { - lookup.Add(t) - } - lookup.Do(10, func(item interface{}) { - t := item.(*task) - if t.vers == "none" { - // Wait for downgrade step. - t.m = module.Version{Path: t.path, Version: "none"} - return + // Query modules referenced by command line arguments at requested versions. + // We need to do this before loading packages since patterns that refer to + // packages in unknown modules can't be expanded. This also avoids looking + // up new modules while loading packages, only to downgrade later. + queryCache := make(map[querySpec]*query) + byPath := runQueries(queryCache, queries, nil) + + // Add missing modules to the build list. + // We call SetBuildList here and elsewhere, since newUpgrader, + // ImportPathsQuiet, and other functions read the global build list. + for _, q := range queries { + if _, ok := versionByPath[q.m.Path]; !ok && q.m.Version != "none" { + buildList = append(buildList, q.m) } - m, err := getQuery(t.path, t.vers, t.forceModulePath) - if err != nil { - base.Errorf("go get %v: %v", t.arg, err) - return + } + versionByPath = nil // out of date now; rebuilt later when needed + modload.SetBuildList(buildList) + + // Upgrade modules specifically named on the command line. This is our only + // chance to upgrade modules without root packages (modOnly below). + // This also skips loading packages at an old version, only to upgrade + // and reload at a new version. + upgrade := make(map[string]*query) + for path, q := range byPath { + if q.path == q.m.Path && q.m.Version != "none" { + upgrade[path] = q } - t.m = m - }) + } + buildList, err := mvs.UpgradeAll(modload.Target, newUpgrader(upgrade, nil)) + if err != nil { + base.Fatalf("go get: %v", err) + } + modload.SetBuildList(buildList) base.ExitIfErrors() - - // Now we know the specific version of each path@vers. - // The final build list will be the union of three build lists: - // 1. the original build list - // 2. the modules named on the command line (other than @none) - // 3. the upgraded requirements of those modules (if upgrading) - // Start building those lists. - // This loop collects (2). - // Also, because the list of paths might have named multiple packages in a single module - // (or even the same package multiple times), now that we know the module for each - // package, this loop deduplicates multiple references to a given module. - // (If a module is mentioned multiple times, the listed target version must be the same each time.) - var named []module.Version - byPath := make(map[string]*task) - for _, t := range tasks { - prev, ok := byPath[t.m.Path] - if prev != nil && prev.m != t.m { - base.Errorf("go get: conflicting versions for module %s: %s and %s", t.m.Path, prev.m.Version, t.m.Version) - byPath[t.m.Path] = nil // sentinel to stop errors + prevBuildList := buildList + + // Build a set of module paths that we don't plan to load packages from. + // This includes explicitly requested modules that don't have a root package + // and modules with a target version of "none". + var wg sync.WaitGroup + modOnly := make(map[string]*query) + for _, q := range queries { + if q.m.Version == "none" { + modOnly[q.m.Path] = q continue } - if ok { - continue // already added - } - byPath[t.m.Path] = t - if t.m.Version != "none" { - named = append(named, t.m) + if q.path == q.m.Path { + wg.Add(1) + go func(q *query) { + if hasPkg, err := modload.ModuleHasRootPackage(q.m); err != nil { + base.Errorf("go get: %v", err) + } else if !hasPkg { + modOnly[q.m.Path] = q + } + wg.Done() + }(q) } } + wg.Wait() base.ExitIfErrors() - // If the modules named on the command line have any dependencies - // and we're supposed to upgrade dependencies, - // chase down the full list of upgraded dependencies. - // This turns required from a not-yet-upgraded (3) to the final (3). - // (See list above.) - var required []module.Version - if getU != "" { - upgraded, err := mvs.UpgradeAll(upgradeTarget, &upgrader{ - Reqs: modload.Reqs(), - targets: named, - patch: getU == "patch", - tasks: byPath, - }) + // Build a list of arguments that may refer to packages. + var pkgPatterns []string + var pkgGets []getArg + for _, arg := range gets { + if modOnly[arg.path] == nil && arg.vers != "none" { + pkgPatterns = append(pkgPatterns, arg.path) + pkgGets = append(pkgGets, arg) + } + } + + // Load packages and upgrade the modules that provide them. We do this until + // we reach a fixed point, since modules providing packages may change as we + // change versions. This must terminate because the module graph is finite, + // and the load and upgrade operations may only add and upgrade modules + // in the build list. + var matches []*search.Match + for { + var seenPkgs map[string]bool + seenQuery := make(map[querySpec]bool) + var queries []*query + addQuery := func(q *query) { + if !seenQuery[q.querySpec] { + seenQuery[q.querySpec] = true + queries = append(queries, q) + } + } + + if len(pkgPatterns) > 0 { + // Don't load packages if pkgPatterns is empty. Both + // modload.ImportPathsQuiet and ModulePackages convert an empty list + // of patterns to []string{"."}, which is not what we want. + matches = modload.ImportPathsQuiet(pkgPatterns, imports.AnyTags()) + seenPkgs = make(map[string]bool) + for i, match := range matches { + arg := pkgGets[i] + + if len(match.Pkgs) == 0 { + // If the pattern did not match any packages, look up a new module. + // If the pattern doesn't match anything on the last iteration, + // we'll print a warning after the outer loop. + if !search.IsRelativePath(arg.path) && !match.Literal && arg.path != "all" { + addQuery(&query{querySpec: querySpec{path: arg.path, vers: arg.vers}, arg: arg.raw}) + } + continue + } + + allStd := true + for _, pkg := range match.Pkgs { + if !seenPkgs[pkg] { + seenPkgs[pkg] = true + if _, _, err := modload.Lookup("", false, pkg); err != nil { + allStd = false + base.Errorf("go get %s: %v", arg.raw, err) + continue + } + } + m := modload.PackageModule(pkg) + if m.Path == "" { + // pkg is in the standard library. + continue + } + allStd = false + if m.Path == modload.Target.Path { + // pkg is in the main module. + continue + } + addQuery(&query{querySpec: querySpec{path: m.Path, vers: arg.vers, forceModulePath: true, prevM: m}, arg: arg.raw}) + } + if allStd && arg.path != arg.raw { + base.Errorf("go get %s: cannot use pattern %q with explicit version", arg.raw, arg.raw) + } + } + } + base.ExitIfErrors() + + // Query target versions for modules providing packages matched by + // command line arguments. + byPath = runQueries(queryCache, queries, modOnly) + + // Handle upgrades. This is needed for arguments that didn't match + // modules or matched different modules from a previous iteration. It + // also upgrades modules providing package dependencies if -u is set. + buildList, err := mvs.UpgradeAll(modload.Target, newUpgrader(byPath, seenPkgs)) if err != nil { base.Fatalf("go get: %v", err) } - required = upgraded[1:] // slice off upgradeTarget + modload.SetBuildList(buildList) base.ExitIfErrors() - } - // Put together the final build list as described above (1) (2) (3). - // If we're not using -u, then len(required) == 0 and ReloadBuildList - // chases down the dependencies of all the named module versions - // in one operation. - var list []module.Version - list = append(list, modload.BuildList()...) - list = append(list, named...) - list = append(list, required...) - modload.SetBuildList(list) - modload.ReloadBuildList() // note: does not update go.mod - base.ExitIfErrors() + // Stop if no changes have been made to the build list. + buildList = modload.BuildList() + eq := len(buildList) == len(prevBuildList) + for i := 0; eq && i < len(buildList); i++ { + eq = buildList[i] == prevBuildList[i] + } + if eq { + break + } + prevBuildList = buildList + } + if !*getD { + // Only print warnings after the last iteration, + // and only if we aren't going to build. + search.WarnUnmatched(matches) + } - // Scan for and apply any needed downgrades. + // Handle downgrades. var down []module.Version for _, m := range modload.BuildList() { - t := byPath[m.Path] - if t != nil && semver.Compare(m.Version, t.m.Version) > 0 { - down = append(down, module.Version{Path: m.Path, Version: t.m.Version}) + q := byPath[m.Path] + if q != nil && semver.Compare(m.Version, q.m.Version) > 0 { + down = append(down, module.Version{Path: m.Path, Version: q.m.Version}) } } if len(down) > 0 { - list, err := mvs.Downgrade(modload.Target, modload.Reqs(), down...) + buildList, err := mvs.Downgrade(modload.Target, modload.Reqs(), down...) if err != nil { - base.Fatalf("go get: %v", err) + base.Fatalf("go: %v", err) } - modload.SetBuildList(list) + modload.SetBuildList(buildList) modload.ReloadBuildList() // note: does not update go.mod + base.ExitIfErrors() } - base.ExitIfErrors() // Scan for any upgrades lost by the downgrades. - lost := make(map[string]string) - for _, m := range modload.BuildList() { - t := byPath[m.Path] - if t != nil && semver.Compare(m.Version, t.m.Version) != 0 { - lost[m.Path] = m.Version + var lostUpgrades []*query + if len(down) > 0 { + versionByPath = make(map[string]string) + for _, m := range modload.BuildList() { + versionByPath[m.Path] = m.Version + } + for _, q := range byPath { + if v, ok := versionByPath[q.m.Path]; q.m.Version != "none" && (!ok || semver.Compare(v, q.m.Version) != 0) { + lostUpgrades = append(lostUpgrades, q) + } } + sort.Slice(lostUpgrades, func(i, j int) bool { + return lostUpgrades[i].m.Path < lostUpgrades[j].m.Path + }) } - if len(lost) > 0 { + if len(lostUpgrades) > 0 { desc := func(m module.Version) string { s := m.Path + "@" + m.Version t := byPath[m.Path] @@ -473,23 +609,22 @@ func runGet(cmd *base.Command, args []string) { for _, d := range down { downByPath[d.Path] = d } + var buf strings.Builder fmt.Fprintf(&buf, "go get: inconsistent versions:") - for _, t := range tasks { - if lost[t.m.Path] == "" { - continue - } - // We lost t because its build list requires a newer version of something in down. + reqs := modload.Reqs() + for _, q := range lostUpgrades { + // We lost q because its build list requires a newer version of something in down. // Figure out exactly what. // Repeatedly constructing the build list is inefficient // if there are MANY command-line arguments, // but at least all the necessary requirement lists are cached at this point. - list, err := mvs.BuildList(t.m, reqs) + list, err := buildListForLostUpgrade(q.m, reqs) if err != nil { - base.Fatalf("go get: %v", err) + base.Fatalf("go: %v", err) } - fmt.Fprintf(&buf, "\n\t%s", desc(t.m)) + fmt.Fprintf(&buf, "\n\t%s", desc(q.m)) sep := " requires" for _, m := range list { if down, ok := downByPath[m.Path]; ok && semver.Compare(down.Version, m.Version) < 0 { @@ -500,7 +635,12 @@ func runGet(cmd *base.Command, args []string) { if sep != "," { // We have no idea why this happened. // At least report the problem. - fmt.Fprintf(&buf, " ended up at %v unexpectedly (please report at golang.org/issue/new)", lost[t.m.Path]) + if v := versionByPath[q.m.Path]; v == "" { + fmt.Fprintf(&buf, " removed unexpectedly") + } else { + fmt.Fprintf(&buf, " ended up at %s unexpectedly", v) + } + fmt.Fprintf(&buf, " (please report at golang.org/issue/new)") } } base.Fatalf("%v", buf.String()) @@ -510,126 +650,253 @@ func runGet(cmd *base.Command, args []string) { modload.AllowWriteGoMod() modload.WriteGoMod() - // If -m was specified, we're done after the module work. No download, no build. - if *getM { + // If -d was specified, we're done after the module work. + // We've already downloaded modules by loading packages above. + // Otherwise, we need to build and install the packages matched by + // command line arguments. This may be a different set of packages, + // since we only build packages for the target platform. + // Note that 'go get -u' without arguments is equivalent to + // 'go get -u .', so we'll typically build the package in the current + // directory. + if *getD || len(pkgPatterns) == 0 { return } + work.BuildInit() + pkgs := load.PackagesForBuild(pkgPatterns) + work.InstallPackages(pkgPatterns, pkgs) +} - if len(install) > 0 { - // All requested versions were explicitly @none. - // Note that 'go get -u' without any arguments results in len(install) == 1: - // search.CleanImportPaths returns "." for empty args. - work.BuildInit() - pkgs := load.PackagesAndErrors(install) - var todo []*load.Package - for _, p := range pkgs { - // Ignore "no Go source files" errors for 'go get' operations on modules. - if p.Error != nil { - if len(args) == 0 && getU != "" && strings.HasPrefix(p.Error.Err, "no Go files") { - // Upgrading modules: skip the implicitly-requested package at the - // current directory, even if it is not tho module root. - continue - } - if strings.Contains(p.Error.Err, "cannot find module providing") && modload.ModuleInfo(p.ImportPath) != nil { - // Explicitly-requested module, but it doesn't contain a package at the - // module root. - continue - } - base.Errorf("%s", p.Error) - } - todo = append(todo, p) +// runQueries looks up modules at target versions in parallel. Results will be +// cached. If the same module is referenced by multiple queries at different +// versions (including earlier queries in the modOnly map), an error will be +// reported. A map from module paths to queries is returned, which includes +// queries and modOnly. +func runQueries(cache map[querySpec]*query, queries []*query, modOnly map[string]*query) map[string]*query { + var lookup par.Work + for _, q := range queries { + if cached := cache[q.querySpec]; cached != nil { + *q = *cached + } else { + cache[q.querySpec] = q + lookup.Add(q) } - base.ExitIfErrors() + } + + lookup.Do(10, func(item interface{}) { + q := item.(*query) + if q.vers == "none" { + // Wait for downgrade step. + q.m = module.Version{Path: q.path, Version: "none"} + return + } + m, err := getQuery(q.path, q.vers, q.prevM, q.forceModulePath) + if err != nil { + base.Errorf("go get %s: %v", q.arg, err) + } + q.m = m + }) + base.ExitIfErrors() - // If -d was specified, we're done after the download: no build. - // (The load.PackagesAndErrors is what did the download - // of the named packages and their dependencies.) - if len(todo) > 0 && !*getD { - work.InstallPackages(install, todo) + byPath := make(map[string]*query) + check := func(q *query) { + if prev, ok := byPath[q.m.Path]; prev != nil && prev.m != q.m { + base.Errorf("go get: conflicting versions for module %s: %s and %s", q.m.Path, prev.m.Version, q.m.Version) + byPath[q.m.Path] = nil // sentinel to stop errors + return + } else if !ok { + byPath[q.m.Path] = q } } + for _, q := range queries { + check(q) + } + for _, q := range modOnly { + check(q) + } + base.ExitIfErrors() + + return byPath } // getQuery evaluates the given package path, version pair // to determine the underlying module version being requested. // If forceModulePath is set, getQuery must interpret path // as a module path. -func getQuery(path, vers string, forceModulePath bool) (module.Version, error) { - if vers == "" { +func getQuery(path, vers string, prevM module.Version, forceModulePath bool) (module.Version, error) { + if (prevM.Version != "") != forceModulePath { + // We resolve package patterns by calling QueryPattern, which does not + // accept a previous version and therefore cannot take it into account for + // the "latest" or "patch" queries. + // If we are resolving a package path or pattern, the caller has already + // resolved any existing packages to their containing module(s), and + // will set both prevM.Version and forceModulePath for those modules. + // The only remaining package patterns are those that are not already + // provided by the build list, which are indicated by + // an empty prevM.Version. + base.Fatalf("go get: internal error: prevM may be set if and only if forceModulePath is set") + } + + if vers == "" || vers == "patch" && prevM.Version == "" { vers = "latest" } - // First choice is always to assume path is a module path. - // If that works out, we're done. - info, err := modload.Query(path, vers, modload.Allowed) - if err == nil { - return module.Version{Path: path, Version: info.Version}, nil + if forceModulePath || !strings.Contains(path, "...") { + if path == modload.Target.Path { + if vers != "latest" { + return module.Version{}, fmt.Errorf("can't get a specific version of the main module") + } + } + + // If the path doesn't contain a wildcard, try interpreting it as a module path. + info, err := modload.Query(path, vers, prevM.Version, modload.Allowed) + if err == nil { + return module.Version{Path: path, Version: info.Version}, nil + } + + // If the query fails, and the path must be a real module, report the query error. + if forceModulePath { + return module.Version{}, err + } } - // Even if the query fails, if the path must be a real module, then report the query error. - if forceModulePath || *getM { + // Otherwise, try a package path or pattern. + results, err := modload.QueryPattern(path, vers, modload.Allowed) + if err != nil { return module.Version{}, err } - - // Otherwise, try a package path. - m, _, err := modload.QueryPackage(path, vers, modload.Allowed) - return m, err + return results[0].Mod, nil } // An upgrader adapts an underlying mvs.Reqs to apply an // upgrade policy to a list of targets and their dependencies. -// If patch=false, the upgrader implements "get -u". -// If patch=true, the upgrader implements "get -u=patch". type upgrader struct { mvs.Reqs - targets []module.Version - patch bool - tasks map[string]*task + + // cmdline maps a module path to a query made for that module at a + // specific target version. Each query corresponds to a module + // matched by a command line argument. + cmdline map[string]*query + + // upgrade is a set of modules providing dependencies of packages + // matched by command line arguments. If -u or -u=patch is set, + // these modules are upgraded accordingly. + upgrade map[string]bool } -// upgradeTarget is a fake "target" requiring all the modules to be upgraded. -var upgradeTarget = module.Version{Path: "upgrade target", Version: ""} +// newUpgrader creates an upgrader. cmdline contains queries made at +// specific versions for modules matched by command line arguments. pkgs +// is the set of packages matched by command line arguments. If -u or -u=patch +// is set, modules providing dependencies of pkgs are upgraded accordingly. +func newUpgrader(cmdline map[string]*query, pkgs map[string]bool) *upgrader { + u := &upgrader{ + Reqs: modload.Reqs(), + cmdline: cmdline, + } + if getU != "" { + u.upgrade = make(map[string]bool) + + // Traverse package import graph. + // Initialize work queue with root packages. + seen := make(map[string]bool) + var work []string + add := func(path string) { + if !seen[path] { + seen[path] = true + work = append(work, path) + } + } + for pkg := range pkgs { + add(pkg) + } + for len(work) > 0 { + pkg := work[0] + work = work[1:] + m := modload.PackageModule(pkg) + u.upgrade[m.Path] = true + + // testImports is empty unless test imports were actually loaded, + // i.e., -t was set or "all" was one of the arguments. + imports, testImports := modload.PackageImports(pkg) + for _, imp := range imports { + add(imp) + } + for _, imp := range testImports { + add(imp) + } + } + } + return u +} // Required returns the requirement list for m. -// Other than the upgradeTarget, we defer to u.Reqs. +// For the main module, we override requirements with the modules named +// one the command line, and we include new requirements. Otherwise, +// we defer to u.Reqs. func (u *upgrader) Required(m module.Version) ([]module.Version, error) { - if m == upgradeTarget { - return u.targets, nil + rs, err := u.Reqs.Required(m) + if err != nil { + return nil, err + } + if m != modload.Target { + return rs, nil + } + + overridden := make(map[string]bool) + for i, m := range rs { + if q := u.cmdline[m.Path]; q != nil && q.m.Version != "none" { + rs[i] = q.m + overridden[q.m.Path] = true + } + } + for _, q := range u.cmdline { + if !overridden[q.m.Path] && q.m.Path != modload.Target.Path && q.m.Version != "none" { + rs = append(rs, q.m) + } } - return u.Reqs.Required(m) + return rs, nil } // Upgrade returns the desired upgrade for m. -// If m is a tagged version, then Upgrade returns the latest tagged version. +// +// If m was requested at a specific version on the command line, then +// Upgrade returns that version. +// +// If -u is set and m provides a dependency of a package matched by +// command line arguments, then Upgrade may provider a newer tagged version. +// If m is a tagged version, then Upgrade will return the latest tagged +// version (with the same minor version number if -u=patch). // If m is a pseudo-version, then Upgrade returns the latest tagged version -// when that version has a time-stamp newer than m. -// Otherwise Upgrade returns m (preserving the pseudo-version). -// This special case prevents accidental downgrades -// when already using a pseudo-version newer than the latest tagged version. +// only if that version has a time-stamp newer than m. This special case +// prevents accidental downgrades when already using a pseudo-version +// newer than the latest tagged version. +// +// If none of the above cases apply, then Upgrade returns m. func (u *upgrader) Upgrade(m module.Version) (module.Version, error) { // Allow pkg@vers on the command line to override the upgrade choice v. - // If t's version is < v, then we're going to downgrade anyway, + // If q's version is < m.Version, then we're going to downgrade anyway, // and it's cleaner to avoid moving back and forth and picking up // extraneous other newer dependencies. - // If t's version is > v, then we're going to upgrade past v anyway, - // and again it's cleaner to avoid moving back and forth picking up - // extraneous other newer dependencies. - if t := u.tasks[m.Path]; t != nil { - return t.m, nil - } - - // Note that query "latest" is not the same as - // using repo.Latest. - // The query only falls back to untagged versions - // if nothing is tagged. The Latest method - // only ever returns untagged versions, - // which is not what we want. - query := "latest" - if u.patch { - // For patch upgrade, query "v1.2". - query = semver.MajorMinor(m.Version) - } - info, err := modload.Query(m.Path, query, modload.Allowed) + // If q's version is > m.Version, then we're going to upgrade past + // m.Version anyway, and again it's cleaner to avoid moving back and forth + // picking up extraneous other newer dependencies. + if q := u.cmdline[m.Path]; q != nil { + return q.m, nil + } + + if !u.upgrade[m.Path] { + // Not involved in upgrade. Leave alone. + return m, nil + } + + // Run query required by upgrade semantics. + // Note that Query "latest" is not the same as using repo.Latest, + // which may return a pseudoversion for the latest commit. + // Query "latest" returns the newest tagged version or the newest + // prerelease version if there are no non-prereleases, or repo.Latest + // if there aren't any tagged versions. Since we're providing the previous + // version, Query will confirm the latest version is actually newer + // and will return the current version if not. + info, err := modload.Query(m.Path, string(getU), m.Version, modload.Allowed) if err != nil { // Report error but return m, to let version selection continue. // (Reporting the error will fail the command at the next base.ExitIfErrors.) @@ -637,23 +904,38 @@ func (u *upgrader) Upgrade(m module.Version) (module.Version, error) { // even report the error. Because Query does not consider pseudo-versions, // it may happen that we have a pseudo-version but during -u=patch // the query v0.0 matches no versions (not even the one we're using). - if !strings.Contains(err.Error(), "no matching versions") { + var noMatch *modload.NoMatchingVersionError + if !errors.As(err, &noMatch) { base.Errorf("go get: upgrading %s@%s: %v", m.Path, m.Version, err) } return m, nil } - // If we're on a later prerelease, keep using it, - // even though normally an Upgrade will ignore prereleases. - if semver.Compare(info.Version, m.Version) < 0 { - return m, nil - } + return module.Version{Path: m.Path, Version: info.Version}, nil +} - // If we're on a pseudo-version chronologically after the latest tagged version, keep using it. - // This avoids some accidental downgrades. - if mTime, err := modfetch.PseudoVersionTime(m.Version); err == nil && info.Time.Before(mTime) { - return m, nil - } +// buildListForLostUpgrade returns the build list for the module graph +// rooted at lost. Unlike mvs.BuildList, the target module (lost) is not +// treated specially. The returned build list may contain a newer version +// of lost. +// +// buildListForLostUpgrade is used after a downgrade has removed a module +// requested at a specific version. This helps us understand the requirements +// implied by each downgrade. +func buildListForLostUpgrade(lost module.Version, reqs mvs.Reqs) ([]module.Version, error) { + return mvs.BuildList(lostUpgradeRoot, &lostUpgradeReqs{Reqs: reqs, lost: lost}) +} - return module.Version{Path: m.Path, Version: info.Version}, nil +var lostUpgradeRoot = module.Version{Path: "lost-upgrade-root", Version: ""} + +type lostUpgradeReqs struct { + mvs.Reqs + lost module.Version +} + +func (r *lostUpgradeReqs) Required(mod module.Version) ([]module.Version, error) { + if mod == lostUpgradeRoot { + return []module.Version{r.lost}, nil + } + return r.Reqs.Required(mod) } diff --git a/libgo/go/cmd/go/internal/modinfo/info.go b/libgo/go/cmd/go/internal/modinfo/info.go index 7341ce44d20..07248d1a61c 100644 --- a/libgo/go/cmd/go/internal/modinfo/info.go +++ b/libgo/go/cmd/go/internal/modinfo/info.go @@ -20,8 +20,8 @@ type ModulePublic struct { Indirect bool `json:",omitempty"` // module is only indirectly needed by main module Dir string `json:",omitempty"` // directory holding local copy of files, if any GoMod string `json:",omitempty"` // path to go.mod file describing module, if any - Error *ModuleError `json:",omitempty"` // error loading module GoVersion string `json:",omitempty"` // go version used in module + Error *ModuleError `json:",omitempty"` // error loading module } type ModuleError struct { diff --git a/libgo/go/cmd/go/internal/modload/build.go b/libgo/go/cmd/go/internal/modload/build.go index 6103545ea65..17a65216c2a 100644 --- a/libgo/go/cmd/go/internal/modload/build.go +++ b/libgo/go/cmd/go/internal/modload/build.go @@ -12,6 +12,7 @@ import ( "cmd/go/internal/modinfo" "cmd/go/internal/module" "cmd/go/internal/search" + "cmd/go/internal/semver" "encoding/hex" "fmt" "internal/goroot" @@ -38,9 +39,6 @@ func findStandardImportPath(path string) string { if goroot.IsStandardPackage(cfg.GOROOT, cfg.BuildContext.Compiler, path) { return filepath.Join(cfg.GOROOT, "src", path) } - if goroot.IsStandardPackage(cfg.GOROOT, cfg.BuildContext.Compiler, "vendor/"+path) { - return filepath.Join(cfg.GOROOT, "src/vendor", path) - } } return "" } @@ -77,13 +75,15 @@ func ModuleInfo(path string) *modinfo.ModulePublic { // addUpdate fills in m.Update if an updated version is available. func addUpdate(m *modinfo.ModulePublic) { - if m.Version != "" { - if info, err := Query(m.Path, "latest", Allowed); err == nil && info.Version != m.Version { - m.Update = &modinfo.ModulePublic{ - Path: m.Path, - Version: info.Version, - Time: &info.Time, - } + if m.Version == "" { + return + } + + if info, err := Query(m.Path, "latest", m.Version, Allowed); err == nil && semver.Compare(info.Version, m.Version) > 0 { + m.Update = &modinfo.ModulePublic{ + Path: m.Path, + Version: info.Version, + Time: &info.Time, } } } @@ -127,7 +127,7 @@ func moduleInfo(m module.Version, fromBuildList bool) *modinfo.ModulePublic { // complete fills in the extra fields in m. complete := func(m *modinfo.ModulePublic) { if m.Version != "" { - if q, err := Query(m.Path, m.Version, nil); err != nil { + if q, err := Query(m.Path, m.Version, "", nil); err != nil { m.Error = &modinfo.ModuleError{Err: err.Error()} } else { m.Version = q.Version @@ -219,7 +219,7 @@ func PackageBuildInfo(path string, deps []string) string { if r.Path == "" { h = "\t" + modfetch.Sum(mod) } - fmt.Fprintf(&buf, "dep\t%s\t%s%s\n", mod.Path, mod.Version, h) + fmt.Fprintf(&buf, "dep\t%s\t%s%s\n", mod.Path, mv, h) if r.Path != "" { fmt.Fprintf(&buf, "=>\t%s\t%s\t%s\n", r.Path, r.Version, modfetch.Sum(r)) } @@ -250,20 +250,16 @@ func findModule(target, path string) module.Version { } func ModInfoProg(info string) []byte { - // Inject a variable with the debug information as runtime/debug.modinfo, + // Inject a variable with the debug information as runtime.modinfo, // but compile it in package main so that it is specific to the binary. - // // The variable must be a literal so that it will have the correct value // before the initializer for package main runs. // - // We also want the value to be present even if runtime/debug.modinfo is - // otherwise unused in the rest of the program. Reading it in an init function - // suffices for now. - + // The runtime startup code refers to the variable, which keeps it live in all binaries. return []byte(fmt.Sprintf(`package main import _ "unsafe" -//go:linkname __set_debug_modinfo__ runtime..z2fdebug.setmodinfo -func __set_debug_modinfo__(string) -func init() { __set_debug_modinfo__(%q) } +//go:linkname __set_modinfo__ runtime.setmodinfo +func __set_modinfo__(string) +func init() { __set_modinfo__(%q) } `, string(infoStart)+info+string(infoEnd))) } diff --git a/libgo/go/cmd/go/internal/modload/help.go b/libgo/go/cmd/go/internal/modload/help.go index d9c8ae40d88..788544c2c85 100644 --- a/libgo/go/cmd/go/internal/modload/help.go +++ b/libgo/go/cmd/go/internal/modload/help.go @@ -19,34 +19,28 @@ including recording and resolving dependencies on other modules. Modules replace the old GOPATH-based approach to specifying which source files are used in a given build. -Preliminary module support - -Go 1.11 includes preliminary support for Go modules, -including a new module-aware 'go get' command. -We intend to keep revising this support, while preserving compatibility, -until it can be declared official (no longer preliminary), -and then at a later point we may remove support for work -in GOPATH and the old 'go get' command. - -The quickest way to take advantage of the new Go 1.11 module support -is to check out your repository into a directory outside GOPATH/src, -create a go.mod file (described in the next section) there, and run +Module support + +Go 1.13 includes support for Go modules. Module-aware mode is active by default +whenever a go.mod file is found in, or in a parent of, the current directory. + +The quickest way to take advantage of module support is to check out your +repository, create a go.mod file (described in the next section) there, and run go commands from within that file tree. -For more fine-grained control, the module support in Go 1.11 respects +For more fine-grained control, Go 1.13 continues to respect a temporary environment variable, GO111MODULE, which can be set to one of three string values: off, on, or auto (the default). -If GO111MODULE=off, then the go command never uses the -new module support. Instead it looks in vendor directories and GOPATH -to find dependencies; we now refer to this as "GOPATH mode." If GO111MODULE=on, then the go command requires the use of modules, -never consulting GOPATH. We refer to this as the command being -module-aware or running in "module-aware mode". -If GO111MODULE=auto or is unset, then the go command enables or -disables module support based on the current directory. -Module support is enabled only when the current directory is outside -GOPATH/src and itself contains a go.mod file or is below a directory -containing a go.mod file. +never consulting GOPATH. We refer to this as the command +being module-aware or running in "module-aware mode". +If GO111MODULE=off, then the go command never uses +module support. Instead it looks in vendor directories and GOPATH +to find dependencies; we now refer to this as "GOPATH mode." +If GO111MODULE=auto or is unset, then the go command enables or disables +module support based on the current directory. +Module support is enabled only when the current directory contains a +go.mod file or is below a directory containing a go.mod file. In module-aware mode, GOPATH no longer defines the meaning of imports during a build, but it still stores downloaded dependencies (in GOPATH/pkg/mod) @@ -337,26 +331,35 @@ module file trees. Module downloading and verification -The go command maintains, in the main module's root directory alongside -go.mod, a file named go.sum containing the expected cryptographic checksums -of the content of specific module versions. Each time a dependency is -used, its checksum is added to go.sum if missing or else required to match -the existing entry in go.sum. - -The go command maintains a cache of downloaded packages and computes -and records the cryptographic checksum of each package at download time. -In normal operation, the go command checks these pre-computed checksums -against the main module's go.sum file, instead of recomputing them on -each command invocation. The 'go mod verify' command checks that -the cached copies of module downloads still match both their recorded -checksums and the entries in go.sum. - -The go command can fetch modules from a proxy instead of connecting -to source control systems directly, according to the setting of the GOPROXY -environment variable. - -See 'go help goproxy' for details about the proxy and also the format of -the cached downloaded packages. +The go command can fetch modules from a proxy or connect to source control +servers directly, according to the setting of the GOPROXY environment +variable (see 'go help env'). The default setting for GOPROXY is +"https://proxy.golang.org,direct", which means to try the +Go module mirror run by Google and fall back to a direct connection +if the proxy reports that it does not have the module (HTTP error 404 or 410). +See https://proxy.golang.org/privacy for the service's privacy policy. +If GOPROXY is set to the string "direct", downloads use a direct connection +to source control servers. Setting GOPROXY to "off" disallows downloading +modules from any source. Otherwise, GOPROXY is expected to be a comma-separated +list of the URLs of module proxies, in which case the go command will fetch +modules from those proxies. For each request, the go command tries each proxy +in sequence, only moving to the next if the current proxy returns a 404 or 410 +HTTP response. The string "direct" may appear in the proxy list, +to cause a direct connection to be attempted at that point in the search. +Any proxies listed after "direct" are never consulted. + +The GOPRIVATE and GONOPROXY environment variables allow bypassing +the proxy for selected modules. See 'go help module-private' for details. + +No matter the source of the modules, the go command checks downloads against +known checksums, to detect unexpected changes in the content of any specific +module version from one day to the next. This check first consults the current +module's go.sum file but falls back to the Go checksum database, controlled by +the GOSUMDB and GONOSUMDB environment variables. See 'go help module-auth' +for details. + +See 'go help goproxy' for details about the proxy protocol and also +the format of the cached downloaded packages. Modules and vendoring @@ -461,5 +464,12 @@ Because the module graph defines the meaning of import statements, any commands that load packages also use and therefore update go.mod, including go build, go get, go install, go list, go test, go mod graph, go mod tidy, and go mod why. + +The expected language version, set by the go directive, determines +which language features are available when compiling the module. +Language features available in that version will be available for use. +Language features removed in earlier versions, or added in later versions, +will not be available. Note that the language version does not affect +build tags, which are determined by the Go release being used. `, } diff --git a/libgo/go/cmd/go/internal/modload/import.go b/libgo/go/cmd/go/internal/modload/import.go index 3210e16c25b..dacc876701a 100644 --- a/libgo/go/cmd/go/internal/modload/import.go +++ b/libgo/go/cmd/go/internal/modload/import.go @@ -18,7 +18,6 @@ import ( "cmd/go/internal/cfg" "cmd/go/internal/modfetch" - "cmd/go/internal/modfetch/codehost" "cmd/go/internal/module" "cmd/go/internal/par" "cmd/go/internal/search" @@ -28,6 +27,10 @@ import ( type ImportMissingError struct { ImportPath string Module module.Version + + // newMissingVersion is set to a newer version of Module if one is present + // in the build list. When set, we can't automatically upgrade. + newMissingVersion string } func (e *ImportMissingError) Error() string { @@ -61,17 +64,21 @@ func Import(path string) (m module.Version, dir string, err error) { } // Is the package in the standard library? - if search.IsStandardImportPath(path) { - if goroot.IsStandardPackage(cfg.GOROOT, cfg.BuildContext.Compiler, path) { - dir := filepath.Join(cfg.GOROOT, "src", path) - return module.Version{}, dir, nil + if search.IsStandardImportPath(path) && + goroot.IsStandardPackage(cfg.GOROOT, cfg.BuildContext.Compiler, path) { + if targetInGorootSrc { + if dir, ok := dirInModule(path, targetPrefix, ModRoot(), true); ok { + return Target, dir, nil + } } + dir := filepath.Join(cfg.GOROOT, "src", path) + return module.Version{}, dir, nil } // -mod=vendor is special. // Everything must be in the main module or the main module's vendor directory. if cfg.BuildMod == "vendor" { - mainDir, mainOK := dirInModule(path, Target.Path, ModRoot(), true) + mainDir, mainOK := dirInModule(path, targetPrefix, ModRoot(), true) vendorDir, vendorOK := dirInModule(path, "", filepath.Join(ModRoot(), "vendor"), false) if mainOK && vendorOK { return module.Version{}, "", fmt.Errorf("ambiguous import: found %s in multiple directories:\n\t%s\n\t%s", path, mainDir, vendorDir) @@ -178,14 +185,37 @@ func Import(path string) (m module.Version, dir string, err error) { } } - m, _, err = QueryPackage(path, "latest", Allowed) + candidates, err := QueryPackage(path, "latest", Allowed) if err != nil { - if _, ok := err.(*codehost.VCSError); ok { + if errors.Is(err, os.ErrNotExist) { + // Return "cannot find module providing package […]" instead of whatever + // low-level error QueryPackage produced. + return module.Version{}, "", &ImportMissingError{ImportPath: path} + } else { return module.Version{}, "", err } - return module.Version{}, "", &ImportMissingError{ImportPath: path} } - return m, "", &ImportMissingError{ImportPath: path, Module: m} + m = candidates[0].Mod + newMissingVersion := "" + for _, c := range candidates { + cm := c.Mod + for _, bm := range buildList { + if bm.Path == cm.Path && semver.Compare(bm.Version, cm.Version) > 0 { + // QueryPackage proposed that we add module cm to provide the package, + // but we already depend on a newer version of that module (and we don't + // have the package). + // + // This typically happens when a package is present at the "@latest" + // version (e.g., v1.0.0) of a module, but we have a newer version + // of the same module in the build list (e.g., v1.0.1-beta), and + // the package is not present there. + m = cm + newMissingVersion = bm.Version + break + } + } + } + return m, "", &ImportMissingError{ImportPath: path, Module: m, newMissingVersion: newMissingVersion} } // maybeInModule reports whether, syntactically, @@ -229,8 +259,8 @@ func dirInModule(path, mpath, mdir string, isLocal bool) (dir string, haveGoFile if isLocal { for d := dir; d != mdir && len(d) > len(mdir); { haveGoMod := haveGoModCache.Do(d, func() interface{} { - _, err := os.Stat(filepath.Join(d, "go.mod")) - return err == nil + fi, err := os.Stat(filepath.Join(d, "go.mod")) + return err == nil && !fi.IsDir() }).(bool) if haveGoMod { diff --git a/libgo/go/cmd/go/internal/modload/import_test.go b/libgo/go/cmd/go/internal/modload/import_test.go index 9422a3d960c..c6ade5d17f4 100644 --- a/libgo/go/cmd/go/internal/modload/import_test.go +++ b/libgo/go/cmd/go/internal/modload/import_test.go @@ -21,7 +21,7 @@ var importTests = []struct { }, { path: "golang.org/x/net", - err: "cannot find module providing package golang.org/x/net", + err: "module golang.org/x/net@.* found, but does not contain package golang.org/x/net", }, { path: "golang.org/x/text", @@ -43,6 +43,7 @@ var importTests = []struct { func TestImport(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") for _, tt := range importTests { t.Run(strings.ReplaceAll(tt.path, "/", "_"), func(t *testing.T) { diff --git a/libgo/go/cmd/go/internal/modload/init.go b/libgo/go/cmd/go/internal/modload/init.go index 22d14ccce78..807ce8d5dc5 100644 --- a/libgo/go/cmd/go/internal/modload/init.go +++ b/libgo/go/cmd/go/internal/modload/init.go @@ -6,6 +6,18 @@ package modload import ( "bytes" + "encoding/json" + "fmt" + "go/build" + "internal/lazyregexp" + "io/ioutil" + "os" + "path" + "path/filepath" + "runtime/debug" + "strconv" + "strings" + "cmd/go/internal/base" "cmd/go/internal/cache" "cmd/go/internal/cfg" @@ -18,22 +30,11 @@ import ( "cmd/go/internal/mvs" "cmd/go/internal/renameio" "cmd/go/internal/search" - "encoding/json" - "fmt" - "go/build" - "io/ioutil" - "os" - "path" - "path/filepath" - "regexp" - "runtime/debug" - "strconv" - "strings" ) var ( cwd string // TODO(bcmills): Is this redundant with base.Cwd? - MustUseModules = mustUseModules() + mustUseModules = false initialized bool modRoot string @@ -42,6 +43,15 @@ var ( excluded map[module.Version]bool Target module.Version + // targetPrefix is the path prefix for packages in Target, without a trailing + // slash. For most modules, targetPrefix is just Target.Path, but the + // standard-library module "std" has an empty prefix. + targetPrefix string + + // targetInGorootSrc caches whether modRoot is within GOROOT/src. + // The "std" module is special within GOROOT/src, but not otherwise. + targetInGorootSrc bool + gopath string CmdModInit bool // running 'go mod init' @@ -69,18 +79,6 @@ func BinDir() string { return filepath.Join(gopath, "bin") } -// mustUseModules reports whether we are invoked as vgo -// (as opposed to go). -// If so, we only support builds with go.mod files. -func mustUseModules() bool { - name := os.Args[0] - name = name[strings.LastIndex(name, "/")+1:] - name = name[strings.LastIndex(name, `\`)+1:] - return strings.HasPrefix(name, "vgo") -} - -var inGOPATH bool // running in GOPATH/src - // Init determines whether module mode is enabled, locates the root of the // current module (if any), sets environment variables for Git subprocesses, and // configures the cfg, codehost, load, modfetch, and search packages for use @@ -91,18 +89,17 @@ func Init() { } initialized = true - env := os.Getenv("GO111MODULE") + env := cfg.Getenv("GO111MODULE") switch env { default: base.Fatalf("go: unknown environment setting GO111MODULE=%s", env) - case "", "auto": - // leave MustUseModules alone + case "auto", "": + mustUseModules = false case "on": - MustUseModules = true + mustUseModules = true case "off": - if !MustUseModules { - return - } + mustUseModules = false + return } // Disable any prompting for passwords by Git. @@ -138,36 +135,14 @@ func Init() { base.Fatalf("go: %v", err) } - inGOPATH = false - for _, gopath := range filepath.SplitList(cfg.BuildContext.GOPATH) { - if gopath == "" { - continue - } - if search.InDir(cwd, filepath.Join(gopath, "src")) != "" { - inGOPATH = true - break - } - } - - if inGOPATH && !MustUseModules { - if CmdModInit { - die() // Don't init a module that we're just going to ignore. - } - // No automatic enabling in GOPATH. - if root, _ := FindModuleRoot(cwd, "", false); root != "" { - cfg.GoModInGOPATH = filepath.Join(root, "go.mod") - } - return - } - if CmdModInit { // Running 'go mod init': go.mod will be created in current directory. modRoot = cwd } else { - modRoot, _ = FindModuleRoot(cwd, "", MustUseModules) + modRoot = findModuleRoot(cwd) if modRoot == "" { - if !MustUseModules { - // GO111MODULE is 'auto' (or unset), and we can't find a module root. + if !mustUseModules { + // GO111MODULE is 'auto', and we can't find a module root. // Stay in GOPATH mode. return } @@ -254,9 +229,11 @@ func Init() { func init() { load.ModInit = Init - // Set modfetch.PkgMod unconditionally, so that go clean -modcache can run even without modules enabled. + // Set modfetch.PkgMod and codehost.WorkRoot unconditionally, + // so that go clean -modcache and go mod download can run even without modules enabled. if list := filepath.SplitList(cfg.BuildContext.GOPATH); len(list) > 0 && list[0] != "" { modfetch.PkgMod = filepath.Join(list[0], "pkg/mod") + codehost.WorkRoot = filepath.Join(list[0], "pkg/mod/cache/vcs") } } @@ -266,7 +243,7 @@ func init() { // (usually through MustModRoot). func Enabled() bool { Init() - return modRoot != "" || MustUseModules + return modRoot != "" || mustUseModules } // ModRoot returns the root of the main module. @@ -296,11 +273,21 @@ func die() { if printStackInDie { debug.PrintStack() } - if os.Getenv("GO111MODULE") == "off" { + if cfg.Getenv("GO111MODULE") == "off" { base.Fatalf("go: modules disabled by GO111MODULE=off; see 'go help modules'") } - if inGOPATH && !MustUseModules { - base.Fatalf("go: modules disabled inside GOPATH/src by GO111MODULE=auto; see 'go help modules'") + if cwd != "" { + if dir, name := findAltConfig(cwd); dir != "" { + rel, err := filepath.Rel(cwd, dir) + if err != nil { + rel = dir + } + cdCmd := "" + if rel != "." { + cdCmd = fmt.Sprintf("cd %s && ", rel) + } + base.Fatalf("go: cannot find main module, but found %s in %s\n\tto create a module there, run:\n\t%sgo mod init", name, dir, cdCmd) + } } base.Fatalf("go: cannot find main module; see 'go help modules'") } @@ -315,6 +302,7 @@ func InitMod() { Init() if modRoot == "" { Target = module.Version{Path: "command-line-arguments"} + targetPrefix = "command-line-arguments" buildList = []module.Version{Target} return } @@ -328,14 +316,8 @@ func InitMod() { } gomod := filepath.Join(modRoot, "go.mod") - data, err := ioutil.ReadFile(gomod) + data, err := renameio.ReadFile(gomod) if err != nil { - if os.IsNotExist(err) { - legacyModInit() - modFileToBuildList() - WriteGoMod() - return - } base.Fatalf("go: %v", err) } @@ -349,7 +331,7 @@ func InitMod() { if len(f.Syntax.Stmt) == 0 || f.Module == nil { // Empty mod file. Must add module path. - path, err := FindModulePath(modRoot) + path, err := findModulePath(modRoot) if err != nil { base.Fatalf("go: %v", err) } @@ -367,12 +349,21 @@ func InitMod() { excluded[x.Mod] = true } modFileToBuildList() + stdVendorMode() WriteGoMod() } // modFileToBuildList initializes buildList from the modFile. func modFileToBuildList() { Target = modFile.Module.Mod + targetPrefix = Target.Path + if rel := search.InDir(cwd, cfg.GOROOTsrc); rel != "" { + targetInGorootSrc = true + if Target.Path == "std" { + targetPrefix = "" + } + } + list := []module.Version{Target} for _, r := range modFile.Require { list = append(list, r.Mod) @@ -380,6 +371,42 @@ func modFileToBuildList() { buildList = list } +// stdVendorMode applies inside $GOROOT/src. +// It checks that the go.mod matches vendor/modules.txt +// and then sets -mod=vendor unless this is a command +// that has to do explicitly with modules. +func stdVendorMode() { + if !targetInGorootSrc { + return + } + if cfg.CmdName == "get" || strings.HasPrefix(cfg.CmdName, "mod ") { + return + } + + readVendorList() +BuildList: + for _, m := range buildList { + if m.Path == "cmd" || m.Path == "std" { + continue + } + for _, v := range vendorList { + if m.Path == v.Path { + if m.Version != v.Version { + base.Fatalf("go: inconsistent vendoring in %s:\n"+ + "\tgo.mod requires %s %s but vendor/modules.txt has %s.\n"+ + "\trun 'go mod tidy; go mod vendor' to sync", + modRoot, m.Path, m.Version, v.Version) + } + continue BuildList + } + } + base.Fatalf("go: inconsistent vendoring in %s:\n"+ + "\tgo.mod requires %s %s but vendor/modules.txt does not include it.\n"+ + "\trun 'go mod tidy; go mod vendor' to sync", modRoot, m.Path, m.Version) + } + cfg.BuildMod = "vendor" +} + // Allowed reports whether module m is allowed (not excluded) by the main module's go.mod. func Allowed(m module.Version) bool { return !excluded[m] @@ -387,17 +414,16 @@ func Allowed(m module.Version) bool { func legacyModInit() { if modFile == nil { - path, err := FindModulePath(modRoot) + path, err := findModulePath(modRoot) if err != nil { base.Fatalf("go: %v", err) } fmt.Fprintf(os.Stderr, "go: creating new go.mod: module %s\n", path) modFile = new(modfile.File) modFile.AddModuleStmt(path) + addGoStmt() // Add the go directive before converted module requirements. } - addGoStmt() - for _, name := range altConfigs { cfg := filepath.Join(modRoot, name) data, err := ioutil.ReadFile(cfg) @@ -420,15 +446,12 @@ func legacyModInit() { } } -// InitGoStmt adds a go statement, unless there already is one. -func InitGoStmt() { - if modFile.Go == nil { - addGoStmt() - } -} - -// addGoStmt adds a go statement referring to the current version. +// addGoStmt adds a go directive to the go.mod file if it does not already include one. +// The 'go' version added, if any, is the latest version supported by this toolchain. func addGoStmt() { + if modFile.Go != nil && modFile.Go.Version != "" { + return + } tags := build.Default.ReleaseTags version := tags[len(tags)-1] if !strings.HasPrefix(version, "go") || !modfile.GoVersionRE.MatchString(version[2:]) { @@ -454,19 +477,13 @@ var altConfigs = []string{ ".git/config", } -// Exported only for testing. -func FindModuleRoot(dir, limit string, legacyConfigOK bool) (root, file string) { +func findModuleRoot(dir string) (root string) { dir = filepath.Clean(dir) - dir1 := dir - limit = filepath.Clean(limit) // Look for enclosing go.mod. for { if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() { - return dir, "go.mod" - } - if dir == limit { - break + return dir } d := filepath.Dir(dir) if d == dir { @@ -474,37 +491,45 @@ func FindModuleRoot(dir, limit string, legacyConfigOK bool) (root, file string) } dir = d } + return "" +} - // Failing that, look for enclosing alternate version config. - if legacyConfigOK { - dir = dir1 - for { - for _, name := range altConfigs { - if fi, err := os.Stat(filepath.Join(dir, name)); err == nil && !fi.IsDir() { - return dir, name +func findAltConfig(dir string) (root, name string) { + dir = filepath.Clean(dir) + for { + for _, name := range altConfigs { + if fi, err := os.Stat(filepath.Join(dir, name)); err == nil && !fi.IsDir() { + if rel := search.InDir(dir, cfg.BuildContext.GOROOT); rel == "." { + // Don't suggest creating a module from $GOROOT/.git/config. + return "", "" } + return dir, name } - if dir == limit { - break - } - d := filepath.Dir(dir) - if d == dir { - break - } - dir = d } + d := filepath.Dir(dir) + if d == dir { + break + } + dir = d } - return "", "" } -// Exported only for testing. -func FindModulePath(dir string) (string, error) { +func findModulePath(dir string) (string, error) { if CmdModModule != "" { // Running go mod init x/y/z; return x/y/z. + if err := module.CheckImportPath(CmdModModule); err != nil { + return "", err + } return CmdModModule, nil } + // TODO(bcmills): once we have located a plausible module path, we should + // query version control (if available) to verify that it matches the major + // version of the most recent tag. + // See https://golang.org/issue/29433, https://golang.org/issue/27009, and + // https://golang.org/issue/31549. + // Cast about for import comments, // first in top-level directory, then in subdirectories. list, _ := ioutil.ReadDir(dir) @@ -554,18 +579,19 @@ func FindModulePath(dir string) (string, error) { } } - // Look for .git/config with github origin as last resort. - data, _ = ioutil.ReadFile(filepath.Join(dir, ".git/config")) - if m := gitOriginRE.FindSubmatch(data); m != nil { - return "github.com/" + string(m[1]), nil - } + msg := `cannot determine module path for source directory %s (outside GOPATH, module path must be specified) + +Example usage: + 'go mod init example.com/m' to initialize a v0 or v1 module + 'go mod init example.com/m/v2' to initialize a v2 module - return "", fmt.Errorf("cannot determine module path for source directory %s (outside GOPATH, no import comments)", dir) +Run 'go help mod init' for more information. +` + return "", fmt.Errorf(msg, dir) } var ( - gitOriginRE = regexp.MustCompile(`(?m)^\[remote "origin"\]\r?\n\turl = (?:https://github.com/|git@github.com:|gh:)([^/]+/[^/]+?)(\.git)?\r?\n`) - importCommentRE = regexp.MustCompile(`(?m)^package[ \t]+[^ \t\r\n/]+[ \t]+//[ \t]+import[ \t]+(\"[^"]+\")[ \t]*\r?\n`) + importCommentRE = lazyregexp.New(`(?m)^package[ \t]+[^ \t\r\n/]+[ \t]+//[ \t]+import[ \t]+(\"[^"]+\")[ \t]*\r?\n`) ) func findImportComment(file string) string { @@ -629,6 +655,8 @@ func WriteGoMod() { return } + addGoStmt() + if loaded != nil { reqs := MinReqs() min, err := reqs.Required(Target) @@ -651,24 +679,27 @@ func WriteGoMod() { base.Fatalf("go: %v", err) } + dirty := !bytes.Equal(new, modFileData) + if dirty && cfg.BuildMod == "readonly" { + // If we're about to fail due to -mod=readonly, + // prefer to report a dirty go.mod over a dirty go.sum + base.Fatalf("go: updates to go.mod needed, disabled by -mod=readonly") + } // Always update go.sum, even if we didn't change go.mod: we may have // downloaded modules that we didn't have before. modfetch.WriteGoSum() - if bytes.Equal(new, modFileData) { + if !dirty { // We don't need to modify go.mod from what we read previously. // Ignore any intervening edits. return } - if cfg.BuildMod == "readonly" { - base.Fatalf("go: updates to go.mod needed, disabled by -mod=readonly") - } unlock := modfetch.SideLock() defer unlock() file := filepath.Join(modRoot, "go.mod") - old, err := ioutil.ReadFile(file) + old, err := renameio.ReadFile(file) if !bytes.Equal(old, modFileData) { if bytes.Equal(old, new) { // Some other process wrote the same go.mod file that we were about to write. @@ -688,7 +719,7 @@ func WriteGoMod() { } - if err := renameio.WriteFile(file, new); err != nil { + if err := renameio.WriteFile(file, new, 0666); err != nil { base.Fatalf("error writing go.mod: %v", err) } modFileData = new @@ -705,13 +736,21 @@ func fixVersion(path, vers string) (string, error) { // Avoid the query if it looks OK. _, pathMajor, ok := module.SplitPathVersion(path) if !ok { - return "", fmt.Errorf("malformed module path: %s", path) + return "", &module.ModuleError{ + Path: path, + Err: &module.InvalidVersionError{ + Version: vers, + Err: fmt.Errorf("malformed module path %q", path), + }, + } } - if vers != "" && module.CanonicalVersion(vers) == vers && module.MatchPathMajor(vers, pathMajor) { - return vers, nil + if vers != "" && module.CanonicalVersion(vers) == vers { + if err := module.MatchPathMajor(vers, pathMajor); err == nil { + return vers, nil + } } - info, err := Query(path, vers, nil) + info, err := Query(path, vers, "", nil) if err != nil { return "", err } diff --git a/libgo/go/cmd/go/internal/modload/init_test.go b/libgo/go/cmd/go/internal/modload/init_test.go deleted file mode 100644 index 2df9d8af7df..00000000000 --- a/libgo/go/cmd/go/internal/modload/init_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package modload - -import ( - "io/ioutil" - "os" - "path/filepath" - "testing" -) - -func TestFindModuleRootIgnoreDir(t *testing.T) { - // In Plan 9, directories are automatically created in /n. - // For example, /n/go.mod always exist, but it's a directory. - // Test that we ignore directories when trying to find go.mod and other config files. - - dir, err := ioutil.TempDir("", "gotest") - if err != nil { - t.Fatalf("failed to create temporary directory: %v", err) - } - defer os.RemoveAll(dir) - if err := os.Mkdir(filepath.Join(dir, "go.mod"), os.ModeDir|0755); err != nil { - t.Fatalf("Mkdir failed: %v", err) - } - for _, name := range altConfigs { - if err := os.MkdirAll(filepath.Join(dir, name), os.ModeDir|0755); err != nil { - t.Fatalf("MkdirAll failed: %v", err) - } - } - p := filepath.Join(dir, "example") - if err := os.Mkdir(p, os.ModeDir|0755); err != nil { - t.Fatalf("Mkdir failed: %v", err) - } - if root, _ := FindModuleRoot(p, "", false); root != "" { - t.Errorf("FindModuleRoot(%q, \"\", false): %q, want empty string", p, root) - } - if root, _ := FindModuleRoot(p, "", true); root != "" { - t.Errorf("FindModuleRoot(%q, \"\", true): %q, want empty string", p, root) - } -} diff --git a/libgo/go/cmd/go/internal/modload/list.go b/libgo/go/cmd/go/internal/modload/list.go index 2f1a3c24d22..c571ddc5f54 100644 --- a/libgo/go/cmd/go/internal/modload/list.go +++ b/libgo/go/cmd/go/internal/modload/list.go @@ -55,18 +55,28 @@ func listModules(args []string, listVersions bool) []*modinfo.ModulePublic { base.Fatalf("go: cannot use relative path %s to specify module", arg) } if i := strings.Index(arg, "@"); i >= 0 { - info, err := Query(arg[:i], arg[i+1:], nil) + path := arg[:i] + vers := arg[i+1:] + var current string + for _, m := range buildList { + if m.Path == path { + current = m.Version + break + } + } + + info, err := Query(path, vers, current, nil) if err != nil { mods = append(mods, &modinfo.ModulePublic{ - Path: arg[:i], - Version: arg[i+1:], + Path: path, + Version: vers, Error: &modinfo.ModuleError{ Err: err.Error(), }, }) continue } - mods = append(mods, moduleInfo(module.Version{Path: arg[:i], Version: info.Version}, false)) + mods = append(mods, moduleInfo(module.Version{Path: path, Version: info.Version}, false)) continue } @@ -101,11 +111,18 @@ func listModules(args []string, listVersions bool) []*modinfo.ModulePublic { // Don't make the user provide an explicit '@latest' when they're // explicitly asking what the available versions are. // Instead, resolve the module, even if it isn't an existing dependency. - info, err := Query(arg, "latest", nil) + info, err := Query(arg, "latest", "", nil) if err == nil { mods = append(mods, moduleInfo(module.Version{Path: arg, Version: info.Version}, false)) - continue + } else { + mods = append(mods, &modinfo.ModulePublic{ + Path: arg, + Error: &modinfo.ModuleError{ + Err: err.Error(), + }, + }) } + continue } mods = append(mods, &modinfo.ModulePublic{ Path: arg, diff --git a/libgo/go/cmd/go/internal/modload/load.go b/libgo/go/cmd/go/internal/modload/load.go index 9a1fb76bb95..a9d6c21b0e3 100644 --- a/libgo/go/cmd/go/internal/modload/load.go +++ b/libgo/go/cmd/go/internal/modload/load.go @@ -12,6 +12,7 @@ import ( "io/ioutil" "os" "path" + pathpkg "path" "path/filepath" "sort" "strings" @@ -50,29 +51,28 @@ var buildList []module.Version var loaded *loader // ImportPaths returns the set of packages matching the args (patterns), -// adding modules to the build list as needed to satisfy new imports. +// on the target platform. Modules may be added to the build list +// to satisfy new imports. func ImportPaths(patterns []string) []*search.Match { - InitMod() - - var matches []*search.Match - for _, pattern := range search.CleanPatterns(patterns) { - m := &search.Match{ - Pattern: pattern, - Literal: !strings.Contains(pattern, "...") && !search.IsMetaPackage(pattern), - } - if m.Literal { - m.Pkgs = []string{pattern} - } - matches = append(matches, m) - } + matches := ImportPathsQuiet(patterns, imports.Tags()) + search.WarnUnmatched(matches) + return matches +} - fsDirs := make([][]string, len(matches)) - loaded = newLoader() - updateMatches := func(iterating bool) { +// ImportPathsQuiet is like ImportPaths but does not warn about patterns with +// no matches. It also lets the caller specify a set of build tags to match +// packages. The build tags should typically be imports.Tags() or +// imports.AnyTags(); a nil map has no special meaning. +func ImportPathsQuiet(patterns []string, tags map[string]bool) []*search.Match { + var fsDirs [][]string + updateMatches := func(matches []*search.Match, iterating bool) { for i, m := range matches { switch { case build.IsLocalImport(m.Pattern) || filepath.IsAbs(m.Pattern): // Evaluate list of file system directories on first iteration. + if fsDirs == nil { + fsDirs = make([][]string, len(matches)) + } if fsDirs[i] == nil { var dirs []string if m.Literal { @@ -90,7 +90,9 @@ func ImportPaths(patterns []string) []*search.Match { // the exact version of a particular module increases during // the loader iterations. m.Pkgs = str.StringList(fsDirs[i]) - for j, pkg := range m.Pkgs { + pkgs := m.Pkgs + m.Pkgs = m.Pkgs[:0] + for _, pkg := range pkgs { dir := pkg if !filepath.IsAbs(dir) { dir = filepath.Join(cwd, pkg) @@ -108,10 +110,20 @@ func ImportPaths(patterns []string) []*search.Match { if strings.HasPrefix(suffix, "/vendor/") { // TODO getmode vendor check pkg = strings.TrimPrefix(suffix, "/vendor/") + } else if targetInGorootSrc && Target.Path == "std" { + // Don't add the prefix "std/" to packages in the "std" module. + // It's the one module path that isn't a prefix of its packages. + pkg = strings.TrimPrefix(suffix, "/") + if pkg == "builtin" { + // "builtin" is a pseudo-package with a real source file. + // It's not included in "std", so it shouldn't be included in + // "./..." within module "std" either. + continue + } } else { pkg = Target.Path + suffix } - } else if sub := search.InDir(dir, cfg.GOROOTsrc); sub != "" && !strings.Contains(sub, "@") { + } else if sub := search.InDir(dir, cfg.GOROOTsrc); sub != "" && sub != "." && !strings.Contains(sub, "@") { pkg = filepath.ToSlash(sub) } else if path := pathInModuleCache(dir); path != "" { pkg = path @@ -129,10 +141,10 @@ func ImportPaths(patterns []string) []*search.Match { // After loader is done iterating, we still need to return the // path, so that "go list -e" produces valid output. if iterating { - pkg = "" + continue } } - m.Pkgs[j] = pkg + m.Pkgs = append(m.Pkgs, pkg) } case strings.Contains(m.Pattern, "..."): @@ -154,25 +166,35 @@ func ImportPaths(patterns []string) []*search.Match { if len(m.Pkgs) == 0 { m.Pkgs = search.MatchPackages(m.Pattern).Pkgs } + + default: + m.Pkgs = []string{m.Pattern} } } } + InitMod() + + var matches []*search.Match + for _, pattern := range search.CleanPatterns(patterns) { + matches = append(matches, &search.Match{ + Pattern: pattern, + Literal: !strings.Contains(pattern, "...") && !search.IsMetaPackage(pattern), + }) + } + + loaded = newLoader(tags) loaded.load(func() []string { var roots []string - updateMatches(true) + updateMatches(matches, true) for _, m := range matches { - for _, pkg := range m.Pkgs { - if pkg != "" { - roots = append(roots, pkg) - } - } + roots = append(roots, m.Pkgs...) } return roots }) // One last pass to finalize wildcards. - updateMatches(false) + updateMatches(matches, false) // A given module path may be used as itself or as a replacement for another // module, but not both at the same time. Otherwise, the aliasing behavior is @@ -193,7 +215,6 @@ func ImportPaths(patterns []string) []*search.Match { base.ExitIfErrors() WriteGoMod() - search.WarnUnmatched(matches) return matches } @@ -201,7 +222,18 @@ func ImportPaths(patterns []string) []*search.Match { // if dir is in the module cache copy of a module in our build list. func pathInModuleCache(dir string) string { for _, m := range buildList[1:] { - root, err := modfetch.DownloadDir(m) + var root string + var err error + if repl := Replacement(m); repl.Path != "" && repl.Version == "" { + root = repl.Path + if !filepath.IsAbs(root) { + root = filepath.Join(ModRoot(), root) + } + } else if repl.Path != "" { + root, err = modfetch.DownloadDir(repl) + } else { + root, err = modfetch.DownloadDir(m) + } if err != nil { continue } @@ -230,12 +262,13 @@ func warnPattern(pattern string, list []string) []string { func ImportFromFiles(gofiles []string) { InitMod() - imports, testImports, err := imports.ScanFiles(gofiles, imports.Tags()) + tags := imports.Tags() + imports, testImports, err := imports.ScanFiles(gofiles, tags) if err != nil { base.Fatalf("go: %v", err) } - loaded = newLoader() + loaded = newLoader(tags) loaded.load(func() []string { var roots []string roots = append(roots, imports...) @@ -259,14 +292,14 @@ func DirImportPath(dir string) string { } if dir == modRoot { - return Target.Path + return targetPrefix } if strings.HasPrefix(dir, modRoot+string(filepath.Separator)) { suffix := filepath.ToSlash(dir[len(modRoot):]) if strings.HasPrefix(suffix, "/vendor/") { return strings.TrimPrefix(suffix, "/vendor/") } - return Target.Path + suffix + return targetPrefix + suffix } return "." } @@ -284,7 +317,7 @@ func LoadBuildList() []module.Version { } func ReloadBuildList() []module.Version { - loaded = newLoader() + loaded = newLoader(imports.Tags()) loaded.load(func() []string { return nil }) return buildList } @@ -310,14 +343,13 @@ func LoadVendor() []string { func loadAll(testAll bool) []string { InitMod() - loaded = newLoader() + loaded = newLoader(imports.AnyTags()) loaded.isALL = true - loaded.tags = anyTags loaded.testAll = testAll if !testAll { loaded.testRoots = true } - all := TargetPackages() + all := TargetPackages("...") loaded.load(func() []string { return all }) WriteGoMod() @@ -331,14 +363,11 @@ func loadAll(testAll bool) []string { return paths } -// anyTags is a special tags map that satisfies nearly all build tag expressions. -// Only "ignore" and malformed build tag requirements are considered false. -var anyTags = map[string]bool{"*": true} - -// TargetPackages returns the list of packages in the target (top-level) module, -// under all build tag settings. -func TargetPackages() []string { - return matchPackages("...", anyTags, false, []module.Version{Target}) +// TargetPackages returns the list of packages in the target (top-level) module +// matching pattern, which may be relative to the working directory, under all +// build tag settings. +func TargetPackages(pattern string) []string { + return matchPackages(pattern, imports.AnyTags(), false, []module.Version{Target}) } // BuildList returns the module build list, @@ -387,6 +416,29 @@ func PackageModule(path string) module.Version { return pkg.mod } +// PackageImports returns the imports for the package named by the import path. +// Test imports will be returned as well if tests were loaded for the package +// (i.e., if "all" was loaded or if LoadTests was set and the path was matched +// by a command line argument). PackageImports will return nil for +// unknown package paths. +func PackageImports(path string) (imports, testImports []string) { + pkg, ok := loaded.pkgCache.Get(path).(*loadPkg) + if !ok { + return nil, nil + } + imports = make([]string, len(pkg.imports)) + for i, p := range pkg.imports { + imports[i] = p.path + } + if pkg.test != nil { + testImports = make([]string, len(pkg.test.imports)) + for i, p := range pkg.test.imports { + testImports[i] = p.path + } + } + return imports, testImports +} + // ModuleUsedDirectly reports whether the main module directly imports // some package in the module with the given path. func ModuleUsedDirectly(path string) bool { @@ -394,13 +446,17 @@ func ModuleUsedDirectly(path string) bool { } // Lookup returns the source directory, import path, and any loading error for -// the package at path. +// the package at path as imported from the package in parentDir. // Lookup requires that one of the Load functions in this package has already // been called. -func Lookup(path string) (dir, realPath string, err error) { +func Lookup(parentPath string, parentIsStd bool, path string) (dir, realPath string, err error) { if path == "" { panic("Lookup called with empty package path") } + + if parentIsStd { + path = loaded.stdVendor(parentPath, path) + } pkg, ok := loaded.pkgCache.Get(path).(*loadPkg) if !ok { // The loader should have found all the relevant paths. @@ -434,10 +490,11 @@ func Lookup(path string) (dir, realPath string, err error) { // TODO(rsc): It might be nice to make the loader take and return // a buildList rather than hard-coding use of the global. type loader struct { - tags map[string]bool // tags for scanDir - testRoots bool // include tests for roots - isALL bool // created with LoadALL - testAll bool // include tests for all packages + tags map[string]bool // tags for scanDir + testRoots bool // include tests for roots + isALL bool // created with LoadALL + testAll bool // include tests for all packages + forceStdVendor bool // if true, load standard-library dependencies from the vendor subtree // reset on each iteration roots []*loadPkg @@ -453,10 +510,17 @@ type loader struct { // LoadTests controls whether the loaders load tests of the root packages. var LoadTests bool -func newLoader() *loader { +func newLoader(tags map[string]bool) *loader { ld := new(loader) - ld.tags = imports.Tags() + ld.tags = tags ld.testRoots = LoadTests + + // Inside the "std" and "cmd" modules, we prefer to use the vendor directory + // unless the command explicitly changes the module graph. + if !targetInGorootSrc || (cfg.CmdName != "get" && !strings.HasPrefix(cfg.CmdName, "mod ")) { + ld.forceStdVendor = true + } + return ld } @@ -511,8 +575,12 @@ func (ld *loader) load(roots func() []string) { for _, m := range buildList { haveMod[m] = true } + modAddedBy := make(map[module.Version]*loadPkg) for _, pkg := range ld.pkgs { if err, ok := pkg.err.(*ImportMissingError); ok && err.Module.Path != "" { + if err.newMissingVersion != "" { + base.Fatalf("go: %s: package provided by %s at latest version %s but not at required version %s", pkg.stackText(), err.Module.Path, err.Module.Version, err.newMissingVersion) + } if added[pkg.path] { base.Fatalf("go: %s: looping trying to add package", pkg.stackText()) } @@ -520,6 +588,7 @@ func (ld *loader) load(roots func() []string) { numAdded++ if !haveMod[err.Module] { haveMod[err.Module] = true + modAddedBy[err.Module] = pkg buildList = append(buildList, err.Module) } continue @@ -535,6 +604,14 @@ func (ld *loader) load(roots func() []string) { reqs = Reqs() buildList, err = mvs.BuildList(Target, reqs) if err != nil { + // If an error was found in a newly added module, report the package + // import stack instead of the module requirement stack. Packages + // are more descriptive. + if err, ok := err.(*mvs.BuildListError); ok { + if pkg := modAddedBy[err.Module()]; pkg != nil { + base.Fatalf("go: %s: %v", pkg.stackText(), err.Err) + } + } base.Fatalf("go: %v", err) } } @@ -635,7 +712,11 @@ func (ld *loader) doPkg(item interface{}) { } } + inStd := (search.IsStandardImportPath(pkg.path) && search.InDir(pkg.dir, cfg.GOROOTsrc) != "") for _, path := range imports { + if inStd { + path = ld.stdVendor(pkg.path, path) + } pkg.imports = append(pkg.imports, ld.pkg(path, false)) } @@ -646,6 +727,31 @@ func (ld *loader) doPkg(item interface{}) { } } +// stdVendor returns the canonical import path for the package with the given +// path when imported from the standard-library package at parentPath. +func (ld *loader) stdVendor(parentPath, path string) string { + if search.IsStandardImportPath(path) { + return path + } + + if str.HasPathPrefix(parentPath, "cmd") { + if ld.forceStdVendor || Target.Path != "cmd" { + vendorPath := pathpkg.Join("cmd", "vendor", path) + if _, err := os.Stat(filepath.Join(cfg.GOROOTsrc, filepath.FromSlash(vendorPath))); err == nil { + return vendorPath + } + } + } else if ld.forceStdVendor || Target.Path != "std" { + vendorPath := pathpkg.Join("vendor", path) + if _, err := os.Stat(filepath.Join(cfg.GOROOTsrc, filepath.FromSlash(vendorPath))); err == nil { + return vendorPath + } + } + + // Not vendored: resolve from modules. + return path +} + // computePatternAll returns the list of packages matching pattern "all", // starting with a list of the import paths for the packages in the main module. func (ld *loader) computePatternAll(paths []string) []string { @@ -741,27 +847,33 @@ func (ld *loader) buildStacks() { // stackText builds the import stack text to use when // reporting an error in pkg. It has the general form // -// import root -> -// import other -> -// import other2 -> -// import pkg +// root imports +// other imports +// other2 tested by +// other2.test imports +// pkg // func (pkg *loadPkg) stackText() string { var stack []*loadPkg - for p := pkg.stack; p != nil; p = p.stack { + for p := pkg; p != nil; p = p.stack { stack = append(stack, p) } var buf bytes.Buffer for i := len(stack) - 1; i >= 0; i-- { p := stack[i] + fmt.Fprint(&buf, p.path) if p.testOf != nil { - fmt.Fprintf(&buf, "test ->\n\t") - } else { - fmt.Fprintf(&buf, "import %q ->\n\t", p.path) + fmt.Fprint(&buf, ".test") + } + if i > 0 { + if stack[i-1].testOf == p { + fmt.Fprint(&buf, " tested by\n\t") + } else { + fmt.Fprint(&buf, " imports\n\t") + } } } - fmt.Fprintf(&buf, "import %q", pkg.path) return buf.String() } @@ -913,27 +1025,40 @@ func readVendorList() { } func (r *mvsReqs) modFileToList(f *modfile.File) []module.Version { - var list []module.Version + list := make([]module.Version, 0, len(f.Require)) for _, r := range f.Require { list = append(list, r.Mod) } return list } +// required returns a unique copy of the requirements of mod. func (r *mvsReqs) required(mod module.Version) ([]module.Version, error) { if mod == Target { if modFile != nil && modFile.Go != nil { r.versions.LoadOrStore(mod, modFile.Go.Version) } - var list []module.Version - return append(list, r.buildList[1:]...), nil + return append([]module.Version(nil), r.buildList[1:]...), nil } if cfg.BuildMod == "vendor" { // For every module other than the target, // return the full list of modules from modules.txt. readVendorList() - return vendorList, nil + return append([]module.Version(nil), vendorList...), nil + } + + if targetInGorootSrc { + // When inside "std" or "cmd", only fetch and read go.mod files if we're + // explicitly running a command that can change the module graph. If we have + // to resolve a new dependency, we might pick the wrong version, but 'go mod + // tidy' will fix it — and new standard-library dependencies should be rare + // anyway. + // + // TODO(golang.org/issue/30240): Drop this special-case. + if cfg.CmdName != "get" && !strings.HasPrefix(cfg.CmdName, "mod ") { + return nil, nil + } } origPath := mod.Path @@ -947,13 +1072,11 @@ func (r *mvsReqs) required(mod module.Version) ([]module.Version, error) { gomod := filepath.Join(dir, "go.mod") data, err := ioutil.ReadFile(gomod) if err != nil { - base.Errorf("go: parsing %s: %v", base.ShortPath(gomod), err) - return nil, ErrRequire + return nil, fmt.Errorf("parsing %s: %v", base.ShortPath(gomod), err) } f, err := modfile.ParseLax(gomod, data, nil) if err != nil { - base.Errorf("go: parsing %s: %v", base.ShortPath(gomod), err) - return nil, ErrRequire + return nil, fmt.Errorf("parsing %s: %v", base.ShortPath(gomod), err) } if f.Go != nil { r.versions.LoadOrStore(mod, f.Go.Version) @@ -974,22 +1097,18 @@ func (r *mvsReqs) required(mod module.Version) ([]module.Version, error) { data, err := modfetch.GoMod(mod.Path, mod.Version) if err != nil { - base.Errorf("go: %s@%s: %v\n", mod.Path, mod.Version, err) - return nil, ErrRequire + return nil, err } f, err := modfile.ParseLax("go.mod", data, nil) if err != nil { - base.Errorf("go: %s@%s: parsing go.mod: %v", mod.Path, mod.Version, err) - return nil, ErrRequire + return nil, module.VersionError(mod, fmt.Errorf("parsing go.mod: %v", err)) } if f.Module == nil { - base.Errorf("go: %s@%s: parsing go.mod: missing module line", mod.Path, mod.Version) - return nil, ErrRequire + return nil, module.VersionError(mod, errors.New("parsing go.mod: missing module line")) } if mpath := f.Module.Mod.Path; mpath != origPath && mpath != mod.Path { - base.Errorf("go: %s@%s: parsing go.mod: unexpected module path %q", mod.Path, mod.Version, mpath) - return nil, ErrRequire + return nil, module.VersionError(mod, fmt.Errorf("parsing go.mod: unexpected module path %q", mpath)) } if f.Go != nil { r.versions.LoadOrStore(mod, f.Go.Version) @@ -998,11 +1117,6 @@ func (r *mvsReqs) required(mod module.Version) ([]module.Version, error) { return r.modFileToList(f), nil } -// ErrRequire is the sentinel error returned when Require encounters problems. -// It prints the problems directly to standard error, so that multiple errors -// can be displayed easily. -var ErrRequire = errors.New("error loading module requirements") - func (*mvsReqs) Max(v1, v2 string) string { if v1 != "" && semver.Compare(v1, v2) == -1 { return v2 @@ -1019,11 +1133,15 @@ func (*mvsReqs) Upgrade(m module.Version) (module.Version, error) { func versions(path string) ([]string, error) { // Note: modfetch.Lookup and repo.Versions are cached, // so there's no need for us to add extra caching here. - repo, err := modfetch.Lookup(path) - if err != nil { - return nil, err - } - return repo.Versions("") + var versions []string + err := modfetch.TryProxies(func(proxy string) error { + repo, err := modfetch.Lookup(proxy, path) + if err == nil { + versions, err = repo.Versions("") + } + return err + }) + return versions, err } // Previous returns the tagged version of m.Path immediately prior to diff --git a/libgo/go/cmd/go/internal/modload/query.go b/libgo/go/cmd/go/internal/modload/query.go index 0856486c212..8ce61c0a1d6 100644 --- a/libgo/go/cmd/go/internal/modload/query.go +++ b/libgo/go/cmd/go/internal/modload/query.go @@ -5,35 +5,64 @@ package modload import ( - "cmd/go/internal/modfetch" - "cmd/go/internal/modfetch/codehost" - "cmd/go/internal/module" - "cmd/go/internal/semver" + "errors" "fmt" + "os" pathpkg "path" "strings" + "sync" + + "cmd/go/internal/imports" + "cmd/go/internal/modfetch" + "cmd/go/internal/module" + "cmd/go/internal/search" + "cmd/go/internal/semver" + "cmd/go/internal/str" ) // Query looks up a revision of a given module given a version query string. // The module must be a complete module path. // The version must take one of the following forms: // -// - the literal string "latest", denoting the latest available, allowed tagged version, -// with non-prereleases preferred over prereleases. -// If there are no tagged versions in the repo, latest returns the most recent commit. -// - v1, denoting the latest available tagged version v1.x.x. -// - v1.2, denoting the latest available tagged version v1.2.x. -// - v1.2.3, a semantic version string denoting that tagged version. -// - v1.2.3, >=v1.2.3, -// denoting the version closest to the target and satisfying the given operator, -// with non-prereleases preferred over prereleases. -// - a repository commit identifier, denoting that commit. +// - the literal string "latest", denoting the latest available, allowed +// tagged version, with non-prereleases preferred over prereleases. +// If there are no tagged versions in the repo, latest returns the most +// recent commit. +// - the literal string "patch", denoting the latest available tagged version +// with the same major and minor number as current. If current is "", +// "patch" is equivalent to "latest". +// - v1, denoting the latest available tagged version v1.x.x. +// - v1.2, denoting the latest available tagged version v1.2.x. +// - v1.2.3, a semantic version string denoting that tagged version. +// - v1.2.3, >=v1.2.3, +// denoting the version closest to the target and satisfying the given operator, +// with non-prereleases preferred over prereleases. +// - a repository commit identifier or tag, denoting that commit. +// +// current is optional, denoting the current version of the module. +// If query is "latest" or "patch", current will be returned if it is a newer +// semantic version or if it is a chronologically later pseudoversion. This +// prevents accidental downgrades from newer prerelease or development +// versions. // -// If the allowed function is non-nil, Query excludes any versions for which allowed returns false. +// If the allowed function is non-nil, Query excludes any versions for which +// allowed returns false. // // If path is the path of the main module and the query is "latest", // Query returns Target.Version as the version. -func Query(path, query string, allowed func(module.Version) bool) (*modfetch.RevInfo, error) { +func Query(path, query, current string, allowed func(module.Version) bool) (*modfetch.RevInfo, error) { + var info *modfetch.RevInfo + err := modfetch.TryProxies(func(proxy string) (err error) { + info, err = queryProxy(proxy, path, query, current, allowed) + return err + }) + return info, err +} + +func queryProxy(proxy, path, query, current string, allowed func(module.Version) bool) (*modfetch.RevInfo, error) { + if current != "" && !semver.IsValid(current) { + return nil, fmt.Errorf("invalid previous version %q", current) + } if allowed == nil { allowed = func(module.Version) bool { return true } } @@ -46,9 +75,22 @@ func Query(path, query string, allowed func(module.Version) bool) (*modfetch.Rev var ok func(module.Version) bool var prefix string var preferOlder bool + var mayUseLatest bool switch { case query == "latest": ok = allowed + mayUseLatest = true + + case query == "patch": + if current == "" { + ok = allowed + mayUseLatest = true + } else { + prefix = semver.MajorMinor(current) + ok = func(m module.Version) bool { + return matchSemverPrefix(prefix, m.Version) && allowed(m) + } + } case strings.HasPrefix(query, "<="): v := query[len("<="):] @@ -102,18 +144,27 @@ func Query(path, query string, allowed func(module.Version) bool) (*modfetch.Rev } prefix = query + "." - case semver.IsValid(query): - vers := module.CanonicalVersion(query) - if !allowed(module.Version{Path: path, Version: vers}) { - return nil, fmt.Errorf("%s@%s excluded", path, vers) - } - return modfetch.Stat(path, vers) - default: // Direct lookup of semantic version or commit identifier. - info, err := modfetch.Stat(path, query) + // + // If the identifier is not a canonical semver tag — including if it's a + // semver tag with a +metadata suffix — then modfetch.Stat will populate + // info.Version with a suitable pseudo-version. + info, err := modfetch.Stat(proxy, path, query) if err != nil { - return nil, err + queryErr := err + // The full query doesn't correspond to a tag. If it is a semantic version + // with a +metadata suffix, see if there is a tag without that suffix: + // semantic versioning defines them to be equivalent. + if vers := module.CanonicalVersion(query); vers != "" && vers != query { + info, err = modfetch.Stat(proxy, path, vers) + if !errors.Is(err, os.ErrNotExist) { + return info, err + } + } + if err != nil { + return nil, queryErr + } } if !allowed(module.Version{Path: path, Version: info.Version}) { return nil, fmt.Errorf("%s@%s excluded", path, info.Version) @@ -131,8 +182,12 @@ func Query(path, query string, allowed func(module.Version) bool) (*modfetch.Rev return &modfetch.RevInfo{Version: Target.Version}, nil } + if str.HasPathPrefix(path, "std") || str.HasPathPrefix(path, "cmd") { + return nil, fmt.Errorf("explicit requirement on standard-library module %s not allowed", path) + } + // Load versions and execute query. - repo, err := modfetch.Lookup(path) + repo, err := modfetch.Lookup(proxy, path) if err != nil { return nil, err } @@ -141,44 +196,67 @@ func Query(path, query string, allowed func(module.Version) bool) (*modfetch.Rev return nil, err } + lookup := func(v string) (*modfetch.RevInfo, error) { + rev, err := repo.Stat(v) + if err != nil { + return nil, err + } + + // For "latest" and "patch", make sure we don't accidentally downgrade + // from a newer prerelease or from a chronologically newer pseudoversion. + if current != "" && (query == "latest" || query == "patch") { + currentTime, err := modfetch.PseudoVersionTime(current) + if semver.Compare(rev.Version, current) < 0 || (err == nil && rev.Time.Before(currentTime)) { + return repo.Stat(current) + } + } + + return rev, nil + } + if preferOlder { for _, v := range versions { if semver.Prerelease(v) == "" && ok(module.Version{Path: path, Version: v}) { - return repo.Stat(v) + return lookup(v) } } for _, v := range versions { if semver.Prerelease(v) != "" && ok(module.Version{Path: path, Version: v}) { - return repo.Stat(v) + return lookup(v) } } } else { for i := len(versions) - 1; i >= 0; i-- { v := versions[i] if semver.Prerelease(v) == "" && ok(module.Version{Path: path, Version: v}) { - return repo.Stat(v) + return lookup(v) } } for i := len(versions) - 1; i >= 0; i-- { v := versions[i] if semver.Prerelease(v) != "" && ok(module.Version{Path: path, Version: v}) { - return repo.Stat(v) + return lookup(v) } } } - if query == "latest" { + if mayUseLatest { // Special case for "latest": if no tags match, use latest commit in repo, // provided it is not excluded. - if info, err := repo.Latest(); err == nil && allowed(module.Version{Path: path, Version: info.Version}) { - return info, nil + latest, err := repo.Latest() + if err == nil { + if allowed(module.Version{Path: path, Version: latest.Version}) { + return lookup(latest.Version) + } + } else if !errors.Is(err, os.ErrNotExist) { + return nil, err } } - return nil, fmt.Errorf("no matching versions for query %q", query) + return nil, &NoMatchingVersionError{query: query, current: current} } -// isSemverPrefix reports whether v is a semantic version prefix: v1 or v1.2 (not v1.2.3). +// isSemverPrefix reports whether v is a semantic version prefix: v1 or v1.2 (not v1.2.3). // The caller is assumed to have checked that semver.IsValid(v) is true. func isSemverPrefix(v string) bool { dots := 0 @@ -199,53 +277,271 @@ func isSemverPrefix(v string) bool { // matchSemverPrefix reports whether the shortened semantic version p // matches the full-width (non-shortened) semantic version v. func matchSemverPrefix(p, v string) bool { - return len(v) > len(p) && v[len(p)] == '.' && v[:len(p)] == p + return len(v) > len(p) && v[len(p)] == '.' && v[:len(p)] == p && semver.Prerelease(v) == "" +} + +type QueryResult struct { + Mod module.Version + Rev *modfetch.RevInfo + Packages []string +} + +// QueryPackage looks up the module(s) containing path at a revision matching +// query. The results are sorted by module path length in descending order. +// +// If the package is in the main module, QueryPackage considers only the main +// module and only the version "latest", without checking for other possible +// modules. +func QueryPackage(path, query string, allowed func(module.Version) bool) ([]QueryResult, error) { + if search.IsMetaPackage(path) || strings.Contains(path, "...") { + return nil, fmt.Errorf("pattern %s is not an importable package", path) + } + return QueryPattern(path, query, allowed) } -// QueryPackage looks up a revision of a module containing path. +// QueryPattern looks up the module(s) containing at least one package matching +// the given pattern at the given version. The results are sorted by module path +// length in descending order. // -// If multiple modules with revisions matching the query provide the requested -// package, QueryPackage picks the one with the longest module path. +// QueryPattern queries modules with package paths up to the first "..." +// in the pattern. For the pattern "example.com/a/b.../c", QueryPattern would +// consider prefixes of "example.com/a". If multiple modules have versions +// that match the query and packages that match the pattern, QueryPattern +// picks the one with the longest module path. // -// If the path is in the main module and the query is "latest", -// QueryPackage returns Target as the version. -func QueryPackage(path, query string, allowed func(module.Version) bool) (module.Version, *modfetch.RevInfo, error) { +// If any matching package is in the main module, QueryPattern considers only +// the main module and only the version "latest", without checking for other +// possible modules. +func QueryPattern(pattern, query string, allowed func(module.Version) bool) ([]QueryResult, error) { + base := pattern + var match func(m module.Version, root string, isLocal bool) (pkgs []string) + + if i := strings.Index(pattern, "..."); i >= 0 { + base = pathpkg.Dir(pattern[:i+3]) + match = func(m module.Version, root string, isLocal bool) []string { + return matchPackages(pattern, imports.AnyTags(), false, []module.Version{m}) + } + } else { + match = func(m module.Version, root string, isLocal bool) []string { + prefix := m.Path + if m == Target { + prefix = targetPrefix + } + if _, ok := dirInModule(pattern, prefix, root, isLocal); ok { + return []string{pattern} + } else { + return nil + } + } + } + if HasModRoot() { - if _, ok := dirInModule(path, Target.Path, modRoot, true); ok { + pkgs := match(Target, modRoot, true) + if len(pkgs) > 0 { if query != "latest" { - return module.Version{}, nil, fmt.Errorf("can't query specific version (%q) for package %s in the main module (%s)", query, path, Target.Path) + return nil, fmt.Errorf("can't query specific version for package %s in the main module (%s)", pattern, Target.Path) } if !allowed(Target) { - return module.Version{}, nil, fmt.Errorf("internal error: package %s is in the main module (%s), but version is not allowed", path, Target.Path) + return nil, fmt.Errorf("internal error: package %s is in the main module (%s), but version is not allowed", pattern, Target.Path) } - return Target, &modfetch.RevInfo{Version: Target.Version}, nil + return []QueryResult{{ + Mod: Target, + Rev: &modfetch.RevInfo{Version: Target.Version}, + Packages: pkgs, + }}, nil } } - finalErr := errMissing - for p := path; p != "." && p != "/"; p = pathpkg.Dir(p) { - info, err := Query(p, query, allowed) - if err != nil { - if _, ok := err.(*codehost.VCSError); ok { - // A VCSError means we know where to find the code, - // we just can't. Abort search. - return module.Version{}, nil, err + var ( + results []QueryResult + candidateModules = modulePrefixesExcludingTarget(base) + ) + if len(candidateModules) == 0 { + return nil, fmt.Errorf("package %s is not in the main module (%s)", pattern, Target.Path) + } + + err := modfetch.TryProxies(func(proxy string) error { + queryModule := func(path string) (r QueryResult, err error) { + r.Mod.Path = path + r.Rev, err = queryProxy(proxy, path, query, "", allowed) + if err != nil { + return r, err + } + r.Mod.Version = r.Rev.Version + root, isLocal, err := fetch(r.Mod) + if err != nil { + return r, err } - if finalErr == errMissing { - finalErr = err + r.Packages = match(r.Mod, root, isLocal) + if len(r.Packages) == 0 { + return r, &packageNotInModuleError{ + mod: r.Mod, + query: query, + pattern: pattern, + } } - continue + return r, nil } - m := module.Version{Path: p, Version: info.Version} - root, isLocal, err := fetch(m) - if err != nil { - return module.Version{}, nil, err + + var err error + results, err = queryPrefixModules(candidateModules, queryModule) + return err + }) + + return results, err +} + +// modulePrefixesExcludingTarget returns all prefixes of path that may plausibly +// exist as a module, excluding targetPrefix but otherwise including path +// itself, sorted by descending length. +func modulePrefixesExcludingTarget(path string) []string { + prefixes := make([]string, 0, strings.Count(path, "/")+1) + + for { + if path != targetPrefix { + if _, _, ok := module.SplitPathVersion(path); ok { + prefixes = append(prefixes, path) + } } - _, ok := dirInModule(path, m.Path, root, isLocal) - if ok { - return m, info, nil + + j := strings.LastIndexByte(path, '/') + if j < 0 { + break + } + path = path[:j] + } + + return prefixes +} + +type prefixResult struct { + QueryResult + err error +} + +func queryPrefixModules(candidateModules []string, queryModule func(path string) (QueryResult, error)) (found []QueryResult, err error) { + // If the path we're attempting is not in the module cache and we don't have a + // fetch result cached either, we'll end up making a (potentially slow) + // request to the proxy or (often even slower) the origin server. + // To minimize latency, execute all of those requests in parallel. + type result struct { + QueryResult + err error + } + results := make([]result, len(candidateModules)) + var wg sync.WaitGroup + wg.Add(len(candidateModules)) + for i, p := range candidateModules { + go func(p string, r *result) { + r.QueryResult, r.err = queryModule(p) + wg.Done() + }(p, &results[i]) + } + wg.Wait() + + // Classify the results. In case of failure, identify the error that the user + // is most likely to find helpful. + var ( + noVersion *NoMatchingVersionError + noPackage *packageNotInModuleError + notExistErr error + ) + for _, r := range results { + switch rErr := r.err.(type) { + case nil: + found = append(found, r.QueryResult) + case *NoMatchingVersionError: + if noVersion == nil { + noVersion = rErr + } + case *packageNotInModuleError: + if noPackage == nil { + noPackage = rErr + } + default: + if errors.Is(rErr, os.ErrNotExist) { + if notExistErr == nil { + notExistErr = rErr + } + } else { + err = r.err + } } } - return module.Version{}, nil, finalErr + // TODO(#26232): If len(found) == 0 and some of the errors are 4xx HTTP + // codes, have the auth package recheck the failed paths. + // If we obtain new credentials for any of them, re-run the above loop. + + if len(found) == 0 && err == nil { + switch { + case noPackage != nil: + err = noPackage + case noVersion != nil: + err = noVersion + case notExistErr != nil: + err = notExistErr + default: + panic("queryPrefixModules: no modules found, but no error detected") + } + } + + return found, err +} + +// A NoMatchingVersionError indicates that Query found a module at the requested +// path, but not at any versions satisfying the query string and allow-function. +// +// NOTE: NoMatchingVersionError MUST NOT implement Is(os.ErrNotExist). +// +// If the module came from a proxy, that proxy had to return a successful status +// code for the versions it knows about, and thus did not have the opportunity +// to return a non-400 status code to suppress fallback. +type NoMatchingVersionError struct { + query, current string +} + +func (e *NoMatchingVersionError) Error() string { + currentSuffix := "" + if (e.query == "latest" || e.query == "patch") && e.current != "" { + currentSuffix = fmt.Sprintf(" (current version is %s)", e.current) + } + return fmt.Sprintf("no matching versions for query %q", e.query) + currentSuffix +} + +// A packageNotInModuleError indicates that QueryPattern found a candidate +// module at the requested version, but that module did not contain any packages +// matching the requested pattern. +// +// NOTE: packageNotInModuleError MUST NOT implement Is(os.ErrNotExist). +// +// If the module came from a proxy, that proxy had to return a successful status +// code for the versions it knows about, and thus did not have the opportunity +// to return a non-400 status code to suppress fallback. +type packageNotInModuleError struct { + mod module.Version + query string + pattern string +} + +func (e *packageNotInModuleError) Error() string { + found := "" + if e.query != e.mod.Version { + found = fmt.Sprintf(" (%s)", e.mod.Version) + } + + if strings.Contains(e.pattern, "...") { + return fmt.Sprintf("module %s@%s%s found, but does not contain packages matching %s", e.mod.Path, e.query, found, e.pattern) + } + return fmt.Sprintf("module %s@%s%s found, but does not contain package %s", e.mod.Path, e.query, found, e.pattern) +} + +// ModuleHasRootPackage returns whether module m contains a package m.Path. +func ModuleHasRootPackage(m module.Version) (bool, error) { + root, isLocal, err := fetch(m) + if err != nil { + return false, err + } + _, ok := dirInModule(m.Path, m.Path, root, isLocal) + return ok, nil } diff --git a/libgo/go/cmd/go/internal/modload/query_test.go b/libgo/go/cmd/go/internal/modload/query_test.go index 9b073832171..5c0527d40c9 100644 --- a/libgo/go/cmd/go/internal/modload/query_test.go +++ b/libgo/go/cmd/go/internal/modload/query_test.go @@ -14,6 +14,7 @@ import ( "strings" "testing" + "cmd/go/internal/cfg" "cmd/go/internal/modfetch" "cmd/go/internal/modfetch/codehost" "cmd/go/internal/module" @@ -24,11 +25,16 @@ func TestMain(m *testing.M) { } func testMain(m *testing.M) int { + cfg.GOPROXY = "direct" + dir, err := ioutil.TempDir("", "modload-test-") if err != nil { log.Fatal(err) } defer os.RemoveAll(dir) + + os.Setenv("GOPATH", dir) + cfg.BuildContext.GOPATH = dir modfetch.PkgMod = filepath.Join(dir, "pkg/mod") codehost.WorkRoot = filepath.Join(dir, "codework") return m.Run() @@ -44,11 +50,12 @@ var ( ) var queryTests = []struct { - path string - query string - allow string - vers string - err string + path string + query string + current string + allow string + vers string + err string }{ /* git init @@ -56,7 +63,7 @@ var queryTests = []struct { git add go.mod git commit -m v1 go.mod git tag start - for i in v0.0.0-pre1 v0.0.0 v0.0.1 v0.0.2 v0.0.3 v0.1.0 v0.1.1 v0.1.2 v0.3.0 v1.0.0 v1.1.0 v1.9.0 v1.9.9 v1.9.10-pre1; do + for i in v0.0.0-pre1 v0.0.0 v0.0.1 v0.0.2 v0.0.3 v0.1.0 v0.1.1 v0.1.2 v0.3.0 v1.0.0 v1.1.0 v1.9.0 v1.9.9 v1.9.10-pre1 v1.9.10-pre2+metadata; do echo before $i >status git add status git commit -m "before $i" status @@ -70,7 +77,7 @@ var queryTests = []struct { git checkout v2 echo module vcs-test.golang.org/git/querytest.git/v2 >go.mod git commit -m v2 go.mod - for i in v2.0.0 v2.1.0 v2.2.0 v2.5.5; do + for i in v2.0.0 v2.1.0 v2.2.0 v2.5.5 v2.6.0-pre1; do echo before $i >status git add status git commit -m "before $i" status @@ -78,6 +85,7 @@ var queryTests = []struct { git commit -m "at $i" status git tag $i done + git checkout v2.5.5 echo after v2.5.5 >status git commit -m 'after v2.5.5' status git checkout master @@ -97,22 +105,61 @@ var queryTests = []struct { {path: queryRepo, query: "v0.1", vers: "v0.1.2"}, {path: queryRepo, query: "v0.2", err: `no matching versions for query "v0.2"`}, {path: queryRepo, query: "v0.0", vers: "v0.0.3"}, + {path: queryRepo, query: "v1.9.10-pre2+metadata", vers: "v1.9.10-pre2.0.20190513201126-42abcb6df8ee"}, + + // golang.org/issue/29262: The major version for for a module without a suffix + // should be based on the most recent tag (v1 as appropriate, not v0 + // unconditionally). + {path: queryRepo, query: "42abcb6df8ee", vers: "v1.9.10-pre2.0.20190513201126-42abcb6df8ee"}, + + {path: queryRepo, query: "v1.9.10-pre2+wrongmetadata", err: `unknown revision v1.9.10-pre2+wrongmetadata`}, + {path: queryRepo, query: "v1.9.10-pre2", err: `unknown revision v1.9.10-pre2`}, {path: queryRepo, query: "latest", vers: "v1.9.9"}, + {path: queryRepo, query: "latest", current: "v1.9.10-pre1", vers: "v1.9.10-pre1"}, + {path: queryRepo, query: "latest", current: "v1.9.10-pre2+metadata", vers: "v1.9.10-pre2.0.20190513201126-42abcb6df8ee"}, + {path: queryRepo, query: "latest", current: "v0.0.0-20190513201126-42abcb6df8ee", vers: "v0.0.0-20190513201126-42abcb6df8ee"}, {path: queryRepo, query: "latest", allow: "NOMATCH", err: `no matching versions for query "latest"`}, + {path: queryRepo, query: "latest", current: "v1.9.9", allow: "NOMATCH", err: `no matching versions for query "latest" (current version is v1.9.9)`}, + {path: queryRepo, query: "latest", current: "v1.99.99", err: `unknown revision v1.99.99`}, + {path: queryRepo, query: "patch", current: "", vers: "v1.9.9"}, + {path: queryRepo, query: "patch", current: "v0.1.0", vers: "v0.1.2"}, + {path: queryRepo, query: "patch", current: "v1.9.0", vers: "v1.9.9"}, + {path: queryRepo, query: "patch", current: "v1.9.10-pre1", vers: "v1.9.10-pre1"}, + {path: queryRepo, query: "patch", current: "v1.9.10-pre2+metadata", vers: "v1.9.10-pre2.0.20190513201126-42abcb6df8ee"}, + {path: queryRepo, query: "patch", current: "v1.99.99", err: `no matching versions for query "patch" (current version is v1.99.99)`}, {path: queryRepo, query: ">v1.9.9", vers: "v1.9.10-pre1"}, {path: queryRepo, query: ">v1.10.0", err: `no matching versions for query ">v1.10.0"`}, {path: queryRepo, query: ">=v1.10.0", err: `no matching versions for query ">=v1.10.0"`}, {path: queryRepo, query: "6cf84eb", vers: "v0.0.2-0.20180704023347-6cf84ebaea54"}, + + // golang.org/issue/27173: A pseudo-version may be based on the highest tag on + // any parent commit, or any existing semantically-lower tag: a given commit + // could have been a pre-release for a backport tag at any point. + {path: queryRepo, query: "3ef0cec634e0", vers: "v0.1.2-0.20180704023347-3ef0cec634e0"}, + {path: queryRepo, query: "v0.1.2-0.20180704023347-3ef0cec634e0", vers: "v0.1.2-0.20180704023347-3ef0cec634e0"}, + {path: queryRepo, query: "v0.1.1-0.20180704023347-3ef0cec634e0", vers: "v0.1.1-0.20180704023347-3ef0cec634e0"}, + {path: queryRepo, query: "v0.0.4-0.20180704023347-3ef0cec634e0", vers: "v0.0.4-0.20180704023347-3ef0cec634e0"}, + + // Invalid tags are tested in cmd/go/testdata/script/mod_pseudo_invalid.txt. + {path: queryRepo, query: "start", vers: "v0.0.0-20180704023101-5e9e31667ddf"}, + {path: queryRepo, query: "5e9e31667ddf", vers: "v0.0.0-20180704023101-5e9e31667ddf"}, + {path: queryRepo, query: "v0.0.0-20180704023101-5e9e31667ddf", vers: "v0.0.0-20180704023101-5e9e31667ddf"}, + {path: queryRepo, query: "7a1b6bf", vers: "v0.1.0"}, {path: queryRepoV2, query: "v0.0.0", vers: "v2.0.0"}, {path: queryRepoV2, query: ">=v0.0.0", vers: "v2.0.0"}, - {path: queryRepoV2, query: "v0.0.1+foo", vers: "v2.0.0-20180704023347-179bc86b1be3"}, + + {path: queryRepoV2, query: "v2", vers: "v2.5.5"}, + {path: queryRepoV2, query: "v2.5", vers: "v2.5.5"}, + {path: queryRepoV2, query: "v2.6", err: `no matching versions for query "v2.6"`}, + {path: queryRepoV2, query: "v2.6.0-pre1", vers: "v2.6.0-pre1"}, {path: queryRepoV2, query: "latest", vers: "v2.5.5"}, + {path: queryRepoV3, query: "e0cf3de987e6", vers: "v3.0.0-20180704024501-e0cf3de987e6"}, {path: queryRepoV3, query: "latest", vers: "v3.0.0-20180704024501-e0cf3de987e6"}, {path: emptyRepo, query: "latest", vers: "v0.0.0-20180704023549-7bb914627242"}, @@ -122,6 +169,7 @@ var queryTests = []struct { func TestQuery(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") for _, tt := range queryTests { allow := tt.allow @@ -132,13 +180,15 @@ func TestQuery(t *testing.T) { ok, _ := path.Match(allow, m.Version) return ok } - t.Run(strings.ReplaceAll(tt.path, "/", "_")+"/"+tt.query+"/"+allow, func(t *testing.T) { - info, err := Query(tt.path, tt.query, allowed) + t.Run(strings.ReplaceAll(tt.path, "/", "_")+"/"+tt.query+"/"+tt.current+"/"+allow, func(t *testing.T) { + info, err := Query(tt.path, tt.query, tt.current, allowed) if tt.err != "" { - if err != nil && err.Error() == tt.err { - return + if err == nil { + t.Errorf("Query(%q, %q, %v) = %v, want error %q", tt.path, tt.query, allow, info.Version, tt.err) + } else if err.Error() != tt.err { + t.Errorf("Query(%q, %q, %v): %v, want error %q", tt.path, tt.query, allow, err, tt.err) } - t.Fatalf("Query(%q, %q, %v): %v, want error %q", tt.path, tt.query, allow, err, tt.err) + return } if err != nil { t.Fatalf("Query(%q, %q, %v): %v", tt.path, tt.query, allow, err) diff --git a/libgo/go/cmd/go/internal/modload/search.go b/libgo/go/cmd/go/internal/modload/search.go index 7d8852d01d7..d82386eca30 100644 --- a/libgo/go/cmd/go/internal/modload/search.go +++ b/libgo/go/cmd/go/internal/modload/search.go @@ -35,12 +35,14 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules [] } var pkgs []string - walkPkgs := func(root, importPathRoot string) { + type pruning int8 + const ( + pruneVendor = pruning(1 << iota) + pruneGoMod + ) + + walkPkgs := func(root, importPathRoot string, prune pruning) { root = filepath.Clean(root) - var cmd string - if root == cfg.GOROOTsrc { - cmd = filepath.Join(root, "cmd") - } filepath.Walk(root, func(path string, fi os.FileInfo, err error) error { if err != nil { return nil @@ -51,14 +53,6 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules [] return nil } - // GOROOT/src/cmd makes use of GOROOT/src/cmd/vendor, - // which module mode can't deal with. Eventually we'll stop using - // that vendor directory, and then we can remove this exclusion. - // golang.org/issue/26924. - if path == cmd { - return filepath.SkipDir - } - want := true // Avoid .foo, _foo, and testdata directory trees. _, elem := filepath.Split(path) @@ -86,8 +80,9 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules [] if !want { return filepath.SkipDir } - if path != root { - if _, err := os.Stat(filepath.Join(path, "go.mod")); err == nil { + // Stop at module boundaries. + if (prune&pruneGoMod != 0) && path != root { + if fi, err := os.Stat(filepath.Join(path, "go.mod")); err == nil && !fi.IsDir() { return filepath.SkipDir } } @@ -101,7 +96,7 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules [] } } - if elem == "vendor" { + if elem == "vendor" && (prune&pruneVendor != 0) { return filepath.SkipDir } return nil @@ -109,28 +104,51 @@ func matchPackages(pattern string, tags map[string]bool, useStd bool, modules [] } if useStd { - walkPkgs(cfg.GOROOTsrc, "") + walkPkgs(cfg.GOROOTsrc, "", pruneGoMod) + if treeCanMatch("cmd") { + walkPkgs(filepath.Join(cfg.GOROOTsrc, "cmd"), "cmd", pruneGoMod) + } + } + + if cfg.BuildMod == "vendor" { + if HasModRoot() { + walkPkgs(ModRoot(), targetPrefix, pruneGoMod|pruneVendor) + walkPkgs(filepath.Join(ModRoot(), "vendor"), "", pruneVendor) + } + return pkgs } for _, mod := range modules { if !treeCanMatch(mod.Path) { continue } - var root string - if mod.Version == "" { + + var ( + root, modPrefix string + isLocal bool + ) + if mod == Target { if !HasModRoot() { continue // If there is no main module, we can't search in it. } root = ModRoot() + modPrefix = targetPrefix + isLocal = true } else { var err error - root, _, err = fetch(mod) + root, isLocal, err = fetch(mod) if err != nil { base.Errorf("go: %v", err) continue } + modPrefix = mod.Path + } + + prune := pruneVendor + if isLocal { + prune |= pruneGoMod } - walkPkgs(root, mod.Path) + walkPkgs(root, modPrefix, prune) } return pkgs diff --git a/libgo/go/cmd/go/internal/module/module.go b/libgo/go/cmd/go/internal/module/module.go index 481a90b1c46..3e0baba15b3 100644 --- a/libgo/go/cmd/go/internal/module/module.go +++ b/libgo/go/cmd/go/internal/module/module.go @@ -18,6 +18,7 @@ package module // Changes to the semantics in this file require approval from rsc. import ( + "errors" "fmt" "sort" "strings" @@ -40,6 +41,60 @@ type Version struct { Version string `json:",omitempty"` } +// A ModuleError indicates an error specific to a module. +type ModuleError struct { + Path string + Version string + Err error +} + +// VersionError returns a ModuleError derived from a Version and error. +func VersionError(v Version, err error) error { + return &ModuleError{ + Path: v.Path, + Version: v.Version, + Err: err, + } +} + +func (e *ModuleError) Error() string { + if v, ok := e.Err.(*InvalidVersionError); ok { + return fmt.Sprintf("%s@%s: invalid %s: %v", e.Path, v.Version, v.noun(), v.Err) + } + if e.Version != "" { + return fmt.Sprintf("%s@%s: %v", e.Path, e.Version, e.Err) + } + return fmt.Sprintf("module %s: %v", e.Path, e.Err) +} + +func (e *ModuleError) Unwrap() error { return e.Err } + +// An InvalidVersionError indicates an error specific to a version, with the +// module path unknown or specified externally. +// +// A ModuleError may wrap an InvalidVersionError, but an InvalidVersionError +// must not wrap a ModuleError. +type InvalidVersionError struct { + Version string + Pseudo bool + Err error +} + +// noun returns either "version" or "pseudo-version", depending on whether +// e.Version is a pseudo-version. +func (e *InvalidVersionError) noun() string { + if e.Pseudo { + return "pseudo-version" + } + return "version" +} + +func (e *InvalidVersionError) Error() string { + return fmt.Sprintf("%s %q invalid: %s", e.noun(), e.Version, e.Err) +} + +func (e *InvalidVersionError) Unwrap() error { return e.Err } + // Check checks that a given module path, version pair is valid. // In addition to the path being a valid module path // and the version being a valid semantic version, @@ -51,17 +106,14 @@ func Check(path, version string) error { return err } if !semver.IsValid(version) { - return fmt.Errorf("malformed semantic version %v", version) + return &ModuleError{ + Path: path, + Err: &InvalidVersionError{Version: version, Err: errors.New("not a semantic version")}, + } } _, pathMajor, _ := SplitPathVersion(path) - if !MatchPathMajor(version, pathMajor) { - if pathMajor == "" { - pathMajor = "v0 or v1" - } - if pathMajor[0] == '.' { // .v1 - pathMajor = pathMajor[1:] - } - return fmt.Errorf("mismatched module path %v and version %v (want %v)", path, version, pathMajor) + if err := MatchPathMajor(version, pathMajor); err != nil { + return &ModuleError{Path: path, Err: err} } return nil } @@ -169,6 +221,9 @@ func checkPath(path string, fileName bool) error { if path == "" { return fmt.Errorf("empty string") } + if path[0] == '-' { + return fmt.Errorf("leading dash") + } if strings.Contains(path, "..") { return fmt.Errorf("double dot") } @@ -317,22 +372,56 @@ func splitGopkgIn(path string) (prefix, pathMajor string, ok bool) { return prefix, pathMajor, true } -// MatchPathMajor reports whether the semantic version v -// matches the path major version pathMajor. -func MatchPathMajor(v, pathMajor string) bool { +// MatchPathMajor returns a non-nil error if the semantic version v +// does not match the path major version pathMajor. +func MatchPathMajor(v, pathMajor string) error { if strings.HasPrefix(pathMajor, ".v") && strings.HasSuffix(pathMajor, "-unstable") { pathMajor = strings.TrimSuffix(pathMajor, "-unstable") } if strings.HasPrefix(v, "v0.0.0-") && pathMajor == ".v1" { // Allow old bug in pseudo-versions that generated v0.0.0- pseudoversion for gopkg .v1. // For example, gopkg.in/yaml.v2@v2.2.1's go.mod requires gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405. - return true + return nil } m := semver.Major(v) if pathMajor == "" { - return m == "v0" || m == "v1" || semver.Build(v) == "+incompatible" + if m == "v0" || m == "v1" || semver.Build(v) == "+incompatible" { + return nil + } + pathMajor = "v0 or v1" + } else if pathMajor[0] == '/' || pathMajor[0] == '.' { + if m == pathMajor[1:] { + return nil + } + pathMajor = pathMajor[1:] + } + return &InvalidVersionError{ + Version: v, + Err: fmt.Errorf("should be %s, not %s", pathMajor, semver.Major(v)), } - return (pathMajor[0] == '/' || pathMajor[0] == '.') && m == pathMajor[1:] +} + +// PathMajorPrefix returns the major-version tag prefix implied by pathMajor. +// An empty PathMajorPrefix allows either v0 or v1. +// +// Note that MatchPathMajor may accept some versions that do not actually begin +// with this prefix: namely, it accepts a 'v0.0.0-' prefix for a '.v1' +// pathMajor, even though that pathMajor implies 'v1' tagging. +func PathMajorPrefix(pathMajor string) string { + if pathMajor == "" { + return "" + } + if pathMajor[0] != '/' && pathMajor[0] != '.' { + panic("pathMajor suffix " + pathMajor + " passed to PathMajorPrefix lacks separator") + } + if strings.HasPrefix(pathMajor, ".v") && strings.HasSuffix(pathMajor, "-unstable") { + pathMajor = strings.TrimSuffix(pathMajor, "-unstable") + } + m := pathMajor[1:] + if m != semver.Major(m) { + panic("pathMajor suffix " + pathMajor + "passed to PathMajorPrefix is not a valid major version") + } + return m } // CanonicalVersion returns the canonical form of the version string v. @@ -447,7 +536,10 @@ func EncodePath(path string) (encoding string, err error) { // and not contain exclamation marks. func EncodeVersion(v string) (encoding string, err error) { if err := checkElem(v, true); err != nil || strings.Contains(v, "!") { - return "", fmt.Errorf("disallowed version string %q", v) + return "", &InvalidVersionError{ + Version: v, + Err: fmt.Errorf("disallowed version string"), + } } return encodeString(v) } diff --git a/libgo/go/cmd/go/internal/module/module_test.go b/libgo/go/cmd/go/internal/module/module_test.go index b40bd03dfa6..b9f07bf57d5 100644 --- a/libgo/go/cmd/go/internal/module/module_test.go +++ b/libgo/go/cmd/go/internal/module/module_test.go @@ -79,7 +79,7 @@ var checkPathTests = []struct { {"/x.y/z", false, false, false}, {"x./z", false, false, false}, {".x/z", false, false, true}, - {"-x/z", false, true, true}, + {"-x/z", false, false, false}, {"x..y/z", false, false, false}, {"x.y/z/../../w", false, false, false}, {"x.y//z", false, false, false}, diff --git a/libgo/go/cmd/go/internal/mvs/mvs.go b/libgo/go/cmd/go/internal/mvs/mvs.go index aa109693f30..568efbd8b26 100644 --- a/libgo/go/cmd/go/internal/mvs/mvs.go +++ b/libgo/go/cmd/go/internal/mvs/mvs.go @@ -9,9 +9,10 @@ package mvs import ( "fmt" "sort" + "strings" "sync" + "sync/atomic" - "cmd/go/internal/base" "cmd/go/internal/module" "cmd/go/internal/par" ) @@ -34,7 +35,7 @@ type Reqs interface { // Max returns the maximum of v1 and v2 (it returns either v1 or v2). // // For all versions v, Max(v, "none") must be v, - // and for the tanget passed as the first argument to MVS functions, + // and for the target passed as the first argument to MVS functions, // Max(target, v) must be target. // // Note that v1 < v2 can be written Max(v1, v2) != v1 @@ -59,12 +60,57 @@ type Reqs interface { Previous(m module.Version) (module.Version, error) } -type MissingModuleError struct { - Module module.Version +// BuildListError decorates an error that occurred gathering requirements +// while constructing a build list. BuildListError prints the chain +// of requirements to the module where the error occurred. +type BuildListError struct { + Err error + stack []buildListErrorElem } -func (e *MissingModuleError) Error() string { - return fmt.Sprintf("missing module: %v", e.Module) +type buildListErrorElem struct { + m module.Version + + // nextReason is the reason this module depends on the next module in the + // stack. Typically either "requires", or "upgraded to". + nextReason string +} + +// Module returns the module where the error occurred. If the module stack +// is empty, this returns a zero value. +func (e *BuildListError) Module() module.Version { + if len(e.stack) == 0 { + return module.Version{} + } + return e.stack[0].m +} + +func (e *BuildListError) Error() string { + b := &strings.Builder{} + stack := e.stack + + // Don't print modules at the beginning of the chain without a + // version. These always seem to be the main module or a + // synthetic module ("target@"). + for len(stack) > 0 && stack[len(stack)-1].m.Version == "" { + stack = stack[:len(stack)-1] + } + + for i := len(stack) - 1; i >= 1; i-- { + fmt.Fprintf(b, "%s@%s %s\n\t", stack[i].m.Path, stack[i].m.Version, stack[i].nextReason) + } + if len(stack) == 0 { + b.WriteString(e.Err.Error()) + } else { + // Ensure that the final module path and version are included as part of the + // error message. + if _, ok := e.Err.(*module.ModuleError); ok { + fmt.Fprintf(b, "%v", e.Err) + } else { + fmt.Fprintf(b, "%v", module.VersionError(stack[0].m, e.Err)) + } + } + return b.String() } // BuildList returns the build list for the target module. @@ -73,66 +119,119 @@ func BuildList(target module.Version, reqs Reqs) ([]module.Version, error) { return buildList(target, reqs, nil) } -func buildList(target module.Version, reqs Reqs, upgrade func(module.Version) module.Version) ([]module.Version, error) { +func buildList(target module.Version, reqs Reqs, upgrade func(module.Version) (module.Version, error)) ([]module.Version, error) { // Explore work graph in parallel in case reqs.Required // does high-latency network operations. - var work par.Work - work.Add(target) + type modGraphNode struct { + m module.Version + required []module.Version + upgrade module.Version + err error + } var ( mu sync.Mutex - min = map[string]string{target.Path: target.Version} - firstErr error + modGraph = map[module.Version]*modGraphNode{} + min = map[string]string{} // maps module path to minimum required version + haveErr int32 ) + setErr := func(n *modGraphNode, err error) { + n.err = err + atomic.StoreInt32(&haveErr, 1) + } + + var work par.Work + work.Add(target) work.Do(10, func(item interface{}) { m := item.(module.Version) - required, err := reqs.Required(m) + node := &modGraphNode{m: m} mu.Lock() - if err != nil && firstErr == nil { - firstErr = err - } - if firstErr != nil { - mu.Unlock() - return - } + modGraph[m] = node if v, ok := min[m.Path]; !ok || reqs.Max(v, m.Version) != v { min[m.Path] = m.Version } mu.Unlock() - for _, r := range required { - if r.Path == "" { - base.Errorf("Required(%v) returned zero module in list", m) - continue - } + required, err := reqs.Required(m) + if err != nil { + setErr(node, err) + return + } + node.required = required + for _, r := range node.required { work.Add(r) } if upgrade != nil { - u := upgrade(m) - if u.Path == "" { - base.Errorf("Upgrade(%v) returned zero module", m) + u, err := upgrade(m) + if err != nil { + setErr(node, err) return } - work.Add(u) + if u != m { + node.upgrade = u + work.Add(u) + } } }) - if firstErr != nil { - return nil, firstErr + // If there was an error, find the shortest path from the target to the + // node where the error occurred so we can report a useful error message. + if haveErr != 0 { + // neededBy[a] = b means a was added to the module graph by b. + neededBy := make(map[*modGraphNode]*modGraphNode) + q := make([]*modGraphNode, 0, len(modGraph)) + q = append(q, modGraph[target]) + for len(q) > 0 { + node := q[0] + q = q[1:] + + if node.err != nil { + err := &BuildListError{ + Err: node.err, + stack: []buildListErrorElem{{m: node.m}}, + } + for n, prev := neededBy[node], node; n != nil; n, prev = neededBy[n], n { + reason := "requires" + if n.upgrade == prev.m { + reason = "updating to" + } + err.stack = append(err.stack, buildListErrorElem{m: n.m, nextReason: reason}) + } + return nil, err + } + + neighbors := node.required + if node.upgrade.Path != "" { + neighbors = append(neighbors, node.upgrade) + } + for _, neighbor := range neighbors { + nn := modGraph[neighbor] + if neededBy[nn] != nil { + continue + } + neededBy[nn] = node + q = append(q, nn) + } + } } + + // Construct the list by traversing the graph again, replacing older + // modules with required minimum versions. if v := min[target.Path]; v != target.Version { + // TODO(jayconrod): there is a special case in modload.mvsReqs.Max + // that prevents us from selecting a newer version of a module + // when the module has no version. This may only be the case for target. + // Should we always panic when target has a version? + // See golang.org/issue/31491, golang.org/issue/29773. panic(fmt.Sprintf("mistake: chose version %q instead of target %+v", v, target)) // TODO: Don't panic. } list := []module.Version{target} listed := map[string]bool{target.Path: true} for i := 0; i < len(list); i++ { - m := list[i] - required, err := reqs.Required(m) - if err != nil { - return nil, err - } + n := modGraph[list[i]] + required := n.required for _, r := range required { v := min[r.Path] if r.Path != target.Path && reqs.Max(v, r.Version) != v { @@ -237,17 +336,12 @@ func Req(target module.Version, list []module.Version, base []string, reqs Reqs) // UpgradeAll returns a build list for the target module // in which every module is upgraded to its latest version. func UpgradeAll(target module.Version, reqs Reqs) ([]module.Version, error) { - return buildList(target, reqs, func(m module.Version) module.Version { + return buildList(target, reqs, func(m module.Version) (module.Version, error) { if m.Path == target.Path { - return target + return target, nil } - latest, err := reqs.Upgrade(m) - if err != nil { - panic(err) // TODO - } - m.Version = latest.Version - return m + return reqs.Upgrade(m) }) } @@ -256,7 +350,7 @@ func UpgradeAll(target module.Version, reqs Reqs) ([]module.Version, error) { func Upgrade(target module.Version, reqs Reqs, upgrade ...module.Version) ([]module.Version, error) { list, err := reqs.Required(target) if err != nil { - panic(err) // TODO + return nil, err } // TODO: Maybe if an error is given, // rerun with BuildList(upgrade[0], reqs) etc @@ -275,7 +369,7 @@ func Upgrade(target module.Version, reqs Reqs, upgrade ...module.Version) ([]mod func Downgrade(target module.Version, reqs Reqs, downgrade ...module.Version) ([]module.Version, error) { list, err := reqs.Required(target) if err != nil { - panic(err) // TODO + return nil, err } max := make(map[string]string) for _, r := range list { @@ -314,7 +408,17 @@ func Downgrade(target module.Version, reqs Reqs, downgrade ...module.Version) ([ } list, err := reqs.Required(m) if err != nil { - panic(err) // TODO + // If we can't load the requirements, we couldn't load the go.mod file. + // There are a number of reasons this can happen, but this usually + // means an older version of the module had a missing or invalid + // go.mod file. For example, if example.com/mod released v2.0.0 before + // migrating to modules (v2.0.0+incompatible), then added a valid go.mod + // in v2.0.1, downgrading from v2.0.1 would cause this error. + // + // TODO(golang.org/issue/31730, golang.org/issue/30134): if the error + // is transient (we couldn't download go.mod), return the error from + // Downgrade. Currently, we can't tell what kind of error it is. + exclude(m) } for _, r := range list { add(r) @@ -334,7 +438,12 @@ List: for excluded[r] { p, err := reqs.Previous(r) if err != nil { - return nil, err // TODO + // This is likely a transient error reaching the repository, + // rather than a permanent error with the retrieved version. + // + // TODO(golang.org/issue/31730, golang.org/issue/30134): + // decode what to do based on the actual error. + return nil, err } // If the target version is a pseudo-version, it may not be // included when iterating over prior versions using reqs.Previous. diff --git a/libgo/go/cmd/go/internal/mvs/mvs_test.go b/libgo/go/cmd/go/internal/mvs/mvs_test.go index 2a27dfb2889..cab4bb241bc 100644 --- a/libgo/go/cmd/go/internal/mvs/mvs_test.go +++ b/libgo/go/cmd/go/internal/mvs/mvs_test.go @@ -5,6 +5,7 @@ package mvs import ( + "fmt" "reflect" "strings" "testing" @@ -446,7 +447,7 @@ func (r reqsMap) Upgrade(m module.Version) (module.Version, error) { } } if u.Path == "" { - return module.Version{}, &MissingModuleError{module.Version{Path: m.Path, Version: ""}} + return module.Version{}, fmt.Errorf("missing module: %v", module.Version{Path: m.Path}) } return u, nil } @@ -467,7 +468,7 @@ func (r reqsMap) Previous(m module.Version) (module.Version, error) { func (r reqsMap) Required(m module.Version) ([]module.Version, error) { rr, ok := r[m] if !ok { - return nil, &MissingModuleError{m} + return nil, fmt.Errorf("missing module: %v", m) } return rr, nil } diff --git a/libgo/go/cmd/go/internal/note/example_test.go b/libgo/go/cmd/go/internal/note/example_test.go new file mode 100644 index 00000000000..53554b4c23f --- /dev/null +++ b/libgo/go/cmd/go/internal/note/example_test.go @@ -0,0 +1,128 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package note_test + +import ( + "fmt" + "io" + "os" + + "cmd/go/internal/note" +) + +func ExampleSign() { + skey := "PRIVATE+KEY+PeterNeumann+c74f20a3+AYEKFALVFGyNhPJEMzD1QIDr+Y7hfZx09iUvxdXHKDFz" + text := "If you think cryptography is the answer to your problem,\n" + + "then you don't know what your problem is.\n" + + signer, err := note.NewSigner(skey) + if err != nil { + fmt.Println(err) + return + } + + msg, err := note.Sign(¬e.Note{Text: text}, signer) + if err != nil { + fmt.Println(err) + return + } + os.Stdout.Write(msg) + + // Output: + // If you think cryptography is the answer to your problem, + // then you don't know what your problem is. + // + // — PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM= +} + +func ExampleOpen() { + vkey := "PeterNeumann+c74f20a3+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW" + msg := []byte("If you think cryptography is the answer to your problem,\n" + + "then you don't know what your problem is.\n" + + "\n" + + "— PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=\n") + + verifier, err := note.NewVerifier(vkey) + if err != nil { + fmt.Println(err) + return + } + verifiers := note.VerifierList(verifier) + + n, err := note.Open(msg, verifiers) + if err != nil { + fmt.Println(err) + return + } + fmt.Printf("%s (%08x):\n%s", n.Sigs[0].Name, n.Sigs[0].Hash, n.Text) + + // Output: + // PeterNeumann (c74f20a3): + // If you think cryptography is the answer to your problem, + // then you don't know what your problem is. +} + +var rand = struct { + Reader io.Reader +}{ + zeroReader{}, +} + +type zeroReader struct{} + +func (zeroReader) Read(buf []byte) (int, error) { + for i := range buf { + buf[i] = 0 + } + return len(buf), nil +} + +func ExampleSign_add_signatures() { + vkey := "PeterNeumann+c74f20a3+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW" + msg := []byte("If you think cryptography is the answer to your problem,\n" + + "then you don't know what your problem is.\n" + + "\n" + + "— PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=\n") + + verifier, err := note.NewVerifier(vkey) + if err != nil { + fmt.Println(err) + return + } + verifiers := note.VerifierList(verifier) + + n, err := note.Open([]byte(msg), verifiers) + if err != nil { + fmt.Println(err) + return + } + + skey, vkey, err := note.GenerateKey(rand.Reader, "EnochRoot") + if err != nil { + fmt.Println(err) + return + } + _ = vkey // give to verifiers + + me, err := note.NewSigner(skey) + if err != nil { + fmt.Println(err) + return + } + + msg, err = note.Sign(n, me) + if err != nil { + fmt.Println(err) + return + } + os.Stdout.Write(msg) + + // Output: + // If you think cryptography is the answer to your problem, + // then you don't know what your problem is. + // + // — PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM= + // — EnochRoot rwz+eBzmZa0SO3NbfRGzPCpDckykFXSdeX+MNtCOXm2/5n2tiOHp+vAF1aGrQ5ovTG01oOTGwnWLox33WWd1RvMc+QQ= +} diff --git a/libgo/go/cmd/go/internal/note/note.go b/libgo/go/cmd/go/internal/note/note.go new file mode 100644 index 00000000000..f770da24b37 --- /dev/null +++ b/libgo/go/cmd/go/internal/note/note.go @@ -0,0 +1,683 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package note defines the notes signed by the Go module database server. +// +// This package is part of a DRAFT of what the Go module database server will look like. +// Do not assume the details here are final! +// +// A note is text signed by one or more server keys. +// The text should be ignored unless the note is signed by +// a trusted server key and the signature has been verified +// using the server's public key. +// +// A server's public key is identified by a name, typically the "host[/path]" +// giving the base URL of the server's transparency log. +// The syntactic restrictions on a name are that it be non-empty, +// well-formed UTF-8 containing neither Unicode spaces nor plus (U+002B). +// +// A Go module database server signs texts using public key cryptography. +// A given server may have multiple public keys, each +// identified by the first 32 bits of the SHA-256 hash of +// the concatenation of the server name, a newline, and +// the encoded public key. +// +// Verifying Notes +// +// A Verifier allows verification of signatures by one server public key. +// It can report the name of the server and the uint32 hash of the key, +// and it can verify a purported signature by that key. +// +// The standard implementation of a Verifier is constructed +// by NewVerifier starting from a verifier key, which is a +// plain text string of the form "++". +// +// A Verifiers allows looking up a Verifier by the combination +// of server name and key hash. +// +// The standard implementation of a Verifiers is constructed +// by VerifierList from a list of known verifiers. +// +// A Note represents a text with one or more signatures. +// An implementation can reject a note with too many signatures +// (for example, more than 100 signatures). +// +// A Signature represents a signature on a note, verified or not. +// +// The Open function takes as input a signed message +// and a set of known verifiers. It decodes and verifies +// the message signatures and returns a Note structure +// containing the message text and (verified or unverified) signatures. +// +// Signing Notes +// +// A Signer allows signing a text with a given key. +// It can report the name of the server and the hash of the key +// and can sign a raw text using that key. +// +// The standard implementation of a Signer is constructed +// by NewSigner starting from an encoded signer key, which is a +// plain text string of the form "PRIVATE+KEY+++". +// Anyone with an encoded signer key can sign messages using that key, +// so it must be kept secret. The encoding begins with the literal text +// "PRIVATE+KEY" to avoid confusion with the public server key. +// +// The Sign function takes as input a Note and a list of Signers +// and returns an encoded, signed message. +// +// Signed Note Format +// +// A signed note consists of a text ending in newline (U+000A), +// followed by a blank line (only a newline), +// followed by one or more signature lines of this form: +// em dash (U+2014), space (U+0020), +// server name, space, base64-encoded signature, newline. +// +// Signed notes must be valid UTF-8 and must not contain any +// ASCII control characters (those below U+0020) other than newline. +// +// A signature is a base64 encoding of 4+n bytes. +// +// The first four bytes in the signature are the uint32 key hash +// stored in big-endian order, which is to say they are the first +// four bytes of the truncated SHA-256 used to derive the key hash +// in the first place. +// +// The remaining n bytes are the result of using the specified key +// to sign the note text (including the final newline but not the +// separating blank line). +// +// Generating Keys +// +// There is only one key type, Ed25519 with algorithm identifier 1. +// New key types may be introduced in the future as needed, +// although doing so will require deploying the new algorithms to all clients +// before starting to depend on them for signatures. +// +// The GenerateKey function generates and returns a new signer +// and corresponding verifier. +// +// Example +// +// Here is a well-formed signed note: +// +// If you think cryptography is the answer to your problem, +// then you don't know what your problem is. +// +// — PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM= +// +// It can be constructed and displayed using: +// +// skey := "PRIVATE+KEY+PeterNeumann+c74f20a3+AYEKFALVFGyNhPJEMzD1QIDr+Y7hfZx09iUvxdXHKDFz" +// text := "If you think cryptography is the answer to your problem,\n" + +// "then you don't know what your problem is.\n" +// +// signer, err := note.NewSigner(skey) +// if err != nil { +// log.Fatal(err) +// } +// +// msg, err := note.Sign(¬e.Note{Text: text}, signer) +// if err != nil { +// log.Fatal(err) +// } +// os.Stdout.Write(msg) +// +// The note's text is two lines, including the final newline, +// and the text is purportedly signed by a server named +// "PeterNeumann". (Although server names are canonically +// base URLs, the only syntactic requirement is that they +// not contain spaces or newlines). +// +// If Open is given access to a Verifiers including the +// Verifier for this key, then it will succeed at verifiying +// the encoded message and returning the parsed Note: +// +// vkey := "PeterNeumann+c74f20a3+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW" +// msg := []byte("If you think cryptography is the answer to your problem,\n" + +// "then you don't know what your problem is.\n" + +// "\n" + +// "— PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=\n") +// +// verifier, err := note.NewVerifier(vkey) +// if err != nil { +// log.Fatal(err) +// } +// verifiers := note.VerifierList(verifier) +// +// n, err := note.Open([]byte(msg), verifiers) +// if err != nil { +// log.Fatal(err) +// } +// fmt.Printf("%s (%08x):\n%s", n.Sigs[0].Name, n.Sigs[0].Hash, n.Text) +// +// You can add your own signature to this message by re-signing the note: +// +// skey, vkey, err := note.GenerateKey(rand.Reader, "EnochRoot") +// if err != nil { +// log.Fatal(err) +// } +// _ = vkey // give to verifiers +// +// me, err := note.NewSigner(skey) +// if err != nil { +// log.Fatal(err) +// } +// +// msg, err := note.Sign(n, me) +// if err != nil { +// log.Fatal(err) +// } +// os.Stdout.Write(msg) +// +// This will print a doubly-signed message, like: +// +// If you think cryptography is the answer to your problem, +// then you don't know what your problem is. +// +// — PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM= +// — EnochRoot rwz+eBzmZa0SO3NbfRGzPCpDckykFXSdeX+MNtCOXm2/5n2tiOHp+vAF1aGrQ5ovTG01oOTGwnWLox33WWd1RvMc+QQ= +// +package note + +import ( + "bytes" + "crypto/ed25519" + "crypto/sha256" + "encoding/base64" + "encoding/binary" + "errors" + "fmt" + "io" + "strconv" + "strings" + "unicode" + "unicode/utf8" +) + +// A Verifier verifies messages signed with a specific key. +type Verifier interface { + // Name returns the server name associated with the key. + Name() string + + // KeyHash returns the key hash. + KeyHash() uint32 + + // Verify reports whether sig is a valid signature of msg. + Verify(msg, sig []byte) bool +} + +// A Signer signs messages using a specific key. +type Signer interface { + // Name returns the server name associated with the key. + Name() string + + // KeyHash returns the key hash. + KeyHash() uint32 + + // Sign returns a signature for the given message. + Sign(msg []byte) ([]byte, error) +} + +// keyHash computes the key hash for the given server name and encoded public key. +func keyHash(name string, key []byte) uint32 { + h := sha256.New() + h.Write([]byte(name)) + h.Write([]byte("\n")) + h.Write(key) + sum := h.Sum(nil) + return binary.BigEndian.Uint32(sum) +} + +var ( + errVerifierID = errors.New("malformed verifier id") + errVerifierAlg = errors.New("unknown verifier algorithm") + errVerifierHash = errors.New("invalid verifier hash") +) + +const ( + algEd25519 = 1 +) + +// isValidName reports whether name is valid. +// It must be non-empty and not have any Unicode spaces or pluses. +func isValidName(name string) bool { + return name != "" && utf8.ValidString(name) && strings.IndexFunc(name, unicode.IsSpace) < 0 && !strings.Contains(name, "+") +} + +// NewVerifier construct a new Verifier from an encoded verifier key. +func NewVerifier(vkey string) (Verifier, error) { + name, vkey := chop(vkey, "+") + hash16, key64 := chop(vkey, "+") + hash, err1 := strconv.ParseUint(hash16, 16, 32) + key, err2 := base64.StdEncoding.DecodeString(key64) + if len(hash16) != 8 || err1 != nil || err2 != nil || !isValidName(name) || len(key) == 0 { + return nil, errVerifierID + } + if uint32(hash) != keyHash(name, key) { + return nil, errVerifierHash + } + + v := &verifier{ + name: name, + hash: uint32(hash), + } + + alg, key := key[0], key[1:] + switch alg { + default: + return nil, errVerifierAlg + + case algEd25519: + if len(key) != 32 { + return nil, errVerifierID + } + v.verify = func(msg, sig []byte) bool { + return ed25519.Verify(key, msg, sig) + } + } + + return v, nil +} + +// chop chops s at the first instance of sep, if any, +// and returns the text before and after sep. +// If sep is not present, chop returns before is s and after is empty. +func chop(s, sep string) (before, after string) { + i := strings.Index(s, sep) + if i < 0 { + return s, "" + } + return s[:i], s[i+len(sep):] +} + +// verifier is a trivial Verifier implementation. +type verifier struct { + name string + hash uint32 + verify func([]byte, []byte) bool +} + +func (v *verifier) Name() string { return v.name } +func (v *verifier) KeyHash() uint32 { return v.hash } +func (v *verifier) Verify(msg, sig []byte) bool { return v.verify(msg, sig) } + +// NewSigner constructs a new Signer from an encoded signer key. +func NewSigner(skey string) (Signer, error) { + priv1, skey := chop(skey, "+") + priv2, skey := chop(skey, "+") + name, skey := chop(skey, "+") + hash16, key64 := chop(skey, "+") + hash, err1 := strconv.ParseUint(hash16, 16, 32) + key, err2 := base64.StdEncoding.DecodeString(key64) + if priv1 != "PRIVATE" || priv2 != "KEY" || len(hash16) != 8 || err1 != nil || err2 != nil || !isValidName(name) || len(key) == 0 { + return nil, errSignerID + } + + // Note: hash is the hash of the public key and we have the private key. + // Must verify hash after deriving public key. + + s := &signer{ + name: name, + hash: uint32(hash), + } + + var pubkey []byte + + alg, key := key[0], key[1:] + switch alg { + default: + return nil, errSignerAlg + + case algEd25519: + if len(key) != 32 { + return nil, errSignerID + } + key = ed25519.NewKeyFromSeed(key) + pubkey = append([]byte{algEd25519}, key[32:]...) + s.sign = func(msg []byte) ([]byte, error) { + return ed25519.Sign(key, msg), nil + } + } + + if uint32(hash) != keyHash(name, pubkey) { + return nil, errSignerHash + } + + return s, nil +} + +var ( + errSignerID = errors.New("malformed verifier id") + errSignerAlg = errors.New("unknown verifier algorithm") + errSignerHash = errors.New("invalid verifier hash") +) + +// signer is a trivial Signer implementation. +type signer struct { + name string + hash uint32 + sign func([]byte) ([]byte, error) +} + +func (s *signer) Name() string { return s.name } +func (s *signer) KeyHash() uint32 { return s.hash } +func (s *signer) Sign(msg []byte) ([]byte, error) { return s.sign(msg) } + +// GenerateKey generates a signer and verifier key pair for a named server. +// The signer key skey is private and must be kept secret. +func GenerateKey(rand io.Reader, name string) (skey, vkey string, err error) { + pub, priv, err := ed25519.GenerateKey(rand) + if err != nil { + return "", "", err + } + pubkey := append([]byte{algEd25519}, pub...) + privkey := append([]byte{algEd25519}, priv.Seed()...) + h := keyHash(name, pubkey) + + skey = fmt.Sprintf("PRIVATE+KEY+%s+%08x+%s", name, h, base64.StdEncoding.EncodeToString(privkey)) + vkey = fmt.Sprintf("%s+%08x+%s", name, h, base64.StdEncoding.EncodeToString(pubkey)) + return skey, vkey, nil +} + +// NewEd25519VerifierKey returns an encoded verifier key using the given name +// and Ed25519 public key. +func NewEd25519VerifierKey(name string, key ed25519.PublicKey) (string, error) { + if len(key) != ed25519.PublicKeySize { + return "", fmt.Errorf("invalid public key size %d, expected %d", len(key), ed25519.PublicKeySize) + } + + pubkey := append([]byte{algEd25519}, key...) + hash := keyHash(name, pubkey) + + b64Key := base64.StdEncoding.EncodeToString(pubkey) + return fmt.Sprintf("%s+%08x+%s", name, hash, b64Key), nil +} + +// A Verifiers is a collection of known verifier keys. +type Verifiers interface { + // Verifier returns the Verifier associated with the key + // identified by the name and hash. + // If the name, hash pair is unknown, Verifier should return + // an UnknownVerifierError. + Verifier(name string, hash uint32) (Verifier, error) +} + +// An UnknownVerifierError indicates that the given key is not known. +// The Open function records signatures without associated verifiers as +// unverified signatures. +type UnknownVerifierError struct { + Name string + KeyHash uint32 +} + +func (e *UnknownVerifierError) Error() string { + return fmt.Sprintf("unknown key %s+%08x", e.Name, e.KeyHash) +} + +// An ambiguousVerifierError indicates that the given name and hash +// match multiple keys passed to VerifierList. +// (If this happens, some malicious actor has taken control of the +// verifier list, at which point we may as well give up entirely, +// but we diagnose the problem instead.) +type ambiguousVerifierError struct { + name string + hash uint32 +} + +func (e *ambiguousVerifierError) Error() string { + return fmt.Sprintf("ambiguous key %s+%08x", e.name, e.hash) +} + +// VerifierList returns a Verifiers implementation that uses the given list of verifiers. +func VerifierList(list ...Verifier) Verifiers { + m := make(verifierMap) + for _, v := range list { + k := nameHash{v.Name(), v.KeyHash()} + m[k] = append(m[k], v) + } + return m +} + +type nameHash struct { + name string + hash uint32 +} + +type verifierMap map[nameHash][]Verifier + +func (m verifierMap) Verifier(name string, hash uint32) (Verifier, error) { + v, ok := m[nameHash{name, hash}] + if !ok { + return nil, &UnknownVerifierError{name, hash} + } + if len(v) > 1 { + return nil, &ambiguousVerifierError{name, hash} + } + return v[0], nil +} + +// A Note is a text and signatures. +type Note struct { + Text string // text of note + Sigs []Signature // verified signatures + UnverifiedSigs []Signature // unverified signatures +} + +// A Signature is a single signature found in a note. +type Signature struct { + // Name and Hash give the name and key hash + // for the key that generated the signature. + Name string + Hash uint32 + + // Base64 records the base64-encoded signature bytes. + Base64 string +} + +// An UnverifiedNoteError indicates that the note +// successfully parsed but had no verifiable signatures. +type UnverifiedNoteError struct { + Note *Note +} + +func (e *UnverifiedNoteError) Error() string { + return "note has no verifiable signatures" +} + +// An InvalidSignatureError indicates that the given key was known +// and the associated Verifier rejected the signature. +type InvalidSignatureError struct { + Name string + Hash uint32 +} + +func (e *InvalidSignatureError) Error() string { + return fmt.Sprintf("invalid signature for key %s+%08x", e.Name, e.Hash) +} + +var ( + errMalformedNote = errors.New("malformed note") + errInvalidSigner = errors.New("invalid signer") + + sigSplit = []byte("\n\n") + sigPrefix = []byte("— ") +) + +// Open opens and parses the message msg, checking signatures from the known verifiers. +// +// For each signature in the message, Open calls known.Verifier to find a verifier. +// If known.Verifier returns a verifier and the verifier accepts the signature, +// Open records the signature in the returned note's Sigs field. +// If known.Verifier returns a verifier but the verifier rejects the signature, +// Open returns an InvalidSignatureError. +// If known.Verifier returns an UnknownVerifierError, +// Open records the signature in the returned note's UnverifiedSigs field. +// If known.Verifier returns any other error, Open returns that error. +// +// If no known verifier has signed an otherwise valid note, +// Open returns an UnverifiedNoteError. +// In this case, the unverified note can be fetched from inside the error. +func Open(msg []byte, known Verifiers) (*Note, error) { + if known == nil { + // Treat nil Verifiers as empty list, to produce useful error instead of crash. + known = VerifierList() + } + + // Must have valid UTF-8 with no non-newline ASCII control characters. + for i := 0; i < len(msg); { + r, size := utf8.DecodeRune(msg[i:]) + if r < 0x20 && r != '\n' || r == utf8.RuneError && size == 1 { + return nil, errMalformedNote + } + i += size + } + + // Must end with signature block preceded by blank line. + split := bytes.LastIndex(msg, sigSplit) + if split < 0 { + return nil, errMalformedNote + } + text, sigs := msg[:split+1], msg[split+2:] + if len(sigs) == 0 || sigs[len(sigs)-1] != '\n' { + return nil, errMalformedNote + } + + n := &Note{ + Text: string(text), + } + + var buf bytes.Buffer + buf.Write(text) + + // Parse and verify signatures. + // Ignore duplicate signatures. + seen := make(map[nameHash]bool) + seenUnverified := make(map[string]bool) + numSig := 0 + for len(sigs) > 0 { + // Pull out next signature line. + // We know sigs[len(sigs)-1] == '\n', so IndexByte always finds one. + i := bytes.IndexByte(sigs, '\n') + line := sigs[:i] + sigs = sigs[i+1:] + + if !bytes.HasPrefix(line, sigPrefix) { + return nil, errMalformedNote + } + line = line[len(sigPrefix):] + name, b64 := chop(string(line), " ") + sig, err := base64.StdEncoding.DecodeString(b64) + if err != nil || !isValidName(name) || b64 == "" || len(sig) < 5 { + return nil, errMalformedNote + } + hash := binary.BigEndian.Uint32(sig[0:4]) + sig = sig[4:] + + if numSig++; numSig > 100 { + // Avoid spending forever parsing a note with many signatures. + return nil, errMalformedNote + } + + v, err := known.Verifier(name, hash) + if _, ok := err.(*UnknownVerifierError); ok { + // Drop repeated identical unverified signatures. + if seenUnverified[string(line)] { + continue + } + seenUnverified[string(line)] = true + n.UnverifiedSigs = append(n.UnverifiedSigs, Signature{Name: name, Hash: hash, Base64: b64}) + continue + } + if err != nil { + return nil, err + } + + // Drop repeated signatures by a single verifier. + if seen[nameHash{name, hash}] { + continue + } + seen[nameHash{name, hash}] = true + + ok := v.Verify(text, sig) + if !ok { + return nil, &InvalidSignatureError{name, hash} + } + + n.Sigs = append(n.Sigs, Signature{Name: name, Hash: hash, Base64: b64}) + } + + // Parsed and verified all the signatures. + if len(n.Sigs) == 0 { + return nil, &UnverifiedNoteError{n} + } + return n, nil +} + +// Sign signs the note with the given signers and returns the encoded message. +// The new signatures from signers are listed in the encoded message after +// the existing signatures already present in n.Sigs. +// If any signer uses the same key as an existing signature, +// the existing signature is elided from the output. +func Sign(n *Note, signers ...Signer) ([]byte, error) { + var buf bytes.Buffer + if !strings.HasSuffix(n.Text, "\n") { + return nil, errMalformedNote + } + buf.WriteString(n.Text) + + // Prepare signatures. + var sigs bytes.Buffer + have := make(map[nameHash]bool) + for _, s := range signers { + name := s.Name() + hash := s.KeyHash() + have[nameHash{name, hash}] = true + if !isValidName(name) { + return nil, errInvalidSigner + } + + sig, err := s.Sign(buf.Bytes()) // buf holds n.Text + if err != nil { + return nil, err + } + + var hbuf [4]byte + binary.BigEndian.PutUint32(hbuf[:], hash) + b64 := base64.StdEncoding.EncodeToString(append(hbuf[:], sig...)) + sigs.WriteString("— ") + sigs.WriteString(name) + sigs.WriteString(" ") + sigs.WriteString(b64) + sigs.WriteString("\n") + } + + buf.WriteString("\n") + + // Emit existing signatures not replaced by new ones. + for _, list := range [][]Signature{n.Sigs, n.UnverifiedSigs} { + for _, sig := range list { + name, hash := sig.Name, sig.Hash + if !isValidName(name) { + return nil, errMalformedNote + } + if have[nameHash{name, hash}] { + continue + } + // Double-check hash against base64. + raw, err := base64.StdEncoding.DecodeString(sig.Base64) + if err != nil || len(raw) < 4 || binary.BigEndian.Uint32(raw) != hash { + return nil, errMalformedNote + } + buf.WriteString("— ") + buf.WriteString(sig.Name) + buf.WriteString(" ") + buf.WriteString(sig.Base64) + buf.WriteString("\n") + } + } + buf.Write(sigs.Bytes()) + + return buf.Bytes(), nil +} diff --git a/libgo/go/cmd/go/internal/note/note_test.go b/libgo/go/cmd/go/internal/note/note_test.go new file mode 100644 index 00000000000..729324647e7 --- /dev/null +++ b/libgo/go/cmd/go/internal/note/note_test.go @@ -0,0 +1,472 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package note + +import ( + "crypto/ed25519" + "crypto/rand" + "errors" + "strings" + "testing" + "testing/iotest" +) + +func TestNewVerifier(t *testing.T) { + vkey := "PeterNeumann+c74f20a3+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW" + _, err := NewVerifier(vkey) + if err != nil { + t.Fatal(err) + } + + // Check various manglings are not accepted. + badKey := func(k string) { + _, err := NewVerifier(k) + if err == nil { + t.Errorf("NewVerifier(%q) succeeded, should have failed", k) + } + } + + b := []byte(vkey) + for i := 0; i <= len(b); i++ { + for j := i + 1; j <= len(b); j++ { + if i != 0 || j != len(b) { + badKey(string(b[i:j])) + } + } + } + for i := 0; i < len(b); i++ { + b[i]++ + badKey(string(b)) + b[i]-- + } + + badKey("PeterNeumann+cc469956+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TWBADKEY==") // wrong length key, with adjusted key hash + badKey("PeterNeumann+173116ae+ZRpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW") // unknown algorithm, with adjusted key hash +} + +func TestNewSigner(t *testing.T) { + skey := "PRIVATE+KEY+PeterNeumann+c74f20a3+AYEKFALVFGyNhPJEMzD1QIDr+Y7hfZx09iUvxdXHKDFz" + _, err := NewSigner(skey) + if err != nil { + t.Fatal(err) + } + + // Check various manglings are not accepted. + b := []byte(skey) + for i := 0; i <= len(b); i++ { + for j := i + 1; j <= len(b); j++ { + if i == 0 && j == len(b) { + continue + } + _, err := NewSigner(string(b[i:j])) + if err == nil { + t.Errorf("NewSigner(%q) succeeded, should have failed", b[i:j]) + } + } + } + for i := 0; i < len(b); i++ { + b[i]++ + _, err := NewSigner(string(b)) + if err == nil { + t.Errorf("NewSigner(%q) succeeded, should have failed", b) + } + b[i]-- + } +} + +func testSignerAndVerifier(t *testing.T, Name string, signer Signer, verifier Verifier) { + if name := signer.Name(); name != Name { + t.Errorf("signer.Name() = %q, want %q", name, Name) + } + if name := verifier.Name(); name != Name { + t.Errorf("verifier.Name() = %q, want %q", name, Name) + } + shash := signer.KeyHash() + vhash := verifier.KeyHash() + if shash != vhash { + t.Errorf("signer.KeyHash() = %#08x != verifier.KeyHash() = %#08x", shash, vhash) + } + + msg := []byte("hi") + sig, err := signer.Sign(msg) + if err != nil { + t.Fatalf("signer.Sign: %v", err) + } + if !verifier.Verify(msg, sig) { + t.Fatalf("verifier.Verify failed on signature returned by signer.Sign") + } + sig[0]++ + if verifier.Verify(msg, sig) { + t.Fatalf("verifier.Verify succceeded on corrupt signature") + } + sig[0]-- + msg[0]++ + if verifier.Verify(msg, sig) { + t.Fatalf("verifier.Verify succceeded on corrupt message") + } +} + +func TestGenerateKey(t *testing.T) { + // Generate key pair, make sure it is all self-consistent. + const Name = "EnochRoot" + + skey, vkey, err := GenerateKey(rand.Reader, Name) + if err != nil { + t.Fatalf("GenerateKey: %v", err) + } + signer, err := NewSigner(skey) + if err != nil { + t.Fatalf("NewSigner: %v", err) + } + verifier, err := NewVerifier(vkey) + if err != nil { + t.Fatalf("NewVerifier: %v", err) + } + + testSignerAndVerifier(t, Name, signer, verifier) + + // Check that GenerateKey returns error from rand reader. + _, _, err = GenerateKey(iotest.TimeoutReader(iotest.OneByteReader(rand.Reader)), Name) + if err == nil { + t.Fatalf("GenerateKey succeeded with error-returning rand reader") + } +} + +func TestFromEd25519(t *testing.T) { + const Name = "EnochRoot" + + pub, priv, err := ed25519.GenerateKey(rand.Reader) + if err != nil { + t.Fatalf("GenerateKey: %v", err) + } + signer, err := newSignerFromEd25519Seed(Name, priv.Seed()) + if err != nil { + t.Fatalf("newSignerFromEd25519Seed: %v", err) + } + vkey, err := NewEd25519VerifierKey(Name, pub) + if err != nil { + t.Fatalf("NewEd25519VerifierKey: %v", err) + } + verifier, err := NewVerifier(vkey) + if err != nil { + t.Fatalf("NewVerifier: %v", err) + } + + testSignerAndVerifier(t, Name, signer, verifier) + + // Check that wrong key sizes return errors. + _, err = NewEd25519VerifierKey(Name, pub[:len(pub)-1]) + if err == nil { + t.Errorf("NewEd25519VerifierKey succeeded with a seed of the wrong size") + } +} + +// newSignerFromEd25519Seed constructs a new signer from a verifier name and a +// crypto/ed25519 private key seed. +func newSignerFromEd25519Seed(name string, seed []byte) (Signer, error) { + if len(seed) != ed25519.SeedSize { + return nil, errors.New("invalid seed size") + } + priv := ed25519.NewKeyFromSeed(seed) + pub := priv[32:] + + pubkey := append([]byte{algEd25519}, pub...) + hash := keyHash(name, pubkey) + + s := &signer{ + name: name, + hash: uint32(hash), + sign: func(msg []byte) ([]byte, error) { + return ed25519.Sign(priv, msg), nil + }, + } + return s, nil +} + +func TestSign(t *testing.T) { + skey := "PRIVATE+KEY+PeterNeumann+c74f20a3+AYEKFALVFGyNhPJEMzD1QIDr+Y7hfZx09iUvxdXHKDFz" + text := "If you think cryptography is the answer to your problem,\n" + + "then you don't know what your problem is.\n" + + signer, err := NewSigner(skey) + if err != nil { + t.Fatal(err) + } + + msg, err := Sign(&Note{Text: text}, signer) + if err != nil { + t.Fatal(err) + } + + want := `If you think cryptography is the answer to your problem, +then you don't know what your problem is. + +— PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM= +` + if string(msg) != want { + t.Errorf("Sign: wrong output\nhave:\n%s\nwant:\n%s", msg, want) + } + + // Check that existing signature is replaced by new one. + msg, err = Sign(&Note{Text: text, Sigs: []Signature{{Name: "PeterNeumann", Hash: 0xc74f20a3, Base64: "BADSIGN="}}}, signer) + if err != nil { + t.Fatal(err) + } + if string(msg) != want { + t.Errorf("Sign replacing signature: wrong output\nhave:\n%s\nwant:\n%s", msg, want) + } + + // Check various bad inputs. + _, err = Sign(&Note{Text: "abc"}, signer) + if err == nil || err.Error() != "malformed note" { + t.Fatalf("Sign with short text: %v, want malformed note error", err) + } + + _, err = Sign(&Note{Text: text, Sigs: []Signature{{Name: "a+b", Base64: "ABCD"}}}) + if err == nil || err.Error() != "malformed note" { + t.Fatalf("Sign with bad name: %v, want malformed note error", err) + } + + _, err = Sign(&Note{Text: text, Sigs: []Signature{{Name: "PeterNeumann", Hash: 0xc74f20a3, Base64: "BADHASH="}}}) + if err == nil || err.Error() != "malformed note" { + t.Fatalf("Sign with bad pre-filled signature: %v, want malformed note error", err) + } + + _, err = Sign(&Note{Text: text}, &badSigner{signer}) + if err == nil || err.Error() != "invalid signer" { + t.Fatalf("Sign with bad signer: %v, want invalid signer error", err) + } + + _, err = Sign(&Note{Text: text}, &errSigner{signer}) + if err != errSurprise { + t.Fatalf("Sign with failing signer: %v, want errSurprise", err) + } +} + +func TestVerifierList(t *testing.T) { + peterKey := "PeterNeumann+c74f20a3+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW" + peterVerifier, err := NewVerifier(peterKey) + if err != nil { + t.Fatal(err) + } + + enochKey := "EnochRoot+af0cfe78+ATtqJ7zOtqQtYqOo0CpvDXNlMhV3HeJDpjrASKGLWdop" + enochVerifier, err := NewVerifier(enochKey) + if err != nil { + t.Fatal(err) + } + + list := VerifierList(peterVerifier, enochVerifier, enochVerifier) + v, err := list.Verifier("PeterNeumann", 0xc74f20a3) + if v != peterVerifier || err != nil { + t.Fatalf("list.Verifier(peter) = %v, %v, want %v, nil", v, err, peterVerifier) + } + v, err = list.Verifier("PeterNeumann", 0xc74f20a4) + if v != nil || err == nil || err.Error() != "unknown key PeterNeumann+c74f20a4" { + t.Fatalf("list.Verifier(peter bad hash) = %v, %v, want nil, unknown key error", v, err) + } + + v, err = list.Verifier("PeterNeuman", 0xc74f20a3) + if v != nil || err == nil || err.Error() != "unknown key PeterNeuman+c74f20a3" { + t.Fatalf("list.Verifier(peter bad name) = %v, %v, want nil, unknown key error", v, err) + } + v, err = list.Verifier("EnochRoot", 0xaf0cfe78) + if v != nil || err == nil || err.Error() != "ambiguous key EnochRoot+af0cfe78" { + t.Fatalf("list.Verifier(enoch) = %v, %v, want nil, ambiguous key error", v, err) + } +} + +type badSigner struct { + Signer +} + +func (b *badSigner) Name() string { + return "bad name" +} + +var errSurprise = errors.New("surprise!") + +type errSigner struct { + Signer +} + +func (e *errSigner) Sign([]byte) ([]byte, error) { + return nil, errSurprise +} + +func TestOpen(t *testing.T) { + peterKey := "PeterNeumann+c74f20a3+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW" + peterVerifier, err := NewVerifier(peterKey) + if err != nil { + t.Fatal(err) + } + + enochKey := "EnochRoot+af0cfe78+ATtqJ7zOtqQtYqOo0CpvDXNlMhV3HeJDpjrASKGLWdop" + enochVerifier, err := NewVerifier(enochKey) + if err != nil { + t.Fatal(err) + } + + text := `If you think cryptography is the answer to your problem, +then you don't know what your problem is. +` + peterSig := "— PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=\n" + enochSig := "— EnochRoot rwz+eBzmZa0SO3NbfRGzPCpDckykFXSdeX+MNtCOXm2/5n2tiOHp+vAF1aGrQ5ovTG01oOTGwnWLox33WWd1RvMc+QQ=\n" + + peter := Signature{"PeterNeumann", 0xc74f20a3, "x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM="} + enoch := Signature{"EnochRoot", 0xaf0cfe78, "rwz+eBzmZa0SO3NbfRGzPCpDckykFXSdeX+MNtCOXm2/5n2tiOHp+vAF1aGrQ5ovTG01oOTGwnWLox33WWd1RvMc+QQ="} + + // Check one signature verified, one not. + n, err := Open([]byte(text+"\n"+peterSig+enochSig), VerifierList(peterVerifier)) + if err != nil { + t.Fatal(err) + } + if n.Text != text { + t.Errorf("n.Text = %q, want %q", n.Text, text) + } + if len(n.Sigs) != 1 || n.Sigs[0] != peter { + t.Errorf("n.Sigs:\nhave %v\nwant %v", n.Sigs, []Signature{peter}) + } + if len(n.UnverifiedSigs) != 1 || n.UnverifiedSigs[0] != enoch { + t.Errorf("n.UnverifiedSigs:\nhave %v\nwant %v", n.Sigs, []Signature{peter}) + } + + // Check both verified. + n, err = Open([]byte(text+"\n"+peterSig+enochSig), VerifierList(peterVerifier, enochVerifier)) + if err != nil { + t.Fatal(err) + } + if len(n.Sigs) != 2 || n.Sigs[0] != peter || n.Sigs[1] != enoch { + t.Errorf("n.Sigs:\nhave %v\nwant %v", n.Sigs, []Signature{peter, enoch}) + } + if len(n.UnverifiedSigs) != 0 { + t.Errorf("n.UnverifiedSigs:\nhave %v\nwant %v", n.Sigs, []Signature{}) + } + + // Check both unverified. + n, err = Open([]byte(text+"\n"+peterSig+enochSig), VerifierList()) + if n != nil || err == nil { + t.Fatalf("Open unverified = %v, %v, want nil, error", n, err) + } + e, ok := err.(*UnverifiedNoteError) + if !ok { + t.Fatalf("Open unverified: err is %T, want *UnverifiedNoteError", err) + } + if err.Error() != "note has no verifiable signatures" { + t.Fatalf("Open unverified: err.Error() = %q, want %q", err.Error(), "note has no verifiable signatures") + } + + n = e.Note + if n == nil { + t.Fatalf("Open unverified: missing note in UnverifiedNoteError") + } + if len(n.Sigs) != 0 { + t.Errorf("n.Sigs:\nhave %v\nwant %v", n.Sigs, []Signature{}) + } + if len(n.UnverifiedSigs) != 2 || n.UnverifiedSigs[0] != peter || n.UnverifiedSigs[1] != enoch { + t.Errorf("n.UnverifiedSigs:\nhave %v\nwant %v", n.Sigs, []Signature{peter, enoch}) + } + + // Check duplicated verifier. + _, err = Open([]byte(text+"\n"+enochSig), VerifierList(enochVerifier, peterVerifier, enochVerifier)) + if err == nil || err.Error() != "ambiguous key EnochRoot+af0cfe78" { + t.Fatalf("Open with duplicated verifier: err=%v, want ambiguous key", err) + } + + // Check unused duplicated verifier. + _, err = Open([]byte(text+"\n"+peterSig), VerifierList(enochVerifier, peterVerifier, enochVerifier)) + if err != nil { + t.Fatal(err) + } + + // Check too many signatures. + n, err = Open([]byte(text+"\n"+strings.Repeat(peterSig, 101)), VerifierList(peterVerifier)) + if n != nil || err == nil || err.Error() != "malformed note" { + t.Fatalf("Open too many verified signatures = %v, %v, want nil, malformed note error", n, err) + } + n, err = Open([]byte(text+"\n"+strings.Repeat(peterSig, 101)), VerifierList()) + if n != nil || err == nil || err.Error() != "malformed note" { + t.Fatalf("Open too many verified signatures = %v, %v, want nil, malformed note error", n, err) + } + + // Invalid signature. + n, err = Open([]byte(text+"\n"+peterSig[:60]+"ABCD"+peterSig[60:]), VerifierList(peterVerifier)) + if n != nil || err == nil || err.Error() != "invalid signature for key PeterNeumann+c74f20a3" { + t.Fatalf("Open too many verified signatures = %v, %v, want nil, invalid signature error", n, err) + } + + // Duplicated verified and unverified signatures. + enochABCD := Signature{"EnochRoot", 0xaf0cfe78, "rwz+eBzmZa0SO3NbfRGzPCpDckykFXSdeX+MNtCOXm2/5n" + "ABCD" + "2tiOHp+vAF1aGrQ5ovTG01oOTGwnWLox33WWd1RvMc+QQ="} + n, err = Open([]byte(text+"\n"+peterSig+peterSig+enochSig+enochSig+enochSig[:60]+"ABCD"+enochSig[60:]), VerifierList(peterVerifier)) + if err != nil { + t.Fatal(err) + } + if len(n.Sigs) != 1 || n.Sigs[0] != peter { + t.Errorf("n.Sigs:\nhave %v\nwant %v", n.Sigs, []Signature{peter}) + } + if len(n.UnverifiedSigs) != 2 || n.UnverifiedSigs[0] != enoch || n.UnverifiedSigs[1] != enochABCD { + t.Errorf("n.UnverifiedSigs:\nhave %v\nwant %v", n.UnverifiedSigs, []Signature{enoch, enochABCD}) + } + + // Invalid encoded message syntax. + badMsgs := []string{ + text, + text + "\n", + text + "\n" + peterSig[:len(peterSig)-1], + "\x01" + text + "\n" + peterSig, + "\xff" + text + "\n" + peterSig, + text + "\n" + "— Bad Name x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=", + text + "\n" + peterSig + "Unexpected line.\n", + } + for _, msg := range badMsgs { + n, err := Open([]byte(msg), VerifierList(peterVerifier)) + if n != nil || err == nil || err.Error() != "malformed note" { + t.Fatalf("Open bad msg = %v, %v, want nil, malformed note error\nmsg:\n%s", n, err, msg) + } + } +} + +func BenchmarkOpen(b *testing.B) { + vkey := "PeterNeumann+c74f20a3+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW" + msg := []byte("If you think cryptography is the answer to your problem,\n" + + "then you don't know what your problem is.\n" + + "\n" + + "— PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=\n") + + verifier, err := NewVerifier(vkey) + if err != nil { + b.Fatal(err) + } + verifiers := VerifierList(verifier) + verifiers0 := VerifierList() + + // Try with 0 signatures and 1 signature so we can tell how much each signature adds. + + b.Run("Sig0", func(b *testing.B) { + for i := 0; i < b.N; i++ { + _, err := Open(msg, verifiers0) + e, ok := err.(*UnverifiedNoteError) + if !ok { + b.Fatal("expected UnverifiedNoteError") + } + n := e.Note + if len(n.Sigs) != 0 || len(n.UnverifiedSigs) != 1 { + b.Fatal("wrong signature count") + } + } + }) + + b.Run("Sig1", func(b *testing.B) { + for i := 0; i < b.N; i++ { + n, err := Open(msg, verifiers) + if err != nil { + b.Fatal(err) + } + if len(n.Sigs) != 1 || len(n.UnverifiedSigs) != 0 { + b.Fatal("wrong signature count") + } + } + }) +} diff --git a/libgo/go/cmd/go/internal/par/work.go b/libgo/go/cmd/go/internal/par/work.go index a568c86f60b..960cec6fb16 100644 --- a/libgo/go/cmd/go/internal/par/work.go +++ b/libgo/go/cmd/go/internal/par/work.go @@ -147,3 +147,44 @@ func (c *Cache) Get(key interface{}) interface{} { } return e.result } + +// Clear removes all entries in the cache. +// +// Concurrent calls to Get may return old values. Concurrent calls to Do +// may return old values or store results in entries that have been deleted. +// +// TODO(jayconrod): Delete this after the package cache clearing functions +// in internal/load have been removed. +func (c *Cache) Clear() { + c.m.Range(func(key, value interface{}) bool { + c.m.Delete(key) + return true + }) +} + +// Delete removes an entry from the map. It is safe to call Delete for an +// entry that does not exist. Delete will return quickly, even if the result +// for a key is still being computed; the computation will finish, but the +// result won't be accessible through the cache. +// +// TODO(jayconrod): Delete this after the package cache clearing functions +// in internal/load have been removed. +func (c *Cache) Delete(key interface{}) { + c.m.Delete(key) +} + +// DeleteIf calls pred for each key in the map. If pred returns true for a key, +// DeleteIf removes the corresponding entry. If the result for a key is +// still being computed, DeleteIf will remove the entry without waiting for +// the computation to finish. The result won't be accessible through the cache. +// +// TODO(jayconrod): Delete this after the package cache clearing functions +// in internal/load have been removed. +func (c *Cache) DeleteIf(pred func(key interface{}) bool) { + c.m.Range(func(key, _ interface{}) bool { + if pred(key) { + c.Delete(key) + } + return true + }) +} diff --git a/libgo/go/cmd/go/internal/renameio/renameio.go b/libgo/go/cmd/go/internal/renameio/renameio.go index 8f59e1a5773..d573cc690d2 100644 --- a/libgo/go/cmd/go/internal/renameio/renameio.go +++ b/libgo/go/cmd/go/internal/renameio/renameio.go @@ -8,12 +8,15 @@ package renameio import ( "bytes" "io" - "io/ioutil" + "math/rand" "os" "path/filepath" + "strconv" + + "cmd/go/internal/robustio" ) -const patternSuffix = "*.tmp" +const patternSuffix = ".tmp" // Pattern returns a glob pattern that matches the unrenamed temporary files // created when writing to filename. @@ -26,14 +29,14 @@ func Pattern(filename string) string { // final name. // // That ensures that the final location, if it exists, is always a complete file. -func WriteFile(filename string, data []byte) (err error) { - return WriteToFile(filename, bytes.NewReader(data)) +func WriteFile(filename string, data []byte, perm os.FileMode) (err error) { + return WriteToFile(filename, bytes.NewReader(data), perm) } // WriteToFile is a variant of WriteFile that accepts the data as an io.Reader // instead of a slice. -func WriteToFile(filename string, data io.Reader) (err error) { - f, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename)+patternSuffix) +func WriteToFile(filename string, data io.Reader, perm os.FileMode) (err error) { + f, err := tempFile(filepath.Dir(filename), filepath.Base(filename), perm) if err != nil { return err } @@ -59,5 +62,32 @@ func WriteToFile(filename string, data io.Reader) (err error) { if err := f.Close(); err != nil { return err } - return os.Rename(f.Name(), filename) + + return robustio.Rename(f.Name(), filename) +} + +// ReadFile is like ioutil.ReadFile, but on Windows retries spurious errors that +// may occur if the file is concurrently replaced. +// +// Errors are classified heuristically and retries are bounded, so even this +// function may occasionally return a spurious error on Windows. +// If so, the error will likely wrap one of: +// - syscall.ERROR_ACCESS_DENIED +// - syscall.ERROR_FILE_NOT_FOUND +// - internal/syscall/windows.ERROR_SHARING_VIOLATION +func ReadFile(filename string) ([]byte, error) { + return robustio.ReadFile(filename) +} + +// tempFile creates a new temporary file with given permission bits. +func tempFile(dir, prefix string, perm os.FileMode) (f *os.File, err error) { + for i := 0; i < 10000; i++ { + name := filepath.Join(dir, prefix+strconv.Itoa(rand.Intn(1000000000))+patternSuffix) + f, err = os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, perm) + if os.IsExist(err) { + continue + } + break + } + return } diff --git a/libgo/go/cmd/go/internal/renameio/renameio_test.go b/libgo/go/cmd/go/internal/renameio/renameio_test.go new file mode 100644 index 00000000000..81dba6d5451 --- /dev/null +++ b/libgo/go/cmd/go/internal/renameio/renameio_test.go @@ -0,0 +1,145 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//+build !plan9 + +package renameio + +import ( + "encoding/binary" + "errors" + "io/ioutil" + "math/rand" + "os" + "path/filepath" + "runtime" + "sync" + "sync/atomic" + "syscall" + "testing" + "time" + + "cmd/go/internal/robustio" +) + +func TestConcurrentReadsAndWrites(t *testing.T) { + dir, err := ioutil.TempDir("", "renameio") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dir) + path := filepath.Join(dir, "blob.bin") + + const chunkWords = 8 << 10 + buf := make([]byte, 2*chunkWords*8) + for i := uint64(0); i < 2*chunkWords; i++ { + binary.LittleEndian.PutUint64(buf[i*8:], i) + } + + var attempts int64 = 128 + if !testing.Short() { + attempts *= 16 + } + const parallel = 32 + + var sem = make(chan bool, parallel) + + var ( + writeSuccesses, readSuccesses int64 // atomic + writeErrnoSeen, readErrnoSeen sync.Map + ) + + for n := attempts; n > 0; n-- { + sem <- true + go func() { + defer func() { <-sem }() + + time.Sleep(time.Duration(rand.Intn(100)) * time.Microsecond) + offset := rand.Intn(chunkWords) + chunk := buf[offset*8 : (offset+chunkWords)*8] + if err := WriteFile(path, chunk, 0666); err == nil { + atomic.AddInt64(&writeSuccesses, 1) + } else if robustio.IsEphemeralError(err) { + var ( + errno syscall.Errno + dup bool + ) + if errors.As(err, &errno) { + _, dup = writeErrnoSeen.LoadOrStore(errno, true) + } + if !dup { + t.Logf("ephemeral error: %v", err) + } + } else { + t.Errorf("unexpected error: %v", err) + } + + time.Sleep(time.Duration(rand.Intn(100)) * time.Microsecond) + data, err := ReadFile(path) + if err == nil { + atomic.AddInt64(&readSuccesses, 1) + } else if robustio.IsEphemeralError(err) { + var ( + errno syscall.Errno + dup bool + ) + if errors.As(err, &errno) { + _, dup = readErrnoSeen.LoadOrStore(errno, true) + } + if !dup { + t.Logf("ephemeral error: %v", err) + } + return + } else { + t.Errorf("unexpected error: %v", err) + return + } + + if len(data) != 8*chunkWords { + t.Errorf("read %d bytes, but each write is a %d-byte file", len(data), 8*chunkWords) + return + } + + u := binary.LittleEndian.Uint64(data) + for i := 1; i < chunkWords; i++ { + next := binary.LittleEndian.Uint64(data[i*8:]) + if next != u+1 { + t.Errorf("wrote sequential integers, but read integer out of sequence at offset %d", i) + return + } + u = next + } + }() + } + + for n := parallel; n > 0; n-- { + sem <- true + } + + var minWriteSuccesses int64 = attempts + if runtime.GOOS == "windows" { + // Windows produces frequent "Access is denied" errors under heavy rename load. + // As long as those are the only errors and *some* of the writes succeed, we're happy. + minWriteSuccesses = attempts / 4 + } + + if writeSuccesses < minWriteSuccesses { + t.Errorf("%d (of %d) writes succeeded; want ≥ %d", writeSuccesses, attempts, minWriteSuccesses) + } else { + t.Logf("%d (of %d) writes succeeded (ok: ≥ %d)", writeSuccesses, attempts, minWriteSuccesses) + } + + var minReadSuccesses int64 = attempts + if runtime.GOOS == "windows" { + // Windows produces frequent "Access is denied" errors under heavy rename load. + // As long as those are the only errors and *some* of the writes succeed, we're happy. + minReadSuccesses = attempts / 4 + } + + if readSuccesses < minReadSuccesses { + t.Errorf("%d (of %d) reads succeeded; want ≥ %d", readSuccesses, attempts, minReadSuccesses) + } else { + t.Logf("%d (of %d) reads succeeded (ok: ≥ %d)", readSuccesses, attempts, minReadSuccesses) + } +} diff --git a/libgo/go/cmd/go/internal/renameio/umask_test.go b/libgo/go/cmd/go/internal/renameio/umask_test.go new file mode 100644 index 00000000000..1a471c9e4e6 --- /dev/null +++ b/libgo/go/cmd/go/internal/renameio/umask_test.go @@ -0,0 +1,42 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//+build !nacl,!plan9,!windows,!js + +package renameio + +import ( + "io/ioutil" + "os" + "path/filepath" + "syscall" + "testing" +) + +func TestWriteFileModeAppliesUmask(t *testing.T) { + dir, err := ioutil.TempDir("", "renameio") + if err != nil { + t.Fatalf("Failed to create temporary directory: %v", err) + } + + const mode = 0644 + const umask = 0007 + defer syscall.Umask(syscall.Umask(umask)) + + file := filepath.Join(dir, "testWrite") + err = WriteFile(file, []byte("go-build"), mode) + if err != nil { + t.Fatalf("Failed to write file: %v", err) + } + defer os.RemoveAll(dir) + + fi, err := os.Stat(file) + if err != nil { + t.Fatalf("Stat %q (looking for mode %#o): %s", file, mode, err) + } + + if fi.Mode()&os.ModePerm != 0640 { + t.Errorf("Stat %q: mode %#o want %#o", file, fi.Mode()&os.ModePerm, 0640) + } +} diff --git a/libgo/go/cmd/go/internal/robustio/robustio.go b/libgo/go/cmd/go/internal/robustio/robustio.go new file mode 100644 index 00000000000..76e47ad1ffa --- /dev/null +++ b/libgo/go/cmd/go/internal/robustio/robustio.go @@ -0,0 +1,53 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package robustio wraps I/O functions that are prone to failure on Windows, +// transparently retrying errors up to an arbitrary timeout. +// +// Errors are classified heuristically and retries are bounded, so the functions +// in this package do not completely eliminate spurious errors. However, they do +// significantly reduce the rate of failure in practice. +// +// If so, the error will likely wrap one of: +// The functions in this package do not completely eliminate spurious errors, +// but substantially reduce their rate of occurrence in practice. +package robustio + +// Rename is like os.Rename, but on Windows retries errors that may occur if the +// file is concurrently read or overwritten. +// +// (See golang.org/issue/31247 and golang.org/issue/32188.) +func Rename(oldpath, newpath string) error { + return rename(oldpath, newpath) +} + +// ReadFile is like ioutil.ReadFile, but on Windows retries errors that may +// occur if the file is concurrently replaced. +// +// (See golang.org/issue/31247 and golang.org/issue/32188.) +func ReadFile(filename string) ([]byte, error) { + return readFile(filename) +} + +// RemoveAll is like os.RemoveAll, but on Windows retries errors that may occur +// if an executable file in the directory has recently been executed. +// +// (See golang.org/issue/19491.) +func RemoveAll(path string) error { + return removeAll(path) +} + +// IsEphemeralError reports whether err is one of the errors that the functions +// in this package attempt to mitigate. +// +// Errors considered ephemeral include: +// - syscall.ERROR_ACCESS_DENIED +// - syscall.ERROR_FILE_NOT_FOUND +// - internal/syscall/windows.ERROR_SHARING_VIOLATION +// +// This set may be expanded in the future; programs must not rely on the +// non-ephemerality of any given error. +func IsEphemeralError(err error) bool { + return isEphemeralError(err) +} diff --git a/libgo/go/cmd/go/internal/robustio/robustio_other.go b/libgo/go/cmd/go/internal/robustio/robustio_other.go new file mode 100644 index 00000000000..91ca56cb82c --- /dev/null +++ b/libgo/go/cmd/go/internal/robustio/robustio_other.go @@ -0,0 +1,28 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//+build !windows + +package robustio + +import ( + "io/ioutil" + "os" +) + +func rename(oldpath, newpath string) error { + return os.Rename(oldpath, newpath) +} + +func readFile(filename string) ([]byte, error) { + return ioutil.ReadFile(filename) +} + +func removeAll(path string) error { + return os.RemoveAll(path) +} + +func isEphemeralError(err error) bool { + return false +} diff --git a/libgo/go/cmd/go/internal/robustio/robustio_windows.go b/libgo/go/cmd/go/internal/robustio/robustio_windows.go new file mode 100644 index 00000000000..a3d94e566fe --- /dev/null +++ b/libgo/go/cmd/go/internal/robustio/robustio_windows.go @@ -0,0 +1,105 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package robustio + +import ( + "errors" + "internal/syscall/windows" + "io/ioutil" + "math/rand" + "os" + "syscall" + "time" +) + +const arbitraryTimeout = 500 * time.Millisecond + +// retry retries ephemeral errors from f up to an arbitrary timeout +// to work around spurious filesystem errors on Windows +func retry(f func() (err error, mayRetry bool)) error { + var ( + bestErr error + lowestErrno syscall.Errno + start time.Time + nextSleep time.Duration = 1 * time.Millisecond + ) + for { + err, mayRetry := f() + if err == nil || !mayRetry { + return err + } + + var errno syscall.Errno + if errors.As(err, &errno) && (lowestErrno == 0 || errno < lowestErrno) { + bestErr = err + lowestErrno = errno + } else if bestErr == nil { + bestErr = err + } + + if start.IsZero() { + start = time.Now() + } else if d := time.Since(start) + nextSleep; d >= arbitraryTimeout { + break + } + time.Sleep(nextSleep) + nextSleep += time.Duration(rand.Int63n(int64(nextSleep))) + } + + return bestErr +} + +// rename is like os.Rename, but retries ephemeral errors. +// +// It wraps os.Rename, which (as of 2019-06-04) uses MoveFileEx with +// MOVEFILE_REPLACE_EXISTING. +// +// Windows also provides a different system call, ReplaceFile, +// that provides similar semantics, but perhaps preserves more metadata. (The +// documentation on the differences between the two is very sparse.) +// +// Empirical error rates with MoveFileEx are lower under modest concurrency, so +// for now we're sticking with what the os package already provides. +func rename(oldpath, newpath string) (err error) { + return retry(func() (err error, mayRetry bool) { + err = os.Rename(oldpath, newpath) + return err, isEphemeralError(err) + }) +} + +// readFile is like ioutil.ReadFile, but retries ephemeral errors. +func readFile(filename string) ([]byte, error) { + var b []byte + err := retry(func() (err error, mayRetry bool) { + b, err = ioutil.ReadFile(filename) + + // Unlike in rename, we do not retry ERROR_FILE_NOT_FOUND here: it can occur + // as a spurious error, but the file may also genuinely not exist, so the + // increase in robustness is probably not worth the extra latency. + return err, isEphemeralError(err) && !errors.Is(err, syscall.ERROR_FILE_NOT_FOUND) + }) + return b, err +} + +func removeAll(path string) error { + return retry(func() (err error, mayRetry bool) { + err = os.RemoveAll(path) + return err, isEphemeralError(err) + }) +} + +// isEphemeralError returns true if err may be resolved by waiting. +func isEphemeralError(err error) bool { + var errno syscall.Errno + if errors.As(err, &errno) { + switch errno { + case syscall.ERROR_ACCESS_DENIED, + syscall.ERROR_FILE_NOT_FOUND, + windows.ERROR_SHARING_VIOLATION: + return true + } + } + return false +} diff --git a/libgo/go/cmd/go/internal/run/run.go b/libgo/go/cmd/go/internal/run/run.go index feccf23b278..71da5adc934 100644 --- a/libgo/go/cmd/go/internal/run/run.go +++ b/libgo/go/cmd/go/internal/run/run.go @@ -8,6 +8,7 @@ package run import ( "fmt" "os" + "path" "strings" "cmd/go/internal/base" @@ -22,7 +23,7 @@ var CmdRun = &base.Command{ Short: "compile and run Go program", Long: ` Run compiles and runs the named main Go package. -Typically the package is specified as a list of .go source files, +Typically the package is specified as a list of .go source files from a single directory, but it may also be an import path, file system path, or pattern matching a single known package, as in 'go run .' or 'go run my/cmd'. @@ -94,10 +95,10 @@ func runRun(cmd *base.Command, args []string) { base.Fatalf("go run: no go files listed") } cmdArgs := args[i:] - if p.Error != nil { base.Fatalf("%s", p.Error) } + p.Internal.OmitDebug = true if len(p.DepsErrors) > 0 { // Since these are errors in dependencies, @@ -117,21 +118,26 @@ func runRun(cmd *base.Command, args []string) { base.Fatalf("go run: cannot run non-main package") } p.Target = "" // must build - not up to date - var src string - if len(p.GoFiles) > 0 { - src = p.GoFiles[0] - } else if len(p.CgoFiles) > 0 { - src = p.CgoFiles[0] - } else { - // this case could only happen if the provided source uses cgo - // while cgo is disabled. - hint := "" - if !cfg.BuildContext.CgoEnabled { - hint = " (cgo is disabled)" + if p.Internal.CmdlineFiles { + //set executable name if go file is given as cmd-argument + var src string + if len(p.GoFiles) > 0 { + src = p.GoFiles[0] + } else if len(p.CgoFiles) > 0 { + src = p.CgoFiles[0] + } else { + // this case could only happen if the provided source uses cgo + // while cgo is disabled. + hint := "" + if !cfg.BuildContext.CgoEnabled { + hint = " (cgo is disabled)" + } + base.Fatalf("go run: no suitable source files%s", hint) } - base.Fatalf("go run: no suitable source files%s", hint) + p.Internal.ExeName = src[:len(src)-len(".go")] + } else { + p.Internal.ExeName = path.Base(p.ImportPath) } - p.Internal.ExeName = src[:len(src)-len(".go")] // name temporary executable for first go file a1 := b.LinkAction(work.ModeBuild, work.ModeBuild, p) a := &work.Action{Mode: "go run", Func: buildRunProgram, Args: cmdArgs, Deps: []*work.Action{a1}} b.Do(a) diff --git a/libgo/go/cmd/go/internal/search/search.go b/libgo/go/cmd/go/internal/search/search.go index 0ca60e73497..0167c8d7550 100644 --- a/libgo/go/cmd/go/internal/search/search.go +++ b/libgo/go/cmd/go/internal/search/search.go @@ -190,7 +190,7 @@ func MatchPackagesInFS(pattern string) *Match { if !top && cfg.ModulesEnabled { // Ignore other modules found in subdirectories. - if _, err := os.Stat(filepath.Join(path, "go.mod")); err == nil { + if fi, err := os.Stat(filepath.Join(path, "go.mod")); err == nil && !fi.IsDir() { return filepath.SkipDir } } @@ -327,14 +327,35 @@ func ImportPathsQuiet(patterns []string) []*Match { out = append(out, MatchPackages(a)) continue } - if strings.Contains(a, "...") { - if build.IsLocalImport(a) { - out = append(out, MatchPackagesInFS(a)) + + if build.IsLocalImport(a) || filepath.IsAbs(a) { + var m *Match + if strings.Contains(a, "...") { + m = MatchPackagesInFS(a) } else { - out = append(out, MatchPackages(a)) + m = &Match{Pattern: a, Literal: true, Pkgs: []string{a}} + } + + // Change the file import path to a regular import path if the package + // is in GOPATH or GOROOT. We don't report errors here; LoadImport + // (or something similar) will report them later. + for i, dir := range m.Pkgs { + if !filepath.IsAbs(dir) { + dir = filepath.Join(base.Cwd, dir) + } + if bp, _ := cfg.BuildContext.ImportDir(dir, build.FindOnly); bp.ImportPath != "" && bp.ImportPath != "." { + m.Pkgs[i] = bp.ImportPath + } } + out = append(out, m) continue } + + if strings.Contains(a, "...") { + out = append(out, MatchPackages(a)) + continue + } + out = append(out, &Match{Pattern: a, Literal: true, Pkgs: []string{a}}) } return out diff --git a/libgo/go/cmd/go/internal/str/path.go b/libgo/go/cmd/go/internal/str/path.go index a9b4d759a6b..a4ffc5f1312 100644 --- a/libgo/go/cmd/go/internal/str/path.go +++ b/libgo/go/cmd/go/internal/str/path.go @@ -5,6 +5,7 @@ package str import ( + "path" "path/filepath" "strings" ) @@ -49,3 +50,47 @@ func HasFilePathPrefix(s, prefix string) bool { return s[len(prefix)] == filepath.Separator && s[:len(prefix)] == prefix } } + +// GlobsMatchPath reports whether any path prefix of target +// matches one of the glob patterns (as defined by path.Match) +// in the comma-separated globs list. +// It ignores any empty or malformed patterns in the list. +func GlobsMatchPath(globs, target string) bool { + for globs != "" { + // Extract next non-empty glob in comma-separated list. + var glob string + if i := strings.Index(globs, ","); i >= 0 { + glob, globs = globs[:i], globs[i+1:] + } else { + glob, globs = globs, "" + } + if glob == "" { + continue + } + + // A glob with N+1 path elements (N slashes) needs to be matched + // against the first N+1 path elements of target, + // which end just before the N+1'th slash. + n := strings.Count(glob, "/") + prefix := target + // Walk target, counting slashes, truncating at the N+1'th slash. + for i := 0; i < len(target); i++ { + if target[i] == '/' { + if n == 0 { + prefix = target[:i] + break + } + n-- + } + } + if n > 0 { + // Not enough prefix elements. + continue + } + matched, _ := path.Match(glob, prefix) + if matched { + return true + } + } + return false +} diff --git a/libgo/go/cmd/go/internal/sumweb/cache.go b/libgo/go/cmd/go/internal/sumweb/cache.go new file mode 100644 index 00000000000..a8117a71b78 --- /dev/null +++ b/libgo/go/cmd/go/internal/sumweb/cache.go @@ -0,0 +1,59 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Parallel cache. +// This file is copied from cmd/go/internal/par. + +package sumweb + +import ( + "sync" + "sync/atomic" +) + +// parCache runs an action once per key and caches the result. +type parCache struct { + m sync.Map +} + +type cacheEntry struct { + done uint32 + mu sync.Mutex + result interface{} +} + +// Do calls the function f if and only if Do is being called for the first time with this key. +// No call to Do with a given key returns until the one call to f returns. +// Do returns the value returned by the one call to f. +func (c *parCache) Do(key interface{}, f func() interface{}) interface{} { + entryIface, ok := c.m.Load(key) + if !ok { + entryIface, _ = c.m.LoadOrStore(key, new(cacheEntry)) + } + e := entryIface.(*cacheEntry) + if atomic.LoadUint32(&e.done) == 0 { + e.mu.Lock() + if atomic.LoadUint32(&e.done) == 0 { + e.result = f() + atomic.StoreUint32(&e.done, 1) + } + e.mu.Unlock() + } + return e.result +} + +// Get returns the cached result associated with key. +// It returns nil if there is no such result. +// If the result for key is being computed, Get does not wait for the computation to finish. +func (c *parCache) Get(key interface{}) interface{} { + entryIface, ok := c.m.Load(key) + if !ok { + return nil + } + e := entryIface.(*cacheEntry) + if atomic.LoadUint32(&e.done) == 0 { + return nil + } + return e.result +} diff --git a/libgo/go/cmd/go/internal/sumweb/client.go b/libgo/go/cmd/go/internal/sumweb/client.go new file mode 100644 index 00000000000..6973e5ac179 --- /dev/null +++ b/libgo/go/cmd/go/internal/sumweb/client.go @@ -0,0 +1,619 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sumweb + +import ( + "bytes" + "errors" + "fmt" + "strings" + "sync" + "sync/atomic" + + "cmd/go/internal/note" + "cmd/go/internal/str" + "cmd/go/internal/tlog" +) + +// A Client provides the external operations +// (file caching, HTTP fetches, and so on) +// needed to implement the HTTP client Conn. +// The methods must be safe for concurrent use by multiple goroutines. +type Client interface { + // ReadRemote reads and returns the content served at the given path + // on the remote database server. The path begins with "/lookup" or "/tile/". + // It is the implementation's responsibility to turn that path into a full URL + // and make the HTTP request. ReadRemote should return an error for + // any non-200 HTTP response status. + ReadRemote(path string) ([]byte, error) + + // ReadConfig reads and returns the content of the named configuration file. + // There are only a fixed set of configuration files. + // + // "key" returns a file containing the verifier key for the server. + // + // serverName + "/latest" returns a file containing the latest known + // signed tree from the server. It is read and written (using WriteConfig). + // To signal that the client wishes to start with an "empty" signed tree, + // ReadConfig can return a successful empty result (0 bytes of data). + ReadConfig(file string) ([]byte, error) + + // WriteConfig updates the content of the named configuration file, + // changing it from the old []byte to the new []byte. + // If the old []byte does not match the stored configuration, + // WriteConfig must return ErrWriteConflict. + // Otherwise, WriteConfig should atomically replace old with new. + WriteConfig(file string, old, new []byte) error + + // ReadCache reads and returns the content of the named cache file. + // Any returned error will be treated as equivalent to the file not existing. + // There can be arbitrarily many cache files, such as: + // serverName/lookup/pkg@version + // serverName/tile/8/1/x123/456 + ReadCache(file string) ([]byte, error) + + // WriteCache writes the named cache file. + WriteCache(file string, data []byte) + + // Log prints the given log message (such as with log.Print) + Log(msg string) + + // SecurityError prints the given security error log message. + // The Conn returns ErrSecurity from any operation that invokes SecurityError, + // but the return value is mainly for testing. In a real program, + // SecurityError should typically print the message and call log.Fatal or os.Exit. + SecurityError(msg string) +} + +// ErrWriteConflict signals a write conflict during Client.WriteConfig. +var ErrWriteConflict = errors.New("write conflict") + +// ErrSecurity is returned by Conn operations that invoke Client.SecurityError. +var ErrSecurity = errors.New("security error: misbehaving server") + +// A Conn is a client connection to a go.sum database. +// All the methods are safe for simultaneous use by multiple goroutines. +type Conn struct { + client Client // client-provided external world + + didLookup uint32 + + // one-time initialized data + initOnce sync.Once + initErr error // init error, if any + name string // name of accepted verifier + verifiers note.Verifiers // accepted verifiers (just one, but Verifiers for note.Open) + tileReader tileReader + tileHeight int + nosumdb string + + record parCache // cache of record lookup, keyed by path@vers + tileCache parCache // cache of c.readTile, keyed by tile + + latestMu sync.Mutex + latest tlog.Tree // latest known tree head + latestMsg []byte // encoded signed note for latest + + tileSavedMu sync.Mutex + tileSaved map[tlog.Tile]bool // which tiles have been saved using c.client.WriteCache already +} + +// NewConn returns a new Conn using the given Client. +func NewConn(client Client) *Conn { + return &Conn{ + client: client, + } +} + +// init initiailzes the conn (if not already initialized) +// and returns any initialization error. +func (c *Conn) init() error { + c.initOnce.Do(c.initWork) + return c.initErr +} + +// initWork does the actual initialization work. +func (c *Conn) initWork() { + defer func() { + if c.initErr != nil { + c.initErr = fmt.Errorf("initializing sumweb.Conn: %v", c.initErr) + } + }() + + c.tileReader.c = c + if c.tileHeight == 0 { + c.tileHeight = 8 + } + c.tileSaved = make(map[tlog.Tile]bool) + + vkey, err := c.client.ReadConfig("key") + if err != nil { + c.initErr = err + return + } + verifier, err := note.NewVerifier(strings.TrimSpace(string(vkey))) + if err != nil { + c.initErr = err + return + } + c.verifiers = note.VerifierList(verifier) + c.name = verifier.Name() + + data, err := c.client.ReadConfig(c.name + "/latest") + if err != nil { + c.initErr = err + return + } + if err := c.mergeLatest(data); err != nil { + c.initErr = err + return + } +} + +// SetTileHeight sets the tile height for the Conn. +// Any call to SetTileHeight must happen before the first call to Lookup. +// If SetTileHeight is not called, the Conn defaults to tile height 8. +func (c *Conn) SetTileHeight(height int) { + if atomic.LoadUint32(&c.didLookup) != 0 { + panic("SetTileHeight used after Lookup") + } + if c.tileHeight != 0 { + panic("multiple calls to SetTileHeight") + } + c.tileHeight = height +} + +// SetGONOSUMDB sets the list of comma-separated GONOSUMDB patterns for the Conn. +// For any module path matching one of the patterns, +// Lookup will return ErrGONOSUMDB. +// Any call to SetGONOSUMDB must happen before the first call to Lookup. +func (c *Conn) SetGONOSUMDB(list string) { + if atomic.LoadUint32(&c.didLookup) != 0 { + panic("SetGONOSUMDB used after Lookup") + } + if c.nosumdb != "" { + panic("multiple calls to SetGONOSUMDB") + } + c.nosumdb = list +} + +// ErrGONOSUMDB is returned by Lookup for paths that match +// a pattern listed in the GONOSUMDB list (set by SetGONOSUMDB, +// usually from the environment variable). +var ErrGONOSUMDB = errors.New("skipped (listed in GONOSUMDB)") + +func (c *Conn) skip(target string) bool { + return str.GlobsMatchPath(c.nosumdb, target) +} + +// Lookup returns the go.sum lines for the given module path and version. +// The version may end in a /go.mod suffix, in which case Lookup returns +// the go.sum lines for the module's go.mod-only hash. +func (c *Conn) Lookup(path, vers string) (lines []string, err error) { + atomic.StoreUint32(&c.didLookup, 1) + + if c.skip(path) { + return nil, ErrGONOSUMDB + } + + defer func() { + if err != nil { + err = fmt.Errorf("%s@%s: %v", path, vers, err) + } + }() + + if err := c.init(); err != nil { + return nil, err + } + + // Prepare encoded cache filename / URL. + epath, err := encodePath(path) + if err != nil { + return nil, err + } + evers, err := encodeVersion(strings.TrimSuffix(vers, "/go.mod")) + if err != nil { + return nil, err + } + file := c.name + "/lookup/" + epath + "@" + evers + remotePath := "/lookup/" + epath + "@" + evers + + // Fetch the data. + // The lookupCache avoids redundant ReadCache/GetURL operations + // (especially since go.sum lines tend to come in pairs for a given + // path and version) and also avoids having multiple of the same + // request in flight at once. + type cached struct { + data []byte + err error + } + result := c.record.Do(file, func() interface{} { + // Try the on-disk cache, or else get from web. + writeCache := false + data, err := c.client.ReadCache(file) + if err != nil { + data, err = c.client.ReadRemote(remotePath) + if err != nil { + return cached{nil, err} + } + writeCache = true + } + + // Validate the record before using it for anything. + id, text, treeMsg, err := tlog.ParseRecord(data) + if err != nil { + return cached{nil, err} + } + if err := c.mergeLatest(treeMsg); err != nil { + return cached{nil, err} + } + if err := c.checkRecord(id, text); err != nil { + return cached{nil, err} + } + + // Now that we've validated the record, + // save it to the on-disk cache (unless that's where it came from). + if writeCache { + c.client.WriteCache(file, data) + } + + return cached{data, nil} + }).(cached) + if result.err != nil { + return nil, result.err + } + + // Extract the lines for the specific version we want + // (with or without /go.mod). + prefix := path + " " + vers + " " + var hashes []string + for _, line := range strings.Split(string(result.data), "\n") { + if strings.HasPrefix(line, prefix) { + hashes = append(hashes, line) + } + } + return hashes, nil +} + +// mergeLatest merges the tree head in msg +// with the Conn's current latest tree head, +// ensuring the result is a consistent timeline. +// If the result is inconsistent, mergeLatest calls c.client.SecurityError +// with a detailed security error message and then +// (only if c.client.SecurityError does not exit the program) returns ErrSecurity. +// If the Conn's current latest tree head moves forward, +// mergeLatest updates the underlying configuration file as well, +// taking care to merge any independent updates to that configuration. +func (c *Conn) mergeLatest(msg []byte) error { + // Merge msg into our in-memory copy of the latest tree head. + when, err := c.mergeLatestMem(msg) + if err != nil { + return err + } + if when != msgFuture { + // msg matched our present or was in the past. + // No change to our present, so no update of config file. + return nil + } + + // Flush our extended timeline back out to the configuration file. + // If the configuration file has been updated in the interim, + // we need to merge any updates made there as well. + // Note that writeConfig is an atomic compare-and-swap. + for { + msg, err := c.client.ReadConfig(c.name + "/latest") + if err != nil { + return err + } + when, err := c.mergeLatestMem(msg) + if err != nil { + return err + } + if when != msgPast { + // msg matched our present or was from the future, + // and now our in-memory copy matches. + return nil + } + + // msg (== config) is in the past, so we need to update it. + c.latestMu.Lock() + latestMsg := c.latestMsg + c.latestMu.Unlock() + if err := c.client.WriteConfig(c.name+"/latest", msg, latestMsg); err != ErrWriteConflict { + // Success or a non-write-conflict error. + return err + } + } +} + +const ( + msgPast = 1 + iota + msgNow + msgFuture +) + +// mergeLatestMem is like mergeLatest but is only concerned with +// updating the in-memory copy of the latest tree head (c.latest) +// not the configuration file. +// The when result explains when msg happened relative to our +// previous idea of c.latest: +// msgPast means msg was from before c.latest, +// msgNow means msg was exactly c.latest, and +// msgFuture means msg was from after c.latest, which has now been updated. +func (c *Conn) mergeLatestMem(msg []byte) (when int, err error) { + if len(msg) == 0 { + // Accept empty msg as the unsigned, empty timeline. + c.latestMu.Lock() + latest := c.latest + c.latestMu.Unlock() + if latest.N == 0 { + return msgNow, nil + } + return msgPast, nil + } + + note, err := note.Open(msg, c.verifiers) + if err != nil { + return 0, fmt.Errorf("reading tree note: %v\nnote:\n%s", err, msg) + } + tree, err := tlog.ParseTree([]byte(note.Text)) + if err != nil { + return 0, fmt.Errorf("reading tree: %v\ntree:\n%s", err, note.Text) + } + + // Other lookups may be calling mergeLatest with other heads, + // so c.latest is changing underfoot. We don't want to hold the + // c.mu lock during tile fetches, so loop trying to update c.latest. + c.latestMu.Lock() + latest := c.latest + latestMsg := c.latestMsg + c.latestMu.Unlock() + + for { + // If the tree head looks old, check that it is on our timeline. + if tree.N <= latest.N { + if err := c.checkTrees(tree, msg, latest, latestMsg); err != nil { + return 0, err + } + if tree.N < latest.N { + return msgPast, nil + } + return msgNow, nil + } + + // The tree head looks new. Check that we are on its timeline and try to move our timeline forward. + if err := c.checkTrees(latest, latestMsg, tree, msg); err != nil { + return 0, err + } + + // Install our msg if possible. + // Otherwise we will go around again. + c.latestMu.Lock() + installed := false + if c.latest == latest { + installed = true + c.latest = tree + c.latestMsg = msg + } else { + latest = c.latest + latestMsg = c.latestMsg + } + c.latestMu.Unlock() + + if installed { + return msgFuture, nil + } + } +} + +// checkTrees checks that older (from olderNote) is contained in newer (from newerNote). +// If an error occurs, such as malformed data or a network problem, checkTrees returns that error. +// If on the other hand checkTrees finds evidence of misbehavior, it prepares a detailed +// message and calls log.Fatal. +func (c *Conn) checkTrees(older tlog.Tree, olderNote []byte, newer tlog.Tree, newerNote []byte) error { + thr := tlog.TileHashReader(newer, &c.tileReader) + h, err := tlog.TreeHash(older.N, thr) + if err != nil { + if older.N == newer.N { + return fmt.Errorf("checking tree#%d: %v", older.N, err) + } + return fmt.Errorf("checking tree#%d against tree#%d: %v", older.N, newer.N, err) + } + if h == older.Hash { + return nil + } + + // Detected a fork in the tree timeline. + // Start by reporting the inconsistent signed tree notes. + var buf bytes.Buffer + fmt.Fprintf(&buf, "SECURITY ERROR\n") + fmt.Fprintf(&buf, "go.sum database server misbehavior detected!\n\n") + indent := func(b []byte) []byte { + return bytes.Replace(b, []byte("\n"), []byte("\n\t"), -1) + } + fmt.Fprintf(&buf, "old database:\n\t%s\n", indent(olderNote)) + fmt.Fprintf(&buf, "new database:\n\t%s\n", indent(newerNote)) + + // The notes alone are not enough to prove the inconsistency. + // We also need to show that the newer note's tree hash for older.N + // does not match older.Hash. The consumer of this report could + // of course consult the server to try to verify the inconsistency, + // but we are holding all the bits we need to prove it right now, + // so we might as well print them and make the report not depend + // on the continued availability of the misbehaving server. + // Preparing this data only reuses the tiled hashes needed for + // tlog.TreeHash(older.N, thr) above, so assuming thr is caching tiles, + // there are no new access to the server here, and these operations cannot fail. + fmt.Fprintf(&buf, "proof of misbehavior:\n\t%v", h) + if p, err := tlog.ProveTree(newer.N, older.N, thr); err != nil { + fmt.Fprintf(&buf, "\tinternal error: %v\n", err) + } else if err := tlog.CheckTree(p, newer.N, newer.Hash, older.N, h); err != nil { + fmt.Fprintf(&buf, "\tinternal error: generated inconsistent proof\n") + } else { + for _, h := range p { + fmt.Fprintf(&buf, "\n\t%v", h) + } + } + c.client.SecurityError(buf.String()) + return ErrSecurity +} + +// checkRecord checks that record #id's hash matches data. +func (c *Conn) checkRecord(id int64, data []byte) error { + c.latestMu.Lock() + latest := c.latest + c.latestMu.Unlock() + + if id >= latest.N { + return fmt.Errorf("cannot validate record %d in tree of size %d", id, latest.N) + } + hashes, err := tlog.TileHashReader(latest, &c.tileReader).ReadHashes([]int64{tlog.StoredHashIndex(0, id)}) + if err != nil { + return err + } + if hashes[0] == tlog.RecordHash(data) { + return nil + } + return fmt.Errorf("cannot authenticate record data in server response") +} + +// tileReader is a *Conn wrapper that implements tlog.TileReader. +// The separate type avoids exposing the ReadTiles and SaveTiles +// methods on Conn itself. +type tileReader struct { + c *Conn +} + +func (r *tileReader) Height() int { + return r.c.tileHeight +} + +// ReadTiles reads and returns the requested tiles, +// either from the on-disk cache or the server. +func (r *tileReader) ReadTiles(tiles []tlog.Tile) ([][]byte, error) { + // Read all the tiles in parallel. + data := make([][]byte, len(tiles)) + errs := make([]error, len(tiles)) + var wg sync.WaitGroup + for i, tile := range tiles { + wg.Add(1) + go func(i int, tile tlog.Tile) { + defer wg.Done() + data[i], errs[i] = r.c.readTile(tile) + }(i, tile) + } + wg.Wait() + + for _, err := range errs { + if err != nil { + return nil, err + } + } + + return data, nil +} + +// tileCacheKey returns the cache key for the tile. +func (c *Conn) tileCacheKey(tile tlog.Tile) string { + return c.name + "/" + tile.Path() +} + +// tileRemotePath returns the remote path for the tile. +func (c *Conn) tileRemotePath(tile tlog.Tile) string { + return "/" + tile.Path() +} + +// readTile reads a single tile, either from the on-disk cache or the server. +func (c *Conn) readTile(tile tlog.Tile) ([]byte, error) { + type cached struct { + data []byte + err error + } + + result := c.tileCache.Do(tile, func() interface{} { + // Try the requested tile in on-disk cache. + data, err := c.client.ReadCache(c.tileCacheKey(tile)) + if err == nil { + c.markTileSaved(tile) + return cached{data, nil} + } + + // Try the full tile in on-disk cache (if requested tile not already full). + // We only save authenticated tiles to the on-disk cache, + // so the recreated prefix is equally authenticated. + full := tile + full.W = 1 << tile.H + if tile != full { + data, err := c.client.ReadCache(c.tileCacheKey(full)) + if err == nil { + c.markTileSaved(tile) // don't save tile later; we already have full + return cached{data[:len(data)/full.W*tile.W], nil} + } + } + + // Try requested tile from server. + data, err = c.client.ReadRemote(c.tileRemotePath(tile)) + if err == nil { + return cached{data, nil} + } + + // Try full tile on server. + // If the partial tile does not exist, it should be because + // the tile has been completed and only the complete one + // is available. + if tile != full { + data, err := c.client.ReadRemote(c.tileRemotePath(full)) + if err == nil { + // Note: We could save the full tile in the on-disk cache here, + // but we don't know if it is valid yet, and we will only find out + // about the partial data, not the full data. So let SaveTiles + // save the partial tile, and we'll just refetch the full tile later + // once we can validate more (or all) of it. + return cached{data[:len(data)/full.W*tile.W], nil} + } + } + + // Nothing worked. + // Return the error from the server fetch for the requested (not full) tile. + return cached{nil, err} + }).(cached) + + return result.data, result.err +} + +// markTileSaved records that tile is already present in the on-disk cache, +// so that a future SaveTiles for that tile can be ignored. +func (c *Conn) markTileSaved(tile tlog.Tile) { + c.tileSavedMu.Lock() + c.tileSaved[tile] = true + c.tileSavedMu.Unlock() +} + +// SaveTiles saves the now validated tiles. +func (r *tileReader) SaveTiles(tiles []tlog.Tile, data [][]byte) { + c := r.c + + // Determine which tiles need saving. + // (Tiles that came from the cache need not be saved back.) + save := make([]bool, len(tiles)) + c.tileSavedMu.Lock() + for i, tile := range tiles { + if !c.tileSaved[tile] { + save[i] = true + c.tileSaved[tile] = true + } + } + c.tileSavedMu.Unlock() + + for i, tile := range tiles { + if save[i] { + // If WriteCache fails here (out of disk space? i/o error?), + // c.tileSaved[tile] is still true and we will not try to write it again. + // Next time we run maybe we'll redownload it again and be + // more successful. + c.client.WriteCache(c.name+"/"+tile.Path(), data[i]) + } + } +} diff --git a/libgo/go/cmd/go/internal/sumweb/client_test.go b/libgo/go/cmd/go/internal/sumweb/client_test.go new file mode 100644 index 00000000000..83a182adc55 --- /dev/null +++ b/libgo/go/cmd/go/internal/sumweb/client_test.go @@ -0,0 +1,460 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sumweb + +import ( + "bytes" + "fmt" + "strings" + "sync" + "testing" + + "cmd/go/internal/note" + "cmd/go/internal/tlog" +) + +const ( + testName = "localhost.localdev/sumdb" + testVerifierKey = "localhost.localdev/sumdb+00000c67+AcTrnkbUA+TU4heY3hkjiSES/DSQniBqIeQ/YppAUtK6" + testSignerKey = "PRIVATE+KEY+localhost.localdev/sumdb+00000c67+AXu6+oaVaOYuQOFrf1V59JK1owcFlJcHwwXHDfDGxSPk" +) + +func TestConnLookup(t *testing.T) { + tc := newTestClient(t) + tc.mustHaveLatest(1) + + // Basic lookup. + tc.mustLookup("rsc.io/sampler", "v1.3.0", "rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=") + tc.mustHaveLatest(3) + + // Everything should now be cached, both for the original package and its /go.mod. + tc.getOK = false + tc.mustLookup("rsc.io/sampler", "v1.3.0", "rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=") + tc.mustLookup("rsc.io/sampler", "v1.3.0/go.mod", "rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=") + tc.mustHaveLatest(3) + tc.getOK = true + tc.getTileOK = false // the cache has what we need + + // Lookup with multiple returned lines. + tc.mustLookup("rsc.io/quote", "v1.5.2", "rsc.io/quote v1.5.2 h1:w5fcysjrx7yqtD/aO+QwRjYZOKnaM9Uh2b40tElTs3Y=\nrsc.io/quote v1.5.2 h2:xyzzy") + tc.mustHaveLatest(3) + + // Lookup with need for !-encoding. + // rsc.io/Quote is the only record written after rsc.io/samper, + // so it is the only one that should need more tiles. + tc.getTileOK = true + tc.mustLookup("rsc.io/Quote", "v1.5.2", "rsc.io/Quote v1.5.2 h1:uppercase!=") + tc.mustHaveLatest(4) +} + +func TestConnBadTiles(t *testing.T) { + tc := newTestClient(t) + + flipBits := func() { + for url, data := range tc.remote { + if strings.Contains(url, "/tile/") { + for i := range data { + data[i] ^= 0x80 + } + } + } + } + + // Bad tiles in initial download. + tc.mustHaveLatest(1) + flipBits() + _, err := tc.conn.Lookup("rsc.io/sampler", "v1.3.0") + tc.mustError(err, "rsc.io/sampler@v1.3.0: initializing sumweb.Conn: checking tree#1: downloaded inconsistent tile") + flipBits() + tc.newConn() + tc.mustLookup("rsc.io/sampler", "v1.3.0", "rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=") + + // Bad tiles after initial download. + flipBits() + _, err = tc.conn.Lookup("rsc.io/Quote", "v1.5.2") + tc.mustError(err, "rsc.io/Quote@v1.5.2: checking tree#3 against tree#4: downloaded inconsistent tile") + flipBits() + tc.newConn() + tc.mustLookup("rsc.io/Quote", "v1.5.2", "rsc.io/Quote v1.5.2 h1:uppercase!=") + + // Bad starting tree hash looks like bad tiles. + tc.newConn() + text := tlog.FormatTree(tlog.Tree{N: 1, Hash: tlog.Hash{}}) + data, err := note.Sign(¬e.Note{Text: string(text)}, tc.signer) + if err != nil { + tc.t.Fatal(err) + } + tc.config[testName+"/latest"] = data + _, err = tc.conn.Lookup("rsc.io/sampler", "v1.3.0") + tc.mustError(err, "rsc.io/sampler@v1.3.0: initializing sumweb.Conn: checking tree#1: downloaded inconsistent tile") +} + +func TestConnFork(t *testing.T) { + tc := newTestClient(t) + tc2 := tc.fork() + + tc.addRecord("rsc.io/pkg1@v1.5.2", `rsc.io/pkg1 v1.5.2 h1:hash!= +`) + tc.addRecord("rsc.io/pkg1@v1.5.4", `rsc.io/pkg1 v1.5.4 h1:hash!= +`) + tc.mustLookup("rsc.io/pkg1", "v1.5.2", "rsc.io/pkg1 v1.5.2 h1:hash!=") + + tc2.addRecord("rsc.io/pkg1@v1.5.3", `rsc.io/pkg1 v1.5.3 h1:hash!= +`) + tc2.addRecord("rsc.io/pkg1@v1.5.4", `rsc.io/pkg1 v1.5.4 h1:hash!= +`) + tc2.mustLookup("rsc.io/pkg1", "v1.5.4", "rsc.io/pkg1 v1.5.4 h1:hash!=") + + key := "/lookup/rsc.io/pkg1@v1.5.2" + tc2.remote[key] = tc.remote[key] + _, err := tc2.conn.Lookup("rsc.io/pkg1", "v1.5.2") + tc2.mustError(err, ErrSecurity.Error()) + + /* + SECURITY ERROR + go.sum database server misbehavior detected! + + old database: + go.sum database tree! + 5 + nWzN20+pwMt62p7jbv1/NlN95ePTlHijabv5zO/s36w= + + — localhost.localdev/sumdb AAAMZ5/2FVAdMH58kmnz/0h299pwyskEbzDzoa2/YaPdhvLya4YWDFQQxu2TQb5GpwAH4NdWnTwuhILafisyf3CNbgg= + + new database: + go.sum database tree + 6 + wc4SkQt52o5W2nQ8To2ARs+mWuUJjss+sdleoiqxMmM= + + — localhost.localdev/sumdb AAAMZ6oRNswlEZ6ZZhxrCvgl1MBy+nusq4JU+TG6Fe2NihWLqOzb+y2c2kzRLoCr4tvw9o36ucQEnhc20e4nA4Qc/wc= + + proof of misbehavior: + T7i+H/8ER4nXOiw4Bj0koZOkGjkxoNvlI34GpvhHhQg= + Nsuejv72de9hYNM5bqFv8rv3gm3zJQwv/DT/WNbLDLA= + mOmqqZ1aI/lzS94oq/JSbj7pD8Rv9S+xDyi12BtVSHo= + /7Aw5jVSMM9sFjQhaMg+iiDYPMk6decH7QLOGrL9Lx0= + */ + + wants := []string{ + "SECURITY ERROR", + "go.sum database server misbehavior detected!", + "old database:\n\tgo.sum database tree\n\t5\n", + "— localhost.localdev/sumdb AAAMZ5/2FVAd", + "new database:\n\tgo.sum database tree\n\t6\n", + "— localhost.localdev/sumdb AAAMZ6oRNswl", + "proof of misbehavior:\n\tT7i+H/8ER4nXOiw4Bj0k", + } + text := tc2.security.String() + for _, want := range wants { + if !strings.Contains(text, want) { + t.Fatalf("cannot find %q in security text:\n%s", want, text) + } + } +} + +func TestConnGONOSUMDB(t *testing.T) { + tc := newTestClient(t) + tc.conn.SetGONOSUMDB("p,*/q") + tc.conn.Lookup("rsc.io/sampler", "v1.3.0") // initialize before we turn off network + tc.getOK = false + + ok := []string{ + "abc", + "a/p", + "pq", + "q", + "n/o/p/q", + } + skip := []string{ + "p", + "p/x", + "x/q", + "x/q/z", + } + + for _, path := range ok { + _, err := tc.conn.Lookup(path, "v1.0.0") + if err == ErrGONOSUMDB { + t.Errorf("Lookup(%q): ErrGONOSUMDB, wanted failed actual lookup", path) + } + } + for _, path := range skip { + _, err := tc.conn.Lookup(path, "v1.0.0") + if err != ErrGONOSUMDB { + t.Errorf("Lookup(%q): %v, wanted ErrGONOSUMDB", path, err) + } + } +} + +// A testClient is a self-contained client-side testing environment. +type testClient struct { + t *testing.T // active test + conn *Conn // conn being tested + tileHeight int // tile height to use (default 2) + getOK bool // should tc.GetURL succeed? + getTileOK bool // should tc.GetURL of tiles succeed? + treeSize int64 + hashes []tlog.Hash + remote map[string][]byte + signer note.Signer + + // mu protects config, cache, log, security + // during concurrent use of the exported methods + // by the conn itself (testClient is the Conn's Client, + // and the Client methods can both read and write these fields). + // Unexported methods invoked directly by the test + // (for example, addRecord) need not hold the mutex: + // for proper test execution those methods should only + // be called when the Conn is idle and not using its Client. + // Not holding the mutex in those methods ensures + // that if a mistake is made, go test -race will report it. + // (Holding the mutex would eliminate the race report but + // not the underlying problem.) + // Similarly, the get map is not protected by the mutex, + // because the Client methods only read it. + mu sync.Mutex // prot + config map[string][]byte + cache map[string][]byte + security bytes.Buffer +} + +// newTestClient returns a new testClient that will call t.Fatal on error +// and has a few records already available on the remote server. +func newTestClient(t *testing.T) *testClient { + tc := &testClient{ + t: t, + tileHeight: 2, + getOK: true, + getTileOK: true, + config: make(map[string][]byte), + cache: make(map[string][]byte), + remote: make(map[string][]byte), + } + + tc.config["key"] = []byte(testVerifierKey + "\n") + var err error + tc.signer, err = note.NewSigner(testSignerKey) + if err != nil { + t.Fatal(err) + } + + tc.newConn() + + tc.addRecord("rsc.io/quote@v1.5.2", `rsc.io/quote v1.5.2 h1:w5fcysjrx7yqtD/aO+QwRjYZOKnaM9Uh2b40tElTs3Y= +rsc.io/quote v1.5.2/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0= +rsc.io/quote v1.5.2 h2:xyzzy +`) + + tc.addRecord("golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c", `golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +`) + tc.addRecord("rsc.io/sampler@v1.3.0", `rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +`) + tc.config[testName+"/latest"] = tc.signTree(1) + + tc.addRecord("rsc.io/!quote@v1.5.2", `rsc.io/Quote v1.5.2 h1:uppercase!= +`) + return tc +} + +// newConn resets the Conn associated with tc. +// This clears any in-memory cache from the Conn +// but not tc's on-disk cache. +func (tc *testClient) newConn() { + tc.conn = NewConn(tc) + tc.conn.SetTileHeight(tc.tileHeight) +} + +// mustLookup does a lookup for path@vers and checks that the lines that come back match want. +func (tc *testClient) mustLookup(path, vers, want string) { + tc.t.Helper() + lines, err := tc.conn.Lookup(path, vers) + if err != nil { + tc.t.Fatal(err) + } + if strings.Join(lines, "\n") != want { + tc.t.Fatalf("Lookup(%q, %q):\n\t%s\nwant:\n\t%s", path, vers, strings.Join(lines, "\n\t"), strings.Replace(want, "\n", "\n\t", -1)) + } +} + +// mustHaveLatest checks that the on-disk configuration +// for latest is a tree of size n. +func (tc *testClient) mustHaveLatest(n int64) { + tc.t.Helper() + + latest := tc.config[testName+"/latest"] + lines := strings.Split(string(latest), "\n") + if len(lines) < 2 || lines[1] != fmt.Sprint(n) { + tc.t.Fatalf("/latest should have tree %d, but has:\n%s", n, latest) + } +} + +// mustError checks that err's error string contains the text. +func (tc *testClient) mustError(err error, text string) { + tc.t.Helper() + if err == nil || !strings.Contains(err.Error(), text) { + tc.t.Fatalf("err = %v, want %q", err, text) + } +} + +// fork returns a copy of tc. +// Changes made to the new copy or to tc are not reflected in the other. +func (tc *testClient) fork() *testClient { + tc2 := &testClient{ + t: tc.t, + getOK: tc.getOK, + getTileOK: tc.getTileOK, + tileHeight: tc.tileHeight, + treeSize: tc.treeSize, + hashes: append([]tlog.Hash{}, tc.hashes...), + signer: tc.signer, + config: copyMap(tc.config), + cache: copyMap(tc.cache), + remote: copyMap(tc.remote), + } + tc2.newConn() + return tc2 +} + +func copyMap(m map[string][]byte) map[string][]byte { + m2 := make(map[string][]byte) + for k, v := range m { + m2[k] = v + } + return m2 +} + +// ReadHashes is tc's implementation of tlog.HashReader, for use with +// tlog.TreeHash and so on. +func (tc *testClient) ReadHashes(indexes []int64) ([]tlog.Hash, error) { + var list []tlog.Hash + for _, id := range indexes { + list = append(list, tc.hashes[id]) + } + return list, nil +} + +// addRecord adds a log record using the given (!-encoded) key and data. +func (tc *testClient) addRecord(key, data string) { + tc.t.Helper() + + // Create record, add hashes to log tree. + id := tc.treeSize + tc.treeSize++ + rec, err := tlog.FormatRecord(id, []byte(data)) + if err != nil { + tc.t.Fatal(err) + } + hashes, err := tlog.StoredHashesForRecordHash(id, tlog.RecordHash([]byte(data)), tc) + if err != nil { + tc.t.Fatal(err) + } + tc.hashes = append(tc.hashes, hashes...) + + // Create lookup result. + tc.remote["/lookup/"+key] = append(rec, tc.signTree(tc.treeSize)...) + + // Create new tiles. + tiles := tlog.NewTiles(tc.tileHeight, id, tc.treeSize) + for _, tile := range tiles { + data, err := tlog.ReadTileData(tile, tc) + if err != nil { + tc.t.Fatal(err) + } + tc.remote["/"+tile.Path()] = data + // TODO delete old partial tiles + } +} + +// signTree returns the signed head for the tree of the given size. +func (tc *testClient) signTree(size int64) []byte { + h, err := tlog.TreeHash(size, tc) + if err != nil { + tc.t.Fatal(err) + } + text := tlog.FormatTree(tlog.Tree{N: size, Hash: h}) + data, err := note.Sign(¬e.Note{Text: string(text)}, tc.signer) + if err != nil { + tc.t.Fatal(err) + } + return data +} + +// ReadRemote is for tc's implementation of Client. +func (tc *testClient) ReadRemote(path string) ([]byte, error) { + // No mutex here because only the Client should be running + // and the Client cannot change tc.get. + if !tc.getOK { + return nil, fmt.Errorf("disallowed remote read %s", path) + } + if strings.Contains(path, "/tile/") && !tc.getTileOK { + return nil, fmt.Errorf("disallowed remote tile read %s", path) + } + + data, ok := tc.remote[path] + if !ok { + return nil, fmt.Errorf("no remote path %s", path) + } + return data, nil +} + +// ReadConfig is for tc's implementation of Client. +func (tc *testClient) ReadConfig(file string) ([]byte, error) { + tc.mu.Lock() + defer tc.mu.Unlock() + + data, ok := tc.config[file] + if !ok { + return nil, fmt.Errorf("no config %s", file) + } + return data, nil +} + +// WriteConfig is for tc's implementation of Client. +func (tc *testClient) WriteConfig(file string, old, new []byte) error { + tc.mu.Lock() + defer tc.mu.Unlock() + + data := tc.config[file] + if !bytes.Equal(old, data) { + return ErrWriteConflict + } + tc.config[file] = new + return nil +} + +// ReadCache is for tc's implementation of Client. +func (tc *testClient) ReadCache(file string) ([]byte, error) { + tc.mu.Lock() + defer tc.mu.Unlock() + + data, ok := tc.cache[file] + if !ok { + return nil, fmt.Errorf("no cache %s", file) + } + return data, nil +} + +// WriteCache is for tc's implementation of Client. +func (tc *testClient) WriteCache(file string, data []byte) { + tc.mu.Lock() + defer tc.mu.Unlock() + + tc.cache[file] = data +} + +// Log is for tc's implementation of Client. +func (tc *testClient) Log(msg string) { + tc.t.Log(msg) +} + +// SecurityError is for tc's implementation of Client. +func (tc *testClient) SecurityError(msg string) { + tc.mu.Lock() + defer tc.mu.Unlock() + + fmt.Fprintf(&tc.security, "%s\n", strings.TrimRight(msg, "\n")) +} diff --git a/libgo/go/cmd/go/internal/sumweb/encode.go b/libgo/go/cmd/go/internal/sumweb/encode.go new file mode 100644 index 00000000000..d044a84f3a8 --- /dev/null +++ b/libgo/go/cmd/go/internal/sumweb/encode.go @@ -0,0 +1,167 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// FS-safe encoding of module paths and versions. +// Copied from cmd/go/internal/module and unexported. + +package sumweb + +import ( + "fmt" + "unicode/utf8" +) + +// Safe encodings +// +// Module paths appear as substrings of file system paths +// (in the download cache) and of web server URLs in the proxy protocol. +// In general we cannot rely on file systems to be case-sensitive, +// nor can we rely on web servers, since they read from file systems. +// That is, we cannot rely on the file system to keep rsc.io/QUOTE +// and rsc.io/quote separate. Windows and macOS don't. +// Instead, we must never require two different casings of a file path. +// Because we want the download cache to match the proxy protocol, +// and because we want the proxy protocol to be possible to serve +// from a tree of static files (which might be stored on a case-insensitive +// file system), the proxy protocol must never require two different casings +// of a URL path either. +// +// One possibility would be to make the safe encoding be the lowercase +// hexadecimal encoding of the actual path bytes. This would avoid ever +// needing different casings of a file path, but it would be fairly illegible +// to most programmers when those paths appeared in the file system +// (including in file paths in compiler errors and stack traces) +// in web server logs, and so on. Instead, we want a safe encoding that +// leaves most paths unaltered. +// +// The safe encoding is this: +// replace every uppercase letter with an exclamation mark +// followed by the letter's lowercase equivalent. +// +// For example, +// github.com/Azure/azure-sdk-for-go -> github.com/!azure/azure-sdk-for-go. +// github.com/GoogleCloudPlatform/cloudsql-proxy -> github.com/!google!cloud!platform/cloudsql-proxy +// github.com/Sirupsen/logrus -> github.com/!sirupsen/logrus. +// +// Import paths that avoid upper-case letters are left unchanged. +// Note that because import paths are ASCII-only and avoid various +// problematic punctuation (like : < and >), the safe encoding is also ASCII-only +// and avoids the same problematic punctuation. +// +// Import paths have never allowed exclamation marks, so there is no +// need to define how to encode a literal !. +// +// Although paths are disallowed from using Unicode (see pathOK above), +// the eventual plan is to allow Unicode letters as well, to assume that +// file systems and URLs are Unicode-safe (storing UTF-8), and apply +// the !-for-uppercase convention. Note however that not all runes that +// are different but case-fold equivalent are an upper/lower pair. +// For example, U+004B ('K'), U+006B ('k'), and U+212A ('K' for Kelvin) +// are considered to case-fold to each other. When we do add Unicode +// letters, we must not assume that upper/lower are the only case-equivalent pairs. +// Perhaps the Kelvin symbol would be disallowed entirely, for example. +// Or perhaps it would encode as "!!k", or perhaps as "(212A)". +// +// Also, it would be nice to allow Unicode marks as well as letters, +// but marks include combining marks, and then we must deal not +// only with case folding but also normalization: both U+00E9 ('é') +// and U+0065 U+0301 ('e' followed by combining acute accent) +// look the same on the page and are treated by some file systems +// as the same path. If we do allow Unicode marks in paths, there +// must be some kind of normalization to allow only one canonical +// encoding of any character used in an import path. + +// encodePath returns the safe encoding of the given module path. +// It fails if the module path is invalid. +func encodePath(path string) (encoding string, err error) { + return encodeString(path) +} + +// encodeVersion returns the safe encoding of the given module version. +// Versions are allowed to be in non-semver form but must be valid file names +// and not contain exclamation marks. +func encodeVersion(v string) (encoding string, err error) { + return encodeString(v) +} + +func encodeString(s string) (encoding string, err error) { + haveUpper := false + for _, r := range s { + if r == '!' || r >= utf8.RuneSelf { + // This should be disallowed by CheckPath, but diagnose anyway. + // The correctness of the encoding loop below depends on it. + return "", fmt.Errorf("internal error: inconsistency in EncodePath") + } + if 'A' <= r && r <= 'Z' { + haveUpper = true + } + } + + if !haveUpper { + return s, nil + } + + var buf []byte + for _, r := range s { + if 'A' <= r && r <= 'Z' { + buf = append(buf, '!', byte(r+'a'-'A')) + } else { + buf = append(buf, byte(r)) + } + } + return string(buf), nil +} + +// decodePath returns the module path of the given safe encoding. +// It fails if the encoding is invalid or encodes an invalid path. +func decodePath(encoding string) (path string, err error) { + path, ok := decodeString(encoding) + if !ok { + return "", fmt.Errorf("invalid module path encoding %q", encoding) + } + return path, nil +} + +// decodeVersion returns the version string for the given safe encoding. +// It fails if the encoding is invalid or encodes an invalid version. +// Versions are allowed to be in non-semver form but must be valid file names +// and not contain exclamation marks. +func decodeVersion(encoding string) (v string, err error) { + v, ok := decodeString(encoding) + if !ok { + return "", fmt.Errorf("invalid version encoding %q", encoding) + } + return v, nil +} + +func decodeString(encoding string) (string, bool) { + var buf []byte + + bang := false + for _, r := range encoding { + if r >= utf8.RuneSelf { + return "", false + } + if bang { + bang = false + if r < 'a' || 'z' < r { + return "", false + } + buf = append(buf, byte(r+'A'-'a')) + continue + } + if r == '!' { + bang = true + continue + } + if 'A' <= r && r <= 'Z' { + return "", false + } + buf = append(buf, byte(r)) + } + if bang { + return "", false + } + return string(buf), true +} diff --git a/libgo/go/cmd/go/internal/sumweb/encode_test.go b/libgo/go/cmd/go/internal/sumweb/encode_test.go new file mode 100644 index 00000000000..9ed5e4a9a04 --- /dev/null +++ b/libgo/go/cmd/go/internal/sumweb/encode_test.go @@ -0,0 +1,67 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sumweb + +import "testing" + +var encodeTests = []struct { + path string + enc string // empty means same as path +}{ + {path: "ascii.com/abcdefghijklmnopqrstuvwxyz.-+/~_0123456789"}, + {path: "github.com/GoogleCloudPlatform/omega", enc: "github.com/!google!cloud!platform/omega"}, +} + +func TestEncodePath(t *testing.T) { + // Check encodings. + for _, tt := range encodeTests { + enc, err := encodePath(tt.path) + if err != nil { + t.Errorf("encodePath(%q): unexpected error: %v", tt.path, err) + continue + } + want := tt.enc + if want == "" { + want = tt.path + } + if enc != want { + t.Errorf("encodePath(%q) = %q, want %q", tt.path, enc, want) + } + } +} + +var badDecode = []string{ + "github.com/GoogleCloudPlatform/omega", + "github.com/!google!cloud!platform!/omega", + "github.com/!0google!cloud!platform/omega", + "github.com/!_google!cloud!platform/omega", + "github.com/!!google!cloud!platform/omega", +} + +func TestDecodePath(t *testing.T) { + // Check invalid decodings. + for _, bad := range badDecode { + _, err := decodePath(bad) + if err == nil { + t.Errorf("DecodePath(%q): succeeded, want error (invalid decoding)", bad) + } + } + + // Check encodings. + for _, tt := range encodeTests { + enc := tt.enc + if enc == "" { + enc = tt.path + } + path, err := decodePath(enc) + if err != nil { + t.Errorf("decodePath(%q): unexpected error: %v", enc, err) + continue + } + if path != tt.path { + t.Errorf("decodePath(%q) = %q, want %q", enc, path, tt.path) + } + } +} diff --git a/libgo/go/cmd/go/internal/sumweb/server.go b/libgo/go/cmd/go/internal/sumweb/server.go new file mode 100644 index 00000000000..5050805f873 --- /dev/null +++ b/libgo/go/cmd/go/internal/sumweb/server.go @@ -0,0 +1,183 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sumweb implements the HTTP protocols for serving or accessing a go.sum database. +package sumweb + +import ( + "context" + "internal/lazyregexp" + "net/http" + "os" + "strings" + + "cmd/go/internal/tlog" +) + +// A Server provides the external operations +// (underlying database access and so on) +// needed to implement the HTTP server Handler. +type Server interface { + // NewContext returns the context to use for the request r. + NewContext(r *http.Request) (context.Context, error) + + // Signed returns the signed hash of the latest tree. + Signed(ctx context.Context) ([]byte, error) + + // ReadRecords returns the content for the n records id through id+n-1. + ReadRecords(ctx context.Context, id, n int64) ([][]byte, error) + + // Lookup looks up a record by its associated key ("module@version"), + // returning the record ID. + Lookup(ctx context.Context, key string) (int64, error) + + // ReadTileData reads the content of tile t. + // It is only invoked for hash tiles (t.L ≥ 0). + ReadTileData(ctx context.Context, t tlog.Tile) ([]byte, error) +} + +// A Handler is the go.sum database server handler, +// which should be invoked to serve the paths listed in Paths. +// The calling code is responsible for initializing Server. +type Handler struct { + Server Server +} + +// Paths are the URL paths for which Handler should be invoked. +// +// Typically a server will do: +// +// handler := &sumweb.Handler{Server: srv} +// for _, path := range sumweb.Paths { +// http.HandleFunc(path, handler) +// } +// +var Paths = []string{ + "/lookup/", + "/latest", + "/tile/", +} + +var modVerRE = lazyregexp.New(`^[^@]+@v[0-9]+\.[0-9]+\.[0-9]+(-[^@]*)?(\+incompatible)?$`) + +func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + ctx, err := h.Server.NewContext(r) + if err != nil { + http.Error(w, err.Error(), 500) + return + } + + switch { + default: + http.NotFound(w, r) + + case strings.HasPrefix(r.URL.Path, "/lookup/"): + mod := strings.TrimPrefix(r.URL.Path, "/lookup/") + if !modVerRE.MatchString(mod) { + http.Error(w, "invalid module@version syntax", http.StatusBadRequest) + return + } + i := strings.Index(mod, "@") + encPath, encVers := mod[:i], mod[i+1:] + path, err := decodePath(encPath) + if err != nil { + reportError(w, r, err) + return + } + vers, err := decodeVersion(encVers) + if err != nil { + reportError(w, r, err) + return + } + id, err := h.Server.Lookup(ctx, path+"@"+vers) + if err != nil { + reportError(w, r, err) + return + } + records, err := h.Server.ReadRecords(ctx, id, 1) + if err != nil { + // This should never happen - the lookup says the record exists. + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if len(records) != 1 { + http.Error(w, "invalid record count returned by ReadRecords", http.StatusInternalServerError) + return + } + msg, err := tlog.FormatRecord(id, records[0]) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + signed, err := h.Server.Signed(ctx) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + w.Header().Set("Content-Type", "text/plain; charset=UTF-8") + w.Write(msg) + w.Write(signed) + + case r.URL.Path == "/latest": + data, err := h.Server.Signed(ctx) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + w.Header().Set("Content-Type", "text/plain; charset=UTF-8") + w.Write(data) + + case strings.HasPrefix(r.URL.Path, "/tile/"): + t, err := tlog.ParseTilePath(r.URL.Path[1:]) + if err != nil { + http.Error(w, "invalid tile syntax", http.StatusBadRequest) + return + } + if t.L == -1 { + // Record data. + start := t.N << uint(t.H) + records, err := h.Server.ReadRecords(ctx, start, int64(t.W)) + if err != nil { + reportError(w, r, err) + return + } + if len(records) != t.W { + http.Error(w, "invalid record count returned by ReadRecords", http.StatusInternalServerError) + return + } + var data []byte + for i, text := range records { + msg, err := tlog.FormatRecord(start+int64(i), text) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } + data = append(data, msg...) + } + w.Header().Set("Content-Type", "text/plain; charset=UTF-8") + w.Write(data) + return + } + + data, err := h.Server.ReadTileData(ctx, t) + if err != nil { + reportError(w, r, err) + return + } + w.Header().Set("Content-Type", "application/octet-stream") + w.Write(data) + } +} + +// reportError reports err to w. +// If it's a not-found, the reported error is 404. +// Otherwise it is an internal server error. +// The caller must only call reportError in contexts where +// a not-found err should be reported as 404. +func reportError(w http.ResponseWriter, r *http.Request, err error) { + if os.IsNotExist(err) { + http.Error(w, err.Error(), http.StatusNotFound) + return + } + http.Error(w, err.Error(), http.StatusInternalServerError) +} diff --git a/libgo/go/cmd/go/internal/sumweb/test.go b/libgo/go/cmd/go/internal/sumweb/test.go new file mode 100644 index 00000000000..cce86e7e9af --- /dev/null +++ b/libgo/go/cmd/go/internal/sumweb/test.go @@ -0,0 +1,133 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sumweb + +import ( + "context" + "fmt" + "net/http" + "strings" + "sync" + + "cmd/go/internal/note" + "cmd/go/internal/tlog" +) + +// NewTestServer constructs a new TestServer +// that will sign its tree with the given signer key +// (see cmd/go/internal/note) +// and fetch new records as needed by calling gosum. +func NewTestServer(signer string, gosum func(path, vers string) ([]byte, error)) *TestServer { + return &TestServer{signer: signer, gosum: gosum} +} + +// A TestServer is an in-memory implementation of Server for testing. +type TestServer struct { + signer string + gosum func(path, vers string) ([]byte, error) + + mu sync.Mutex + hashes testHashes + records [][]byte + lookup map[string]int64 +} + +// testHashes implements tlog.HashReader, reading from a slice. +type testHashes []tlog.Hash + +func (h testHashes) ReadHashes(indexes []int64) ([]tlog.Hash, error) { + var list []tlog.Hash + for _, id := range indexes { + list = append(list, h[id]) + } + return list, nil +} + +func (s *TestServer) NewContext(r *http.Request) (context.Context, error) { + return nil, nil +} + +func (s *TestServer) Signed(ctx context.Context) ([]byte, error) { + s.mu.Lock() + defer s.mu.Unlock() + + size := int64(len(s.records)) + h, err := tlog.TreeHash(size, s.hashes) + if err != nil { + return nil, err + } + text := tlog.FormatTree(tlog.Tree{N: size, Hash: h}) + signer, err := note.NewSigner(s.signer) + if err != nil { + return nil, err + } + return note.Sign(¬e.Note{Text: string(text)}, signer) +} + +func (s *TestServer) ReadRecords(ctx context.Context, id, n int64) ([][]byte, error) { + s.mu.Lock() + defer s.mu.Unlock() + + var list [][]byte + for i := int64(0); i < n; i++ { + if id+i >= int64(len(s.records)) { + return nil, fmt.Errorf("missing records") + } + list = append(list, s.records[id+i]) + } + return list, nil +} + +func (s *TestServer) Lookup(ctx context.Context, key string) (int64, error) { + s.mu.Lock() + id, ok := s.lookup[key] + s.mu.Unlock() + if ok { + return id, nil + } + + // Look up module and compute go.sum lines. + i := strings.Index(key, "@") + if i < 0 { + return 0, fmt.Errorf("invalid lookup key %q", key) + } + path, vers := key[:i], key[i+1:] + data, err := s.gosum(path, vers) + if err != nil { + return 0, err + } + + s.mu.Lock() + defer s.mu.Unlock() + + // We ran the fetch without the lock. + // If another fetch happened and committed, use it instead. + id, ok = s.lookup[key] + if ok { + return id, nil + } + + // Add record. + id = int64(len(s.records)) + s.records = append(s.records, data) + if s.lookup == nil { + s.lookup = make(map[string]int64) + } + s.lookup[key] = id + hashes, err := tlog.StoredHashesForRecordHash(id, tlog.RecordHash([]byte(data)), s.hashes) + if err != nil { + panic(err) + } + s.hashes = append(s.hashes, hashes...) + + return id, nil +} + +func (s *TestServer) ReadTileData(ctx context.Context, t tlog.Tile) ([]byte, error) { + s.mu.Lock() + defer s.mu.Unlock() + + return tlog.ReadTileData(t, s.hashes) +} diff --git a/libgo/go/cmd/go/internal/test/test.go b/libgo/go/cmd/go/internal/test/test.go index b72eace55ab..eed2d437c99 100644 --- a/libgo/go/cmd/go/internal/test/test.go +++ b/libgo/go/cmd/go/internal/test/test.go @@ -102,7 +102,10 @@ package test passes, go test prints only the final 'ok' summary line. If a package test fails, go test prints the full test output. If invoked with the -bench or -v flag, go test prints the full output even for passing package tests, in order to display the -requested benchmark results or verbose logging. +requested benchmark results or verbose logging. After the package +tests for all of the listed packages finish, and their output is +printed, go test prints a final 'FAIL' status if any package test +has failed. In package list mode only, go test caches successful package test results to avoid unnecessary repeated running of tests. When the @@ -484,10 +487,14 @@ var ( pkgArgs []string pkgs []*load.Package - testKillTimeout = 10 * time.Minute - testCacheExpire time.Time // ignore cached test results before this time + testActualTimeout = 10 * time.Minute // actual timeout which is passed to tests + testKillTimeout = testActualTimeout + 1*time.Minute // backup alarm + testCacheExpire time.Time // ignore cached test results before this time ) +// testVetExplicit records whether testVetFlags were set by an explicit -vet. +var testVetExplicit = false + // testVetFlags is the list of flags to pass to vet when invoked automatically during go test. var testVetFlags = []string{ // TODO(rsc): Decide which tests are enabled by default. @@ -500,6 +507,7 @@ var testVetFlags = []string{ // "-cgocall", // "-composites", // "-copylocks", + "-errorsas", // "-httpresponse", // "-lostcancel", // "-methods", @@ -514,15 +522,22 @@ var testVetFlags = []string{ // "-unusedresult", } +func testCmdUsage() { + fmt.Fprintf(os.Stderr, "usage: %s\n", CmdTest.UsageLine) + fmt.Fprintf(os.Stderr, "Run 'go help %s' and 'go help %s' for details.\n", CmdTest.LongName(), HelpTestflag.LongName()) + os.Exit(2) +} + func runTest(cmd *base.Command, args []string) { modload.LoadTests = true - pkgArgs, testArgs = testFlags(cmd.Usage, args) + pkgArgs, testArgs = testFlags(testCmdUsage, args) work.FindExecCmd() // initialize cached result work.BuildInit() work.VetFlags = testVetFlags + work.VetExplicit = testVetExplicit pkgs = load.PackagesForBuild(pkgArgs) if len(pkgs) == 0 { @@ -546,13 +561,21 @@ func runTest(cmd *base.Command, args []string) { // the test wedges with a goroutine spinning and its background // timer does not get a chance to fire. if dt, err := time.ParseDuration(testTimeout); err == nil && dt > 0 { - testKillTimeout = dt + 1*time.Minute + testActualTimeout = dt + testKillTimeout = testActualTimeout + 1*time.Minute } else if err == nil && dt == 0 { // An explicit zero disables the test timeout. + // No timeout is passed to tests. // Let it have one century (almost) before we kill it. + testActualTimeout = -1 testKillTimeout = 100 * 365 * 24 * time.Hour } + // Pass timeout to tests if it exists. + if testActualTimeout > 0 { + testArgs = append(testArgs, "-test.timeout="+testActualTimeout.String()) + } + // show passing test output (after buffering) with -v flag. // must buffer because tests are running in parallel, and // otherwise the output will get mixed. @@ -640,7 +663,7 @@ func runTest(cmd *base.Command, args []string) { } // Select for coverage all dependencies matching the testCoverPaths patterns. - for _, p := range load.GetTestPackageList(pkgs) { + for _, p := range load.TestPackageList(pkgs) { haveMatch := false for i := range testCoverPaths { if match[i](p) { @@ -720,7 +743,7 @@ func runTest(cmd *base.Command, args []string) { } // Ultimately the goal is to print the output. - root := &work.Action{Mode: "go test", Deps: prints} + root := &work.Action{Mode: "go test", Func: printExitStatus, Deps: prints} // Force the printing of results to happen in order, // one at a time. @@ -754,7 +777,7 @@ func ensureImport(p *load.Package, pkg string) { } } - p1 := load.LoadPackage(pkg, &load.ImportStack{}) + p1 := load.LoadImportWithFlags(pkg, p.Dir, p, &load.ImportStack{}, nil, 0) if p1.Error != nil { base.Fatalf("load %s: %v", pkg, p1.Error) } @@ -792,7 +815,7 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin DeclVars: declareCoverVars, } } - pmain, ptest, pxtest, err := load.GetTestPackagesFor(p, cover) + pmain, ptest, pxtest, err := load.TestPackagesFor(p, cover) if err != nil { return nil, nil, nil, err } @@ -820,7 +843,7 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin if !cfg.BuildN { // writeTestmain writes _testmain.go, // using the test description gathered in t. - if err := ioutil.WriteFile(testDir+"_testmain.go", *pmain.Internal.TestmainGo, 0666); err != nil { + if err := ioutil.WriteFile(testDir+"_testmain.go", pmain.Internal.TestmainGo, 0666); err != nil { return nil, nil, nil, err } } @@ -1617,3 +1640,14 @@ func builderNoTest(b *work.Builder, a *work.Action) error { fmt.Fprintf(stdout, "? \t%s\t[no test files]\n", a.Package.ImportPath) return nil } + +// printExitStatus is the action for printing the exit status +func printExitStatus(b *work.Builder, a *work.Action) error { + if !testJSON && len(pkgArgs) != 0 { + if base.GetExitStatus() != 0 { + fmt.Println("FAIL") + return nil + } + } + return nil +} diff --git a/libgo/go/cmd/go/internal/test/testflag.go b/libgo/go/cmd/go/internal/test/testflag.go index ebcf49a4e9c..138e1f9d2a2 100644 --- a/libgo/go/cmd/go/internal/test/testflag.go +++ b/libgo/go/cmd/go/internal/test/testflag.go @@ -202,6 +202,7 @@ func testFlags(usage func(), args []string) (packageNames, passToTest []string) } } + testVetExplicit = testVetList != "" if testVetList != "" && testVetList != "off" { if strings.Contains(testVetList, "=") { base.Fatalf("-vet argument cannot contain equal signs") diff --git a/libgo/go/cmd/go/internal/tlog/ct_test.go b/libgo/go/cmd/go/internal/tlog/ct_test.go new file mode 100644 index 00000000000..c2d9aebe79a --- /dev/null +++ b/libgo/go/cmd/go/internal/tlog/ct_test.go @@ -0,0 +1,96 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tlog + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "os" + "testing" +) + +func TestCertificateTransparency(t *testing.T) { + // Test that we can verify actual Certificate Transparency proofs. + // (The other tests check that we can verify our own proofs; + // this is a test that the two are compatible.) + + if testing.Short() { + t.Skip("skipping in -short mode") + } + + var root ctTree + httpGET(t, "http://ct.googleapis.com/logs/argon2020/ct/v1/get-sth", &root) + + var leaf ctEntries + httpGET(t, "http://ct.googleapis.com/logs/argon2020/ct/v1/get-entries?start=10000&end=10000", &leaf) + hash := RecordHash(leaf.Entries[0].Data) + + var rp ctRecordProof + httpGET(t, "http://ct.googleapis.com/logs/argon2020/ct/v1/get-proof-by-hash?tree_size="+fmt.Sprint(root.Size)+"&hash="+url.QueryEscape(hash.String()), &rp) + + err := CheckRecord(rp.Proof, root.Size, root.Hash, 10000, hash) + if err != nil { + t.Fatal(err) + } + + var tp ctTreeProof + httpGET(t, "http://ct.googleapis.com/logs/argon2020/ct/v1/get-sth-consistency?first=3654490&second="+fmt.Sprint(root.Size), &tp) + + oh, _ := ParseHash("AuIZ5V6sDUj1vn3Y1K85oOaQ7y+FJJKtyRTl1edIKBQ=") + err = CheckTree(tp.Proof, root.Size, root.Hash, 3654490, oh) + if err != nil { + t.Fatal(err) + } +} + +type ctTree struct { + Size int64 `json:"tree_size"` + Hash Hash `json:"sha256_root_hash"` +} + +type ctEntries struct { + Entries []*ctEntry +} + +type ctEntry struct { + Data []byte `json:"leaf_input"` +} + +type ctRecordProof struct { + Index int64 `json:"leaf_index"` + Proof RecordProof `json:"audit_path"` +} + +type ctTreeProof struct { + Proof TreeProof `json:"consistency"` +} + +func httpGET(t *testing.T, url string, targ interface{}) { + if testing.Verbose() { + println() + println(url) + } + resp, err := http.Get(url) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + data, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + if testing.Verbose() { + os.Stdout.Write(data) + } + err = json.Unmarshal(data, targ) + if err != nil { + println(url) + os.Stdout.Write(data) + t.Fatal(err) + } +} diff --git a/libgo/go/cmd/go/internal/tlog/note.go b/libgo/go/cmd/go/internal/tlog/note.go new file mode 100644 index 00000000000..65c71644baf --- /dev/null +++ b/libgo/go/cmd/go/internal/tlog/note.go @@ -0,0 +1,135 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tlog + +import ( + "bytes" + "encoding/base64" + "errors" + "fmt" + "strconv" + "strings" + "unicode/utf8" +) + +// A Tree is a tree description, to be signed by a go.sum database server. +type Tree struct { + N int64 + Hash Hash +} + +// FormatTree formats a tree description for inclusion in a note. +// +// The encoded form is three lines, each ending in a newline (U+000A): +// +// go.sum database tree +// N +// Hash +// +// where N is in decimal and Hash is in base64. +// +// A future backwards-compatible encoding may add additional lines, +// which the parser can ignore. +// A future backwards-incompatible encoding would use a different +// first line (for example, "go.sum database tree v2"). +func FormatTree(tree Tree) []byte { + return []byte(fmt.Sprintf("go.sum database tree\n%d\n%s\n", tree.N, tree.Hash)) +} + +var errMalformedTree = errors.New("malformed tree note") +var treePrefix = []byte("go.sum database tree\n") + +// ParseTree parses a tree root description. +func ParseTree(text []byte) (tree Tree, err error) { + // The message looks like: + // + // go.sum database tree + // 2 + // nND/nri/U0xuHUrYSy0HtMeal2vzD9V4k/BO79C+QeI= + // + // For forwards compatibility, extra text lines after the encoding are ignored. + if !bytes.HasPrefix(text, treePrefix) || bytes.Count(text, []byte("\n")) < 3 || len(text) > 1e6 { + return Tree{}, errMalformedTree + } + + lines := strings.SplitN(string(text), "\n", 4) + n, err := strconv.ParseInt(lines[1], 10, 64) + if err != nil || n < 0 || lines[1] != strconv.FormatInt(n, 10) { + return Tree{}, errMalformedTree + } + + h, err := base64.StdEncoding.DecodeString(lines[2]) + if err != nil || len(h) != HashSize { + return Tree{}, errMalformedTree + } + + var hash Hash + copy(hash[:], h) + return Tree{n, hash}, nil +} + +var errMalformedRecord = errors.New("malformed record data") + +// FormatRecord formats a record for serving to a client +// in a lookup response or data tile. +// +// The encoded form is the record ID as a single number, +// then the text of the record, and then a terminating blank line. +// Record text must be valid UTF-8 and must not contain any ASCII control +// characters (those below U+0020) other than newline (U+000A). +// It must end in a terminating newline and not contain any blank lines. +func FormatRecord(id int64, text []byte) (msg []byte, err error) { + if !isValidRecordText(text) { + return nil, errMalformedRecord + } + msg = []byte(fmt.Sprintf("%d\n", id)) + msg = append(msg, text...) + msg = append(msg, '\n') + return msg, nil +} + +// isValidRecordText reports whether text is syntactically valid record text. +func isValidRecordText(text []byte) bool { + var last rune + for i := 0; i < len(text); { + r, size := utf8.DecodeRune(text[i:]) + if r < 0x20 && r != '\n' || r == utf8.RuneError && size == 1 || last == '\n' && r == '\n' { + return false + } + i += size + last = r + } + if last != '\n' { + return false + } + return true +} + +// ParseRecord parses a record description at the start of text, +// stopping immediately after the terminating blank line. +// It returns the record id, the record text, and the remainder of text. +func ParseRecord(msg []byte) (id int64, text, rest []byte, err error) { + // Leading record id. + i := bytes.IndexByte(msg, '\n') + if i < 0 { + return 0, nil, nil, errMalformedRecord + } + id, err = strconv.ParseInt(string(msg[:i]), 10, 64) + if err != nil { + return 0, nil, nil, errMalformedRecord + } + msg = msg[i+1:] + + // Record text. + i = bytes.Index(msg, []byte("\n\n")) + if i < 0 { + return 0, nil, nil, errMalformedRecord + } + text, rest = msg[:i+1], msg[i+2:] + if !isValidRecordText(text) { + return 0, nil, nil, errMalformedRecord + } + return id, text, rest, nil +} diff --git a/libgo/go/cmd/go/internal/tlog/note_test.go b/libgo/go/cmd/go/internal/tlog/note_test.go new file mode 100644 index 00000000000..a32d6d21436 --- /dev/null +++ b/libgo/go/cmd/go/internal/tlog/note_test.go @@ -0,0 +1,117 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tlog + +import ( + "strings" + "testing" +) + +func TestFormatTree(t *testing.T) { + n := int64(123456789012) + h := RecordHash([]byte("hello world")) + golden := "go.sum database tree\n123456789012\nTszzRgjTG6xce+z2AG31kAXYKBgQVtCSCE40HmuwBb0=\n" + b := FormatTree(Tree{n, h}) + if string(b) != golden { + t.Errorf("FormatTree(...) = %q, want %q", b, golden) + } +} + +func TestParseTree(t *testing.T) { + in := "go.sum database tree\n123456789012\nTszzRgjTG6xce+z2AG31kAXYKBgQVtCSCE40HmuwBb0=\n" + goldH := RecordHash([]byte("hello world")) + goldN := int64(123456789012) + tree, err := ParseTree([]byte(in)) + if tree.N != goldN || tree.Hash != goldH || err != nil { + t.Fatalf("ParseTree(...) = Tree{%d, %v}, %v, want Tree{%d, %v}, nil", tree.N, tree.Hash, err, goldN, goldH) + } + + // Check invalid trees. + var badTrees = []string{ + "not-" + in, + "go.sum database tree\n0xabcdef\nTszzRgjTG6xce+z2AG31kAXYKBgQVtCSCE40HmuwBb0=\n", + "go.sum database tree\n123456789012\nTszzRgjTG6xce+z2AG31kAXYKBgQVtCSCE40HmuwBTOOBIG=\n", + } + for _, bad := range badTrees { + _, err := ParseTree([]byte(bad)) + if err == nil { + t.Fatalf("ParseTree(%q) succeeded, want failure", in) + } + } + + // Check junk on end is ignored. + var goodTrees = []string{ + in + "JOE", + in + "JOE\n", + in + strings.Repeat("JOE\n", 1000), + } + for _, good := range goodTrees { + _, err := ParseTree([]byte(good)) + if tree.N != goldN || tree.Hash != goldH || err != nil { + t.Fatalf("ParseTree(...+%q) = Tree{%d, %v}, %v, want Tree{%d, %v}, nil", good[len(in):], tree.N, tree.Hash, err, goldN, goldH) + } + } +} + +func TestFormatRecord(t *testing.T) { + id := int64(123456789012) + text := "hello, world\n" + golden := "123456789012\nhello, world\n\n" + msg, err := FormatRecord(id, []byte(text)) + if err != nil { + t.Fatalf("FormatRecord: %v", err) + } + if string(msg) != golden { + t.Fatalf("FormatRecord(...) = %q, want %q", msg, golden) + } + + var badTexts = []string{ + "", + "hello\nworld", + "hello\n\nworld\n", + "hello\x01world\n", + } + for _, bad := range badTexts { + msg, err := FormatRecord(id, []byte(bad)) + if err == nil { + t.Errorf("FormatRecord(id, %q) = %q, want error", bad, msg) + } + } +} + +func TestParseRecord(t *testing.T) { + in := "123456789012\nhello, world\n\njunk on end\x01\xff" + goldID := int64(123456789012) + goldText := "hello, world\n" + goldRest := "junk on end\x01\xff" + id, text, rest, err := ParseRecord([]byte(in)) + if id != goldID || string(text) != goldText || string(rest) != goldRest || err != nil { + t.Fatalf("ParseRecord(%q) = %d, %q, %q, %v, want %d, %q, %q, nil", in, id, text, rest, err, goldID, goldText, goldRest) + } + + in = "123456789012\nhello, world\n\n" + id, text, rest, err = ParseRecord([]byte(in)) + if id != goldID || string(text) != goldText || len(rest) != 0 || err != nil { + t.Fatalf("ParseRecord(%q) = %d, %q, %q, %v, want %d, %q, %q, nil", in, id, text, rest, err, goldID, goldText, "") + } + if rest == nil { + t.Fatalf("ParseRecord(%q): rest = []byte(nil), want []byte{}", in) + } + + // Check invalid records. + var badRecords = []string{ + "not-" + in, + "123\nhello\x01world\n\n", + "123\nhello\xffworld\n\n", + "123\nhello world\n", + "0x123\nhello world\n\n", + } + for _, bad := range badRecords { + id, text, rest, err := ParseRecord([]byte(bad)) + if err == nil { + t.Fatalf("ParseRecord(%q) = %d, %q, %q, nil, want error", in, id, text, rest) + } + } +} diff --git a/libgo/go/cmd/go/internal/tlog/tile.go b/libgo/go/cmd/go/internal/tlog/tile.go new file mode 100644 index 00000000000..694d89cdf26 --- /dev/null +++ b/libgo/go/cmd/go/internal/tlog/tile.go @@ -0,0 +1,418 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tlog + +import ( + "fmt" + "strconv" + "strings" +) + +// A Tile is a description of a transparency log tile. +// A tile of height H at level L offset N lists W consecutive hashes +// at level H*L of the tree starting at offset N*(2**H). +// A complete tile lists 2**H hashes; a partial tile lists fewer. +// Note that a tile represents the entire subtree of height H +// with those hashes as the leaves. The levels above H*L +// can be reconstructed by hashing the leaves. +// +// Each Tile can be encoded as a “tile coordinate path” +// of the form tile/H/L/NNN[.p/W]. +// The .p/W suffix is present only for partial tiles, meaning W < 2**H. +// The NNN element is an encoding of N into 3-digit path elements. +// All but the last path element begins with an "x". +// For example, +// Tile{H: 3, L: 4, N: 1234067, W: 1}'s path +// is tile/3/4/x001/x234/067.p/1, and +// Tile{H: 3, L: 4, N: 1234067, W: 8}'s path +// is tile/3/4/x001/x234/067. +// See Tile's Path method and the ParseTilePath function. +// +// The special level L=-1 holds raw record data instead of hashes. +// In this case, the level encodes into a tile path as the path element +// "data" instead of "-1". +type Tile struct { + H int // height of tile (1 ≤ H ≤ 30) + L int // level in tiling (-1 ≤ L ≤ 63) + N int64 // number within level (0 ≤ N, unbounded) + W int // width of tile (1 ≤ W ≤ 2**H; 2**H is complete tile) +} + +// TileForIndex returns the tile of height h ≥ 1 +// and least width storing the given hash storage index. +func TileForIndex(h int, index int64) Tile { + if h < 1 { + panic("TileForIndex: invalid height") + } + t, _, _ := tileForIndex(h, index) + return t +} + +// tileForIndex returns the tile of height h ≥ 1 +// storing the given hash index, which can be +// reconstructed using tileHash(data[start:end]). +func tileForIndex(h int, index int64) (t Tile, start, end int) { + level, n := SplitStoredHashIndex(index) + t.H = h + t.L = level / h + level -= t.L * h // now level within tile + t.N = n << uint(level) >> uint(t.H) + n -= t.N << uint(t.H) >> uint(level) // now n within tile at level + t.W = int((n + 1) << uint(level)) + return t, int(n< 30 || t.L < 0 || t.L >= 64 || t.W < 1 || t.W > 1<>(H*level) > 0; level++ { + oldN := oldTreeSize >> (H * level) + newN := newTreeSize >> (H * level) + for n := oldN >> H; n < newN>>H; n++ { + tiles = append(tiles, Tile{H: h, L: int(level), N: n, W: 1 << H}) + } + n := newN >> H + maxW := int(newN - n< n<= pathBase { + n /= pathBase + nStr = fmt.Sprintf("x%03d/%s", n%pathBase, nStr) + } + pStr := "" + if t.W != 1< 30 { + return Tile{}, &badPathError{path} + } + w := 1 << uint(h) + if dotP := f[len(f)-2]; strings.HasSuffix(dotP, ".p") { + ww, err := strconv.Atoi(f[len(f)-1]) + if err != nil || ww <= 0 || ww >= w { + return Tile{}, &badPathError{path} + } + w = ww + f[len(f)-2] = dotP[:len(dotP)-len(".p")] + f = f[:len(f)-1] + } + f = f[3:] + n := int64(0) + for _, s := range f { + nn, err := strconv.Atoi(strings.TrimPrefix(s, "x")) + if err != nil || nn < 0 || nn >= pathBase { + return Tile{}, &badPathError{path} + } + n = n*pathBase + int64(nn) + } + if isData { + l = -1 + } + t := Tile{H: h, L: l, N: n, W: w} + if path != t.Path() { + return Tile{}, &badPathError{path} + } + return t, nil +} + +type badPathError struct { + path string +} + +func (e *badPathError) Error() string { + return fmt.Sprintf("malformed tile path %q", e.path) +} + +// A TileReader reads tiles from a go.sum database log. +type TileReader interface { + // Height returns the height of the available tiles. + Height() int + + // ReadTiles returns the data for each requested tile. + // If ReadTiles returns err == nil, it must also return + // a data record for each tile (len(data) == len(tiles)) + // and each data record must be the correct length + // (len(data[i]) == tiles[i].W*HashSize). + ReadTiles(tiles []Tile) (data [][]byte, err error) + + // SaveTiles informs the TileReader that the tile data + // returned by ReadTiles has been confirmed as valid + // and can be saved in persistent storage (on disk). + SaveTiles(tiles []Tile, data [][]byte) +} + +// TileHashReader returns a HashReader that satisfies requests +// by loading tiles of the given tree. +// +// The returned HashReader checks that loaded tiles are +// valid for the given tree. Therefore, any hashes returned +// by the HashReader are already proven to be in the tree. +func TileHashReader(tree Tree, tr TileReader) HashReader { + return &tileHashReader{tree: tree, tr: tr} +} + +type tileHashReader struct { + tree Tree + tr TileReader +} + +// tileParent returns t's k'th tile parent in the tiles for a tree of size n. +// If there is no such parent, tileParent returns Tile{}. +func tileParent(t Tile, k int, n int64) Tile { + t.L += k + t.N >>= uint(k * t.H) + t.W = 1 << uint(t.H) + if max := n >> uint(t.L*t.H); t.N<= max { + if t.N<= max { + return Tile{} + } + t.W = int(max - t.N<= StoredHashIndex(0, r.tree.N) { + return nil, fmt.Errorf("indexes not in tree") + } + + tile, _, _ := tileForIndex(h, x) + + // Walk up parent tiles until we find one we've requested. + // That one will be authenticated. + k := 0 + for ; ; k++ { + p := tileParent(tile, k, r.tree.N) + if j, ok := tileOrder[p]; ok { + if k == 0 { + indexTileOrder[i] = j + } + break + } + } + + // Walk back down recording child tiles after parents. + // This loop ends by revisiting the tile for this index + // (tileParent(tile, 0, r.tree.N)) unless k == 0, in which + // case the previous loop did it. + for k--; k >= 0; k-- { + p := tileParent(tile, k, r.tree.N) + if p.W != 1<= 0; i-- { + h, err := HashFromTile(tiles[stxTileOrder[i]], data[stxTileOrder[i]], stx[i]) + if err != nil { + return nil, err + } + th = NodeHash(h, th) + } + if th != r.tree.Hash { + // The tiles do not support the tree hash. + // We know at least one is wrong, but not which one. + return nil, fmt.Errorf("downloaded inconsistent tile") + } + + // Authenticate full tiles against their parents. + for i := len(stx); i < len(tiles); i++ { + tile := tiles[i] + p := tileParent(tile, 1, r.tree.N) + j, ok := tileOrder[p] + if !ok { + return nil, fmt.Errorf("bad math in tileHashReader %d %v: lost parent of %v", r.tree.N, indexes, tile) + } + h, err := HashFromTile(p, data[j], StoredHashIndex(p.L*p.H, tile.N)) + if err != nil { + return nil, fmt.Errorf("bad math in tileHashReader %d %v: lost hash of %v: %v", r.tree.N, indexes, tile, err) + } + if h != tileHash(data[i]) { + return nil, fmt.Errorf("downloaded inconsistent tile") + } + } + + // Now we have all the tiles needed for the requested hashes, + // and we've authenticated the full tile set against the trusted tree hash. + r.tr.SaveTiles(tiles, data) + + // Pull out the requested hashes. + hashes := make([]Hash, len(indexes)) + for i, x := range indexes { + j := indexTileOrder[i] + h, err := HashFromTile(tiles[j], data[j], x) + if err != nil { + return nil, fmt.Errorf("bad math in tileHashReader %d %v: lost hash %v: %v", r.tree.N, indexes, x, err) + } + hashes[i] = h + } + + return hashes, nil +} diff --git a/libgo/go/cmd/go/internal/tlog/tlog.go b/libgo/go/cmd/go/internal/tlog/tlog.go new file mode 100644 index 00000000000..6703656b19f --- /dev/null +++ b/libgo/go/cmd/go/internal/tlog/tlog.go @@ -0,0 +1,601 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package tlog implements a tamper-evident log +// used in the Go module go.sum database server. +// +// This package is part of a DRAFT of what the go.sum database server will look like. +// Do not assume the details here are final! +// +// This package follows the design of Certificate Transparency (RFC 6962) +// and its proofs are compatible with that system. +// See TestCertificateTransparency. +// +package tlog + +import ( + "crypto/sha256" + "encoding/base64" + "errors" + "fmt" + "math/bits" +) + +// A Hash is a hash identifying a log record or tree root. +type Hash [HashSize]byte + +// HashSize is the size of a Hash in bytes. +const HashSize = 32 + +// String returns a base64 representation of the hash for printing. +func (h Hash) String() string { + return base64.StdEncoding.EncodeToString(h[:]) +} + +// MarshalJSON marshals the hash as a JSON string containing the base64-encoded hash. +func (h Hash) MarshalJSON() ([]byte, error) { + return []byte(`"` + h.String() + `"`), nil +} + +// UnmarshalJSON unmarshals a hash from JSON string containing the a base64-encoded hash. +func (h *Hash) UnmarshalJSON(data []byte) error { + if len(data) != 1+44+1 || data[0] != '"' || data[len(data)-2] != '=' || data[len(data)-1] != '"' { + return errors.New("cannot decode hash") + } + + // As of Go 1.12, base64.StdEncoding.Decode insists on + // slicing into target[33:] even when it only writes 32 bytes. + // Since we already checked that the hash ends in = above, + // we can use base64.RawStdEncoding with the = removed; + // RawStdEncoding does not exhibit the same bug. + // We decode into a temporary to avoid writing anything to *h + // unless the entire input is well-formed. + var tmp Hash + n, err := base64.RawStdEncoding.Decode(tmp[:], data[1:len(data)-2]) + if err != nil || n != HashSize { + return errors.New("cannot decode hash") + } + *h = tmp + return nil +} + +// ParseHash parses the base64-encoded string form of a hash. +func ParseHash(s string) (Hash, error) { + data, err := base64.StdEncoding.DecodeString(s) + if err != nil || len(data) != HashSize { + return Hash{}, fmt.Errorf("malformed hash") + } + var h Hash + copy(h[:], data) + return h, nil +} + +// maxpow2 returns k, the maximum power of 2 smaller than n, +// as well as l = log₂ k (so k = 1< 0; l-- { + n = 2*n + 1 + } + + // Level 0's n'th hash is written at n+n/2+n/4+... (eventually n/2ⁱ hits zero). + i := int64(0) + for ; n > 0; n >>= 1 { + i += n + } + + return i + int64(level) +} + +// SplitStoredHashIndex is the inverse of StoredHashIndex. +// That is, SplitStoredHashIndex(StoredHashIndex(level, n)) == level, n. +func SplitStoredHashIndex(index int64) (level int, n int64) { + // Determine level 0 record before index. + // StoredHashIndex(0, n) < 2*n, + // so the n we want is in [index/2, index/2+log₂(index)]. + n = index / 2 + indexN := StoredHashIndex(0, n) + if indexN > index { + panic("bad math") + } + for { + // Each new record n adds 1 + trailingZeros(n) hashes. + x := indexN + 1 + int64(bits.TrailingZeros64(uint64(n+1))) + if x > index { + break + } + n++ + indexN = x + } + // The hash we want was commited with record n, + // meaning it is one of (0, n), (1, n/2), (2, n/4), ... + level = int(index - indexN) + return level, n >> uint(level) +} + +// StoredHashCount returns the number of stored hashes +// that are expected for a tree with n records. +func StoredHashCount(n int64) int64 { + if n == 0 { + return 0 + } + // The tree will have the hashes up to the last leaf hash. + numHash := StoredHashIndex(0, n-1) + 1 + // And it will have any hashes for subtrees completed by that leaf. + for i := uint64(n - 1); i&1 != 0; i >>= 1 { + numHash++ + } + return numHash +} + +// StoredHashes returns the hashes that must be stored when writing +// record n with the given data. The hashes should be stored starting +// at StoredHashIndex(0, n). The result will have at most 1 + log₂ n hashes, +// but it will average just under two per call for a sequence of calls for n=1..k. +// +// StoredHashes may read up to log n earlier hashes from r +// in order to compute hashes for completed subtrees. +func StoredHashes(n int64, data []byte, r HashReader) ([]Hash, error) { + return StoredHashesForRecordHash(n, RecordHash(data), r) +} + +// StoredHashesForRecordHash is like StoredHashes but takes +// as its second argument RecordHash(data) instead of data itself. +func StoredHashesForRecordHash(n int64, h Hash, r HashReader) ([]Hash, error) { + // Start with the record hash. + hashes := []Hash{h} + + // Build list of indexes needed for hashes for completed subtrees. + // Each trailing 1 bit in the binary representation of n completes a subtree + // and consumes a hash from an adjacent subtree. + m := int(bits.TrailingZeros64(uint64(n + 1))) + indexes := make([]int64, m) + for i := 0; i < m; i++ { + // We arrange indexes in sorted order. + // Note that n>>i is always odd. + indexes[m-1-i] = StoredHashIndex(i, n>>uint(i)-1) + } + + // Fetch hashes. + old, err := r.ReadHashes(indexes) + if err != nil { + return nil, err + } + if len(old) != len(indexes) { + return nil, fmt.Errorf("tlog: ReadHashes(%d indexes) = %d hashes", len(indexes), len(old)) + } + + // Build new hashes. + for i := 0; i < m; i++ { + h = NodeHash(old[m-1-i], h) + hashes = append(hashes, h) + } + return hashes, nil +} + +// A HashReader can read hashes for nodes in the log's tree structure. +type HashReader interface { + // ReadHashes returns the hashes with the given stored hash indexes + // (see StoredHashIndex and SplitStoredHashIndex). + // ReadHashes must return a slice of hashes the same length as indexes, + // or else it must return a non-nil error. + // ReadHashes may run faster if indexes is sorted in increasing order. + ReadHashes(indexes []int64) ([]Hash, error) +} + +// A HashReaderFunc is a function implementing HashReader. +type HashReaderFunc func([]int64) ([]Hash, error) + +func (f HashReaderFunc) ReadHashes(indexes []int64) ([]Hash, error) { + return f(indexes) +} + +// TreeHash computes the hash for the root of the tree with n records, +// using the HashReader to obtain previously stored hashes +// (those returned by StoredHashes during the writes of those n records). +// TreeHash makes a single call to ReadHash requesting at most 1 + log₂ n hashes. +// The tree of size zero is defined to have an all-zero Hash. +func TreeHash(n int64, r HashReader) (Hash, error) { + if n == 0 { + return Hash{}, nil + } + indexes := subTreeIndex(0, n, nil) + hashes, err := r.ReadHashes(indexes) + if err != nil { + return Hash{}, err + } + if len(hashes) != len(indexes) { + return Hash{}, fmt.Errorf("tlog: ReadHashes(%d indexes) = %d hashes", len(indexes), len(hashes)) + } + hash, hashes := subTreeHash(0, n, hashes) + if len(hashes) != 0 { + panic("tlog: bad index math in TreeHash") + } + return hash, nil +} + +// subTreeIndex returns the storage indexes needed to compute +// the hash for the subtree containing records [lo, hi), +// appending them to need and returning the result. +// See https://tools.ietf.org/html/rfc6962#section-2.1 +func subTreeIndex(lo, hi int64, need []int64) []int64 { + // See subTreeHash below for commentary. + for lo < hi { + k, level := maxpow2(hi - lo + 1) + if lo&(k-1) != 0 { + panic("tlog: bad math in subTreeIndex") + } + need = append(need, StoredHashIndex(level, lo>>uint(level))) + lo += k + } + return need +} + +// subTreeHash computes the hash for the subtree containing records [lo, hi), +// assuming that hashes are the hashes corresponding to the indexes +// returned by subTreeIndex(lo, hi). +// It returns any leftover hashes. +func subTreeHash(lo, hi int64, hashes []Hash) (Hash, []Hash) { + // Repeatedly partition the tree into a left side with 2^level nodes, + // for as large a level as possible, and a right side with the fringe. + // The left hash is stored directly and can be read from storage. + // The right side needs further computation. + numTree := 0 + for lo < hi { + k, _ := maxpow2(hi - lo + 1) + if lo&(k-1) != 0 || lo >= hi { + panic("tlog: bad math in subTreeHash") + } + numTree++ + lo += k + } + + if len(hashes) < numTree { + panic("tlog: bad index math in subTreeHash") + } + + // Reconstruct hash. + h := hashes[numTree-1] + for i := numTree - 2; i >= 0; i-- { + h = NodeHash(hashes[i], h) + } + return h, hashes[numTree:] +} + +// A RecordProof is a verifiable proof that a particular log root contains a particular record. +// RFC 6962 calls this a “Merkle audit path.” +type RecordProof []Hash + +// ProveRecord returns the proof that the tree of size t contains the record with index n. +func ProveRecord(t, n int64, r HashReader) (RecordProof, error) { + if t < 0 || n < 0 || n >= t { + return nil, fmt.Errorf("tlog: invalid inputs in ProveRecord") + } + indexes := leafProofIndex(0, t, n, nil) + if len(indexes) == 0 { + return RecordProof{}, nil + } + hashes, err := r.ReadHashes(indexes) + if err != nil { + return nil, err + } + if len(hashes) != len(indexes) { + return nil, fmt.Errorf("tlog: ReadHashes(%d indexes) = %d hashes", len(indexes), len(hashes)) + } + + p, hashes := leafProof(0, t, n, hashes) + if len(hashes) != 0 { + panic("tlog: bad index math in ProveRecord") + } + return p, nil +} + +// leafProofIndex builds the list of indexes needed to construct the proof +// that leaf n is contained in the subtree with leaves [lo, hi). +// It appends those indexes to need and returns the result. +// See https://tools.ietf.org/html/rfc6962#section-2.1.1 +func leafProofIndex(lo, hi, n int64, need []int64) []int64 { + // See leafProof below for commentary. + if !(lo <= n && n < hi) { + panic("tlog: bad math in leafProofIndex") + } + if lo+1 == hi { + return need + } + if k, _ := maxpow2(hi - lo); n < lo+k { + need = leafProofIndex(lo, lo+k, n, need) + need = subTreeIndex(lo+k, hi, need) + } else { + need = subTreeIndex(lo, lo+k, need) + need = leafProofIndex(lo+k, hi, n, need) + } + return need +} + +// leafProof constructs the proof that leaf n is contained in the subtree with leaves [lo, hi). +// It returns any leftover hashes as well. +// See https://tools.ietf.org/html/rfc6962#section-2.1.1 +func leafProof(lo, hi, n int64, hashes []Hash) (RecordProof, []Hash) { + // We must have lo <= n < hi or else the code here has a bug. + if !(lo <= n && n < hi) { + panic("tlog: bad math in leafProof") + } + + if lo+1 == hi { // n == lo + // Reached the leaf node. + // The verifier knows what the leaf hash is, so we don't need to send it. + return RecordProof{}, hashes + } + + // Walk down the tree toward n. + // Record the hash of the path not taken (needed for verifying the proof). + var p RecordProof + var th Hash + if k, _ := maxpow2(hi - lo); n < lo+k { + // n is on left side + p, hashes = leafProof(lo, lo+k, n, hashes) + th, hashes = subTreeHash(lo+k, hi, hashes) + } else { + // n is on right side + th, hashes = subTreeHash(lo, lo+k, hashes) + p, hashes = leafProof(lo+k, hi, n, hashes) + } + return append(p, th), hashes +} + +var errProofFailed = errors.New("invalid transparency proof") + +// CheckRecord verifies that p is a valid proof that the tree of size t +// with hash th has an n'th record with hash h. +func CheckRecord(p RecordProof, t int64, th Hash, n int64, h Hash) error { + if t < 0 || n < 0 || n >= t { + return fmt.Errorf("tlog: invalid inputs in CheckRecord") + } + th2, err := runRecordProof(p, 0, t, n, h) + if err != nil { + return err + } + if th2 == th { + return nil + } + return errProofFailed +} + +// runRecordProof runs the proof p that leaf n is contained in the subtree with leaves [lo, hi). +// Running the proof means constructing and returning the implied hash of that +// subtree. +func runRecordProof(p RecordProof, lo, hi, n int64, leafHash Hash) (Hash, error) { + // We must have lo <= n < hi or else the code here has a bug. + if !(lo <= n && n < hi) { + panic("tlog: bad math in runRecordProof") + } + + if lo+1 == hi { // m == lo + // Reached the leaf node. + // The proof must not have any unnecessary hashes. + if len(p) != 0 { + return Hash{}, errProofFailed + } + return leafHash, nil + } + + if len(p) == 0 { + return Hash{}, errProofFailed + } + + k, _ := maxpow2(hi - lo) + if n < lo+k { + th, err := runRecordProof(p[:len(p)-1], lo, lo+k, n, leafHash) + if err != nil { + return Hash{}, err + } + return NodeHash(th, p[len(p)-1]), nil + } else { + th, err := runRecordProof(p[:len(p)-1], lo+k, hi, n, leafHash) + if err != nil { + return Hash{}, err + } + return NodeHash(p[len(p)-1], th), nil + } +} + +// A TreeProof is a verifiable proof that a particular log tree contains +// as a prefix all records present in an earlier tree. +// RFC 6962 calls this a “Merkle consistency proof.” +type TreeProof []Hash + +// ProveTree returns the proof that the tree of size t contains +// as a prefix all the records from the tree of smaller size n. +func ProveTree(t, n int64, h HashReader) (TreeProof, error) { + if t < 1 || n < 1 || n > t { + return nil, fmt.Errorf("tlog: invalid inputs in ProveTree") + } + indexes := treeProofIndex(0, t, n, nil) + if len(indexes) == 0 { + return TreeProof{}, nil + } + hashes, err := h.ReadHashes(indexes) + if err != nil { + return nil, err + } + if len(hashes) != len(indexes) { + return nil, fmt.Errorf("tlog: ReadHashes(%d indexes) = %d hashes", len(indexes), len(hashes)) + } + + p, hashes := treeProof(0, t, n, hashes) + if len(hashes) != 0 { + panic("tlog: bad index math in ProveTree") + } + return p, nil +} + +// treeProofIndex builds the list of indexes needed to construct +// the sub-proof related to the subtree containing records [lo, hi). +// See https://tools.ietf.org/html/rfc6962#section-2.1.2. +func treeProofIndex(lo, hi, n int64, need []int64) []int64 { + // See treeProof below for commentary. + if !(lo < n && n <= hi) { + panic("tlog: bad math in treeProofIndex") + } + + if n == hi { + if lo == 0 { + return need + } + return subTreeIndex(lo, hi, need) + } + + if k, _ := maxpow2(hi - lo); n <= lo+k { + need = treeProofIndex(lo, lo+k, n, need) + need = subTreeIndex(lo+k, hi, need) + } else { + need = subTreeIndex(lo, lo+k, need) + need = treeProofIndex(lo+k, hi, n, need) + } + return need +} + +// treeProof constructs the sub-proof related to the subtree containing records [lo, hi). +// It returns any leftover hashes as well. +// See https://tools.ietf.org/html/rfc6962#section-2.1.2. +func treeProof(lo, hi, n int64, hashes []Hash) (TreeProof, []Hash) { + // We must have lo < n <= hi or else the code here has a bug. + if !(lo < n && n <= hi) { + panic("tlog: bad math in treeProof") + } + + // Reached common ground. + if n == hi { + if lo == 0 { + // This subtree corresponds exactly to the old tree. + // The verifier knows that hash, so we don't need to send it. + return TreeProof{}, hashes + } + th, hashes := subTreeHash(lo, hi, hashes) + return TreeProof{th}, hashes + } + + // Interior node for the proof. + // Decide whether to walk down the left or right side. + var p TreeProof + var th Hash + if k, _ := maxpow2(hi - lo); n <= lo+k { + // m is on left side + p, hashes = treeProof(lo, lo+k, n, hashes) + th, hashes = subTreeHash(lo+k, hi, hashes) + } else { + // m is on right side + th, hashes = subTreeHash(lo, lo+k, hashes) + p, hashes = treeProof(lo+k, hi, n, hashes) + } + return append(p, th), hashes +} + +// CheckTree verifies that p is a valid proof that the tree of size t with hash th +// contains as a prefix the tree of size n with hash h. +func CheckTree(p TreeProof, t int64, th Hash, n int64, h Hash) error { + if t < 1 || n < 1 || n > t { + return fmt.Errorf("tlog: invalid inputs in CheckTree") + } + h2, th2, err := runTreeProof(p, 0, t, n, h) + if err != nil { + return err + } + if th2 == th && h2 == h { + return nil + } + return errProofFailed +} + +// runTreeProof runs the sub-proof p related to the subtree containing records [lo, hi), +// where old is the hash of the old tree with n records. +// Running the proof means constructing and returning the implied hashes of that +// subtree in both the old and new tree. +func runTreeProof(p TreeProof, lo, hi, n int64, old Hash) (Hash, Hash, error) { + // We must have lo < n <= hi or else the code here has a bug. + if !(lo < n && n <= hi) { + panic("tlog: bad math in runTreeProof") + } + + // Reached common ground. + if n == hi { + if lo == 0 { + if len(p) != 0 { + return Hash{}, Hash{}, errProofFailed + } + return old, old, nil + } + if len(p) != 1 { + return Hash{}, Hash{}, errProofFailed + } + return p[0], p[0], nil + } + + if len(p) == 0 { + return Hash{}, Hash{}, errProofFailed + } + + // Interior node for the proof. + k, _ := maxpow2(hi - lo) + if n <= lo+k { + oh, th, err := runTreeProof(p[:len(p)-1], lo, lo+k, n, old) + if err != nil { + return Hash{}, Hash{}, err + } + return oh, NodeHash(th, p[len(p)-1]), nil + } else { + oh, th, err := runTreeProof(p[:len(p)-1], lo+k, hi, n, old) + if err != nil { + return Hash{}, Hash{}, err + } + return NodeHash(p[len(p)-1], oh), NodeHash(p[len(p)-1], th), nil + } +} diff --git a/libgo/go/cmd/go/internal/tlog/tlog_test.go b/libgo/go/cmd/go/internal/tlog/tlog_test.go new file mode 100644 index 00000000000..584e728c1bb --- /dev/null +++ b/libgo/go/cmd/go/internal/tlog/tlog_test.go @@ -0,0 +1,269 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tlog + +import ( + "bytes" + "fmt" + "testing" +) + +type testHashStorage []Hash + +func (t testHashStorage) ReadHash(level int, n int64) (Hash, error) { + return t[StoredHashIndex(level, n)], nil +} + +func (t testHashStorage) ReadHashes(index []int64) ([]Hash, error) { + // It's not required by HashReader that indexes be in increasing order, + // but check that the functions we are testing only ever ask for + // indexes in increasing order. + for i := 1; i < len(index); i++ { + if index[i-1] >= index[i] { + panic("indexes out of order") + } + } + + out := make([]Hash, len(index)) + for i, x := range index { + out[i] = t[x] + } + return out, nil +} + +type testTilesStorage struct { + unsaved int + m map[Tile][]byte +} + +func (t testTilesStorage) Height() int { + return 2 +} + +func (t *testTilesStorage) SaveTiles(tiles []Tile, data [][]byte) { + t.unsaved -= len(tiles) +} + +func (t *testTilesStorage) ReadTiles(tiles []Tile) ([][]byte, error) { + out := make([][]byte, len(tiles)) + for i, tile := range tiles { + out[i] = t.m[tile] + } + t.unsaved += len(tiles) + return out, nil +} + +func TestTree(t *testing.T) { + var trees []Hash + var leafhashes []Hash + var storage testHashStorage + tiles := make(map[Tile][]byte) + const testH = 2 + for i := int64(0); i < 100; i++ { + data := []byte(fmt.Sprintf("leaf %d", i)) + hashes, err := StoredHashes(i, data, storage) + if err != nil { + t.Fatal(err) + } + leafhashes = append(leafhashes, RecordHash(data)) + oldStorage := len(storage) + storage = append(storage, hashes...) + if count := StoredHashCount(i + 1); count != int64(len(storage)) { + t.Errorf("StoredHashCount(%d) = %d, have %d StoredHashes", i+1, count, len(storage)) + } + th, err := TreeHash(i+1, storage) + if err != nil { + t.Fatal(err) + } + + for _, tile := range NewTiles(testH, i, i+1) { + data, err := ReadTileData(tile, storage) + if err != nil { + t.Fatal(err) + } + old := Tile{H: tile.H, L: tile.L, N: tile.N, W: tile.W - 1} + oldData := tiles[old] + if len(oldData) != len(data)-HashSize || !bytes.Equal(oldData, data[:len(oldData)]) { + t.Fatalf("tile %v not extending earlier tile %v", tile.Path(), old.Path()) + } + tiles[tile] = data + } + for _, tile := range NewTiles(testH, 0, i+1) { + data, err := ReadTileData(tile, storage) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(tiles[tile], data) { + t.Fatalf("mismatch at %+v", tile) + } + } + for _, tile := range NewTiles(testH, i/2, i+1) { + data, err := ReadTileData(tile, storage) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(tiles[tile], data) { + t.Fatalf("mismatch at %+v", tile) + } + } + + // Check that all the new hashes are readable from their tiles. + for j := oldStorage; j < len(storage); j++ { + tile := TileForIndex(testH, int64(j)) + data, ok := tiles[tile] + if !ok { + t.Log(NewTiles(testH, 0, i+1)) + t.Fatalf("TileForIndex(%d, %d) = %v, not yet stored (i=%d, stored %d)", testH, j, tile.Path(), i, len(storage)) + continue + } + h, err := HashFromTile(tile, data, int64(j)) + if err != nil { + t.Fatal(err) + } + if h != storage[j] { + t.Errorf("HashFromTile(%v, %d) = %v, want %v", tile.Path(), int64(j), h, storage[j]) + } + } + + trees = append(trees, th) + + // Check that leaf proofs work, for all trees and leaves so far. + for j := int64(0); j <= i; j++ { + p, err := ProveRecord(i+1, j, storage) + if err != nil { + t.Fatalf("ProveRecord(%d, %d): %v", i+1, j, err) + } + if err := CheckRecord(p, i+1, th, j, leafhashes[j]); err != nil { + t.Fatalf("CheckRecord(%d, %d): %v", i+1, j, err) + } + for k := range p { + p[k][0] ^= 1 + if err := CheckRecord(p, i+1, th, j, leafhashes[j]); err == nil { + t.Fatalf("CheckRecord(%d, %d) succeeded with corrupt proof hash #%d!", i+1, j, k) + } + p[k][0] ^= 1 + } + } + + // Check that leaf proofs work using TileReader. + // To prove a leaf that way, all you have to do is read and verify its hash. + storage := &testTilesStorage{m: tiles} + thr := TileHashReader(Tree{i + 1, th}, storage) + for j := int64(0); j <= i; j++ { + h, err := thr.ReadHashes([]int64{StoredHashIndex(0, j)}) + if err != nil { + t.Fatalf("TileHashReader(%d).ReadHashes(%d): %v", i+1, j, err) + } + if h[0] != leafhashes[j] { + t.Fatalf("TileHashReader(%d).ReadHashes(%d) returned wrong hash", i+1, j) + } + + // Even though reading the hash suffices, + // check we can generate the proof too. + p, err := ProveRecord(i+1, j, thr) + if err != nil { + t.Fatalf("ProveRecord(%d, %d, TileHashReader(%d)): %v", i+1, j, i+1, err) + } + if err := CheckRecord(p, i+1, th, j, leafhashes[j]); err != nil { + t.Fatalf("CheckRecord(%d, %d, TileHashReader(%d)): %v", i+1, j, i+1, err) + } + } + if storage.unsaved != 0 { + t.Fatalf("TileHashReader(%d) did not save %d tiles", i+1, storage.unsaved) + } + + // Check that ReadHashes will give an error if the index is not in the tree. + if _, err := thr.ReadHashes([]int64{(i + 1) * 2}); err == nil { + t.Fatalf("TileHashReader(%d).ReadHashes(%d) for index not in tree , want err", i, i+1) + } + if storage.unsaved != 0 { + t.Fatalf("TileHashReader(%d) did not save %d tiles", i+1, storage.unsaved) + } + + // Check that tree proofs work, for all trees so far, using TileReader. + // To prove a tree that way, all you have to do is compute and verify its hash. + for j := int64(0); j <= i; j++ { + h, err := TreeHash(j+1, thr) + if err != nil { + t.Fatalf("TreeHash(%d, TileHashReader(%d)): %v", j, i+1, err) + } + if h != trees[j] { + t.Fatalf("TreeHash(%d, TileHashReader(%d)) = %x, want %x (%v)", j, i+1, h[:], trees[j][:], trees[j]) + } + + // Even though computing the subtree hash suffices, + // check that we can generate the proof too. + p, err := ProveTree(i+1, j+1, thr) + if err != nil { + t.Fatalf("ProveTree(%d, %d): %v", i+1, j+1, err) + } + if err := CheckTree(p, i+1, th, j+1, trees[j]); err != nil { + t.Fatalf("CheckTree(%d, %d): %v [%v]", i+1, j+1, err, p) + } + for k := range p { + p[k][0] ^= 1 + if err := CheckTree(p, i+1, th, j+1, trees[j]); err == nil { + t.Fatalf("CheckTree(%d, %d) succeeded with corrupt proof hash #%d!", i+1, j+1, k) + } + p[k][0] ^= 1 + } + } + if storage.unsaved != 0 { + t.Fatalf("TileHashReader(%d) did not save %d tiles", i+1, storage.unsaved) + } + } +} + +func TestSplitStoredHashIndex(t *testing.T) { + for l := 0; l < 10; l++ { + for n := int64(0); n < 100; n++ { + x := StoredHashIndex(l, n) + l1, n1 := SplitStoredHashIndex(x) + if l1 != l || n1 != n { + t.Fatalf("StoredHashIndex(%d, %d) = %d, but SplitStoredHashIndex(%d) = %d, %d", l, n, x, x, l1, n1) + } + } + } +} + +// TODO(rsc): Test invalid paths too, like "tile/3/5/123/456/078". +var tilePaths = []struct { + path string + tile Tile +}{ + {"tile/4/0/001", Tile{4, 0, 1, 16}}, + {"tile/4/0/001.p/5", Tile{4, 0, 1, 5}}, + {"tile/3/5/x123/x456/078", Tile{3, 5, 123456078, 8}}, + {"tile/3/5/x123/x456/078.p/2", Tile{3, 5, 123456078, 2}}, + {"tile/1/0/x003/x057/500", Tile{1, 0, 3057500, 2}}, + {"tile/3/5/123/456/078", Tile{}}, + {"tile/3/-1/123/456/078", Tile{}}, + {"tile/1/data/x003/x057/500", Tile{1, -1, 3057500, 2}}, +} + +func TestTilePath(t *testing.T) { + for _, tt := range tilePaths { + if tt.tile.H > 0 { + p := tt.tile.Path() + if p != tt.path { + t.Errorf("%+v.Path() = %q, want %q", tt.tile, p, tt.path) + } + } + tile, err := ParseTilePath(tt.path) + if err != nil { + if tt.tile.H == 0 { + // Expected error. + continue + } + t.Errorf("ParseTilePath(%q): %v", tt.path, err) + } else if tile != tt.tile { + if tt.tile.H == 0 { + t.Errorf("ParseTilePath(%q): expected error, got %+v", tt.path, tt.tile) + continue + } + t.Errorf("ParseTilePath(%q) = %+v, want %+v", tt.path, tile, tt.tile) + } + } +} diff --git a/libgo/go/cmd/go/internal/tool/tool.go b/libgo/go/cmd/go/internal/tool/tool.go index edcf93513d8..930eecb63f1 100644 --- a/libgo/go/cmd/go/internal/tool/tool.go +++ b/libgo/go/cmd/go/internal/tool/tool.go @@ -83,8 +83,6 @@ func runTool(cmd *base.Command, args []string) { Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr, - // Set $GOROOT, mainly for go tool dist. - Env: base.MergeEnvLists([]string{"GOROOT=" + cfg.GOROOT}, os.Environ()), } err := toolCmd.Run() if err != nil { diff --git a/libgo/go/cmd/go/internal/version/exe.go b/libgo/go/cmd/go/internal/version/exe.go new file mode 100644 index 00000000000..55da960c025 --- /dev/null +++ b/libgo/go/cmd/go/internal/version/exe.go @@ -0,0 +1,252 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package version + +import ( + "bytes" + "debug/elf" + "debug/macho" + "debug/pe" + "fmt" + "internal/xcoff" + "io" + "os" +) + +// An exe is a generic interface to an OS executable (ELF, Mach-O, PE, XCOFF). +type exe interface { + // Close closes the underlying file. + Close() error + + // ReadData reads and returns up to size byte starting at virtual address addr. + ReadData(addr, size uint64) ([]byte, error) + + // DataStart returns the writable data segment start address. + DataStart() uint64 +} + +// openExe opens file and returns it as an exe. +func openExe(file string) (exe, error) { + f, err := os.Open(file) + if err != nil { + return nil, err + } + data := make([]byte, 16) + if _, err := io.ReadFull(f, data); err != nil { + return nil, err + } + f.Seek(0, 0) + if bytes.HasPrefix(data, []byte("\x7FELF")) { + e, err := elf.NewFile(f) + if err != nil { + f.Close() + return nil, err + } + return &elfExe{f, e}, nil + } + if bytes.HasPrefix(data, []byte("MZ")) { + e, err := pe.NewFile(f) + if err != nil { + f.Close() + return nil, err + } + return &peExe{f, e}, nil + } + if bytes.HasPrefix(data, []byte("\xFE\xED\xFA")) || bytes.HasPrefix(data[1:], []byte("\xFA\xED\xFE")) { + e, err := macho.NewFile(f) + if err != nil { + f.Close() + return nil, err + } + return &machoExe{f, e}, nil + } + if bytes.HasPrefix(data, []byte{0x01, 0xDF}) || bytes.HasPrefix(data, []byte{0x01, 0xF7}) { + e, err := xcoff.NewFile(f) + if err != nil { + f.Close() + return nil, err + } + return &xcoffExe{f, e}, nil + + } + return nil, fmt.Errorf("unrecognized executable format") +} + +// elfExe is the ELF implementation of the exe interface. +type elfExe struct { + os *os.File + f *elf.File +} + +func (x *elfExe) Close() error { + return x.os.Close() +} + +func (x *elfExe) ReadData(addr, size uint64) ([]byte, error) { + for _, prog := range x.f.Progs { + if prog.Vaddr <= addr && addr <= prog.Vaddr+prog.Filesz-1 { + n := prog.Vaddr + prog.Filesz - addr + if n > size { + n = size + } + data := make([]byte, n) + _, err := prog.ReadAt(data, int64(addr-prog.Vaddr)) + if err != nil { + return nil, err + } + return data, nil + } + } + return nil, fmt.Errorf("address not mapped") +} + +func (x *elfExe) DataStart() uint64 { + for _, p := range x.f.Progs { + if p.Type == elf.PT_LOAD && p.Flags&(elf.PF_X|elf.PF_W) == elf.PF_W { + return p.Vaddr + } + } + return 0 +} + +// peExe is the PE (Windows Portable Executable) implementation of the exe interface. +type peExe struct { + os *os.File + f *pe.File +} + +func (x *peExe) Close() error { + return x.os.Close() +} + +func (x *peExe) imageBase() uint64 { + switch oh := x.f.OptionalHeader.(type) { + case *pe.OptionalHeader32: + return uint64(oh.ImageBase) + case *pe.OptionalHeader64: + return oh.ImageBase + } + return 0 +} + +func (x *peExe) ReadData(addr, size uint64) ([]byte, error) { + addr -= x.imageBase() + for _, sect := range x.f.Sections { + if uint64(sect.VirtualAddress) <= addr && addr <= uint64(sect.VirtualAddress+sect.Size-1) { + n := uint64(sect.VirtualAddress+sect.Size) - addr + if n > size { + n = size + } + data := make([]byte, n) + _, err := sect.ReadAt(data, int64(addr-uint64(sect.VirtualAddress))) + if err != nil { + return nil, err + } + return data, nil + } + } + return nil, fmt.Errorf("address not mapped") +} + +func (x *peExe) DataStart() uint64 { + // Assume data is first writable section. + const ( + IMAGE_SCN_CNT_CODE = 0x00000020 + IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040 + IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080 + IMAGE_SCN_MEM_EXECUTE = 0x20000000 + IMAGE_SCN_MEM_READ = 0x40000000 + IMAGE_SCN_MEM_WRITE = 0x80000000 + IMAGE_SCN_MEM_DISCARDABLE = 0x2000000 + IMAGE_SCN_LNK_NRELOC_OVFL = 0x1000000 + IMAGE_SCN_ALIGN_32BYTES = 0x600000 + ) + for _, sect := range x.f.Sections { + if sect.VirtualAddress != 0 && sect.Size != 0 && + sect.Characteristics&^IMAGE_SCN_ALIGN_32BYTES == IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE { + return uint64(sect.VirtualAddress) + x.imageBase() + } + } + return 0 +} + +// machoExe is the Mach-O (Apple macOS/iOS) implementation of the exe interface. +type machoExe struct { + os *os.File + f *macho.File +} + +func (x *machoExe) Close() error { + return x.os.Close() +} + +func (x *machoExe) ReadData(addr, size uint64) ([]byte, error) { + for _, load := range x.f.Loads { + seg, ok := load.(*macho.Segment) + if !ok { + continue + } + if seg.Addr <= addr && addr <= seg.Addr+seg.Filesz-1 { + if seg.Name == "__PAGEZERO" { + continue + } + n := seg.Addr + seg.Filesz - addr + if n > size { + n = size + } + data := make([]byte, n) + _, err := seg.ReadAt(data, int64(addr-seg.Addr)) + if err != nil { + return nil, err + } + return data, nil + } + } + return nil, fmt.Errorf("address not mapped") +} + +func (x *machoExe) DataStart() uint64 { + // Assume data is first non-empty writable segment. + const RW = 3 + for _, load := range x.f.Loads { + seg, ok := load.(*macho.Segment) + if ok && seg.Addr != 0 && seg.Filesz != 0 && seg.Prot == RW && seg.Maxprot == RW { + return seg.Addr + } + } + return 0 +} + +// xcoffExe is the XCOFF (AIX eXtended COFF) implementation of the exe interface. +type xcoffExe struct { + os *os.File + f *xcoff.File +} + +func (x *xcoffExe) Close() error { + return x.os.Close() +} + +func (x *xcoffExe) ReadData(addr, size uint64) ([]byte, error) { + for _, sect := range x.f.Sections { + if uint64(sect.VirtualAddress) <= addr && addr <= uint64(sect.VirtualAddress+sect.Size-1) { + n := uint64(sect.VirtualAddress+sect.Size) - addr + if n > size { + n = size + } + data := make([]byte, n) + _, err := sect.ReadAt(data, int64(addr-uint64(sect.VirtualAddress))) + if err != nil { + return nil, err + } + return data, nil + } + } + return nil, fmt.Errorf("address not mapped") +} + +func (x *xcoffExe) DataStart() uint64 { + return x.f.SectionByType(xcoff.STYP_DATA).VirtualAddress +} diff --git a/libgo/go/cmd/go/internal/version/version.go b/libgo/go/cmd/go/internal/version/version.go index 9344a28dc36..857548c7ed8 100644 --- a/libgo/go/cmd/go/internal/version/version.go +++ b/libgo/go/cmd/go/internal/version/version.go @@ -6,23 +6,196 @@ package version import ( + "bytes" + "encoding/binary" "fmt" + "os" + "path/filepath" "runtime" + "strings" "cmd/go/internal/base" ) var CmdVersion = &base.Command{ - Run: runVersion, - UsageLine: "go version", + UsageLine: "go version [-m] [-v] [file ...]", Short: "print Go version", - Long: `Version prints the Go version, as reported by runtime.Version.`, + Long: `Version prints the build information for Go executables. + +Go version reports the Go version used to build each of the named +executable files. + +If no files are named on the command line, go version prints its own +version information. + +If a directory is named, go version walks that directory, recursively, +looking for recognized Go binaries and reporting their versions. +By default, go version does not report unrecognized files found +during a directory scan. The -v flag causes it to report unrecognized files. + +The -m flag causes go version to print each executable's embedded +module version information, when available. In the output, the module +information consists of multiple lines following the version line, each +indented by a leading tab character. + +See also: go doc runtime/debug.BuildInfo. +`, } +func init() { + CmdVersion.Run = runVersion // break init cycle +} + +var ( + versionM = CmdVersion.Flag.Bool("m", false, "") + versionV = CmdVersion.Flag.Bool("v", false, "") +) + func runVersion(cmd *base.Command, args []string) { - if len(args) != 0 { - cmd.Usage() + if len(args) == 0 { + fmt.Printf("go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) + return + } + + for _, arg := range args { + info, err := os.Stat(arg) + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + continue + } + if info.IsDir() { + scanDir(arg) + } else { + scanFile(arg, info, true) + } + } +} + +// scanDir scans a directory for executables to run scanFile on. +func scanDir(dir string) { + filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if info.Mode().IsRegular() || info.Mode()&os.ModeSymlink != 0 { + scanFile(path, info, *versionV) + } + return nil + }) +} + +// isExe reports whether the file should be considered executable. +func isExe(file string, info os.FileInfo) bool { + if runtime.GOOS == "windows" { + return strings.HasSuffix(strings.ToLower(file), ".exe") + } + return info.Mode().IsRegular() && info.Mode()&0111 != 0 +} + +// scanFile scans file to try to report the Go and module versions. +// If mustPrint is true, scanFile will report any error reading file. +// Otherwise (mustPrint is false, because scanFile is being called +// by scanDir) scanFile prints nothing for non-Go executables. +func scanFile(file string, info os.FileInfo, mustPrint bool) { + if info.Mode()&os.ModeSymlink != 0 { + // Accept file symlinks only. + i, err := os.Stat(file) + if err != nil || !i.Mode().IsRegular() { + if mustPrint { + fmt.Fprintf(os.Stderr, "%s: symlink\n", file) + } + return + } + info = i + } + if !isExe(file, info) { + if mustPrint { + fmt.Fprintf(os.Stderr, "%s: not executable file\n", file) + } + return } - fmt.Printf("go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) + x, err := openExe(file) + if err != nil { + if mustPrint { + fmt.Fprintf(os.Stderr, "%s: %v\n", file, err) + } + return + } + defer x.Close() + + vers, mod := findVers(x) + if vers == "" { + if mustPrint { + fmt.Fprintf(os.Stderr, "%s: go version not found\n", file) + } + return + } + + fmt.Printf("%s: %s\n", file, vers) + if *versionM && mod != "" { + fmt.Printf("\t%s\n", strings.Replace(mod[:len(mod)-1], "\n", "\n\t", -1)) + } +} + +// The build info blob left by the linker is identified by +// a 16-byte header, consisting of buildInfoMagic (14 bytes), +// the binary's pointer size (1 byte), +// and whether the binary is big endian (1 byte). +var buildInfoMagic = []byte("\xff Go buildinf:") + +// findVers finds and returns the Go version and module version information +// in the executable x. +func findVers(x exe) (vers, mod string) { + // Read the first 64kB of text to find the build info blob. + text := x.DataStart() + data, err := x.ReadData(text, 64*1024) + if err != nil { + return + } + for ; !bytes.HasPrefix(data, buildInfoMagic); data = data[32:] { + if len(data) < 32 { + return + } + } + + // Decode the blob. + ptrSize := int(data[14]) + bigEndian := data[15] != 0 + var bo binary.ByteOrder + if bigEndian { + bo = binary.BigEndian + } else { + bo = binary.LittleEndian + } + var readPtr func([]byte) uint64 + if ptrSize == 4 { + readPtr = func(b []byte) uint64 { return uint64(bo.Uint32(b)) } + } else { + readPtr = bo.Uint64 + } + vers = readString(x, ptrSize, readPtr, readPtr(data[16:])) + if vers == "" { + return + } + mod = readString(x, ptrSize, readPtr, readPtr(data[16+ptrSize:])) + if len(mod) >= 33 && mod[len(mod)-17] == '\n' { + // Strip module framing. + mod = mod[16 : len(mod)-16] + } else { + mod = "" + } + return +} + +// readString returns the string at address addr in the executable x. +func readString(x exe, ptrSize int, readPtr func([]byte) uint64, addr uint64) string { + hdr, err := x.ReadData(addr, uint64(2*ptrSize)) + if err != nil || len(hdr) < 2*ptrSize { + return "" + } + dataAddr := readPtr(hdr) + dataLen := readPtr(hdr[ptrSize:]) + data, err := x.ReadData(dataAddr, dataLen) + if err != nil || uint64(len(data)) < dataLen { + return "" + } + return string(data) } diff --git a/libgo/go/cmd/go/internal/vet/vet.go b/libgo/go/cmd/go/internal/vet/vet.go index 3d828a2a4a4..327b761c3cd 100644 --- a/libgo/go/cmd/go/internal/vet/vet.go +++ b/libgo/go/cmd/go/internal/vet/vet.go @@ -69,7 +69,7 @@ func runVet(cmd *base.Command, args []string) { root := &work.Action{Mode: "go vet"} for _, p := range pkgs { - _, ptest, pxtest, err := load.GetTestPackagesFor(p, nil) + _, ptest, pxtest, err := load.TestPackagesFor(p, nil) if err != nil { base.Errorf("%v", err) continue diff --git a/libgo/go/cmd/go/internal/web/api.go b/libgo/go/cmd/go/internal/web/api.go new file mode 100644 index 00000000000..cd0e19d3ffd --- /dev/null +++ b/libgo/go/cmd/go/internal/web/api.go @@ -0,0 +1,133 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package web defines minimal helper routines for accessing HTTP/HTTPS +// resources without requiring external dependenicies on the net package. +// +// If the cmd_go_bootstrap build tag is present, web avoids the use of the net +// package and returns errors for all network operations. +package web + +import ( + "fmt" + "io" + "io/ioutil" + "net/url" + "os" + "strings" +) + +// SecurityMode specifies whether a function should make network +// calls using insecure transports (eg, plain text HTTP). +// The zero value is "secure". +type SecurityMode int + +const ( + SecureOnly SecurityMode = iota // Reject plain HTTP; validate HTTPS. + DefaultSecurity // Allow plain HTTP if explicit; validate HTTPS. + Insecure // Allow plain HTTP if not explicitly HTTPS; skip HTTPS validation. +) + +// An HTTPError describes an HTTP error response (non-200 result). +type HTTPError struct { + URL string // redacted + Status string + StatusCode int +} + +func (e *HTTPError) Error() string { + return fmt.Sprintf("reading %s: %v", e.URL, e.Status) +} + +func (e *HTTPError) Is(target error) bool { + return target == os.ErrNotExist && (e.StatusCode == 404 || e.StatusCode == 410) +} + +// GetBytes returns the body of the requested resource, or an error if the +// response status was not http.StatusOK. +// +// GetBytes is a convenience wrapper around Get and Response.Err. +func GetBytes(u *url.URL) ([]byte, error) { + resp, err := Get(DefaultSecurity, u) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if err := resp.Err(); err != nil { + return nil, err + } + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("reading %s: %v", Redacted(u), err) + } + return b, nil +} + +type Response struct { + URL string // redacted + Status string + StatusCode int + Header map[string][]string + Body io.ReadCloser +} + +// Err returns an *HTTPError corresponding to the response r. +// It returns nil if the response r has StatusCode 200 or 0 (unset). +func (r *Response) Err() error { + if r.StatusCode == 200 || r.StatusCode == 0 { + return nil + } + return &HTTPError{URL: r.URL, Status: r.Status, StatusCode: r.StatusCode} +} + +// Get returns the body of the HTTP or HTTPS resource specified at the given URL. +// +// If the URL does not include an explicit scheme, Get first tries "https". +// If the server does not respond under that scheme and the security mode is +// Insecure, Get then tries "http". +// The URL included in the response indicates which scheme was actually used, +// and it is a redacted URL suitable for use in error messages. +// +// For the "https" scheme only, credentials are attached using the +// cmd/go/internal/auth package. If the URL itself includes a username and +// password, it will not be attempted under the "http" scheme unless the +// security mode is Insecure. +// +// Get returns a non-nil error only if the request did not receive a response +// under any applicable scheme. (A non-2xx response does not cause an error.) +func Get(security SecurityMode, u *url.URL) (*Response, error) { + return get(security, u) +} + +// Redacted returns a redacted string form of the URL, +// suitable for printing in error messages. +// The string form replaces any non-empty password +// in the original URL with "[redacted]". +func Redacted(u *url.URL) string { + if u.User != nil { + if _, ok := u.User.Password(); ok { + redacted := *u + redacted.User = url.UserPassword(u.User.Username(), "[redacted]") + u = &redacted + } + } + return u.String() +} + +// OpenBrowser attempts to open the requested URL in a web browser. +func OpenBrowser(url string) (opened bool) { + return openBrowser(url) +} + +// Join returns the result of adding the slash-separated +// path elements to the end of u's path. +func Join(u *url.URL, path string) *url.URL { + j := *u + if path == "" { + return &j + } + j.Path = strings.TrimSuffix(u.Path, "/") + "/" + strings.TrimPrefix(path, "/") + j.RawPath = strings.TrimSuffix(u.RawPath, "/") + "/" + strings.TrimPrefix(path, "/") + return &j +} diff --git a/libgo/go/cmd/go/internal/web/bootstrap.go b/libgo/go/cmd/go/internal/web/bootstrap.go index d1d4621a44b..781702100a0 100644 --- a/libgo/go/cmd/go/internal/web/bootstrap.go +++ b/libgo/go/cmd/go/internal/web/bootstrap.go @@ -6,32 +6,18 @@ // This code is compiled only into the bootstrap 'go' binary. // These stubs avoid importing packages with large dependency -// trees, like the use of "net/http" in vcs.go. +// trees that potentially require C linking, +// like the use of "net/http" in vcs.go. package web import ( "errors" - "io" + urlpkg "net/url" ) -var errHTTP = errors.New("no http in bootstrap go command") - -type HTTPError struct { - StatusCode int -} - -func (e *HTTPError) Error() string { - panic("unreachable") -} - -func Get(url string) ([]byte, error) { - return nil, errHTTP -} - -func GetMaybeInsecure(importPath string, security SecurityMode) (string, io.ReadCloser, error) { - return "", nil, errHTTP +func get(security SecurityMode, url *urlpkg.URL) (*Response, error) { + return nil, errors.New("no http in bootstrap go command") } -func QueryEscape(s string) string { panic("unreachable") } -func OpenBrowser(url string) bool { panic("unreachable") } +func openBrowser(url string) bool { return false } diff --git a/libgo/go/cmd/go/internal/web/file_test.go b/libgo/go/cmd/go/internal/web/file_test.go new file mode 100644 index 00000000000..e31ad71d4d9 --- /dev/null +++ b/libgo/go/cmd/go/internal/web/file_test.go @@ -0,0 +1,58 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package web + +import ( + "errors" + "io/ioutil" + "os" + "path/filepath" + "testing" +) + +func TestGetFileURL(t *testing.T) { + const content = "Hello, file!\n" + + f, err := ioutil.TempFile("", "web-TestGetFileURL") + if err != nil { + t.Fatal(err) + } + if _, err := f.WriteString(content); err != nil { + t.Error(err) + } + if err := f.Close(); err != nil { + t.Fatal(err) + } + + u, err := urlFromFilePath(f.Name()) + if err != nil { + t.Fatal(err) + } + + b, err := GetBytes(u) + if err != nil { + t.Fatalf("GetBytes(%v) = _, %v", u, err) + } + if string(b) != content { + t.Fatalf("after writing %q to %s, GetBytes(%v) read %q", content, f.Name(), u, b) + } +} + +func TestGetNonexistentFile(t *testing.T) { + path, err := filepath.Abs("nonexistent") + if err != nil { + t.Fatal(err) + } + + u, err := urlFromFilePath(path) + if err != nil { + t.Fatal(err) + } + + b, err := GetBytes(u) + if !errors.Is(err, os.ErrNotExist) { + t.Fatalf("GetBytes(%v) = %q, %v; want _, os.ErrNotExist", u, b, err) + } +} diff --git a/libgo/go/cmd/go/internal/web/http.go b/libgo/go/cmd/go/internal/web/http.go index 6e347fbf860..b790fe9916e 100644 --- a/libgo/go/cmd/go/internal/web/http.go +++ b/libgo/go/cmd/go/internal/web/http.go @@ -14,21 +14,18 @@ package web import ( "crypto/tls" "fmt" - "io" "io/ioutil" - "log" "net/http" - "net/url" + urlpkg "net/url" + "os" + "strings" "time" + "cmd/go/internal/auth" "cmd/go/internal/cfg" "cmd/internal/browser" ) -// httpClient is the default HTTP client, but a variable so it can be -// changed by tests, without modifying http.DefaultClient. -var httpClient = http.DefaultClient - // impatientInsecureHTTPClient is used in -insecure mode, // when we're connecting to https servers that might not be there // or might be using self-signed certificates. @@ -42,81 +39,179 @@ var impatientInsecureHTTPClient = &http.Client{ }, } -type HTTPError struct { - status string - StatusCode int - url string +// securityPreservingHTTPClient is like the default HTTP client, but rejects +// redirects to plain-HTTP URLs if the original URL was secure. +var securityPreservingHTTPClient = &http.Client{ + CheckRedirect: func(req *http.Request, via []*http.Request) error { + if len(via) > 0 && via[0].URL.Scheme == "https" && req.URL.Scheme != "https" { + lastHop := via[len(via)-1].URL + return fmt.Errorf("redirected from secure URL %s to insecure URL %s", lastHop, req.URL) + } + return nil + }, } -func (e *HTTPError) Error() string { - return fmt.Sprintf("%s: %s", e.url, e.status) -} +func get(security SecurityMode, url *urlpkg.URL) (*Response, error) { + start := time.Now() -// Get returns the data from an HTTP GET request for the given URL. -func Get(url string) ([]byte, error) { - resp, err := httpClient.Get(url) - if err != nil { - return nil, err + if url.Scheme == "file" { + return getFile(url) } - defer resp.Body.Close() - if resp.StatusCode != 200 { - err := &HTTPError{status: resp.Status, StatusCode: resp.StatusCode, url: url} - return nil, err - } - b, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("%s: %v", url, err) + if os.Getenv("TESTGOPROXY404") == "1" && url.Host == "proxy.golang.org" { + res := &Response{ + URL: Redacted(url), + Status: "404 testing", + StatusCode: 404, + Header: make(map[string][]string), + Body: ioutil.NopCloser(strings.NewReader("")), + } + if cfg.BuildX { + fmt.Fprintf(os.Stderr, "# get %s: %v (%.3fs)\n", Redacted(url), res.Status, time.Since(start).Seconds()) + } + return res, nil } - return b, nil -} -// GetMaybeInsecure returns the body of either the importPath's -// https resource or, if unavailable and permitted by the security mode, the http resource. -func GetMaybeInsecure(importPath string, security SecurityMode) (urlStr string, body io.ReadCloser, err error) { - fetch := func(scheme string) (urlStr string, res *http.Response, err error) { - u, err := url.Parse(scheme + "://" + importPath) + fetch := func(url *urlpkg.URL) (*urlpkg.URL, *http.Response, error) { + // Note: The -v build flag does not mean "print logging information", + // despite its historical misuse for this in GOPATH-based go get. + // We print extra logging in -x mode instead, which traces what + // commands are executed. + if cfg.BuildX { + fmt.Fprintf(os.Stderr, "# get %s\n", Redacted(url)) + } + + req, err := http.NewRequest("GET", url.String(), nil) if err != nil { - return "", nil, err + return nil, nil, err } - u.RawQuery = "go-get=1" - urlStr = u.String() - if cfg.BuildV { - log.Printf("Fetching %s", urlStr) + if url.Scheme == "https" { + auth.AddCredentials(req) } - if security == Insecure && scheme == "https" { // fail earlier - res, err = impatientInsecureHTTPClient.Get(urlStr) + + var res *http.Response + if security == Insecure && url.Scheme == "https" { // fail earlier + res, err = impatientInsecureHTTPClient.Do(req) } else { - res, err = httpClient.Get(urlStr) + res, err = securityPreservingHTTPClient.Do(req) } - return + return url, res, err } - closeBody := func(res *http.Response) { - if res != nil { - res.Body.Close() + + var ( + fetched *urlpkg.URL + res *http.Response + err error + ) + if url.Scheme == "" || url.Scheme == "https" { + secure := new(urlpkg.URL) + *secure = *url + secure.Scheme = "https" + + fetched, res, err = fetch(secure) + if err != nil { + if cfg.BuildX { + fmt.Fprintf(os.Stderr, "# get %s: %v\n", Redacted(url), err) + } + if security != Insecure || url.Scheme == "https" { + // HTTPS failed, and we can't fall back to plain HTTP. + // Report the error from the HTTPS attempt. + return nil, err + } } } - urlStr, res, err := fetch("https") - if err != nil { - if cfg.BuildV { - log.Printf("https fetch failed: %v", err) + + if res == nil { + switch url.Scheme { + case "http": + if security == SecureOnly { + if cfg.BuildX { + fmt.Fprintf(os.Stderr, "# get %s: insecure\n", Redacted(url)) + } + return nil, fmt.Errorf("insecure URL: %s", Redacted(url)) + } + case "": + if security != Insecure { + panic("should have returned after HTTPS failure") + } + default: + if cfg.BuildX { + fmt.Fprintf(os.Stderr, "# get %s: unsupported\n", Redacted(url)) + } + return nil, fmt.Errorf("unsupported scheme: %s", Redacted(url)) + } + + insecure := new(urlpkg.URL) + *insecure = *url + insecure.Scheme = "http" + if insecure.User != nil && security != Insecure { + if cfg.BuildX { + fmt.Fprintf(os.Stderr, "# get %s: insecure credentials\n", Redacted(url)) + } + return nil, fmt.Errorf("refusing to pass credentials to insecure URL: %s", Redacted(insecure)) } - if security == Insecure { - closeBody(res) - urlStr, res, err = fetch("http") + + fetched, res, err = fetch(insecure) + if err != nil { + if cfg.BuildX { + fmt.Fprintf(os.Stderr, "# get %s: %v\n", Redacted(url), err) + } + // HTTP failed, and we already tried HTTPS if applicable. + // Report the error from the HTTP attempt. + return nil, err } } - if err != nil { - closeBody(res) - return "", nil, err - } + // Note: accepting a non-200 OK here, so people can serve a // meta import in their http 404 page. - if cfg.BuildV { - log.Printf("Parsing meta tags from %s (status code %d)", urlStr, res.StatusCode) + if cfg.BuildX { + fmt.Fprintf(os.Stderr, "# get %s: %v (%.3fs)\n", Redacted(url), res.Status, time.Since(start).Seconds()) } - return urlStr, res.Body, nil + r := &Response{ + URL: Redacted(fetched), + Status: res.Status, + StatusCode: res.StatusCode, + Header: map[string][]string(res.Header), + Body: res.Body, + } + return r, nil +} + +func getFile(u *urlpkg.URL) (*Response, error) { + path, err := urlToFilePath(u) + if err != nil { + return nil, err + } + f, err := os.Open(path) + + if os.IsNotExist(err) { + return &Response{ + URL: Redacted(u), + Status: http.StatusText(http.StatusNotFound), + StatusCode: http.StatusNotFound, + Body: http.NoBody, + }, nil + } + + if os.IsPermission(err) { + return &Response{ + URL: Redacted(u), + Status: http.StatusText(http.StatusForbidden), + StatusCode: http.StatusForbidden, + Body: http.NoBody, + }, nil + } + + if err != nil { + return nil, err + } + + return &Response{ + URL: Redacted(u), + Status: http.StatusText(http.StatusOK), + StatusCode: http.StatusOK, + Body: f, + }, nil } -func QueryEscape(s string) string { return url.QueryEscape(s) } -func OpenBrowser(url string) bool { return browser.Open(url) } +func openBrowser(url string) bool { return browser.Open(url) } diff --git a/libgo/go/cmd/go/internal/web/security.go b/libgo/go/cmd/go/internal/web/security.go deleted file mode 100644 index 1dc6f1b076f..00000000000 --- a/libgo/go/cmd/go/internal/web/security.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package web defines helper routines for accessing HTTP/HTTPS resources. -package web - -// SecurityMode specifies whether a function should make network -// calls using insecure transports (eg, plain text HTTP). -// The zero value is "secure". -type SecurityMode int - -const ( - Secure SecurityMode = iota - Insecure -) diff --git a/libgo/go/cmd/go/internal/web/url.go b/libgo/go/cmd/go/internal/web/url.go new file mode 100644 index 00000000000..146c51f0aec --- /dev/null +++ b/libgo/go/cmd/go/internal/web/url.go @@ -0,0 +1,95 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package web + +import ( + "errors" + "net/url" + "path/filepath" + "strings" +) + +// TODO(golang.org/issue/32456): If accepted, move these functions into the +// net/url package. + +var errNotAbsolute = errors.New("path is not absolute") + +func urlToFilePath(u *url.URL) (string, error) { + if u.Scheme != "file" { + return "", errors.New("non-file URL") + } + + checkAbs := func(path string) (string, error) { + if !filepath.IsAbs(path) { + return "", errNotAbsolute + } + return path, nil + } + + if u.Path == "" { + if u.Host != "" || u.Opaque == "" { + return "", errors.New("file URL missing path") + } + return checkAbs(filepath.FromSlash(u.Opaque)) + } + + path, err := convertFileURLPath(u.Host, u.Path) + if err != nil { + return path, err + } + return checkAbs(path) +} + +func urlFromFilePath(path string) (*url.URL, error) { + if !filepath.IsAbs(path) { + return nil, errNotAbsolute + } + + // If path has a Windows volume name, convert the volume to a host and prefix + // per https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/. + if vol := filepath.VolumeName(path); vol != "" { + if strings.HasPrefix(vol, `\\`) { + path = filepath.ToSlash(path[2:]) + i := strings.IndexByte(path, '/') + + if i < 0 { + // A degenerate case. + // \\host.example.com (without a share name) + // becomes + // file://host.example.com/ + return &url.URL{ + Scheme: "file", + Host: path, + Path: "/", + }, nil + } + + // \\host.example.com\Share\path\to\file + // becomes + // file://host.example.com/Share/path/to/file + return &url.URL{ + Scheme: "file", + Host: path[:i], + Path: filepath.ToSlash(path[i:]), + }, nil + } + + // C:\path\to\file + // becomes + // file:///C:/path/to/file + return &url.URL{ + Scheme: "file", + Path: "/" + filepath.ToSlash(path), + }, nil + } + + // /path/to/file + // becomes + // file:///path/to/file + return &url.URL{ + Scheme: "file", + Path: filepath.ToSlash(path), + }, nil +} diff --git a/libgo/go/cmd/go/internal/web/url_other.go b/libgo/go/cmd/go/internal/web/url_other.go new file mode 100644 index 00000000000..bd243e591a9 --- /dev/null +++ b/libgo/go/cmd/go/internal/web/url_other.go @@ -0,0 +1,21 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//+build !windows + +package web + +import ( + "errors" + "path/filepath" +) + +func convertFileURLPath(host, path string) (string, error) { + switch host { + case "", "localhost": + default: + return "", errors.New("file URL specifies non-local host") + } + return filepath.FromSlash(path), nil +} diff --git a/libgo/go/cmd/go/internal/web/url_other_test.go b/libgo/go/cmd/go/internal/web/url_other_test.go new file mode 100644 index 00000000000..b4a74d94b93 --- /dev/null +++ b/libgo/go/cmd/go/internal/web/url_other_test.go @@ -0,0 +1,36 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//+build !windows + +package web + +var urlTests = []struct { + url string + filePath string + canonicalURL string // If empty, assume equal to url. + wantErr string +}{ + // Examples from RFC 8089: + { + url: `file:///path/to/file`, + filePath: `/path/to/file`, + }, + { + url: `file:/path/to/file`, + filePath: `/path/to/file`, + canonicalURL: `file:///path/to/file`, + }, + { + url: `file://localhost/path/to/file`, + filePath: `/path/to/file`, + canonicalURL: `file:///path/to/file`, + }, + + // We reject non-local files. + { + url: `file://host.example.com/path/to/file`, + wantErr: "file URL specifies non-local host", + }, +} diff --git a/libgo/go/cmd/go/internal/web/url_test.go b/libgo/go/cmd/go/internal/web/url_test.go new file mode 100644 index 00000000000..8f462f53259 --- /dev/null +++ b/libgo/go/cmd/go/internal/web/url_test.go @@ -0,0 +1,77 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package web + +import ( + "net/url" + "testing" +) + +func TestURLToFilePath(t *testing.T) { + for _, tc := range urlTests { + if tc.url == "" { + continue + } + tc := tc + + t.Run(tc.url, func(t *testing.T) { + u, err := url.Parse(tc.url) + if err != nil { + t.Fatalf("url.Parse(%q): %v", tc.url, err) + } + + path, err := urlToFilePath(u) + if err != nil { + if err.Error() == tc.wantErr { + return + } + if tc.wantErr == "" { + t.Fatalf("urlToFilePath(%v): %v; want ", u, err) + } else { + t.Fatalf("urlToFilePath(%v): %v; want %s", u, err, tc.wantErr) + } + } + + if path != tc.filePath || tc.wantErr != "" { + t.Fatalf("urlToFilePath(%v) = %q, ; want %q, %s", u, path, tc.filePath, tc.wantErr) + } + }) + } +} + +func TestURLFromFilePath(t *testing.T) { + for _, tc := range urlTests { + if tc.filePath == "" { + continue + } + tc := tc + + t.Run(tc.filePath, func(t *testing.T) { + u, err := urlFromFilePath(tc.filePath) + if err != nil { + if err.Error() == tc.wantErr { + return + } + if tc.wantErr == "" { + t.Fatalf("urlFromFilePath(%v): %v; want ", tc.filePath, err) + } else { + t.Fatalf("urlFromFilePath(%v): %v; want %s", tc.filePath, err, tc.wantErr) + } + } + + if tc.wantErr != "" { + t.Fatalf("urlFromFilePath(%v) = ; want error: %s", tc.filePath, tc.wantErr) + } + + wantURL := tc.url + if tc.canonicalURL != "" { + wantURL = tc.canonicalURL + } + if u.String() != wantURL { + t.Errorf("urlFromFilePath(%v) = %v; want %s", tc.filePath, u, wantURL) + } + }) + } +} diff --git a/libgo/go/cmd/go/internal/web/url_windows.go b/libgo/go/cmd/go/internal/web/url_windows.go new file mode 100644 index 00000000000..2a65ec83f60 --- /dev/null +++ b/libgo/go/cmd/go/internal/web/url_windows.go @@ -0,0 +1,43 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package web + +import ( + "errors" + "path/filepath" + "strings" +) + +func convertFileURLPath(host, path string) (string, error) { + if len(path) == 0 || path[0] != '/' { + return "", errNotAbsolute + } + + path = filepath.FromSlash(path) + + // We interpret Windows file URLs per the description in + // https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/. + + // The host part of a file URL (if any) is the UNC volume name, + // but RFC 8089 reserves the authority "localhost" for the local machine. + if host != "" && host != "localhost" { + // A common "legacy" format omits the leading slash before a drive letter, + // encoding the drive letter as the host instead of part of the path. + // (See https://blogs.msdn.microsoft.com/freeassociations/2005/05/19/the-bizarre-and-unhappy-story-of-file-urls/.) + // We do not support that format, but we should at least emit a more + // helpful error message for it. + if filepath.VolumeName(host) != "" { + return "", errors.New("file URL encodes volume in host field: too few slashes?") + } + return `\\` + host + path, nil + } + + // If host is empty, path must contain an initial slash followed by a + // drive letter and path. Remove the slash and verify that the path is valid. + if vol := filepath.VolumeName(path[1:]); vol == "" || strings.HasPrefix(vol, `\\`) { + return "", errors.New("file URL missing drive letter") + } + return path[1:], nil +} diff --git a/libgo/go/cmd/go/internal/web/url_windows_test.go b/libgo/go/cmd/go/internal/web/url_windows_test.go new file mode 100644 index 00000000000..06386a03898 --- /dev/null +++ b/libgo/go/cmd/go/internal/web/url_windows_test.go @@ -0,0 +1,94 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package web + +var urlTests = []struct { + url string + filePath string + canonicalURL string // If empty, assume equal to url. + wantErr string +}{ + // Examples from https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/: + + { + url: `file://laptop/My%20Documents/FileSchemeURIs.doc`, + filePath: `\\laptop\My Documents\FileSchemeURIs.doc`, + }, + { + url: `file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc`, + filePath: `C:\Documents and Settings\davris\FileSchemeURIs.doc`, + }, + { + url: `file:///D:/Program%20Files/Viewer/startup.htm`, + filePath: `D:\Program Files\Viewer\startup.htm`, + }, + { + url: `file:///C:/Program%20Files/Music/Web%20Sys/main.html?REQUEST=RADIO`, + filePath: `C:\Program Files\Music\Web Sys\main.html`, + canonicalURL: `file:///C:/Program%20Files/Music/Web%20Sys/main.html`, + }, + { + url: `file://applib/products/a-b/abc_9/4148.920a/media/start.swf`, + filePath: `\\applib\products\a-b\abc_9\4148.920a\media\start.swf`, + }, + { + url: `file:////applib/products/a%2Db/abc%5F9/4148.920a/media/start.swf`, + wantErr: "file URL missing drive letter", + }, + { + url: `C:\Program Files\Music\Web Sys\main.html?REQUEST=RADIO`, + wantErr: "non-file URL", + }, + + // The example "file://D:\Program Files\Viewer\startup.htm" errors out in + // url.Parse, so we substitute a slash-based path for testing instead. + { + url: `file://D:/Program Files/Viewer/startup.htm`, + wantErr: "file URL encodes volume in host field: too few slashes?", + }, + + // The blog post discourages the use of non-ASCII characters because they + // depend on the user's current codepage. However, when we are working with Go + // strings we assume UTF-8 encoding, and our url package refuses to encode + // URLs to non-ASCII strings. + { + url: `file:///C:/exampleㄓ.txt`, + filePath: `C:\exampleㄓ.txt`, + canonicalURL: `file:///C:/example%E3%84%93.txt`, + }, + { + url: `file:///C:/example%E3%84%93.txt`, + filePath: `C:\exampleㄓ.txt`, + }, + + // Examples from RFC 8089: + + // We allow the drive-letter variation from section E.2, because it is + // simpler to support than not to. However, we do not generate the shorter + // form in the reverse direction. + { + url: `file:c:/path/to/file`, + filePath: `c:\path\to\file`, + canonicalURL: `file:///c:/path/to/file`, + }, + + // We encode the UNC share name as the authority following section E.3.1, + // because that is what the Microsoft blog post explicitly recommends. + { + url: `file://host.example.com/Share/path/to/file.txt`, + filePath: `\\host.example.com\Share\path\to\file.txt`, + }, + + // We decline the four- and five-slash variations from section E.3.2. + // The paths in these URLs would change meaning under path.Clean. + { + url: `file:////host.example.com/path/to/file`, + wantErr: "file URL missing drive letter", + }, + { + url: `file://///host.example.com/path/to/file`, + wantErr: "file URL missing drive letter", + }, +} diff --git a/libgo/go/cmd/go/internal/web2/web.go b/libgo/go/cmd/go/internal/web2/web.go deleted file mode 100644 index 64934f1d506..00000000000 --- a/libgo/go/cmd/go/internal/web2/web.go +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package web2 - -import ( - "bytes" - "cmd/go/internal/base" - "cmd/go/internal/cfg" - "encoding/json" - "flag" - "fmt" - "io" - "io/ioutil" - "log" - "net/http" - "os" - "path/filepath" - "runtime" - "runtime/debug" - "strings" - "sync" -) - -var TraceGET = false -var webstack = false - -func init() { - flag.BoolVar(&TraceGET, "webtrace", TraceGET, "trace GET requests") - flag.BoolVar(&webstack, "webstack", webstack, "print stack for GET requests") -} - -type netrcLine struct { - machine string - login string - password string -} - -var netrcOnce sync.Once -var netrc []netrcLine - -func parseNetrc(data string) []netrcLine { - var nrc []netrcLine - var l netrcLine - for _, line := range strings.Split(data, "\n") { - f := strings.Fields(line) - for i := 0; i < len(f)-1; i += 2 { - switch f[i] { - case "machine": - l.machine = f[i+1] - case "login": - l.login = f[i+1] - case "password": - l.password = f[i+1] - } - } - if l.machine != "" && l.login != "" && l.password != "" { - nrc = append(nrc, l) - l = netrcLine{} - } - } - return nrc -} - -func havePassword(machine string) bool { - netrcOnce.Do(readNetrc) - for _, line := range netrc { - if line.machine == machine { - return true - } - } - return false -} - -func netrcPath() string { - switch runtime.GOOS { - case "windows": - return filepath.Join(os.Getenv("USERPROFILE"), "_netrc") - case "plan9": - return filepath.Join(os.Getenv("home"), ".netrc") - default: - return filepath.Join(os.Getenv("HOME"), ".netrc") - } -} - -func readNetrc() { - data, err := ioutil.ReadFile(netrcPath()) - if err != nil { - return - } - netrc = parseNetrc(string(data)) -} - -type getState struct { - req *http.Request - resp *http.Response - body io.ReadCloser - non200ok bool -} - -type Option interface { - option(*getState) error -} - -func Non200OK() Option { - return optionFunc(func(g *getState) error { - g.non200ok = true - return nil - }) -} - -type optionFunc func(*getState) error - -func (f optionFunc) option(g *getState) error { - return f(g) -} - -func DecodeJSON(dst interface{}) Option { - return optionFunc(func(g *getState) error { - if g.resp != nil { - return json.NewDecoder(g.body).Decode(dst) - } - return nil - }) -} - -func ReadAllBody(body *[]byte) Option { - return optionFunc(func(g *getState) error { - if g.resp != nil { - var err error - *body, err = ioutil.ReadAll(g.body) - return err - } - return nil - }) -} - -func Body(body *io.ReadCloser) Option { - return optionFunc(func(g *getState) error { - if g.resp != nil { - *body = g.body - g.body = nil - } - return nil - }) -} - -func Header(hdr *http.Header) Option { - return optionFunc(func(g *getState) error { - if g.resp != nil { - *hdr = CopyHeader(g.resp.Header) - } - return nil - }) -} - -func CopyHeader(hdr http.Header) http.Header { - if hdr == nil { - return nil - } - h2 := make(http.Header) - for k, v := range hdr { - v2 := make([]string, len(v)) - copy(v2, v) - h2[k] = v2 - } - return h2 -} - -var cache struct { - mu sync.Mutex - byURL map[string]*cacheEntry -} - -type cacheEntry struct { - mu sync.Mutex - resp *http.Response - body []byte -} - -var httpDo = http.DefaultClient.Do - -func SetHTTPDoForTesting(do func(*http.Request) (*http.Response, error)) { - if do == nil { - do = http.DefaultClient.Do - } - httpDo = do -} - -func Get(url string, options ...Option) error { - if TraceGET || webstack || cfg.BuildV { - log.Printf("Fetching %s", url) - if webstack { - log.Println(string(debug.Stack())) - } - } - - req, err := http.NewRequest("GET", url, nil) - if err != nil { - return err - } - - netrcOnce.Do(readNetrc) - for _, l := range netrc { - if l.machine == req.URL.Host { - req.SetBasicAuth(l.login, l.password) - break - } - } - - g := &getState{req: req} - for _, o := range options { - if err := o.option(g); err != nil { - return err - } - } - - cache.mu.Lock() - e := cache.byURL[url] - if e == nil { - e = new(cacheEntry) - if !strings.HasPrefix(url, "file:") { - if cache.byURL == nil { - cache.byURL = make(map[string]*cacheEntry) - } - cache.byURL[url] = e - } - } - cache.mu.Unlock() - - e.mu.Lock() - if strings.HasPrefix(url, "file:") { - body, err := ioutil.ReadFile(req.URL.Path) - if err != nil { - e.mu.Unlock() - return err - } - e.body = body - e.resp = &http.Response{ - StatusCode: 200, - } - } else if e.resp == nil { - resp, err := httpDo(req) - if err != nil { - e.mu.Unlock() - return err - } - e.resp = resp - // TODO: Spool to temp file. - body, err := ioutil.ReadAll(resp.Body) - resp.Body.Close() - resp.Body = nil - if err != nil { - e.mu.Unlock() - return err - } - e.body = body - } - g.resp = e.resp - g.body = ioutil.NopCloser(bytes.NewReader(e.body)) - e.mu.Unlock() - - defer func() { - if g.body != nil { - g.body.Close() - } - }() - - if g.resp.StatusCode == 403 && req.URL.Host == "api.github.com" && !havePassword("api.github.com") { - base.Errorf("%s", githubMessage) - } - if !g.non200ok && g.resp.StatusCode != 200 { - return fmt.Errorf("unexpected status (%s): %v", url, g.resp.Status) - } - - for _, o := range options { - if err := o.option(g); err != nil { - return err - } - } - return err -} - -var githubMessage = `go: 403 response from api.github.com - -GitHub applies fairly small rate limits to unauthenticated users, and -you appear to be hitting them. To authenticate, please visit -https://github.com/settings/tokens and click "Generate New Token" to -create a Personal Access Token. The token only needs "public_repo" -scope, but you can add "repo" if you want to access private -repositories too. - -Add the token to your $HOME/.netrc (%USERPROFILE%\_netrc on Windows): - - machine api.github.com login YOU password TOKEN - -Sorry for the interruption. -` diff --git a/libgo/go/cmd/go/internal/web2/web_test.go b/libgo/go/cmd/go/internal/web2/web_test.go deleted file mode 100644 index c6f6b1eff4d..00000000000 --- a/libgo/go/cmd/go/internal/web2/web_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package web2 - -import ( - "reflect" - "testing" -) - -var testNetrc = ` -machine api.github.com - login user - password pwd - -machine incomlete.host - login justlogin - -machine test.host -login user2 -password pwd2 -` - -func TestReadNetrc(t *testing.T) { - lines := parseNetrc(testNetrc) - want := []netrcLine{ - {"api.github.com", "user", "pwd"}, - {"test.host", "user2", "pwd2"}, - } - - if !reflect.DeepEqual(lines, want) { - t.Errorf("parseNetrc:\nhave %q\nwant %q", lines, want) - } -} diff --git a/libgo/go/cmd/go/internal/webtest/test.go b/libgo/go/cmd/go/internal/webtest/test.go deleted file mode 100644 index 94b20a33ffc..00000000000 --- a/libgo/go/cmd/go/internal/webtest/test.go +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package webtest - -import ( - "bufio" - "bytes" - "encoding/hex" - "flag" - "fmt" - "io" - "io/ioutil" - "log" - "net/http" - "os" - "sort" - "strconv" - "strings" - "sync" - "unicode/utf8" - - web "cmd/go/internal/web2" -) - -var mode = flag.String("webtest", "replay", "set webtest `mode` - record, replay, bypass") - -func Hook() { - if *mode == "bypass" { - return - } - web.SetHTTPDoForTesting(Do) -} - -func Unhook() { - web.SetHTTPDoForTesting(nil) -} - -func Print() { - web.SetHTTPDoForTesting(DoPrint) -} - -var responses struct { - mu sync.Mutex - byURL map[string]*respEntry -} - -type respEntry struct { - status string - code int - hdr http.Header - body []byte -} - -func Serve(url string, status string, hdr http.Header, body []byte) { - if status == "" { - status = "200 OK" - } - code, err := strconv.Atoi(strings.Fields(status)[0]) - if err != nil { - panic("bad Serve status - " + status + " - " + err.Error()) - } - - responses.mu.Lock() - defer responses.mu.Unlock() - - if responses.byURL == nil { - responses.byURL = make(map[string]*respEntry) - } - responses.byURL[url] = &respEntry{status: status, code: code, hdr: web.CopyHeader(hdr), body: body} -} - -func Do(req *http.Request) (*http.Response, error) { - if req.Method != "GET" { - return nil, fmt.Errorf("bad method - must be GET") - } - - responses.mu.Lock() - e := responses.byURL[req.URL.String()] - responses.mu.Unlock() - - if e == nil { - if *mode == "record" { - loaded.mu.Lock() - if len(loaded.did) != 1 { - loaded.mu.Unlock() - return nil, fmt.Errorf("cannot use -webtest=record with multiple loaded response files") - } - var file string - for file = range loaded.did { - break - } - loaded.mu.Unlock() - return doSave(file, req) - } - e = &respEntry{code: 599, status: "599 unexpected request (no canned response)"} - } - resp := &http.Response{ - Status: e.status, - StatusCode: e.code, - Header: web.CopyHeader(e.hdr), - Body: ioutil.NopCloser(bytes.NewReader(e.body)), - } - return resp, nil -} - -func DoPrint(req *http.Request) (*http.Response, error) { - return doSave("", req) -} - -func doSave(file string, req *http.Request) (*http.Response, error) { - resp, err := http.DefaultClient.Do(req) - if err != nil { - return nil, err - } - data, err := ioutil.ReadAll(resp.Body) - resp.Body.Close() - if err != nil { - return nil, err - } - resp.Body = ioutil.NopCloser(bytes.NewReader(data)) - - var f *os.File - if file == "" { - f = os.Stderr - } else { - f, err = os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) - if err != nil { - log.Fatal(err) - } - defer f.Close() - } - - fmt.Fprintf(f, "GET %s\n", req.URL.String()) - fmt.Fprintf(f, "%s\n", resp.Status) - var keys []string - for k := range resp.Header { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - if k == "Set-Cookie" { - continue - } - for _, v := range resp.Header[k] { - fmt.Fprintf(f, "%s: %s\n", k, v) - } - } - fmt.Fprintf(f, "\n") - if utf8.Valid(data) && !bytes.Contains(data, []byte("\nGET")) && !isHexDump(data) { - fmt.Fprintf(f, "%s\n\n", data) - } else { - fmt.Fprintf(f, "%s\n", hex.Dump(data)) - } - return resp, err -} - -var loaded struct { - mu sync.Mutex - did map[string]bool -} - -func LoadOnce(file string) { - loaded.mu.Lock() - if loaded.did[file] { - loaded.mu.Unlock() - return - } - if loaded.did == nil { - loaded.did = make(map[string]bool) - } - loaded.did[file] = true - loaded.mu.Unlock() - - f, err := os.Open(file) - if err != nil { - log.Fatal(err) - } - defer f.Close() - - b := bufio.NewReader(f) - var ungetLine string - nextLine := func() string { - if ungetLine != "" { - l := ungetLine - ungetLine = "" - return l - } - line, err := b.ReadString('\n') - if err != nil { - if err == io.EOF { - return "" - } - log.Fatalf("%s: unexpected read error: %v", file, err) - } - return line - } - - for { - line := nextLine() - if line == "" { // EOF - break - } - line = strings.TrimSpace(line) - if strings.HasPrefix(line, "#") || line == "" { - continue - } - if !strings.HasPrefix(line, "GET ") { - log.Fatalf("%s: malformed GET line: %s", file, line) - } - url := line[len("GET "):] - status := nextLine() - if _, err := strconv.Atoi(strings.Fields(status)[0]); err != nil { - log.Fatalf("%s: malformed status line (after GET %s): %s", file, url, status) - } - hdr := make(http.Header) - for { - kv := strings.TrimSpace(nextLine()) - if kv == "" { - break - } - i := strings.Index(kv, ":") - if i < 0 { - log.Fatalf("%s: malformed header line (after GET %s): %s", file, url, kv) - } - k, v := kv[:i], strings.TrimSpace(kv[i+1:]) - hdr[k] = append(hdr[k], v) - } - - var body []byte - Body: - for n := 0; ; n++ { - line := nextLine() - if n == 0 && isHexDump([]byte(line)) { - ungetLine = line - b, err := parseHexDump(nextLine) - if err != nil { - log.Fatalf("%s: malformed hex dump (after GET %s): %v", file, url, err) - } - body = b - break - } - if line == "" { // EOF - for i := 0; i < 2; i++ { - if len(body) > 0 && body[len(body)-1] == '\n' { - body = body[:len(body)-1] - } - } - break - } - body = append(body, line...) - for line == "\n" { - line = nextLine() - if strings.HasPrefix(line, "GET ") { - ungetLine = line - body = body[:len(body)-1] - if len(body) > 0 { - body = body[:len(body)-1] - } - break Body - } - body = append(body, line...) - } - } - - Serve(url, status, hdr, body) - } -} - -func isHexDump(data []byte) bool { - return bytes.HasPrefix(data, []byte("00000000 ")) || bytes.HasPrefix(data, []byte("0000000 ")) -} - -// parseHexDump parses the hex dump in text, which should be the -// output of "hexdump -C" or Plan 9's "xd -b" or Go's hex.Dump -// and returns the original data used to produce the dump. -// It is meant to enable storing golden binary files as text, so that -// changes to the golden files can be seen during code reviews. -func parseHexDump(nextLine func() string) ([]byte, error) { - var out []byte - for { - line := nextLine() - if line == "" || line == "\n" { - break - } - if i := strings.Index(line, "|"); i >= 0 { // remove text dump - line = line[:i] - } - f := strings.Fields(line) - if len(f) > 1+16 { - return nil, fmt.Errorf("parsing hex dump: too many fields on line %q", line) - } - if len(f) == 0 || len(f) == 1 && f[0] == "*" { // all zeros block omitted - continue - } - addr64, err := strconv.ParseUint(f[0], 16, 0) - if err != nil { - return nil, fmt.Errorf("parsing hex dump: invalid address %q", f[0]) - } - addr := int(addr64) - if len(out) < addr { - out = append(out, make([]byte, addr-len(out))...) - } - for _, x := range f[1:] { - val, err := strconv.ParseUint(x, 16, 8) - if err != nil { - return nil, fmt.Errorf("parsing hexdump: invalid hex byte %q", x) - } - out = append(out, byte(val)) - } - } - return out, nil -} diff --git a/libgo/go/cmd/go/internal/work/action.go b/libgo/go/cmd/go/internal/work/action.go index 1cc701d2ae3..eabac6bd14e 100644 --- a/libgo/go/cmd/go/internal/work/action.go +++ b/libgo/go/cmd/go/internal/work/action.go @@ -17,8 +17,10 @@ import ( "io/ioutil" "os" "path/filepath" + "runtime" "strings" "sync" + "time" "cmd/go/internal/base" "cmd/go/internal/cache" @@ -83,15 +85,17 @@ type Action struct { actionID cache.ActionID // cache ID of action input buildID string // build ID of action output - VetxOnly bool // Mode=="vet": only being called to supply info about dependencies - needVet bool // Mode=="build": need to fill in vet config - vetCfg *vetConfig // vet config - output []byte // output redirect buffer (nil means use b.Print) + VetxOnly bool // Mode=="vet": only being called to supply info about dependencies + needVet bool // Mode=="build": need to fill in vet config + needBuild bool // Mode=="build": need to do actual build (can be false if needVet is true) + vetCfg *vetConfig // vet config + output []byte // output redirect buffer (nil means use b.Print) // Execution state. - pending int // number of deps yet to complete - priority int // relative execution priority - Failed bool // whether the action failed + pending int // number of deps yet to complete + priority int // relative execution priority + Failed bool // whether the action failed + json *actionJSON // action graph information } // BuildActionID returns the action ID section of a's build ID. @@ -123,6 +127,9 @@ func (q *actionQueue) Pop() interface{} { } func (q *actionQueue) push(a *Action) { + if a.json != nil { + a.json.TimeReady = time.Now() + } heap.Push(q, a) } @@ -134,16 +141,28 @@ type actionJSON struct { ID int Mode string Package string - Deps []int `json:",omitempty"` - IgnoreFail bool `json:",omitempty"` - Args []string `json:",omitempty"` - Link bool `json:",omitempty"` - Objdir string `json:",omitempty"` - Target string `json:",omitempty"` - Priority int `json:",omitempty"` - Failed bool `json:",omitempty"` - Built string `json:",omitempty"` - VetxOnly bool `json:",omitempty"` + Deps []int `json:",omitempty"` + IgnoreFail bool `json:",omitempty"` + Args []string `json:",omitempty"` + Link bool `json:",omitempty"` + Objdir string `json:",omitempty"` + Target string `json:",omitempty"` + Priority int `json:",omitempty"` + Failed bool `json:",omitempty"` + Built string `json:",omitempty"` + VetxOnly bool `json:",omitempty"` + NeedVet bool `json:",omitempty"` + NeedBuild bool `json:",omitempty"` + ActionID string `json:",omitempty"` + BuildID string `json:",omitempty"` + TimeReady time.Time `json:",omitempty"` + TimeStart time.Time `json:",omitempty"` + TimeDone time.Time `json:",omitempty"` + + Cmd []string // `json:",omitempty"` + CmdReal time.Duration `json:",omitempty"` + CmdUser time.Duration `json:",omitempty"` + CmdSys time.Duration `json:",omitempty"` } // cacheKey is the key for the action cache. @@ -173,26 +192,30 @@ func actionGraphJSON(a *Action) string { var list []*actionJSON for id, a := range workq { - aj := &actionJSON{ - Mode: a.Mode, - ID: id, - IgnoreFail: a.IgnoreFail, - Args: a.Args, - Objdir: a.Objdir, - Target: a.Target, - Failed: a.Failed, - Priority: a.priority, - Built: a.built, - VetxOnly: a.VetxOnly, - } - if a.Package != nil { - // TODO(rsc): Make this a unique key for a.Package somehow. - aj.Package = a.Package.ImportPath - } - for _, a1 := range a.Deps { - aj.Deps = append(aj.Deps, inWorkq[a1]) + if a.json == nil { + a.json = &actionJSON{ + Mode: a.Mode, + ID: id, + IgnoreFail: a.IgnoreFail, + Args: a.Args, + Objdir: a.Objdir, + Target: a.Target, + Failed: a.Failed, + Priority: a.priority, + Built: a.built, + VetxOnly: a.VetxOnly, + NeedBuild: a.needBuild, + NeedVet: a.needVet, + } + if a.Package != nil { + // TODO(rsc): Make this a unique key for a.Package somehow. + a.json.Package = a.Package.ImportPath + } + for _, a1 := range a.Deps { + a.json.Deps = append(a.json.Deps, inWorkq[a1]) + } } - list = append(list, aj) + list = append(list, a.json) } js, err := json.MarshalIndent(list, "", "\t") @@ -211,6 +234,8 @@ const ( ModeBuild BuildMode = iota ModeInstall ModeBuggyInstall + + ModeVetOnly = 1 << 8 ) func (b *Builder) Init() { @@ -225,7 +250,7 @@ func (b *Builder) Init() { if cfg.BuildN { b.WorkDir = "$WORK" } else { - tmp, err := ioutil.TempDir(os.Getenv("GOTMPDIR"), "go-build") + tmp, err := ioutil.TempDir(cfg.Getenv("GOTMPDIR"), "go-build") if err != nil { base.Fatalf("go: creating work dir: %v", err) } @@ -243,7 +268,26 @@ func (b *Builder) Init() { } if !cfg.BuildWork { workdir := b.WorkDir - base.AtExit(func() { os.RemoveAll(workdir) }) + base.AtExit(func() { + start := time.Now() + for { + err := os.RemoveAll(workdir) + if err == nil { + return + } + + // On some configurations of Windows, directories containing executable + // files may be locked for a while after the executable exits (perhaps + // due to antivirus scans?). It's probably worth a little extra latency + // on exit to avoid filling up the user's temporary directory with leaked + // files. (See golang.org/issue/30789.) + if runtime.GOOS != "windows" || time.Since(start) >= 500*time.Millisecond { + fmt.Fprintf(os.Stderr, "go: failed to remove work dir: %s\n", err) + return + } + time.Sleep(5 * time.Millisecond) + } + }) } } @@ -294,7 +338,7 @@ func readpkglist(shlibpath string) (pkgs []*load.Package) { if strings.HasPrefix(t, "pkgpath ") { t = strings.TrimPrefix(t, "pkgpath ") t = strings.TrimSuffix(t, ";") - pkgs = append(pkgs, load.LoadPackage(t, &stk)) + pkgs = append(pkgs, load.LoadImportWithFlags(t, base.Cwd, nil, &stk, nil, 0)) } } } else { @@ -305,7 +349,7 @@ func readpkglist(shlibpath string) (pkgs []*load.Package) { scanner := bufio.NewScanner(bytes.NewBuffer(pkglistbytes)) for scanner.Scan() { t := scanner.Text() - pkgs = append(pkgs, load.LoadPackage(t, &stk)) + pkgs = append(pkgs, load.LoadImportWithFlags(t, base.Cwd, nil, &stk, nil, 0)) } } return @@ -338,6 +382,9 @@ func (b *Builder) AutoAction(mode, depMode BuildMode, p *load.Package) *Action { // depMode is the action (build or install) to use when building dependencies. // To turn package main into an executable, call b.Link instead. func (b *Builder) CompileAction(mode, depMode BuildMode, p *load.Package) *Action { + vetOnly := mode&ModeVetOnly != 0 + mode &^= ModeVetOnly + if mode != ModeBuild && (p.Internal.Local || p.Module != nil) && p.Target == "" { // Imported via local path or using modules. No permanent target. mode = ModeBuild @@ -384,6 +431,19 @@ func (b *Builder) CompileAction(mode, depMode BuildMode, p *load.Package) *Actio return a }) + // Find the build action; the cache entry may have been replaced + // by the install action during (*Builder).installAction. + buildAction := a + switch buildAction.Mode { + case "build", "built-in package", "gccgo stdlib": + // ok + case "build-install": + buildAction = a.Deps[0] + default: + panic("lost build action: " + buildAction.Mode) + } + buildAction.needBuild = buildAction.needBuild || !vetOnly + // Construct install action. if mode == ModeInstall || mode == ModeBuggyInstall { a = b.installAction(a, mode) @@ -405,12 +465,12 @@ func (b *Builder) VetAction(mode, depMode BuildMode, p *load.Package) *Action { func (b *Builder) vetAction(mode, depMode BuildMode, p *load.Package) *Action { // Construct vet action. a := b.cacheAction("vet", p, func() *Action { - a1 := b.CompileAction(mode, depMode, p) + a1 := b.CompileAction(mode|ModeVetOnly, depMode, p) // vet expects to be able to import "fmt". var stk load.ImportStack stk.Push("vet") - p1 := load.LoadPackage("fmt", &stk) + p1 := load.LoadImportWithFlags("fmt", p.Dir, p, &stk, nil, 0) stk.Pop() aFmt := b.CompileAction(ModeBuild, depMode, p1) @@ -424,7 +484,7 @@ func (b *Builder) vetAction(mode, depMode BuildMode, p *load.Package) *Action { } else { deps = []*Action{a1, aFmt} } - for _, p1 := range load.PackageList(p.Internal.Imports) { + for _, p1 := range p.Internal.Imports { deps = append(deps, b.vetAction(mode, depMode, p1)) } @@ -710,7 +770,7 @@ func (b *Builder) linkSharedAction(mode, depMode BuildMode, shlib string, a1 *Ac } } var stk load.ImportStack - p := load.LoadPackage(pkg, &stk) + p := load.LoadImportWithFlags(pkg, base.Cwd, nil, &stk, nil, 0) if p.Error != nil { base.Fatalf("load %s: %v", pkg, p.Error) } diff --git a/libgo/go/cmd/go/internal/work/build.go b/libgo/go/cmd/go/internal/work/build.go index ed66df22c33..ed5a149da35 100644 --- a/libgo/go/cmd/go/internal/work/build.go +++ b/libgo/go/cmd/go/internal/work/build.go @@ -27,8 +27,8 @@ var CmdBuild = &base.Command{ Build compiles the packages named by the import paths, along with their dependencies, but it does not install the results. -If the arguments to build are a list of .go files, build treats -them as a list of source files specifying a single package. +If the arguments to build are a list of .go files from a single directory, +build treats them as a list of source files specifying a single package. When compiling a single main package, build writes the resulting executable to an output file named after @@ -42,10 +42,10 @@ serving only as a check that the packages can be built. When compiling packages, build ignores files that end in '_test.go'. -The -o flag, only allowed when compiling a single package, -forces build to write the resulting executable or object -to the named output file, instead of the default behavior described -in the last two paragraphs. +The -o flag forces build to write the resulting executable or object +to the named output file or directory, instead of the default behavior described +in the last two paragraphs. If the named output is a directory that exists, +then any resulting executables will be written to that directory. The -i flag installs the packages that are dependencies of the target. @@ -104,10 +104,18 @@ and test commands: install and load all packages from dir instead of the usual locations. For example, when building with a non-standard configuration, use -pkgdir to keep generated packages in a separate location. - -tags 'tag list' - a space-separated list of build tags to consider satisfied during the + -tags tag,list + a comma-separated list of build tags to consider satisfied during the build. For more information about build tags, see the description of build constraints in the documentation for the go/build package. + (Earlier versions of Go used a space-separated list, and that form + is deprecated but still recognized.) + -trimpath + remove all file system paths from the resulting executable. + Instead of absolute file system paths, the recorded file names + will begin with either "go" (for the standard library), + or a module path@version (when using modules), + or a plain import path (when using GOPATH). -toolexec 'cmd args' a program to use to invoke toolchain programs like vet and asm. For example, instead of running asm, the go command will run @@ -153,7 +161,7 @@ func init() { CmdInstall.Run = runInstall CmdBuild.Flag.BoolVar(&cfg.BuildI, "i", false, "") - CmdBuild.Flag.StringVar(&cfg.BuildO, "o", "", "output file") + CmdBuild.Flag.StringVar(&cfg.BuildO, "o", "", "output file or directory") CmdInstall.Flag.BoolVar(&cfg.BuildI, "i", false, "") @@ -227,14 +235,38 @@ func AddBuildFlags(cmd *base.Command) { cmd.Flag.StringVar(&cfg.BuildPkgdir, "pkgdir", "", "") cmd.Flag.BoolVar(&cfg.BuildRace, "race", false, "") cmd.Flag.BoolVar(&cfg.BuildMSan, "msan", false, "") - cmd.Flag.Var((*base.StringsFlag)(&cfg.BuildContext.BuildTags), "tags", "") + cmd.Flag.Var((*tagsFlag)(&cfg.BuildContext.BuildTags), "tags", "") cmd.Flag.Var((*base.StringsFlag)(&cfg.BuildToolexec), "toolexec", "") + cmd.Flag.BoolVar(&cfg.BuildTrimpath, "trimpath", false, "") cmd.Flag.BoolVar(&cfg.BuildWork, "work", false, "") // Undocumented, unstable debugging flags. cmd.Flag.StringVar(&cfg.DebugActiongraph, "debug-actiongraph", "", "") } +// tagsFlag is the implementation of the -tags flag. +type tagsFlag []string + +func (v *tagsFlag) Set(s string) error { + // For compatibility with Go 1.12 and earlier, allow "-tags='a b c'" or even just "-tags='a'". + if strings.Contains(s, " ") || strings.Contains(s, "'") { + return (*base.StringsFlag)(v).Set(s) + } + + // Split on commas, ignore empty strings. + *v = []string{} + for _, s := range strings.Split(s, ",") { + if s != "" { + *v = append(*v, s) + } + } + return nil +} + +func (v *tagsFlag) String() string { + return "" +} + // fileExtSplit expects a filename and returns the name // and ext (without the dot). If the file has no // extension, ext will be empty. @@ -283,6 +315,8 @@ func runBuild(cmd *base.Command, args []string) { pkgs := load.PackagesForBuild(args) + explicitO := len(cfg.BuildO) > 0 + if len(pkgs) == 1 && pkgs[0].Name == "main" && cfg.BuildO == "" { cfg.BuildO = load.DefaultExecName(pkgs[0].ImportPath) cfg.BuildO += cfg.ExeSuffix @@ -316,8 +350,32 @@ func runBuild(cmd *base.Command, args []string) { } if cfg.BuildO != "" { + // If the -o name exists and is a directory, then + // write all main packages to that directory. + // Otherwise require only a single package be built. + if fi, err := os.Stat(cfg.BuildO); err == nil && fi.IsDir() { + if !explicitO { + base.Fatalf("go build: build output %q already exists and is a directory", cfg.BuildO) + } + a := &Action{Mode: "go build"} + for _, p := range pkgs { + if p.Name != "main" { + continue + } + p.Target = filepath.Join(cfg.BuildO, load.DefaultExecName(p.ImportPath)) + p.Target += cfg.ExeSuffix + p.Stale = true + p.StaleReason = "build -o flag in use" + a.Deps = append(a.Deps, b.AutoAction(ModeInstall, depMode, p)) + } + if len(a.Deps) == 0 { + base.Fatalf("go build: no main packages to build") + } + b.Do(a) + return + } if len(pkgs) > 1 { - base.Fatalf("go build: cannot use -o with multiple packages") + base.Fatalf("go build: cannot write multiple packages to non-directory %s", cfg.BuildO) } else if len(pkgs) == 0 { base.Fatalf("no packages to build") } @@ -346,6 +404,15 @@ var CmdInstall = &base.Command{ Long: ` Install compiles and installs the packages named by the import paths. +Executables are installed in the directory named by the GOBIN environment +variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH +environment variable is not set. Executables in $GOROOT +are installed in $GOROOT/bin or $GOTOOLDIR instead of $GOBIN. + +When module-aware mode is disabled, other packages are installed in the +directory $GOPATH/pkg/$GOOS_$GOARCH. When module-aware mode is enabled, +other packages are built and cached but not installed. + The -i flag installs the dependencies of the named packages as well. For more about the build flags, see 'go help build'. diff --git a/libgo/go/cmd/go/internal/work/build_test.go b/libgo/go/cmd/go/internal/work/build_test.go index ef95a408ca3..55e1eea25ba 100644 --- a/libgo/go/cmd/go/internal/work/build_test.go +++ b/libgo/go/cmd/go/internal/work/build_test.go @@ -227,8 +227,8 @@ func TestRespectSetgidDir(t *testing.T) { if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" { t.Skip("can't set SetGID bit with chmod on iOS") } - case "windows", "plan9", "js": - t.Skip("chown/chmod setgid are not supported on Windows, Plan 9, or JS") + case "windows", "plan9": + t.Skip("chown/chmod setgid are not supported on Windows or Plan 9") } var b Builder diff --git a/libgo/go/cmd/go/internal/work/buildid.go b/libgo/go/cmd/go/internal/work/buildid.go index 750bc3c6cdb..1f6d1e8e779 100644 --- a/libgo/go/cmd/go/internal/work/buildid.go +++ b/libgo/go/cmd/go/internal/work/buildid.go @@ -159,7 +159,7 @@ func hashToString(h [cache.HashSize]byte) string { // which influences the action ID half of the build ID, is based on the content ID, // then the Linux compiler binary and Mac compiler binary will have different tool IDs // and therefore produce executables with different action IDs. -// To avoids this problem, for releases we use the release version string instead +// To avoid this problem, for releases we use the release version string instead // of the compiler binary's content hash. This assumes that all compilers built // on all different systems are semantically equivalent, which is of course only true // modulo bugs. (Producing the exact same executables also requires that the different @@ -215,7 +215,7 @@ func (b *Builder) toolID(name string) string { } // gccToolID returns the unique ID to use for a tool that is invoked -// by the GCC driver. This is in particular gccgo, but this can also +// by the GCC driver. This is used particularly for gccgo, but this can also // be used for gcc, g++, gfortran, etc.; those tools all use the GCC // driver under different names. The approach used here should also // work for sufficiently new versions of clang. Unlike toolID, the @@ -326,7 +326,7 @@ func (b *Builder) gccgoBuildIDFile(a *Action) (string, error) { var buf bytes.Buffer if cfg.Goos == "aix" { fmt.Fprintf(&buf, "\t.csect .go.buildid[XO]\n") - } else if cfg.Goos != "solaris" || assemblerIsGas() { + } else if (cfg.Goos != "solaris" && cfg.Goos != "illumos") || assemblerIsGas() { fmt.Fprintf(&buf, "\t"+`.section .go.buildid,"e"`+"\n") } else if cfg.Goarch == "sparc" || cfg.Goarch == "sparc64" { fmt.Fprintf(&buf, "\t"+`.section ".go.buildid",#exclude`+"\n") @@ -345,7 +345,7 @@ func (b *Builder) gccgoBuildIDFile(a *Action) (string, error) { fmt.Fprintf(&buf, "%#02x", a.buildID[i]) } fmt.Fprintf(&buf, "\n") - if cfg.Goos != "solaris" && cfg.Goos != "aix" { + if cfg.Goos != "solaris" && cfg.Goos != "illumos" && cfg.Goos != "aix" { secType := "@progbits" if cfg.Goarch == "arm" { secType = "%progbits" @@ -423,6 +423,9 @@ func (b *Builder) useCache(a *Action, p *load.Package, actionHash cache.ActionID // engineered 96-bit partial SHA256 collision. a.actionID = actionHash actionID := hashToString(actionHash) + if a.json != nil { + a.json.ActionID = actionID + } contentID := actionID // temporary placeholder, likely unique a.buildID = actionID + buildIDSeparator + contentID @@ -440,6 +443,9 @@ func (b *Builder) useCache(a *Action, p *load.Package, actionHash cache.ActionID buildID, _ = buildid.ReadFile(target) if strings.HasPrefix(buildID, actionID+buildIDSeparator) { a.buildID = buildID + if a.json != nil { + a.json.BuildID = a.buildID + } a.built = target // Poison a.Target to catch uses later in the build. a.Target = "DO NOT USE - " + a.Mode @@ -482,6 +488,9 @@ func (b *Builder) useCache(a *Action, p *load.Package, actionHash cache.ActionID // Poison a.Target to catch uses later in the build. a.Target = "DO NOT USE - main build pseudo-cache Target" a.built = "DO NOT USE - main build pseudo-cache built" + if a.json != nil { + a.json.BuildID = a.buildID + } return true } // Otherwise restore old build ID for main build. @@ -549,6 +558,9 @@ func (b *Builder) useCache(a *Action, p *load.Package, actionHash cache.ActionID a.built = file a.Target = "DO NOT USE - using cache" a.buildID = buildID + if a.json != nil { + a.json.BuildID = a.buildID + } if p := a.Package; p != nil { // Clearer than explaining that something else is stale. p.StaleReason = "not installed but available in build cache" @@ -644,6 +656,9 @@ func (b *Builder) updateBuildID(a *Action, target string, rewrite bool) error { // Replace with new content-based ID. a.buildID = newID + if a.json != nil { + a.json.BuildID = a.buildID + } if len(matches) == 0 { // Assume the user specified -buildid= to override what we were going to choose. return nil diff --git a/libgo/go/cmd/go/internal/work/exec.go b/libgo/go/cmd/go/internal/work/exec.go index 53027246614..8e92f9461cf 100644 --- a/libgo/go/cmd/go/internal/work/exec.go +++ b/libgo/go/cmd/go/internal/work/exec.go @@ -8,9 +8,15 @@ package work import ( "bytes" + "cmd/go/internal/base" + "cmd/go/internal/cache" + "cmd/go/internal/cfg" + "cmd/go/internal/load" + "cmd/go/internal/str" "encoding/json" "errors" "fmt" + "internal/lazyregexp" "io" "io/ioutil" "log" @@ -24,12 +30,6 @@ import ( "strings" "sync" "time" - - "cmd/go/internal/base" - "cmd/go/internal/cache" - "cmd/go/internal/cfg" - "cmd/go/internal/load" - "cmd/go/internal/str" ) // actionList returns the list of actions in the dag rooted at root @@ -75,13 +75,22 @@ func (b *Builder) Do(root *Action) { a.priority = i } - if cfg.DebugActiongraph != "" { - js := actionGraphJSON(root) - if err := ioutil.WriteFile(cfg.DebugActiongraph, []byte(js), 0666); err != nil { - fmt.Fprintf(os.Stderr, "go: writing action graph: %v\n", err) - base.SetExitStatus(1) + // Write action graph, without timing information, in case we fail and exit early. + writeActionGraph := func() { + if file := cfg.DebugActiongraph; file != "" { + if strings.HasSuffix(file, ".go") { + // Do not overwrite Go source code in: + // go build -debug-actiongraph x.go + base.Fatalf("go: refusing to write action graph to %v\n", file) + } + js := actionGraphJSON(root) + if err := ioutil.WriteFile(file, []byte(js), 0666); err != nil { + fmt.Fprintf(os.Stderr, "go: writing action graph: %v\n", err) + base.SetExitStatus(1) + } } } + writeActionGraph() b.readySema = make(chan bool, len(all)) @@ -100,12 +109,15 @@ func (b *Builder) Do(root *Action) { // Handle runs a single action and takes care of triggering // any actions that are runnable as a result. handle := func(a *Action) { + if a.json != nil { + a.json.TimeStart = time.Now() + } var err error - if a.Func != nil && (!a.Failed || a.IgnoreFail) { - if err == nil { - err = a.Func(b, a) - } + err = a.Func(b, a) + } + if a.json != nil { + a.json.TimeDone = time.Now() } // The actions run in parallel but all the updates to the @@ -172,6 +184,9 @@ func (b *Builder) Do(root *Action) { } wg.Wait() + + // Write action graph again, this time with timing information. + writeActionGraph() } // buildActionID computes the action ID for a build action. @@ -196,6 +211,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch) fmt.Fprintf(h, "import %q\n", p.ImportPath) fmt.Fprintf(h, "omitdebug %v standard %v local %v prefix %q\n", p.Internal.OmitDebug, p.Standard, p.Internal.Local, p.Internal.LocalPrefix) + if cfg.BuildTrimpath { + fmt.Fprintln(h, "trimpath") + } if p.Internal.ForceLibrary { fmt.Fprintf(h, "forcelibrary\n") } @@ -225,12 +243,16 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { if len(p.SFiles) > 0 { fmt.Fprintf(h, "asm %q %q %q\n", b.toolID("asm"), forcedAsmflags, p.Internal.Asmflags) } + // GO386, GOARM, GOMIPS, etc. - baseArch := strings.TrimSuffix(cfg.BuildContext.GOARCH, "le") - fmt.Fprintf(h, "GO$GOARCH=%s\n", os.Getenv("GO"+strings.ToUpper(baseArch))) + key, val := cfg.GetArchEnv() + fmt.Fprintf(h, "%s=%s\n", key, val) // TODO(rsc): Convince compiler team not to add more magic environment variables, // or perhaps restrict the environment variables passed to subprocesses. + // Because these are clumsy, undocumented special-case hacks + // for debugging the compiler, they are not settable using 'go env -w', + // and so here we use os.Getenv, not cfg.Getenv. magic := []string{ "GOCLOBBERDEADHASH", "GOSSAFUNC", @@ -267,8 +289,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID { } fmt.Fprintf(h, "compile %s %q %q\n", id, forcedGccgoflags, p.Internal.Gccgoflags) fmt.Fprintf(h, "pkgpath %s\n", gccgoPkgpath(p)) + fmt.Fprintf(h, "ar %q\n", BuildToolchain.(gccgoToolchain).ar()) if len(p.SFiles) > 0 { - id, err = b.gccgoToolID(BuildToolchain.compiler(), "assembler-with-cpp") + id, _ = b.gccgoToolID(BuildToolchain.compiler(), "assembler-with-cpp") // Ignore error; different assembler versions // are unlikely to make any difference anyhow. fmt.Fprintf(h, "asm %q\n", id) @@ -364,8 +387,8 @@ func (b *Builder) build(a *Action) (err error) { return 0 } - cached := false - need := bit(needBuild, !b.IsCmdList || b.NeedExport) | + cachedBuild := false + need := bit(needBuild, !b.IsCmdList && a.needBuild || b.NeedExport) | bit(needCgoHdr, b.needCgoHdr(a)) | bit(needVet, a.needVet) | bit(needCompiledGoFiles, b.NeedCompiledGoFiles) @@ -374,6 +397,11 @@ func (b *Builder) build(a *Action) (err error) { if b.useCache(a, p, b.buildActionID(a), p.Target) { // We found the main output in the cache. // If we don't need any other outputs, we can stop. + // Otherwise, we need to write files to a.Objdir (needVet, needCgoHdr). + // Remember that we might have them in cache + // and check again after we create a.Objdir. + cachedBuild = true + a.output = []byte{} // start saving output in case we miss any cache results need &^= needBuild if b.NeedExport { p.Export = a.built @@ -381,16 +409,11 @@ func (b *Builder) build(a *Action) (err error) { if need&needCompiledGoFiles != 0 && b.loadCachedSrcFiles(a) { need &^= needCompiledGoFiles } - // Otherwise, we need to write files to a.Objdir (needVet, needCgoHdr). - // Remember that we might have them in cache - // and check again after we create a.Objdir. - cached = true - a.output = []byte{} // start saving output in case we miss any cache results } // Source files might be cached, even if the full action is not // (e.g., go list -compiled -find). - if !cached && need&needCompiledGoFiles != 0 && b.loadCachedSrcFiles(a) { + if !cachedBuild && need&needCompiledGoFiles != 0 && b.loadCachedSrcFiles(a) { need &^= needCompiledGoFiles } @@ -422,24 +445,12 @@ func (b *Builder) build(a *Action) (err error) { } if a.Package.BinaryOnly { - _, err := os.Stat(a.Package.Target) - if err == nil { - a.built = a.Package.Target - a.Target = a.Package.Target - if b.NeedExport { - a.Package.Export = a.Package.Target - } - a.buildID = b.fileHash(a.Package.Target) - a.Package.Stale = false - a.Package.StaleReason = "binary-only package" - return nil - } - a.Package.Stale = true - a.Package.StaleReason = "missing or invalid binary-only package" + p.Stale = true + p.StaleReason = "binary-only packages are no longer supported" if b.IsCmdList { return nil } - return fmt.Errorf("missing or invalid binary-only package; expected file %q", a.Package.Target) + return errors.New("binary-only packages are no longer supported") } if err := b.Mkdir(a.Objdir); err != nil { @@ -447,21 +458,20 @@ func (b *Builder) build(a *Action) (err error) { } objdir := a.Objdir - if cached { - if need&needCgoHdr != 0 && b.loadCachedCgoHdr(a) { - need &^= needCgoHdr - } + // Load cached cgo header, but only if we're skipping the main build (cachedBuild==true). + if cachedBuild && need&needCgoHdr != 0 && b.loadCachedCgoHdr(a) { + need &^= needCgoHdr + } - // Load cached vet config, but only if that's all we have left - // (need == needVet, not testing just the one bit). - // If we are going to do a full build anyway, - // we're going to regenerate the files below anyway. - if need == needVet && b.loadCachedVet(a) { - need &^= needVet - } - if need == 0 { - return nil - } + // Load cached vet config, but only if that's all we have left + // (need == needVet, not testing just the one bit). + // If we are going to do a full build anyway, + // we're going to regenerate the files below anyway. + if need == needVet && b.loadCachedVet(a) { + need &^= needVet + } + if need == 0 { + return nil } // make target directory @@ -532,6 +542,15 @@ func (b *Builder) build(a *Action) (err error) { } } + // Write out the _testinginit.go file for any test packages that import "testing". + if a.Package.Internal.TestinginitGo != nil { + initfile := objdir + "_testinginit.go" + if err := b.writeFile(initfile, a.Package.Internal.TestinginitGo); err != nil { + return err + } + gofiles = append([]string{initfile}, gofiles...) + } + // Run cgo. if a.Package.UsesCgo() || a.Package.UsesSwig() { // In a package using cgo, cgo compiles the C, C++ and assembly files with gcc. @@ -724,7 +743,7 @@ func (b *Builder) build(a *Action) (err error) { // This is read by readGccgoArchive in cmd/internal/buildid/buildid.go. if a.buildID != "" && cfg.BuildToolchainName == "gccgo" { switch cfg.Goos { - case "aix", "android", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris": + case "aix", "android", "dragonfly", "freebsd", "illumos", "linux", "netbsd", "openbsd", "solaris": asmfile, err := b.gccgoBuildIDFile(a) if err != nil { return err @@ -971,10 +990,13 @@ func buildVetConfig(a *Action, srcfiles []string) { // The caller is expected to set it (if needed) before executing any vet actions. var VetTool string -// VetFlags are the flags to pass to vet. +// VetFlags are the default flags to pass to vet. // The caller is expected to set them before executing any vet actions. var VetFlags []string +// VetExplicit records whether the vet flags were set explicitly on the command line. +var VetExplicit bool + func (b *Builder) vet(a *Action) error { // a.Deps[0] is the build of the package being vetted. // a.Deps[1] is the build of the "fmt" package. @@ -1001,12 +1023,42 @@ func (b *Builder) vet(a *Action) error { h := cache.NewHash("vet " + a.Package.ImportPath) fmt.Fprintf(h, "vet %q\n", b.toolID("vet")) + vetFlags := VetFlags + + // In GOROOT, we enable all the vet tests during 'go test', + // not just the high-confidence subset. This gets us extra + // checking for the standard library (at some compliance cost) + // and helps us gain experience about how well the checks + // work, to help decide which should be turned on by default. + // The command-line still wins. + // + // Note that this flag change applies even when running vet as + // a dependency of vetting a package outside std. + // (Otherwise we'd have to introduce a whole separate + // space of "vet fmt as a dependency of a std top-level vet" + // versus "vet fmt as a dependency of a non-std top-level vet".) + // This is OK as long as the packages that are farther down the + // dependency tree turn on *more* analysis, as here. + // (The unsafeptr check does not write any facts for use by + // later vet runs.) + if a.Package.Goroot && !VetExplicit { + // Note that $GOROOT/src/buildall.bash + // does the same for the misc-compile trybots + // and should be updated if these flags are + // changed here. + // + // There's too much unsafe.Pointer code + // that vet doesn't like in low-level packages + // like runtime, sync, and reflect. + vetFlags = []string{"-unsafeptr=false"} + } + // Note: We could decide that vet should compute export data for // all analyses, in which case we don't need to include the flags here. // But that would mean that if an analysis causes problems like // unexpected crashes there would be no way to turn it off. // It seems better to let the flags disable export analysis too. - fmt.Fprintf(h, "vetflags %q\n", VetFlags) + fmt.Fprintf(h, "vetflags %q\n", vetFlags) fmt.Fprintf(h, "pkg %q\n", a.Deps[0].actionID) for _, a1 := range a.Deps { @@ -1026,26 +1078,6 @@ func (b *Builder) vet(a *Action) error { } } - // TODO(adonovan): delete this when we use the new vet printf checker. - // https://github.com/golang/go/issues/28756 - if vcfg.ImportMap["fmt"] == "" { - a1 := a.Deps[1] - vcfg.ImportMap["fmt"] = "fmt" - if a1.built != "" { - vcfg.PackageFile["fmt"] = a1.built - } - vcfg.Standard["fmt"] = true - } - - // During go test, ignore type-checking failures during vet. - // We only run vet if the compilation has succeeded, - // so at least for now assume the bug is in vet. - // We know of at least #18395. - // TODO(rsc,gri): Try to remove this for Go 1.11. - // - // Disabled 2018-04-20. Let's see if we can do without it. - // vcfg.SucceedOnTypecheckFailure = cfg.CmdName == "test" - js, err := json.MarshalIndent(vcfg, "", "\t") if err != nil { return fmt.Errorf("internal error marshaling vet config: %v", err) @@ -1065,7 +1097,7 @@ func (b *Builder) vet(a *Action) error { if tool == "" { tool = base.Tool("vet") } - runErr := b.run(a, p.Dir, p.ImportPath, env, cfg.BuildToolexec, tool, VetFlags, a.Objdir+"vet.cfg") + runErr := b.run(a, p.Dir, p.ImportPath, env, cfg.BuildToolexec, tool, vetFlags, a.Objdir+"vet.cfg") // If vet wrote export data, save it for input to future vets. if f, err := os.Open(vcfg.VetxOutput); err == nil { @@ -1089,6 +1121,9 @@ func (b *Builder) linkActionID(a *Action) cache.ActionID { fmt.Fprintf(h, "buildmode %s goos %s goarch %s\n", cfg.BuildBuildmode, cfg.Goos, cfg.Goarch) fmt.Fprintf(h, "import %q\n", p.ImportPath) fmt.Fprintf(h, "omitdebug %v standard %v local %v prefix %q\n", p.Internal.OmitDebug, p.Standard, p.Internal.Local, p.Internal.LocalPrefix) + if cfg.BuildTrimpath { + fmt.Fprintln(h, "trimpath") + } // Toolchain-dependent configuration, shared with b.linkSharedActionID. b.printLinkerConfig(h, p) @@ -1130,21 +1165,16 @@ func (b *Builder) printLinkerConfig(h io.Writer, p *load.Package) { if p != nil { fmt.Fprintf(h, "linkflags %q\n", p.Internal.Ldflags) } - fmt.Fprintf(h, "GO$GOARCH=%s\n", os.Getenv("GO"+strings.ToUpper(cfg.BuildContext.GOARCH))) // GO386, GOARM, etc + + // GO386, GOARM, GOMIPS, etc. + key, val := cfg.GetArchEnv() + fmt.Fprintf(h, "%s=%s\n", key, val) // The linker writes source file paths that say GOROOT_FINAL. fmt.Fprintf(h, "GOROOT=%s\n", cfg.GOROOT_FINAL) - // TODO(rsc): Convince linker team not to add more magic environment variables, - // or perhaps restrict the environment variables passed to subprocesses. - magic := []string{ - "GO_EXTLINK_ENABLED", - } - for _, env := range magic { - if x := os.Getenv(env); x != "" { - fmt.Fprintf(h, "magic %s=%s\n", env, x) - } - } + // GO_EXTLINK_ENABLED controls whether the external linker is used. + fmt.Fprintf(h, "GO_EXTLINK_ENABLED=%s\n", cfg.Getenv("GO_EXTLINK_ENABLED")) // TODO(rsc): Do cgo settings and flags need to be included? // Or external linker settings and flags? @@ -1317,7 +1347,7 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string, } } var out []byte - out, err = b.runOut(p.Dir, nil, b.PkgconfigCmd(), "--cflags", pcflags, "--", pkgs) + out, err = b.runOut(nil, p.Dir, nil, b.PkgconfigCmd(), "--cflags", pcflags, "--", pkgs) if err != nil { b.showOutput(nil, p.Dir, b.PkgconfigCmd()+" --cflags "+strings.Join(pcflags, " ")+" -- "+strings.Join(pkgs, " "), string(out)) b.Print(err.Error() + "\n") @@ -1332,7 +1362,7 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string, return nil, nil, err } } - out, err = b.runOut(p.Dir, nil, b.PkgconfigCmd(), "--libs", pcflags, "--", pkgs) + out, err = b.runOut(nil, p.Dir, nil, b.PkgconfigCmd(), "--libs", pcflags, "--", pkgs) if err != nil { b.showOutput(nil, p.Dir, b.PkgconfigCmd()+" --libs "+strings.Join(pcflags, " ")+" -- "+strings.Join(pkgs, " "), string(out)) b.Print(err.Error() + "\n") @@ -1432,6 +1462,9 @@ func BuildInstallFunc(b *Builder, a *Action) (err error) { a1 := a.Deps[0] a.buildID = a1.buildID + if a.json != nil { + a.json.BuildID = a.buildID + } // If we are using the eventual install target as an up-to-date // cached copy of the thing we built, then there's no need to @@ -1651,25 +1684,6 @@ func (b *Builder) writeFile(file string, text []byte) error { return ioutil.WriteFile(file, text, 0666) } -// appendFile appends the text to file. -func (b *Builder) appendFile(file string, text []byte) error { - if cfg.BuildN || cfg.BuildX { - b.Showcmd("", "cat >>%s << 'EOF' # internal\n%sEOF", file, text) - } - if cfg.BuildN { - return nil - } - f, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) - if err != nil { - return err - } - defer f.Close() - if _, err = f.Write(text); err != nil { - return err - } - return f.Close() -} - // Install the cgo export header file, if there is one. func (b *Builder) installHeader(a *Action) error { src := a.Objdir + "_cgo_install.h" @@ -1841,14 +1855,14 @@ func (b *Builder) showOutput(a *Action, dir, desc, out string) { // print this error. var errPrintedOutput = errors.New("already printed output - no need to show error") -var cgoLine = regexp.MustCompile(`\[[^\[\]]+\.(cgo1|cover)\.go:[0-9]+(:[0-9]+)?\]`) -var cgoTypeSigRe = regexp.MustCompile(`\b_C2?(type|func|var|macro)_\B`) +var cgoLine = lazyregexp.New(`\[[^\[\]]+\.(cgo1|cover)\.go:[0-9]+(:[0-9]+)?\]`) +var cgoTypeSigRe = lazyregexp.New(`\b_C2?(type|func|var|macro)_\B`) // run runs the command given by cmdline in the directory dir. // If the command fails, run prints information about the failure // and returns a non-nil error. func (b *Builder) run(a *Action, dir string, desc string, env []string, cmdargs ...interface{}) error { - out, err := b.runOut(dir, env, cmdargs...) + out, err := b.runOut(a, dir, env, cmdargs...) if len(out) > 0 { if desc == "" { desc = b.fmtcmd(dir, "%s", strings.Join(str.StringList(cmdargs...), " ")) @@ -1880,7 +1894,8 @@ func (b *Builder) processOutput(out []byte) string { // runOut runs the command given by cmdline in the directory dir. // It returns the command output and any errors that occurred. -func (b *Builder) runOut(dir string, env []string, cmdargs ...interface{}) ([]byte, error) { +// It accumulates execution time in a. +func (b *Builder) runOut(a *Action, dir string, env []string, cmdargs ...interface{}) ([]byte, error) { cmdline := str.StringList(cmdargs...) for _, arg := range cmdline { @@ -1919,8 +1934,19 @@ func (b *Builder) runOut(dir string, env []string, cmdargs ...interface{}) ([]by cleanup := passLongArgsInResponseFiles(cmd) defer cleanup() cmd.Dir = dir - cmd.Env = base.MergeEnvLists(env, base.EnvForDir(cmd.Dir, os.Environ())) + cmd.Env = base.EnvForDir(cmd.Dir, os.Environ()) + cmd.Env = append(cmd.Env, env...) + start := time.Now() err := cmd.Run() + if a != nil && a.json != nil { + aj := a.json + aj.Cmd = append(aj.Cmd, joinUnambiguously(cmdline)) + aj.CmdReal += time.Since(start) + if ps := cmd.ProcessState; ps != nil { + aj.CmdUser += ps.UserTime() + aj.CmdSys += ps.SystemTime() + } + } // err can be something like 'exit status 1'. // Add information about what program was running. @@ -1945,7 +1971,8 @@ func joinUnambiguously(a []string) string { q := strconv.Quote(s) // A gccgo command line can contain -( and -). // Make sure we quote them since they are special to the shell. - if s == "" || strings.ContainsAny(s, " ()") || len(q) > len(s)+2 { + // The trimpath argument can also contain > (part of =>) and ;. Quote those too. + if s == "" || strings.ContainsAny(s, " ()>;") || len(q) > len(s)+2 { buf.WriteString(q) } else { buf.WriteString(s) @@ -2117,7 +2144,7 @@ func (b *Builder) ccompile(a *Action, p *load.Package, outfile string, flags []s if !filepath.IsAbs(outfile) { outfile = filepath.Join(p.Dir, outfile) } - output, err := b.runOut(filepath.Dir(file), b.cCompilerEnv(), compiler, flags, "-o", outfile, "-c", filepath.Base(file)) + output, err := b.runOut(a, filepath.Dir(file), b.cCompilerEnv(), compiler, flags, "-o", outfile, "-c", filepath.Base(file)) if len(output) > 0 { // On FreeBSD 11, when we pass -g to clang 3.8 it // invokes its internal assembler with -dwarf-version=2. @@ -2150,7 +2177,7 @@ func (b *Builder) ccompile(a *Action, p *load.Package, outfile string, flags []s } // gccld runs the gcc linker to create an executable from a set of object files. -func (b *Builder) gccld(p *load.Package, objdir, outfile string, flags []string, objs []string) error { +func (b *Builder) gccld(a *Action, p *load.Package, objdir, outfile string, flags []string, objs []string) error { var cmd []string if len(p.CXXFiles) > 0 || len(p.SwigCXXFiles) > 0 { cmd = b.GxxCmd(p.Dir, objdir) @@ -2160,16 +2187,37 @@ func (b *Builder) gccld(p *load.Package, objdir, outfile string, flags []string, cmdargs := []interface{}{cmd, "-o", outfile, objs, flags} dir := p.Dir - out, err := b.runOut(dir, b.cCompilerEnv(), cmdargs...) + out, err := b.runOut(a, dir, b.cCompilerEnv(), cmdargs...) if len(out) > 0 { // Filter out useless linker warnings caused by bugs outside Go. // See also cmd/link/internal/ld's hostlink method. var save [][]byte + var skipLines int for _, line := range bytes.SplitAfter(out, []byte("\n")) { // golang.org/issue/26073 - Apple Xcode bug if bytes.Contains(line, []byte("ld: warning: text-based stub file")) { continue } + + if skipLines > 0 { + skipLines-- + continue + } + + // Remove duplicate main symbol with runtime/cgo on AIX. + // With runtime/cgo, two main are available: + // One is generated by cgo tool with {return 0;}. + // The other one is the main calling runtime.rt0_go + // in runtime/cgo. + // The second can't be used by cgo programs because + // runtime.rt0_go is unknown to them. + // Therefore, we let ld remove this main version + // and used the cgo generated one. + if p.ImportPath == "runtime/cgo" && bytes.Contains(line, []byte("ld: 0711-224 WARNING: Duplicate symbol: .main")) { + skipLines = 1 + continue + } + save = append(save, line) } out = bytes.Join(save, nil) @@ -2185,8 +2233,8 @@ func (b *Builder) gccld(p *load.Package, objdir, outfile string, flags []string, // Grab these before main helpfully overwrites them. var ( - origCC = os.Getenv("CC") - origCXX = os.Getenv("CXX") + origCC = cfg.Getenv("CC") + origCXX = cfg.Getenv("CXX") ) // gccCmd returns a gcc command line prefix @@ -2218,7 +2266,7 @@ func (b *Builder) cxxExe() []string { // fcExe returns the FC compiler setting without all the extra flags we add implicitly. func (b *Builder) fcExe() []string { - return b.compilerExe(os.Getenv("FC"), "gfortran") + return b.compilerExe(cfg.Getenv("FC"), "gfortran") } // compilerExe returns the compiler to use given an @@ -2260,6 +2308,11 @@ func (b *Builder) compilerCmd(compiler []string, incdir, workdir string) []strin } } + if cfg.Goos == "aix" { + // mcmodel=large must always be enabled to allow large TOC. + a = append(a, "-mcmodel=large") + } + // disable ASCII art in clang errors, if possible if b.gccSupportsFlag(compiler, "-fno-caret-diagnostics") { a = append(a, "-fno-caret-diagnostics") @@ -2344,7 +2397,8 @@ func (b *Builder) gccSupportsFlag(compiler []string, flag string) bool { } cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) cmd.Dir = b.WorkDir - cmd.Env = base.MergeEnvLists([]string{"LC_ALL=C"}, base.EnvForDir(cmd.Dir, os.Environ())) + cmd.Env = base.EnvForDir(cmd.Dir, os.Environ()) + cmd.Env = append(cmd.Env, "LC_ALL=C") out, _ := cmd.CombinedOutput() // GCC says "unrecognized command line option". // clang says "unknown argument". @@ -2384,7 +2438,7 @@ func (b *Builder) gccArchArgs() []string { // envList returns the value of the given environment variable broken // into fields, using the default value when the variable is empty. func envList(key, def string) []string { - v := os.Getenv(key) + v := cfg.Getenv(key) if v == "" { v = def } @@ -2421,7 +2475,7 @@ func buildFlags(name, defaults string, fromPackage []string, check func(string, return str.StringList(envList("CGO_"+name, defaults), fromPackage), nil } -var cgoRe = regexp.MustCompile(`[/\\:]`) +var cgoRe = lazyregexp.New(`[/\\:]`) func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) { p := a.Package @@ -2441,7 +2495,7 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo // Support gfortran out of the box and let others pass the correct link options // via CGO_LDFLAGS if len(ffiles) > 0 { - fc := os.Getenv("FC") + fc := cfg.Getenv("FC") if fc == "" { fc = "gfortran" } @@ -2622,7 +2676,7 @@ func (b *Builder) dynimport(a *Action, p *load.Package, objdir, importGo, cgoExe } ldflags = append(n, "-pie") } - if err := b.gccld(p, objdir, dynobj, ldflags, linkobj); err != nil { + if err := b.gccld(a, p, objdir, dynobj, ldflags, linkobj); err != nil { return err } @@ -2681,7 +2735,7 @@ var ( ) func (b *Builder) swigDoVersionCheck() error { - out, err := b.runOut("", nil, "swig", "-version") + out, err := b.runOut(nil, "", nil, "swig", "-version") if err != nil { return err } @@ -2836,7 +2890,7 @@ func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFL args = append(args, "-c++") } - out, err := b.runOut(p.Dir, nil, "swig", args, file) + out, err := b.runOut(a, p.Dir, nil, "swig", args, file) if err != nil { if len(out) > 0 { if bytes.Contains(out, []byte("-intgosize")) || bytes.Contains(out, []byte("-cgo")) { diff --git a/libgo/go/cmd/go/internal/work/gc.go b/libgo/go/cmd/go/internal/work/gc.go index 3d09f69fcc3..86322946a61 100644 --- a/libgo/go/cmd/go/internal/work/gc.go +++ b/libgo/go/cmd/go/internal/work/gc.go @@ -21,6 +21,7 @@ import ( "cmd/go/internal/load" "cmd/go/internal/str" "cmd/internal/objabi" + "cmd/internal/sys" "crypto/sha1" ) @@ -116,7 +117,7 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg []byte, s } } - args := []interface{}{cfg.BuildToolexec, base.Tool("compile"), "-o", ofile, "-trimpath", trimDir(a.Objdir), gcflags, gcargs, "-D", p.Internal.LocalPrefix} + args := []interface{}{cfg.BuildToolexec, base.Tool("compile"), "-o", ofile, "-trimpath", a.trimpath(), gcflags, gcargs, "-D", p.Internal.LocalPrefix} if importcfg != nil { if err := b.writeFile(objdir+"importcfg", importcfg); err != nil { return "", nil, err @@ -139,7 +140,7 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg []byte, s args = append(args, mkAbs(p.Dir, f)) } - output, err = b.runOut(p.Dir, nil, args...) + output, err = b.runOut(a, p.Dir, nil, args...) return ofile, output, err } @@ -214,17 +215,33 @@ CheckFlags: return c } -func trimDir(dir string) string { - if len(dir) > 1 && dir[len(dir)-1] == filepath.Separator { - dir = dir[:len(dir)-1] +// trimpath returns the -trimpath argument to use +// when compiling the action. +func (a *Action) trimpath() string { + // Strip the object directory entirely. + objdir := a.Objdir + if len(objdir) > 1 && objdir[len(objdir)-1] == filepath.Separator { + objdir = objdir[:len(objdir)-1] } - return dir + rewrite := objdir + "=>" + + // For "go build -trimpath", rewrite package source directory + // to a file system-independent path (just the import path). + if cfg.BuildTrimpath { + if m := a.Package.Module; m != nil { + rewrite += ";" + m.Dir + "=>" + m.Path + "@" + m.Version + } else { + rewrite += ";" + a.Package.Dir + "=>" + a.Package.ImportPath + } + } + + return rewrite } func asmArgs(a *Action, p *load.Package) []interface{} { // Add -I pkg/GOOS_GOARCH so #include "textflag.h" works in .s files. inc := filepath.Join(cfg.GOROOT, "pkg", "include") - args := []interface{}{cfg.BuildToolexec, base.Tool("asm"), "-trimpath", trimDir(a.Objdir), "-I", a.Objdir, "-I", inc, "-D", "GOOS_" + cfg.Goos, "-D", "GOARCH_" + cfg.Goarch, forcedAsmflags, p.Internal.Asmflags} + args := []interface{}{cfg.BuildToolexec, base.Tool("asm"), "-trimpath", a.trimpath(), "-I", a.Objdir, "-I", inc, "-D", "GOOS_" + cfg.Goos, "-D", "GOARCH_" + cfg.Goarch, forcedAsmflags, p.Internal.Asmflags} if p.ImportPath == "runtime" && cfg.Goarch == "386" { for _, arg := range forcedAsmflags { if arg == "-dynlink" { @@ -292,55 +309,6 @@ func (gcToolchain) symabis(b *Builder, a *Action, sfiles []string) (string, erro } } - // Gather known cross-package references from assembly code. - var otherPkgs []string - if p.ImportPath == "runtime" { - // Assembly in the following packages references - // symbols in runtime. - otherPkgs = []string{"syscall", "internal/syscall/unix", "runtime/cgo"} - } else if p.ImportPath == "runtime/internal/atomic" { - // sync/atomic is an assembly wrapper around - // runtime/internal/atomic. - otherPkgs = []string{"sync/atomic"} - } - for _, p2name := range otherPkgs { - p2 := load.LoadPackage(p2name, &load.ImportStack{}) - if len(p2.SFiles) == 0 { - continue - } - - symabis2 := a.Objdir + "symabis2" - if err := mkSymabis(p2, p2.SFiles, symabis2); err != nil { - return "", err - } - - // Filter out just the symbol refs and append them to - // the symabis file. - if cfg.BuildN { - // -x will print the lines from symabis2 that are actually appended - // to symabis. With -n, we don't know what those lines will be. - b.Showcmd("", `grep '^ref' <%s | grep -v '^ref\s*""\.' >>%s`, symabis2, a.Objdir+"symabis") - continue - } - abis2, err := ioutil.ReadFile(symabis2) - if err != nil { - return "", err - } - var refs bytes.Buffer - for _, line := range strings.Split(string(abis2), "\n") { - fs := strings.Fields(line) - if len(fs) >= 2 && fs[0] == "ref" && !strings.HasPrefix(fs[1], `"".`) { - fmt.Fprintf(&refs, "%s\n", line) - } - } - if refs.Len() != 0 { - symabis = a.Objdir + "symabis" - if err := b.appendFile(symabis, refs.Bytes()); err != nil { - return "", err - } - } - } - return symabis, nil } @@ -493,7 +461,21 @@ func pluginPath(a *Action) string { return p.ImportPath } h := sha1.New() - fmt.Fprintf(h, "build ID: %s\n", a.buildID) + buildID := a.buildID + if a.Mode == "link" { + // For linking, use the main package's build ID instead of + // the binary's build ID, so it is the same hash used in + // compiling and linking. + // When compiling, we use actionID/actionID (instead of + // actionID/contentID) as a temporary build ID to compute + // the hash. Do the same here. (See buildid.go:useCache) + // The build ID matters because it affects the overall hash + // in the plugin's pseudo-import path returned below. + // We need to use the same import path when compiling and linking. + id := strings.Split(buildID, buildIDSeparator) + buildID = id[1] + buildIDSeparator + id[1] + } + fmt.Fprintf(h, "build ID: %s\n", buildID) for _, file := range str.StringList(p.GoFiles, p.CgoFiles, p.SFiles) { data, err := ioutil.ReadFile(filepath.Join(p.Dir, file)) if err != nil { @@ -525,7 +507,13 @@ func (gcToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string) // Store BuildID inside toolchain binaries as a unique identifier of the // tool being run, for use by content-based staleness determination. if root.Package.Goroot && strings.HasPrefix(root.Package.ImportPath, "cmd/") { - ldflags = append(ldflags, "-X=cmd/internal/objabi.buildID="+root.buildID) + // External linking will include our build id in the external + // linker's build id, which will cause our build id to not + // match the next time the tool is built. + // Rely on the external build id instead. + if !sys.MustLinkExternal(cfg.Goos, cfg.Goarch) { + ldflags = append(ldflags, "-X=cmd/internal/objabi.buildID="+root.buildID) + } } // If the user has not specified the -extld option, then specify the @@ -560,7 +548,11 @@ func (gcToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string) dir, out = filepath.Split(out) } - return b.run(root, dir, root.Package.ImportPath, nil, cfg.BuildToolexec, base.Tool("link"), "-o", out, "-importcfg", importcfg, ldflags, mainpkg) + env := []string{} + if cfg.BuildTrimpath { + env = append(env, "GOROOT_FINAL=go") + } + return b.run(root, dir, root.Package.ImportPath, env, cfg.BuildToolexec, base.Tool("link"), "-o", out, "-importcfg", importcfg, ldflags, mainpkg) } func (gcToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, out, importcfg string, allactions []*Action) error { diff --git a/libgo/go/cmd/go/internal/work/gccgo.go b/libgo/go/cmd/go/internal/work/gccgo.go index 3b97209b752..87b3f5facd9 100644 --- a/libgo/go/cmd/go/internal/work/gccgo.go +++ b/libgo/go/cmd/go/internal/work/gccgo.go @@ -26,7 +26,7 @@ var GccgoName, GccgoBin string var gccgoErr error func init() { - GccgoName = os.Getenv("GCCGO") + GccgoName = cfg.Getenv("GCCGO") if GccgoName == "" { GccgoName = cfg.DefaultGCCGO(cfg.Goos, cfg.Goarch) } @@ -44,7 +44,7 @@ func (gccgoToolchain) linker() string { } func (gccgoToolchain) ar() string { - ar := os.Getenv("AR") + ar := cfg.Getenv("AR") if ar == "" { ar = "ar" } @@ -96,7 +96,7 @@ func (tools gccgoToolchain) gc(b *Builder, a *Action, archive string, importcfg args = append(args, mkAbs(p.Dir, f)) } - output, err = b.runOut(p.Dir, nil, args) + output, err = b.runOut(a, p.Dir, nil, args) return ofile, output, err } @@ -209,7 +209,7 @@ func (tools gccgoToolchain) pack(b *Builder, a *Action, afile string, ofiles []s } absAfile := mkAbs(objdir, afile) // Try with D modifier first, then without if that fails. - output, err := b.runOut(p.Dir, nil, tools.ar(), arArgs, "rcD", absAfile, absOfiles) + output, err := b.runOut(a, p.Dir, nil, tools.ar(), arArgs, "rcD", absAfile, absOfiles) if err != nil { return b.run(a, p.Dir, p.ImportPath, nil, tools.ar(), arArgs, "rc", absAfile, absOfiles) } @@ -490,6 +490,7 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string ldflags = append(ldflags, "-shared", "-nostdlib") ldflags = append(ldflags, goLibBegin...) ldflags = append(ldflags, "-lgo", "-lgcc_s", "-lgcc", "-lc", "-lgcc") + case "shared": if cfg.Goos != "aix" { ldflags = append(ldflags, "-zdefs") @@ -512,7 +513,7 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string ldflags = append(ldflags, "-lobjc") } if fortran { - fc := os.Getenv("FC") + fc := cfg.Getenv("FC") if fc == "" { fc = "gfortran" } diff --git a/libgo/go/cmd/go/internal/work/init.go b/libgo/go/cmd/go/internal/work/init.go index 3381ab544c7..35d3a505cc7 100644 --- a/libgo/go/cmd/go/internal/work/init.go +++ b/libgo/go/cmd/go/internal/work/init.go @@ -95,7 +95,7 @@ func buildModeInit() { codegenArg = "-shared" default: switch cfg.Goos { - case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris": + case "dragonfly", "freebsd", "illumos", "linux", "netbsd", "openbsd", "solaris": if platform == "linux/ppc64" { base.Fatalf("-buildmode=c-archive not supported on %s\n", platform) } @@ -164,6 +164,7 @@ func buildModeInit() { codegenArg = "-shared" case "darwin/amd64": codegenArg = "-shared" + case "aix/ppc64": default: base.Fatalf("-buildmode=pie not supported on %s\n", platform) } diff --git a/libgo/go/cmd/go/internal/work/security.go b/libgo/go/cmd/go/internal/work/security.go index 1a401b8981e..0d8da21ae38 100644 --- a/libgo/go/cmd/go/internal/work/security.go +++ b/libgo/go/cmd/go/internal/work/security.go @@ -30,16 +30,18 @@ package work import ( - "cmd/go/internal/load" "fmt" - "os" + "internal/lazyregexp" "regexp" "strings" + + "cmd/go/internal/cfg" + "cmd/go/internal/load" ) -var re = regexp.MustCompile +var re = lazyregexp.New -var validCompilerFlags = []*regexp.Regexp{ +var validCompilerFlags = []*lazyregexp.Regexp{ re(`-D([A-Za-z_].*)`), re(`-F([^@\-].*)`), re(`-I([^@\-].*)`), @@ -100,6 +102,10 @@ var validCompilerFlags = []*regexp.Regexp{ re(`-mmacosx-(.+)`), re(`-mios-simulator-version-min=(.+)`), re(`-miphoneos-version-min=(.+)`), + re(`-mtvos-simulator-version-min=(.+)`), + re(`-mtvos-version-min=(.+)`), + re(`-mwatchos-simulator-version-min=(.+)`), + re(`-mwatchos-version-min=(.+)`), re(`-mnop-fun-dllimport`), re(`-m(no-)?sse[0-9.]*`), re(`-m(no-)?ssse3`), @@ -130,7 +136,7 @@ var validCompilerFlagsWithNextArg = []string{ "-x", } -var validLinkerFlags = []*regexp.Regexp{ +var validLinkerFlags = []*lazyregexp.Regexp{ re(`-F([^@\-].*)`), re(`-l([^@\-].*)`), re(`-L([^@\-].*)`), @@ -166,6 +172,7 @@ var validLinkerFlags = []*regexp.Regexp{ re(`-Wl,--(no-)?allow-shlib-undefined`), re(`-Wl,--(no-)?as-needed`), re(`-Wl,-Bdynamic`), + re(`-Wl,-berok`), re(`-Wl,-Bstatic`), re(`-WL,-O([^@,\-][^,]*)?`), re(`-Wl,-d[ny]`), @@ -177,6 +184,8 @@ var validLinkerFlags = []*regexp.Regexp{ re(`-Wl,-framework,[^,@\-][^,]+`), re(`-Wl,-headerpad_max_install_names`), re(`-Wl,--no-undefined`), + re(`-Wl,-R([^@\-][^,@]*$)`), + re(`-Wl,--just-symbols[=,]([^,@\-][^,@]+)`), re(`-Wl,-rpath(-link)?[=,]([^,@\-][^,]+)`), re(`-Wl,-s`), re(`-Wl,-search_paths_first`), @@ -206,6 +215,8 @@ var validLinkerFlagsWithNextArg = []string{ "-target", "-Wl,-framework", "-Wl,-rpath", + "-Wl,-R", + "-Wl,--just-symbols", "-Wl,-undefined", } @@ -217,20 +228,20 @@ func checkLinkerFlags(name, source string, list []string) error { return checkFlags(name, source, list, validLinkerFlags, validLinkerFlagsWithNextArg) } -func checkFlags(name, source string, list []string, valid []*regexp.Regexp, validNext []string) error { +func checkFlags(name, source string, list []string, valid []*lazyregexp.Regexp, validNext []string) error { // Let users override rules with $CGO_CFLAGS_ALLOW, $CGO_CFLAGS_DISALLOW, etc. var ( allow *regexp.Regexp disallow *regexp.Regexp ) - if env := os.Getenv("CGO_" + name + "_ALLOW"); env != "" { + if env := cfg.Getenv("CGO_" + name + "_ALLOW"); env != "" { r, err := regexp.Compile(env) if err != nil { return fmt.Errorf("parsing $CGO_%s_ALLOW: %v", name, err) } allow = r } - if env := os.Getenv("CGO_" + name + "_DISALLOW"); env != "" { + if env := cfg.Getenv("CGO_" + name + "_DISALLOW"); env != "" { r, err := regexp.Compile(env) if err != nil { return fmt.Errorf("parsing $CGO_%s_DISALLOW: %v", name, err) diff --git a/libgo/go/cmd/go/internal/work/security_test.go b/libgo/go/cmd/go/internal/work/security_test.go index d23b6eadff5..fd8caeab4ec 100644 --- a/libgo/go/cmd/go/internal/work/security_test.go +++ b/libgo/go/cmd/go/internal/work/security_test.go @@ -125,6 +125,11 @@ var goodLinkerFlags = [][]string{ {"-pthread"}, {"-Wl,-rpath,foo"}, {"-Wl,-rpath,$ORIGIN/foo"}, + {"-Wl,-R", "/foo"}, + {"-Wl,-R", "foo"}, + {"-Wl,-R,foo"}, + {"-Wl,--just-symbols=foo"}, + {"-Wl,--just-symbols,foo"}, {"-Wl,--warn-error"}, {"-Wl,--no-warn-error"}, {"foo.so"}, @@ -197,6 +202,9 @@ var badLinkerFlags = [][]string{ {"-x", "--c"}, {"-x", "@obj"}, {"-Wl,-rpath,@foo"}, + {"-Wl,-R,foo,bar"}, + {"-Wl,-R,@foo"}, + {"-Wl,--just-symbols,@foo"}, {"../x.o"}, } diff --git a/libgo/go/cmd/go/main.go b/libgo/go/cmd/go/main.go index d986f5508d9..16bdb6209f1 100644 --- a/libgo/go/cmd/go/main.go +++ b/libgo/go/cmd/go/main.go @@ -49,7 +49,7 @@ func init() { fix.CmdFix, fmtcmd.CmdFmt, generate.CmdGenerate, - get.CmdGet, + modget.CmdGet, work.CmdInstall, list.CmdList, modcmd.CmdMod, @@ -71,6 +71,8 @@ func init() { help.HelpImportPath, modload.HelpModules, modget.HelpModuleGet, + modfetch.HelpModuleAuth, + modfetch.HelpModulePrivate, help.HelpPackages, test.HelpTestflag, test.HelpTestfunc, @@ -88,17 +90,10 @@ func main() { base.Usage() } - if modload.MustUseModules { - // If running with modules force-enabled, change get now to change help message. - *get.CmdGet = *modget.CmdGet - } - if args[0] == "get" || args[0] == "help" { - // Replace get with module-aware get if appropriate. - // Note that if MustUseModules is true, this happened already above, - // but no harm in doing it again. - if modload.Init(); modload.Enabled() { - *get.CmdGet = *modget.CmdGet + if modload.Init(); !modload.Enabled() { + // Replace module-aware get with GOPATH get if appropriate. + *modget.CmdGet = *get.CmdGet } } @@ -128,8 +123,14 @@ func main() { os.Exit(2) } if !filepath.IsAbs(p) { - fmt.Fprintf(os.Stderr, "go: GOPATH entry is relative; must be absolute path: %q.\nFor more details see: 'go help gopath'\n", p) - os.Exit(2) + if cfg.Getenv("GOPATH") == "" { + // We inferred $GOPATH from $HOME and did a bad job at it. + // Instead of dying, uninfer it. + cfg.BuildContext.GOPATH = "" + } else { + fmt.Fprintf(os.Stderr, "go: GOPATH entry is relative; must be absolute path: %q.\nFor more details see: 'go help gopath'\n", p) + os.Exit(2) + } } } } @@ -142,37 +143,6 @@ func main() { os.Exit(2) } - // TODO(rsc): Remove all these helper prints in Go 1.12. - switch args[0] { - case "mod": - if len(args) >= 2 { - flag := args[1] - if strings.HasPrefix(flag, "--") { - flag = flag[1:] - } - if i := strings.Index(flag, "="); i >= 0 { - flag = flag[:i] - } - switch flag { - case "-sync", "-fix": - fmt.Fprintf(os.Stderr, "go: go mod %s is now go mod tidy\n", flag) - os.Exit(2) - case "-init", "-graph", "-vendor", "-verify": - fmt.Fprintf(os.Stderr, "go: go mod %s is now go mod %s\n", flag, flag[1:]) - os.Exit(2) - case "-fmt", "-json", "-module", "-require", "-droprequire", "-replace", "-dropreplace", "-exclude", "-dropexclude": - fmt.Fprintf(os.Stderr, "go: go mod %s is now go mod edit %s\n", flag, flag) - os.Exit(2) - } - } - case "vendor": - fmt.Fprintf(os.Stderr, "go: vgo vendor is now go mod vendor\n") - os.Exit(2) - case "verify": - fmt.Fprintf(os.Stderr, "go: vgo verify is now go mod verify\n") - os.Exit(2) - } - // Set environment (GOOS, GOARCH, etc) explicitly. // In theory all the commands we invoke should have // the same default computation of these as we do, diff --git a/libgo/go/cmd/go/note_test.go b/libgo/go/cmd/go/note_test.go index 7ef4c641d7d..e94e82bd5bd 100644 --- a/libgo/go/cmd/go/note_test.go +++ b/libgo/go/cmd/go/note_test.go @@ -34,8 +34,6 @@ func TestNoteReading(t *testing.T) { switch { case !build.Default.CgoEnabled: t.Skipf("skipping - no cgo, so assuming external linking not available") - case runtime.GOOS == "openbsd" && runtime.GOARCH == "arm": - t.Skipf("skipping - external linking not supported, golang.org/issue/10619") case runtime.GOOS == "plan9": t.Skipf("skipping - external linking not supported") } diff --git a/libgo/go/cmd/go/proxy_test.go b/libgo/go/cmd/go/proxy_test.go index 830cea029b7..6919d321847 100644 --- a/libgo/go/cmd/go/proxy_test.go +++ b/libgo/go/cmd/go/proxy_test.go @@ -8,23 +8,28 @@ import ( "archive/zip" "bytes" "encoding/json" + "errors" "flag" "fmt" + "io" "io/ioutil" "log" "net" "net/http" "os" "path/filepath" + "strconv" "strings" "sync" "testing" + "cmd/go/internal/dirhash" "cmd/go/internal/modfetch" "cmd/go/internal/modfetch/codehost" "cmd/go/internal/module" "cmd/go/internal/par" "cmd/go/internal/semver" + "cmd/go/internal/sumweb" "cmd/go/internal/txtar" ) @@ -42,7 +47,6 @@ var proxyOnce sync.Once // The proxy serves from testdata/mod. See testdata/mod/README. func StartProxy() { proxyOnce.Do(func() { - fmt.Fprintf(os.Stderr, "go test proxy starting\n") readModList() addr := *proxyAddr if addr == "" { @@ -58,6 +62,11 @@ func StartProxy() { go func() { log.Fatalf("go proxy: http.Serve: %v", http.Serve(l, http.HandlerFunc(proxyHandler))) }() + + // Prepopulate main sumdb. + for _, mod := range modList { + sumdbHandler.Server.Lookup(nil, mod.Path+"@"+mod.Version) + } }) } @@ -81,7 +90,9 @@ func readModList() { encPath := strings.ReplaceAll(name[:i], "_", "/") path, err := module.DecodePath(encPath) if err != nil { - fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err) + if encPath != "example.com/invalidpath/v1" { + fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err) + } continue } encVers := name[i+1:] @@ -96,6 +107,15 @@ func readModList() { var zipCache par.Cache +const ( + testSumDBName = "localhost.localdev/sumdb" + testSumDBVerifierKey = "localhost.localdev/sumdb+00000c67+AcTrnkbUA+TU4heY3hkjiSES/DSQniBqIeQ/YppAUtK6" + testSumDBSignerKey = "PRIVATE+KEY+localhost.localdev/sumdb+00000c67+AXu6+oaVaOYuQOFrf1V59JK1owcFlJcHwwXHDfDGxSPk" +) + +var sumdbHandler = &sumweb.Handler{Server: sumweb.NewTestServer(testSumDBSignerKey, proxyGoSum)} +var sumdbWrongHandler = &sumweb.Handler{Server: sumweb.NewTestServer(testSumDBSignerKey, proxyGoSumWrong)} + // proxyHandler serves the Go module proxy protocol. // See the proxy section of https://research.swtch.com/vgo-module. func proxyHandler(w http.ResponseWriter, r *http.Request) { @@ -103,7 +123,117 @@ func proxyHandler(w http.ResponseWriter, r *http.Request) { http.NotFound(w, r) return } - path := strings.TrimPrefix(r.URL.Path, "/mod/") + path := r.URL.Path[len("/mod/"):] + + // /mod/quiet/ does not print errors. + quiet := false + if strings.HasPrefix(path, "quiet/") { + path = path[len("quiet/"):] + quiet = true + } + + // Next element may opt into special behavior. + if j := strings.Index(path, "/"); j >= 0 { + n, err := strconv.Atoi(path[:j]) + if err == nil && n >= 200 { + w.WriteHeader(n) + return + } + if strings.HasPrefix(path, "sumdb-") { + n, err := strconv.Atoi(path[len("sumdb-"):j]) + if err == nil && n >= 200 { + if strings.HasPrefix(path[j:], "/sumdb/") { + w.WriteHeader(n) + return + } + path = path[j+1:] + } + } + } + + // Request for $GOPROXY/sumdb-direct is direct sumdb access. + // (Client thinks it is talking directly to a sumdb.) + if strings.HasPrefix(path, "sumdb-direct/") { + r.URL.Path = path[len("sumdb-direct"):] + sumdbHandler.ServeHTTP(w, r) + return + } + + // Request for $GOPROXY/sumdb-wrong is direct sumdb access + // but all the hashes are wrong. + // (Client thinks it is talking directly to a sumdb.) + if strings.HasPrefix(path, "sumdb-wrong/") { + r.URL.Path = path[len("sumdb-wrong"):] + sumdbWrongHandler.ServeHTTP(w, r) + return + } + + // Request for $GOPROXY/sumdb//supported + // is checking whether it's OK to access sumdb via the proxy. + if path == "sumdb/"+testSumDBName+"/supported" { + w.WriteHeader(200) + return + } + + // Request for $GOPROXY/sumdb//... goes to sumdb. + if sumdbPrefix := "sumdb/" + testSumDBName + "/"; strings.HasPrefix(path, sumdbPrefix) { + r.URL.Path = path[len(sumdbPrefix)-1:] + sumdbHandler.ServeHTTP(w, r) + return + } + + // Module proxy request: /mod/path/@latest + // Rewrite to /mod/path/@v/.info where is the semantically + // latest version, including pseudo-versions. + if i := strings.LastIndex(path, "/@latest"); i >= 0 { + enc := path[:i] + modPath, err := module.DecodePath(enc) + if err != nil { + if !quiet { + fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err) + } + http.NotFound(w, r) + return + } + + // Imitate what "latest" does in direct mode and what proxy.golang.org does. + // Use the latest released version. + // If there is no released version, use the latest prereleased version. + // Otherwise, use the latest pseudoversion. + var latestRelease, latestPrerelease, latestPseudo string + for _, m := range modList { + if m.Path != modPath { + continue + } + if modfetch.IsPseudoVersion(m.Version) && (latestPseudo == "" || semver.Compare(latestPseudo, m.Version) > 0) { + latestPseudo = m.Version + } else if semver.Prerelease(m.Version) != "" && (latestPrerelease == "" || semver.Compare(latestPrerelease, m.Version) > 0) { + latestPrerelease = m.Version + } else if latestRelease == "" || semver.Compare(latestRelease, m.Version) > 0 { + latestRelease = m.Version + } + } + var latest string + if latestRelease != "" { + latest = latestRelease + } else if latestPrerelease != "" { + latest = latestPrerelease + } else if latestPseudo != "" { + latest = latestPseudo + } else { + http.NotFound(w, r) + return + } + + encVers, err := module.EncodeVersion(latest) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + path = fmt.Sprintf("%s/@v/%s.info", enc, encVers) + } + + // Module proxy request: /mod/path/@v/version[.suffix] i := strings.Index(path, "/@v/") if i < 0 { http.NotFound(w, r) @@ -112,21 +242,29 @@ func proxyHandler(w http.ResponseWriter, r *http.Request) { enc, file := path[:i], path[i+len("/@v/"):] path, err := module.DecodePath(enc) if err != nil { - fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err) + if !quiet { + fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err) + } http.NotFound(w, r) return } if file == "list" { - n := 0 + // list returns a list of versions, not including pseudo-versions. + // If the module has no tagged versions, we should serve an empty 200. + // If the module doesn't exist, we should serve 404 or 410. + found := false for _, m := range modList { - if m.Path == path && !modfetch.IsPseudoVersion(m.Version) { + if m.Path != path { + continue + } + found = true + if !modfetch.IsPseudoVersion(m.Version) { if err := module.Check(m.Path, m.Version); err == nil { fmt.Fprintf(w, "%s\n", m.Version) - n++ } } } - if n == 0 { + if !found { http.NotFound(w, r) } return @@ -168,10 +306,16 @@ func proxyHandler(w http.ResponseWriter, r *http.Request) { } } - a := readArchive(path, vers) - if a == nil { - fmt.Fprintf(os.Stderr, "go proxy: no archive %s %s\n", path, vers) - http.Error(w, "cannot load archive", 500) + a, err := readArchive(path, vers) + if err != nil { + if !quiet { + fmt.Fprintf(os.Stderr, "go proxy: no archive %s %s: %v\n", path, vers, err) + } + if errors.Is(err, os.ErrNotExist) { + http.NotFound(w, r) + } else { + http.Error(w, "cannot load archive", 500) + } return } @@ -218,7 +362,9 @@ func proxyHandler(w http.ResponseWriter, r *http.Request) { }).(cached) if c.err != nil { - fmt.Fprintf(os.Stderr, "go proxy: %v\n", c.err) + if !quiet { + fmt.Fprintf(os.Stderr, "go proxy: %v\n", c.err) + } http.Error(w, c.err.Error(), 500) return } @@ -230,8 +376,8 @@ func proxyHandler(w http.ResponseWriter, r *http.Request) { } func findHash(m module.Version) string { - a := readArchive(m.Path, m.Version) - if a == nil { + a, err := readArchive(m.Path, m.Version) + if err != nil { return "" } var data []byte @@ -250,16 +396,14 @@ var archiveCache par.Cache var cmdGoDir, _ = os.Getwd() -func readArchive(path, vers string) *txtar.Archive { +func readArchive(path, vers string) (*txtar.Archive, error) { enc, err := module.EncodePath(path) if err != nil { - fmt.Fprintf(os.Stderr, "go proxy: %v\n", err) - return nil + return nil, err } encVers, err := module.EncodeVersion(vers) if err != nil { - fmt.Fprintf(os.Stderr, "go proxy: %v\n", err) - return nil + return nil, err } prefix := strings.ReplaceAll(enc, "/", "_") @@ -274,5 +418,51 @@ func readArchive(path, vers string) *txtar.Archive { } return a }).(*txtar.Archive) - return a + if a == nil { + return nil, os.ErrNotExist + } + return a, nil +} + +// proxyGoSum returns the two go.sum lines for path@vers. +func proxyGoSum(path, vers string) ([]byte, error) { + a, err := readArchive(path, vers) + if err != nil { + return nil, err + } + var names []string + files := make(map[string][]byte) + var gomod []byte + for _, f := range a.Files { + if strings.HasPrefix(f.Name, ".") { + if f.Name == ".mod" { + gomod = f.Data + } + continue + } + name := path + "@" + vers + "/" + f.Name + names = append(names, name) + files[name] = f.Data + } + h1, err := dirhash.Hash1(names, func(name string) (io.ReadCloser, error) { + data := files[name] + return ioutil.NopCloser(bytes.NewReader(data)), nil + }) + if err != nil { + return nil, err + } + h1mod, err := dirhash.Hash1([]string{"go.mod"}, func(string) (io.ReadCloser, error) { + return ioutil.NopCloser(bytes.NewReader(gomod)), nil + }) + if err != nil { + return nil, err + } + data := []byte(fmt.Sprintf("%s %s %s\n%s %s/go.mod %s\n", path, vers, h1, path, vers, h1mod)) + return data, nil +} + +// proxyGoSumWrong returns the wrong lines. +func proxyGoSumWrong(path, vers string) ([]byte, error) { + data := []byte(fmt.Sprintf("%s %s %s\n%s %s/go.mod %s\n", path, vers, "h1:wrong", path, vers, "h1:wrong")) + return data, nil } diff --git a/libgo/go/cmd/go/script_test.go b/libgo/go/cmd/go/script_test.go index 3002db76799..4dcb4b4e0d5 100644 --- a/libgo/go/cmd/go/script_test.go +++ b/libgo/go/cmd/go/script_test.go @@ -24,8 +24,10 @@ import ( "testing" "time" + "cmd/go/internal/cfg" "cmd/go/internal/imports" "cmd/go/internal/par" + "cmd/go/internal/robustio" "cmd/go/internal/txtar" "cmd/go/internal/work" ) @@ -84,6 +86,7 @@ type backgroundCmd struct { var extraEnvKeys = []string{ "SYSTEMROOT", // must be preserved on Windows to find DLLs; golang.org/issue/25210 + "WINDIR", // must be preserved on Windows to be able to run PowerShell command; golang.org/issue/30711 "LD_LIBRARY_PATH", // must be preserved on Unix systems to find shared libraries "CC", // don't lose user settings when invoking cgo "GO_TESTING_GOTOOLS", // for gccgo testing @@ -105,10 +108,15 @@ func (ts *testScript) setup() { "CCACHE_DISABLE=1", // ccache breaks with non-existent HOME "GOARCH=" + runtime.GOARCH, "GOCACHE=" + testGOCACHE, + "GOEXE=" + cfg.ExeSuffix, "GOOS=" + runtime.GOOS, "GOPATH=" + filepath.Join(ts.workdir, "gopath"), "GOPROXY=" + proxyURL, + "GOPRIVATE=", "GOROOT=" + testGOROOT, + "GOSUMDB=" + testSumDBVerifierKey, + "GONOPROXY=", + "GONOSUMDB=", tempEnvName() + "=" + filepath.Join(ts.workdir, "tmp"), "devnull=" + os.DevNull, "goversion=" + goVersion(ts), @@ -119,11 +127,6 @@ func (ts *testScript) setup() { ts.env = append(ts.env, "path="+testBin+string(filepath.ListSeparator)+os.Getenv("path")) } - if runtime.GOOS == "windows" { - ts.env = append(ts.env, "exe=.exe") - } else { - ts.env = append(ts.env, "exe=") - } for _, key := range extraEnvKeys { if val := os.Getenv(key); val != "" { ts.env = append(ts.env, key+"="+val) @@ -192,7 +195,7 @@ func (ts *testScript) run() { a, err := txtar.ParseFile(ts.file) ts.check(err) for _, f := range a.Files { - name := ts.mkabs(ts.expand(f.Name)) + name := ts.mkabs(ts.expand(f.Name, false)) ts.check(os.MkdirAll(filepath.Dir(name), 0777)) ts.check(ioutil.WriteFile(name, f.Data, 0666)) } @@ -238,34 +241,24 @@ Script: } // Parse input line. Ignore blanks entirely. - args := ts.parse(line) - if len(args) == 0 { + parsed := ts.parse(line) + if parsed.name == "" { + if parsed.neg || len(parsed.conds) > 0 { + ts.fatalf("missing command") + } continue } // Echo command to log. fmt.Fprintf(&ts.log, "> %s\n", line) - // Command prefix [cond] means only run this command if cond is satisfied. - for strings.HasPrefix(args[0], "[") && strings.HasSuffix(args[0], "]") { - cond := args[0] - cond = cond[1 : len(cond)-1] - cond = strings.TrimSpace(cond) - args = args[1:] - if len(args) == 0 { - ts.fatalf("missing command after condition") - } - want := true - if strings.HasPrefix(cond, "!") { - want = false - cond = strings.TrimSpace(cond[1:]) - } + for _, cond := range parsed.conds { // Known conds are: $GOOS, $GOARCH, runtime.Compiler, and 'short' (for testing.Short). // // NOTE: If you make changes here, update testdata/script/README too! // ok := false - switch cond { + switch cond.tag { case runtime.GOOS, runtime.GOARCH, runtime.Compiler: ok = true case "short": @@ -285,8 +278,8 @@ Script: case "symlink": ok = testenv.HasSymlink() default: - if strings.HasPrefix(cond, "exec:") { - prog := cond[len("exec:"):] + if strings.HasPrefix(cond.tag, "exec:") { + prog := cond.tag[len("exec:"):] ok = execCache.Do(prog, func() interface{} { if runtime.GOOS == "plan9" && prog == "git" { // The Git command is usually not the real Git on Plan 9. @@ -298,33 +291,22 @@ Script: }).(bool) break } - if !imports.KnownArch[cond] && !imports.KnownOS[cond] && cond != "gc" && cond != "gccgo" { - ts.fatalf("unknown condition %q", cond) + if !imports.KnownArch[cond.tag] && !imports.KnownOS[cond.tag] && cond.tag != "gc" && cond.tag != "gccgo" { + ts.fatalf("unknown condition %q", cond.tag) } } - if ok != want { + if ok != cond.want { // Don't run rest of line. continue Script } } - // Command prefix ! means negate the expectations about this command: - // go command should fail, match should not be found, etc. - neg := false - if args[0] == "!" { - neg = true - args = args[1:] - if len(args) == 0 { - ts.fatalf("! on line by itself") - } - } - // Run command. - cmd := scriptCmds[args[0]] + cmd := scriptCmds[parsed.name] if cmd == nil { - ts.fatalf("unknown command %q", args[0]) + ts.fatalf("unknown command %q", parsed.name) } - cmd(ts, neg, args[1:]) + cmd(ts, parsed.neg, parsed.args) // Command can ask script to stop early. if ts.stopped { @@ -376,6 +358,14 @@ var scriptCmds = map[string]func(*testScript, bool, []string){ "wait": (*testScript).cmdWait, } +// When expanding shell variables for these commands, we apply regexp quoting to +// expanded strings within the first argument. +var regexpCmd = map[string]bool{ + "grep": true, + "stderr": true, + "stdout": true, +} + // addcrlf adds CRLF line endings to the named files. func (ts *testScript) cmdAddcrlf(neg bool, args []string) { if len(args) == 0 { @@ -399,7 +389,7 @@ func (ts *testScript) cmdCc(neg bool, args []string) { var b work.Builder b.Init() ts.cmdExec(neg, append(b.GccCmd(".", ""), args...)) - os.RemoveAll(b.WorkDir) + robustio.RemoveAll(b.WorkDir) } // cd changes to a different directory. @@ -486,8 +476,8 @@ func (ts *testScript) doCmdCmp(args []string, env bool) { text2 = string(data) if env { - text1 = ts.expand(text1) - text2 = ts.expand(text2) + text1 = ts.expand(text1, false) + text2 = ts.expand(text2, false) } if text1 == text2 { @@ -515,16 +505,33 @@ func (ts *testScript) cmdCp(neg bool, args []string) { } for _, arg := range args[:len(args)-1] { - src := ts.mkabs(arg) - info, err := os.Stat(src) - ts.check(err) - data, err := ioutil.ReadFile(src) - ts.check(err) + var ( + src string + data []byte + mode os.FileMode + ) + switch arg { + case "stdout": + src = arg + data = []byte(ts.stdout) + mode = 0666 + case "stderr": + src = arg + data = []byte(ts.stderr) + mode = 0666 + default: + src = ts.mkabs(arg) + info, err := os.Stat(src) + ts.check(err) + mode = info.Mode() & 0777 + data, err = ioutil.ReadFile(src) + ts.check(err) + } targ := dst if dstDir { targ = filepath.Join(dst, filepath.Base(src)) } - ts.check(ioutil.WriteFile(targ, data, info.Mode()&0777)) + ts.check(ioutil.WriteFile(targ, data, mode)) } } @@ -533,6 +540,13 @@ func (ts *testScript) cmdEnv(neg bool, args []string) { if neg { ts.fatalf("unsupported: ! env") } + + conv := func(s string) string { return s } + if len(args) > 0 && args[0] == "-r" { + conv = regexp.QuoteMeta + args = args[1:] + } + if len(args) == 0 { printed := make(map[string]bool) // env list can have duplicates; only print effective value (from envMap) once for _, kv := range ts.env { @@ -550,8 +564,9 @@ func (ts *testScript) cmdEnv(neg bool, args []string) { fmt.Fprintf(&ts.log, "%s=%s\n", env, ts.envMap[env]) continue } - ts.env = append(ts.env, env) - ts.envMap[env[:i]] = env[i+1:] + key, val := env[:i], conv(env[i+1:]) + ts.env = append(ts.env, key+"="+val) + ts.envMap[key] = val } } @@ -655,8 +670,8 @@ func (ts *testScript) cmdRm(neg bool, args []string) { } for _, arg := range args { file := ts.mkabs(arg) - removeAll(file) // does chmod and then attempts rm - ts.check(os.RemoveAll(file)) // report error + removeAll(file) // does chmod and then attempts rm + ts.check(robustio.RemoveAll(file)) // report error } } @@ -737,6 +752,11 @@ func scriptMatch(ts *testScript, neg bool, args []string, text, name string) { } args = args[1:] } + quiet := false + if len(args) >= 1 && args[0] == "-q" { + quiet = true + args = args[1:] + } extraUsage := "" want := 1 @@ -748,9 +768,11 @@ func scriptMatch(ts *testScript, neg bool, args []string, text, name string) { ts.fatalf("usage: %s [-count=N] 'pattern'%s", name, extraUsage) } - pattern := args[0] - re, err := regexp.Compile(`(?m)` + pattern) - ts.check(err) + pattern := `(?m)` + args[0] + re, err := regexp.Compile(pattern) + if err != nil { + ts.fatalf("regexp.Compile(%q): %v", pattern, err) + } isGrep := name == "grep" if isGrep { @@ -765,14 +787,14 @@ func scriptMatch(ts *testScript, neg bool, args []string, text, name string) { if neg { if re.MatchString(text) { - if isGrep { + if isGrep && !quiet { fmt.Fprintf(&ts.log, "[%s]\n%s\n", name, text) } ts.fatalf("unexpected match for %#q found in %s: %s", pattern, name, re.FindString(text)) } } else { if !re.MatchString(text) { - if isGrep { + if isGrep && !quiet { fmt.Fprintf(&ts.log, "[%s]\n%s\n", name, text) } ts.fatalf("no match for %#q found in %s", pattern, name) @@ -780,7 +802,7 @@ func scriptMatch(ts *testScript, neg bool, args []string, text, name string) { if n > 0 { count := len(re.FindAllString(text, -1)) if count != n { - if isGrep { + if isGrep && !quiet { fmt.Fprintf(&ts.log, "[%s]\n%s\n", name, text) } ts.fatalf("have %d matches for %#q, want %d", count, pattern, n) @@ -939,8 +961,20 @@ func interruptProcess(p *os.Process) { } // expand applies environment variable expansion to the string s. -func (ts *testScript) expand(s string) string { - return os.Expand(s, func(key string) string { return ts.envMap[key] }) +func (ts *testScript) expand(s string, inRegexp bool) string { + return os.Expand(s, func(key string) string { + e := ts.envMap[key] + if inRegexp { + // Replace workdir with $WORK, since we have done the same substitution in + // the text we're about to compare against. + e = strings.ReplaceAll(e, ts.workdir, "$WORK") + + // Quote to literal strings: we want paths like C:\work\go1.4 to remain + // paths rather than regular expressions. + e = regexp.QuoteMeta(e) + } + return e + }) } // fatalf aborts the test with the given failure message. @@ -958,27 +992,82 @@ func (ts *testScript) mkabs(file string) string { return filepath.Join(ts.cd, file) } +// A condition guards execution of a command. +type condition struct { + want bool + tag string +} + +// A command is a complete command parsed from a script. +type command struct { + neg bool // if true, expect the command to fail + conds []condition // all must be satisfied + name string // the name of the command; must be non-empty + args []string // shell-expanded arguments following name +} + // parse parses a single line as a list of space-separated arguments // subject to environment variable expansion (but not resplitting). // Single quotes around text disable splitting and expansion. // To embed a single quote, double it: 'Don''t communicate by sharing memory.' -func (ts *testScript) parse(line string) []string { +func (ts *testScript) parse(line string) command { ts.line = line var ( - args []string - arg string // text of current arg so far (need to add line[start:i]) - start = -1 // if >= 0, position where current arg text chunk starts - quoted = false // currently processing quoted text + cmd command + arg string // text of current arg so far (need to add line[start:i]) + start = -1 // if >= 0, position where current arg text chunk starts + quoted = false // currently processing quoted text + isRegexp = false // currently processing unquoted regular expression ) + + flushArg := func() { + defer func() { + arg = "" + start = -1 + }() + + if cmd.name != "" { + cmd.args = append(cmd.args, arg) + isRegexp = false // Commands take only one regexp argument, so no subsequent args are regexps. + return + } + + // Command prefix ! means negate the expectations about this command: + // go command should fail, match should not be found, etc. + if arg == "!" { + if cmd.neg { + ts.fatalf("duplicated '!' token") + } + cmd.neg = true + return + } + + // Command prefix [cond] means only run this command if cond is satisfied. + if strings.HasPrefix(arg, "[") && strings.HasSuffix(arg, "]") { + want := true + arg = strings.TrimSpace(arg[1 : len(arg)-1]) + if strings.HasPrefix(arg, "!") { + want = false + arg = strings.TrimSpace(arg[1:]) + } + if arg == "" { + ts.fatalf("empty condition") + } + cmd.conds = append(cmd.conds, condition{want: want, tag: arg}) + return + } + + cmd.name = arg + isRegexp = regexpCmd[cmd.name] + } + for i := 0; ; i++ { if !quoted && (i >= len(line) || line[i] == ' ' || line[i] == '\t' || line[i] == '\r' || line[i] == '#') { // Found arg-separating space. if start >= 0 { - arg += ts.expand(line[start:i]) - args = append(args, arg) - start = -1 - arg = "" + arg += ts.expand(line[start:i], isRegexp) + flushArg() } if i >= len(line) || line[i] == '#' { break @@ -992,7 +1081,7 @@ func (ts *testScript) parse(line string) []string { if !quoted { // starting a quoted chunk if start >= 0 { - arg += ts.expand(line[start:i]) + arg += ts.expand(line[start:i], isRegexp) } start = i + 1 quoted = true @@ -1016,7 +1105,7 @@ func (ts *testScript) parse(line string) []string { start = i } } - return args + return cmd } // diff returns a formatted diff of the two texts, diff --git a/libgo/go/cmd/go/testdata/addmod.go b/libgo/go/cmd/go/testdata/addmod.go index 8bb6056a540..d9c3aab9c49 100644 --- a/libgo/go/cmd/go/testdata/addmod.go +++ b/libgo/go/cmd/go/testdata/addmod.go @@ -29,7 +29,7 @@ import ( "path/filepath" "strings" - "../internal/txtar" + "cmd/go/internal/txtar" ) func usage() { @@ -44,7 +44,7 @@ func fatalf(format string, args ...interface{}) { log.Fatalf(format, args...) } -const goCmd = "vgo" +const goCmd = "go" func main() { flag.Usage = usage diff --git a/libgo/go/cmd/go/testdata/flag_test.go b/libgo/go/cmd/go/testdata/flag_test.go index ddf613d8701..a4e5507f2cd 100644 --- a/libgo/go/cmd/go/testdata/flag_test.go +++ b/libgo/go/cmd/go/testdata/flag_test.go @@ -1,16 +1,19 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package flag_test import ( "flag" - "log" "testing" ) var v = flag.Int("v", 0, "v flag") -// Run this as go test pkg -v=7 +// Run this as go test pkg -args -v=7 func TestVFlagIsSet(t *testing.T) { if *v != 7 { - log.Fatal("v flag not set") + t.Fatal("v flag not set") } } diff --git a/libgo/go/cmd/go/testdata/mod/example.com_badchain_a_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_badchain_a_v1.0.0.txt new file mode 100644 index 00000000000..d7bf6471b7c --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_badchain_a_v1.0.0.txt @@ -0,0 +1,12 @@ +example.com/badchain/a v1.0.0 + +-- .mod -- +module example.com/badchain/a + +require example.com/badchain/b v1.0.0 +-- .info -- +{"Version":"v1.0.0"} +-- a.go -- +package a + +import _ "example.com/badchain/b" diff --git a/libgo/go/cmd/go/testdata/mod/example.com_badchain_a_v1.1.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_badchain_a_v1.1.0.txt new file mode 100644 index 00000000000..92190d8ac17 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_badchain_a_v1.1.0.txt @@ -0,0 +1,12 @@ +example.com/badchain/a v1.1.0 + +-- .mod -- +module example.com/badchain/a + +require example.com/badchain/b v1.1.0 +-- .info -- +{"Version":"v1.1.0"} +-- a.go -- +package a + +import _ "example.com/badchain/b" diff --git a/libgo/go/cmd/go/testdata/mod/example.com_badchain_b_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_badchain_b_v1.0.0.txt new file mode 100644 index 00000000000..d42b8aab164 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_badchain_b_v1.0.0.txt @@ -0,0 +1,12 @@ +example.com/badchain/b v1.0.0 + +-- .mod -- +module example.com/badchain/b + +require example.com/badchain/c v1.0.0 +-- .info -- +{"Version":"v1.0.0"} +-- b.go -- +package b + +import _ "example.com/badchain/c" diff --git a/libgo/go/cmd/go/testdata/mod/example.com_badchain_b_v1.1.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_badchain_b_v1.1.0.txt new file mode 100644 index 00000000000..664818474ce --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_badchain_b_v1.1.0.txt @@ -0,0 +1,12 @@ +example.com/badchain/b v1.1.0 + +-- .mod -- +module example.com/badchain/b + +require example.com/badchain/c v1.1.0 +-- .info -- +{"Version":"v1.1.0"} +-- b.go -- +package b + +import _ "example.com/badchain/c" diff --git a/libgo/go/cmd/go/testdata/mod/example.com_badchain_c_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_badchain_c_v1.0.0.txt new file mode 100644 index 00000000000..9c717cb0e6e --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_badchain_c_v1.0.0.txt @@ -0,0 +1,8 @@ +example.com/badchain/c v1.0.0 + +-- .mod -- +module example.com/badchain/c +-- .info -- +{"Version":"v1.0.0"} +-- c.go -- +package c diff --git a/libgo/go/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt new file mode 100644 index 00000000000..da19ebd9ec9 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt @@ -0,0 +1,8 @@ +example.com/badchain/c v1.1.0 + +-- .mod -- +module example.com/badchain/wrong +-- .info -- +{"Version":"v1.1.0"} +-- c.go -- +package c diff --git a/libgo/go/cmd/go/testdata/mod/example.com_downgrade_v2.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_downgrade_v2.0.0.txt new file mode 100644 index 00000000000..88d50e5bbab --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_downgrade_v2.0.0.txt @@ -0,0 +1,9 @@ +example.com/downgrade v2.0.0 +written by hand + +-- .mod -- +module example.com/downgrade + +require rsc.io/quote v1.5.2 +-- .info -- +{"Version":"v2.0.0"} diff --git a/libgo/go/cmd/go/testdata/mod/example.com_downgrade_v2_v2.0.1.txt b/libgo/go/cmd/go/testdata/mod/example.com_downgrade_v2_v2.0.1.txt new file mode 100644 index 00000000000..a4d665ff1be --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_downgrade_v2_v2.0.1.txt @@ -0,0 +1,13 @@ +example.com/downgrade/v2 v2.0.1 +written by hand + +-- .mod -- +module example.com/downgrade/v2 + +require rsc.io/quote v1.5.2 +-- .info -- +{"Version":"v2.0.1"} +-- go.mod -- +module example.com/downgrade/v2 + +require rsc.io/quote v1.5.2 diff --git a/libgo/go/cmd/go/testdata/mod/example.com_invalidpath_v1_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_invalidpath_v1_v1.0.0.txt new file mode 100644 index 00000000000..7d9d1303a90 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_invalidpath_v1_v1.0.0.txt @@ -0,0 +1,13 @@ +example.com/invalidpath/v1 v1.0.0 +written by hand + +-- .mod -- +module example.com/invalidpath/v1 +-- .info -- +{"Version":"v1.0.0"} +-- go.mod -- +module example.com/invalidpath/v1 +-- version.go -- +package version + +const V = "v1.0.0" diff --git a/libgo/go/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.0.txt new file mode 100644 index 00000000000..25bd3d9d8fa --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.0.txt @@ -0,0 +1,14 @@ +example.com/latemigrate/v2 v2.0.0 +written by hand + +This repository migrated to modules in v2.0.1 after v2.0.0 was already tagged. +All versions require rsc.io/quote so we can test downgrades. + +v2.0.0 is technically part of example.com/latemigrate as v2.0.0+incompatible. +Proxies may serve it as part of the version list for example.com/latemigrate/v2. +'go get' must be able to ignore these versions. + +-- .mod -- +module example.com/latemigrate +-- .info -- +{"Version":"v2.0.0"} diff --git a/libgo/go/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.1.txt b/libgo/go/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.1.txt new file mode 100644 index 00000000000..be427a3185d --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.1.txt @@ -0,0 +1,20 @@ +example.com/latemigrate/v2 v2.0.1 +written by hand + +This repository migrated to modules in v2.0.1 after v2.0.0 was already tagged. +All versions require rsc.io/quote so we can test downgrades. + +v2.0.1 belongs to example.com/latemigrate/v2. + +-- .mod -- +module example.com/latemigrate/v2 + +require rsc.io/quote v1.3.0 +-- .info -- +{"Version":"v2.0.1"} +-- go.mod -- +module example.com/latemigrate/v2 + +require rsc.io/quote v1.3.0 +-- late.go -- +package late diff --git a/libgo/go/cmd/go/testdata/mod/example.com_missingpkg_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_missingpkg_v1.0.0.txt new file mode 100644 index 00000000000..15f3f69557d --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_missingpkg_v1.0.0.txt @@ -0,0 +1,11 @@ +The deprecated package is present in this version (which is @latest) but +is deleted in a newer prerelease version. + +-- .mod -- +module example.com/missingpkg +-- .info -- +{"Version":"v1.0.0"} +-- lib.go -- +package lib +-- deprecated/deprecated.go -- +package deprecated diff --git a/libgo/go/cmd/go/testdata/mod/example.com_missingpkg_v1.0.1-beta.txt b/libgo/go/cmd/go/testdata/mod/example.com_missingpkg_v1.0.1-beta.txt new file mode 100644 index 00000000000..44580fe4cbe --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_missingpkg_v1.0.1-beta.txt @@ -0,0 +1,8 @@ +The deprecated package is deleted in this version. + +-- .mod -- +module example.com/missingpkg +-- .info -- +{"Version":"v1.0.1-beta"} +-- lib.go -- +package lib diff --git a/libgo/go/cmd/go/testdata/mod/example.com_nest_sub_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_nest_sub_v1.0.0.txt new file mode 100644 index 00000000000..90f14598039 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_nest_sub_v1.0.0.txt @@ -0,0 +1,12 @@ +Written by hand. +Test case for nested modules without an explicit relationship. +This is nested below the top-level module. + +-- .mod -- +module example.com/nest/sub +-- .info -- +{"Version": "v1.0.0"} +-- go.mod -- +module example.com/nest/sub +-- y/y.go -- +package y diff --git a/libgo/go/cmd/go/testdata/mod/example.com_nest_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_nest_v1.0.0.txt new file mode 100644 index 00000000000..593caf1d90a --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_nest_v1.0.0.txt @@ -0,0 +1,12 @@ +Written by hand. +Test case for nested modules without an explicit relationship. +This is the top-level module. + +-- .mod -- +module example.com/nest +-- .info -- +{"Version": "v1.0.0"} +-- go.mod -- +module example.com/nest +-- sub/x/x.go -- +package x diff --git a/libgo/go/cmd/go/testdata/mod/example.com_nest_v1.1.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_nest_v1.1.0.txt new file mode 100644 index 00000000000..5a01550fd5d --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_nest_v1.1.0.txt @@ -0,0 +1,12 @@ +Written by hand. +Test case for nested modules without an explicit relationship. +This is the top-level module. + +-- .mod -- +module example.com/nest +-- .info -- +{"Version": "v1.1.0"} +-- go.mod -- +module example.com/nest +-- sub/x/x.go -- +package x diff --git a/libgo/go/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.0.txt new file mode 100644 index 00000000000..829065df9fb --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.0.txt @@ -0,0 +1,10 @@ +example.com/newcycle/a v1.0.0 + +Transitively requires v1.0.1 of itself via example.com/newcycle/b + +-- .mod -- +module example.com/newcycle/a + +require example.com/newcycle/b v1.0.0 +-- .info -- +{"Version":"v1.0.0"} diff --git a/libgo/go/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.1.txt b/libgo/go/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.1.txt new file mode 100644 index 00000000000..a03f4b49fd5 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.1.txt @@ -0,0 +1,10 @@ +example.com/newcycle/a v1.0.1 + +Transitively requires itself via example.com/newcycle/b + +-- .mod -- +module example.com/newcycle/a + +require example.com/newcycle/b v1.0.0 +-- .info -- +{"Version":"v1.0.1"} diff --git a/libgo/go/cmd/go/testdata/mod/example.com_newcycle_b_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_newcycle_b_v1.0.0.txt new file mode 100644 index 00000000000..ff9e1f5ea5f --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_newcycle_b_v1.0.0.txt @@ -0,0 +1,8 @@ +example.com/newcycle/b v1.0.0 + +-- .mod -- +module example.com/newcycle/b + +require example.com/newcycle/a v1.0.1 +-- .info -- +{"Version":"v1.0.0"} diff --git a/libgo/go/cmd/go/testdata/mod/example.com_noroot_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_noroot_v1.0.0.txt new file mode 100644 index 00000000000..aa5febf7105 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_noroot_v1.0.0.txt @@ -0,0 +1,8 @@ +A module which has no root package. + +-- .mod -- +module example.com/noroot +-- .info -- +{"Version":"v1.0.0"} +-- pkg/pkg.go -- +package pkg diff --git a/libgo/go/cmd/go/testdata/mod/example.com_noroot_v1.0.1.txt b/libgo/go/cmd/go/testdata/mod/example.com_noroot_v1.0.1.txt new file mode 100644 index 00000000000..9b93717c84f --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_noroot_v1.0.1.txt @@ -0,0 +1,8 @@ +A module which has no root package. + +-- .mod -- +module example.com/noroot +-- .info -- +{"Version":"v1.0.1"} +-- pkg/pkg.go -- +package pkg diff --git a/libgo/go/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt b/libgo/go/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt new file mode 100644 index 00000000000..259774d5425 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt @@ -0,0 +1,9 @@ +Written by hand. +The "latest" version of a module without any tags. + +-- .mod -- +module example.com/notags +-- .info -- +{"Version":"v0.0.0-20190507143103-cc8cbe209b64","Time":"2019-05-07T07:31:03-07:00"} +-- notags.go -- +package notags diff --git a/libgo/go/cmd/go/testdata/mod/example.com_printversion_v0.1.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_printversion_v0.1.0.txt new file mode 100644 index 00000000000..bae8b13d470 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_printversion_v0.1.0.txt @@ -0,0 +1,27 @@ +example.com/printversion v0.1.0 + +-- .mod -- +module example.com/printversion +-- .info -- +{"Version":"v0.1.0"} +-- README.txt -- +There is no go.mod file for this version of the module. +-- printversion.go -- +package main + +import ( + "fmt" + "os" + "runtime/debug" + + _ "example.com/version" +) + +func main() { + info, _ := debug.ReadBuildInfo() + fmt.Fprintf(os.Stdout, "path is %s\n", info.Path) + fmt.Fprintf(os.Stdout, "main is %s %s\n", info.Main.Path, info.Main.Version) + for _, m := range info.Deps { + fmt.Fprintf(os.Stdout, "using %s %s\n", m.Path, m.Version) + } +} diff --git a/libgo/go/cmd/go/testdata/mod/example.com_printversion_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_printversion_v1.0.0.txt new file mode 100644 index 00000000000..246741821af --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_printversion_v1.0.0.txt @@ -0,0 +1,35 @@ +example.com/printversion v1.0.0 + +-- .mod -- +module example.com/printversion + +require example.com/version v1.0.0 +replace example.com/version v1.0.0 => ../oops v0.0.0 +exclude example.com/version v1.1.0 +-- .info -- +{"Version":"v1.0.0"} +-- go.mod -- +module example.com/printversion + +require example.com/version v1.0.0 +replace example.com/version v1.0.0 => ../oops v0.0.0 +exclude example.com/version v1.0.1 +-- printversion.go -- +package main + +import ( + "fmt" + "os" + "runtime/debug" + + _ "example.com/version" +) + +func main() { + info, _ := debug.ReadBuildInfo() + fmt.Fprintf(os.Stdout, "path is %s\n", info.Path) + fmt.Fprintf(os.Stdout, "main is %s %s\n", info.Main.Path, info.Main.Version) + for _, m := range info.Deps { + fmt.Fprintf(os.Stdout, "using %s %s\n", m.Path, m.Version) + } +} diff --git a/libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190430073000-30950c05d534.txt b/libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190430073000-30950c05d534.txt new file mode 100644 index 00000000000..047ceb68c5b --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190430073000-30950c05d534.txt @@ -0,0 +1,13 @@ +example.com/pseudoupgrade v0.0.0-20190429073000-30950c05d534 +written by hand + +-- .mod -- +module example.com/pseudoupgrade + +-- .info -- +{"Version":"v0.0.0-20190430073000-30950c05d534","Name":"v0.0.0-20190430073000-30950c05d534","Short":"30950c05d534","Time":"2019-04-30T07:30:00Z"} + +-- pseudoupgrade.go -- +package pseudoupgrade + +const X = 1 diff --git a/libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.1.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.1.0.txt new file mode 100644 index 00000000000..7ddb0dc724d --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.1.0.txt @@ -0,0 +1,13 @@ +example.com/pseudoupgrade v0.1.0 +written by hand + +-- .mod -- +module example.com/pseudoupgrade + +-- .info -- +{"Version":"v0.1.0","Name":"","Short":"","Time":"2019-04-29T07:30:30Z"} + +-- pseudoupgrade.go -- +package pseudoupgrade + +const X = 1 diff --git a/libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.1.1-0.20190429073117-b5426c86b553.txt b/libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.1.1-0.20190429073117-b5426c86b553.txt new file mode 100644 index 00000000000..b3f48bbdab6 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.1.1-0.20190429073117-b5426c86b553.txt @@ -0,0 +1,13 @@ +example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553 +written by hand + +-- .mod -- +module example.com/pseudoupgrade + +-- .info -- +{"Version":"v0.1.1-0.20190429073117-b5426c86b553","Name":"v0.1.1-0.20190429073117-b5426c86b553","Short":"b5426c86b553","Time":"2019-04-29T07:31:00Z"} + +-- pseudoupgrade.go -- +package pseudoupgrade + +const X = 1 diff --git a/libgo/go/cmd/go/testdata/mod/example.com_tools_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_tools_v1.0.0.txt new file mode 100644 index 00000000000..22e36b993af --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_tools_v1.0.0.txt @@ -0,0 +1,12 @@ +-- .info -- +{"Version": "v1.0.0"} +-- .mod -- +module example.com/tools +-- cmd/hello/hello.go -- +package main + +import "fmt" + +func main() { + fmt.Println("hello") +} diff --git a/libgo/go/cmd/go/testdata/mod/example.com_usemissingpre_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_usemissingpre_v1.0.0.txt new file mode 100644 index 00000000000..5e1c5c815ed --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_usemissingpre_v1.0.0.txt @@ -0,0 +1,13 @@ +This module requires example.com/missingpkg at a prerelease version, which +is newer than @latest. + +-- .mod -- +module example.com/usemissingpre + +require example.com/missingpkg v1.0.1-beta +-- .info -- +{"Version":"v1.0.0"} +-- use.go -- +package use + +import _ "example.com/missingpkg" diff --git a/libgo/go/cmd/go/testdata/mod/example.com_version_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_version_v1.0.0.txt new file mode 100644 index 00000000000..d8c45b527e9 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_version_v1.0.0.txt @@ -0,0 +1,11 @@ +example.com/version v1.0.0 +written by hand + +-- .mod -- +module example.com/version +-- .info -- +{"Version":"v1.0.0"} +-- version.go -- +package version + +const V = "v1.0.0" diff --git a/libgo/go/cmd/go/testdata/mod/example.com_version_v1.0.1.txt b/libgo/go/cmd/go/testdata/mod/example.com_version_v1.0.1.txt new file mode 100644 index 00000000000..3bfdb0e4cdc --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_version_v1.0.1.txt @@ -0,0 +1,11 @@ +example.com/version v1.0.1 +written by hand + +-- .mod -- +module example.com/version +-- .info -- +{"Version":"v1.0.1"} +-- version.go -- +package version + +const V = "v1.0.1" diff --git a/libgo/go/cmd/go/testdata/mod/example.com_version_v1.1.0.txt b/libgo/go/cmd/go/testdata/mod/example.com_version_v1.1.0.txt new file mode 100644 index 00000000000..8109a9acc9e --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/example.com_version_v1.1.0.txt @@ -0,0 +1,11 @@ +example.com/version v1.1.0 +written by hand + +-- .mod -- +module example.com/version +-- .info -- +{"Version":"v1.1.0"} +-- version.go -- +package version + +const V = "v1.1.0" diff --git a/libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.0.0-20190619020302-197a620e0c9a.txt b/libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.0.0-20190619020302-197a620e0c9a.txt new file mode 100644 index 00000000000..c2709c161e1 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.0.0-20190619020302-197a620e0c9a.txt @@ -0,0 +1,10 @@ +module github.com/dmitshur-test/modtest5@v0.0.0-20190619020302-197a620e0c9a + +-- .mod -- +module github.com/dmitshur-test/modtest5 +-- .info -- +{"Version":"v0.0.0-20190619020302-197a620e0c9a","Time":"2019-06-18T19:03:02-07:00"} +-- p.go -- +package p + +const v = 1 diff --git a/libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.5.0-alpha.0.20190619023908-3da23a9deb9e.txt b/libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.5.0-alpha.0.20190619023908-3da23a9deb9e.txt new file mode 100644 index 00000000000..22e47f378ef --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.5.0-alpha.0.20190619023908-3da23a9deb9e.txt @@ -0,0 +1,10 @@ +module github.com/dmitshur-test/modtest5@v0.5.0-alpha.0.20190619023908-3da23a9deb9e + +-- .mod -- +module github.com/dmitshur-test/modtest5 +-- .info -- +{"Version":"v0.5.0-alpha.0.20190619023908-3da23a9deb9e","Time":"2019-06-18T19:39:08-07:00"} +-- p.go -- +package p + +const v = 3 diff --git a/libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.5.0-alpha.txt b/libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.5.0-alpha.txt new file mode 100644 index 00000000000..4f088ccd2ca --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/github.com_dmitshur-test_modtest5_v0.5.0-alpha.txt @@ -0,0 +1,10 @@ +module github.com/dmitshur-test/modtest5@v0.5.0-alpha + +-- .mod -- +module github.com/dmitshur-test/modtest5 +-- .info -- +{"Version":"v0.5.0-alpha","Time":"2019-06-18T19:04:46-07:00"} +-- p.go -- +package p + +const v = 2 diff --git a/libgo/go/cmd/go/testdata/mod/patch.example.com_depofdirectpatch_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/patch.example.com_depofdirectpatch_v1.0.0.txt new file mode 100644 index 00000000000..40616c668a8 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/patch.example.com_depofdirectpatch_v1.0.0.txt @@ -0,0 +1,11 @@ +patch.example.com/depofdirectpatch v1.0.0 +written by hand + +-- .mod -- +module patch.example.com/depofdirectpatch +-- .info -- +{"Version":"v1.0.0"} +-- go.mod -- +module patch.example.com/depofdirectpatch +-- depofdirectpatch.go -- +package depofdirectpatch diff --git a/libgo/go/cmd/go/testdata/mod/patch.example.com_depofdirectpatch_v1.0.1.txt b/libgo/go/cmd/go/testdata/mod/patch.example.com_depofdirectpatch_v1.0.1.txt new file mode 100644 index 00000000000..e075028656e --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/patch.example.com_depofdirectpatch_v1.0.1.txt @@ -0,0 +1,11 @@ +patch.example.com/depofdirectpatch v1.0.1 +written by hand + +-- .mod -- +module patch.example.com/depofdirectpatch +-- .info -- +{"Version":"v1.0.1"} +-- go.mod -- +module patch.example.com/depofdirectpatch +-- depofdirectpatch.go -- +package depofdirectpatch diff --git a/libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.0.0.txt new file mode 100644 index 00000000000..1e775fb89bc --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.0.0.txt @@ -0,0 +1,21 @@ +patch.example.com/direct v1.0.0 +written by hand + +-- .mod -- +module patch.example.com/direct + +require ( + patch.example.com/indirect v1.0.0 +) +-- .info -- +{"Version":"v1.0.0"} +-- go.mod -- +module patch.example.com/direct + +require ( + patch.example.com/indirect v1.0.0 +) +-- direct.go -- +package direct + +import _ "patch.example.com/indirect" diff --git a/libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.0.1.txt b/libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.0.1.txt new file mode 100644 index 00000000000..64912b7b439 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.0.1.txt @@ -0,0 +1,27 @@ +patch.example.com/direct v1.0.1 +written by hand + +-- .mod -- +module patch.example.com/direct + +require ( + patch.example.com/indirect v1.0.0 + patch.example.com/depofdirectpatch v1.0.0 +) +-- .info -- +{"Version":"v1.0.1"} +-- go.mod -- +module patch.example.com/direct + +require ( + patch.example.com/indirect v1.0.0 + patch.example.com/depofdirectpatch v1.0.0 +) +-- direct.go -- +package direct + +import _ "patch.example.com/indirect" +-- usedepofdirectpatch/unused.go -- +package usedepofdirectpatch + +import _ "patch.example.com/depofdirectpatch" diff --git a/libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.1.0.txt b/libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.1.0.txt new file mode 100644 index 00000000000..406e3b9f628 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/patch.example.com_direct_v1.1.0.txt @@ -0,0 +1,21 @@ +patch.example.com/direct v1.1.0 +written by hand + +-- .mod -- +module patch.example.com/direct + +require ( + patch.example.com/indirect v1.0.0 +) +-- .info -- +{"Version":"v1.1.0"} +-- go.mod -- +module patch.example.com/direct + +require ( + patch.example.com/indirect v1.0.0 +) +-- direct.go -- +package direct + +import _ "patch.example.com/indirect" diff --git a/libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.0.0.txt new file mode 100644 index 00000000000..ea7f5e2d8d0 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.0.0.txt @@ -0,0 +1,11 @@ +patch.example.com/indirect v1.0.0 +written by hand + +-- .mod -- +module patch.example.com/indirect +-- .info -- +{"Version":"v1.0.0"} +-- go.mod -- +module patch.example.com/indirect +-- direct.go -- +package indirect diff --git a/libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.0.1.txt b/libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.0.1.txt new file mode 100644 index 00000000000..8c6cf8e7bf9 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.0.1.txt @@ -0,0 +1,11 @@ +patch.example.com/indirect v1.0.1 +written by hand + +-- .mod -- +module patch.example.com/indirect +-- .info -- +{"Version":"v1.0.1"} +-- go.mod -- +module patch.example.com/indirect +-- direct.go -- +package indirect diff --git a/libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.1.0.txt b/libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.1.0.txt new file mode 100644 index 00000000000..f7229d417aa --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/patch.example.com_indirect_v1.1.0.txt @@ -0,0 +1,11 @@ +patch.example.com/indirect v1.1.0 +written by hand + +-- .mod -- +module patch.example.com/indirect +-- .info -- +{"Version":"v1.1.0"} +-- go.mod -- +module patch.example.com/indirect +-- direct.go -- +package indirect diff --git a/libgo/go/cmd/go/testdata/mod/rsc.io_badsum_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/rsc.io_badsum_v1.0.0.txt new file mode 100644 index 00000000000..d62db2627a0 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/rsc.io_badsum_v1.0.0.txt @@ -0,0 +1,14 @@ +rsc.io/badsum@v1.0.0 + +This module would match the hard-coded hash for rsc.io/badsum v1.0.0 +in modfetch/notary.go if not for the "break hash" line. + +-- .mod -- +module "rsc.io/badsum" +-- .info -- +{"Version":"v1.0.0","Time":"2018-02-14T00:45:20Z"} +-- go.mod -- +module "rsc.io/badsum" +-- badsum.go -- +package badsum +// break hash diff --git a/libgo/go/cmd/go/testdata/mod/rsc.io_badsum_v1.0.1.txt b/libgo/go/cmd/go/testdata/mod/rsc.io_badsum_v1.0.1.txt new file mode 100644 index 00000000000..5fea50a01d7 --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/rsc.io_badsum_v1.0.1.txt @@ -0,0 +1,14 @@ +rsc.io/badsum@v1.0.1 + +This module would match the hard-coded hash for rsc.io/badsum v1.0.1/go.mod +in modfetch/notary.go if not for the "break hash" line. + +-- .mod -- +module "rsc.io/badsum" +# break hash +-- .info -- +{"Version":"v1.0.1","Time":"2018-02-14T00:45:20Z"} +-- go.mod -- +module "rsc.io/badsum" +-- badsum.go -- +package badsum diff --git a/libgo/go/cmd/go/testdata/mod/rsc.io_badzip_v1.0.0.txt b/libgo/go/cmd/go/testdata/mod/rsc.io_badzip_v1.0.0.txt new file mode 100644 index 00000000000..07a38fa6d7d --- /dev/null +++ b/libgo/go/cmd/go/testdata/mod/rsc.io_badzip_v1.0.0.txt @@ -0,0 +1,11 @@ +rsc.io/badzip v1.0.0 +written by hand + +-- .mod -- +module rsc.io/badzip +-- .info -- +{"Version":"v1.0.0"} +-- x.go -- +package x +-- /rsc.io/badzip@v1.0.0.txt -- +This file should not be here. diff --git a/libgo/go/cmd/go/testdata/script/README b/libgo/go/cmd/go/testdata/script/README index a7b50fff164..66ab8515c33 100644 --- a/libgo/go/cmd/go/testdata/script/README +++ b/libgo/go/cmd/go/testdata/script/README @@ -28,6 +28,7 @@ Scripts also have access to these other environment variables: GOARCH= GOCACHE= + GOEXE= GOOS= GOPATH=$WORK/gopath GOPROXY= @@ -38,8 +39,6 @@ Scripts also have access to these other environment variables: devnull= goversion= -The environment variable $exe (lowercase) is an empty string on most systems, ".exe" on Windows. - The scripts supporting files are unpacked relative to $GOPATH/src (aka $WORK/gopath/src) and then the script begins execution in that directory as well. Thus the example above runs in $WORK/gopath/src with GOPATH=$WORK/gopath and $WORK/gopath/src/hello.go @@ -108,10 +107,14 @@ The commands are: - cp src... dst Copy the listed files to the target file or existing directory. + src can include "stdout" or "stderr" to use the standard output or standard error + from the most recent exec or go command. -- env [key=value...] +- env [-r] [key=value...] With no arguments, print the environment (useful for debugging). Otherwise add the listed key=value pairs to the environment. + The -r flag causes the values to be escaped using regexp.QuoteMeta + before being recorded. - [!] exec program [args...] [&] Run the given executable program with the arguments. @@ -133,9 +136,10 @@ The commands are: Run the (test copy of the) go command with the given arguments. It must (or must not) succeed. -- [!] grep [-count=N] pattern file +- [!] grep [-count=N] [-q] pattern file The file's content must (or must not) match the regular expression pattern. For positive matches, -count=N specifies an exact number of matches to require. + The -q flag disables printing the file content on a mismatch. - mkdir path... Create the listed directories, if they do not already exists. diff --git a/libgo/go/cmd/go/testdata/script/binary_only.txt b/libgo/go/cmd/go/testdata/script/binary_only.txt deleted file mode 100644 index 397904efaa8..00000000000 --- a/libgo/go/cmd/go/testdata/script/binary_only.txt +++ /dev/null @@ -1,10 +0,0 @@ -# check that error for missing binary-only says where it should be -! go build b -stderr pkg[\\/].*a\.a - --- a/a.go -- -//go:binary-only-package - -package a --- b/b.go -- -package b; import "a" diff --git a/libgo/go/cmd/go/testdata/script/bug.txt b/libgo/go/cmd/go/testdata/script/bug.txt new file mode 100644 index 00000000000..db3ac253672 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/bug.txt @@ -0,0 +1,46 @@ +# Verify that go bug creates the appropriate URL issue body + +[!linux] skip + +go install +env BROWSER=$GOPATH/bin/browser +go bug +exists $TMPDIR/browser +grep '^go version' $TMPDIR/browser +[!gccgo] grep '^GOROOT/bin/go version: go version' $TMPDIR/browser +[!gccgo] grep '^GOROOT/bin/go tool compile -V: compile version' $TMPDIR/browser +grep '^uname -sr: Linux' $TMPDIR/browser + +-- go.mod -- +module browser + +-- main.go -- +package main + +import ( + "fmt" + "net/url" + "os" + "path/filepath" +) + +func main() { + u, err := url.Parse(os.Args[1]) + if err != nil { + panic(err) + } + body, err := url.PathUnescape(u.Query().Get("body")) + if err != nil { + panic(err) + } + out := filepath.Join(os.TempDir(), "browser") + f, err := os.Create(out) + if err != nil { + panic(err) + } + fmt.Fprintln(f, body) + if err := f.Close(); err != nil { + panic(err) + } +} + diff --git a/libgo/go/cmd/go/testdata/script/build_GOTMPDIR.txt b/libgo/go/cmd/go/testdata/script/build_GOTMPDIR.txt index ea06dcc472d..c93ca932cab 100644 --- a/libgo/go/cmd/go/testdata/script/build_GOTMPDIR.txt +++ b/libgo/go/cmd/go/testdata/script/build_GOTMPDIR.txt @@ -1,3 +1,6 @@ +env GO111MODULE=off +[short] skip + # Set GOCACHE to a clean directory to ensure that 'go build' has work to report. env GOCACHE=$WORK/gocache diff --git a/libgo/go/cmd/go/testdata/script/build_acl_windows.txt b/libgo/go/cmd/go/testdata/script/build_acl_windows.txt new file mode 100644 index 00000000000..13a3ba226aa --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/build_acl_windows.txt @@ -0,0 +1,44 @@ +[!windows] stop +[!exec:icacls] skip +[!exec:powershell] skip + +# Create $WORK\guest and give the Guests group full access. +# Files created within that directory will have different security attributes by default. +mkdir $WORK\guest +exec icacls $WORK\guest /grant '*S-1-5-32-546:(oi)(ci)f' + +env TMP=$WORK\guest +env TEMP=$WORK\guest + +# Build a binary using the guest directory as an intermediate +cd TestACL +go build -o main.exe main.go +# Build the same binary, but write it to the guest directory. +go build -o $TMP\main.exe main.go + +# Read ACLs for the files. +exec powershell -Command 'Get-Acl main.exe | Select -expand AccessToString' +cp stdout $WORK\exe-acl.txt +exec powershell -Command 'Get-Acl main.go | Select -expand AccessToString' +cp stdout $WORK\src-acl.txt +cd $TMP +exec powershell -Command 'Get-Acl main.exe | Select -expand AccessToString' +cp stdout $WORK\guest-acl.txt + +cd $WORK + +# The executable written to the source directory should have the same ACL as the source file. +cmp $WORK\exe-acl.txt $WORK\src-acl.txt + +# The file written to the guest-allowed directory should give Guests control. +grep 'BUILTIN\\Guests\s+Allow' $WORK\guest-acl.txt + +# The file written to the ordinary directory should not. +! grep 'BUILTIN\\Guests\s+Allow' $WORK\exe-acl.txt + + +-- TestACL/go.mod -- +module TestACL +-- TestACL/main.go -- +package main +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/build_cache_compile.txt b/libgo/go/cmd/go/testdata/script/build_cache_compile.txt index 7db881a2682..64b391f9aa4 100644 --- a/libgo/go/cmd/go/testdata/script/build_cache_compile.txt +++ b/libgo/go/cmd/go/testdata/script/build_cache_compile.txt @@ -1,3 +1,6 @@ +env GO111MODULE=off +[short] skip + # Set up fresh GOCACHE. env GOCACHE=$WORK/gocache mkdir $GOCACHE diff --git a/libgo/go/cmd/go/testdata/script/build_cache_gomips.txt b/libgo/go/cmd/go/testdata/script/build_cache_gomips.txt new file mode 100644 index 00000000000..0cbf16a923b --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/build_cache_gomips.txt @@ -0,0 +1,40 @@ +env GO111MODULE=off +[short] skip # rebuilds std for mips + +# Set up fresh GOCACHE. +env GOCACHE=$WORK/gocache +mkdir $GOCACHE + +# Building for mipsle without setting GOMIPS will use floating point registers. +env GOARCH=mipsle +env GOOS=linux +go build -gcflags=-S f.go +stderr ADDD.F[0-9]+,.F[0-9]+,.F[0-9]+ + +# Clean cache +go clean -cache + +# Building with GOMIPS=softfloat will not use floating point registers +env GOMIPS=softfloat +go build -gcflags=-S f.go +! stderr ADDD.F[0-9]+,.F[0-9]+,.F[0-9]+ + +# Clean cache +go clean -cache + +# Build without setting GOMIPS +env GOMIPS= +go build -gcflags=-S f.go +stderr ADDD.F[0-9]+,.F[0-9]+,.F[0-9]+ + +# Building with GOMIPS should still not use floating point registers. +env GOMIPS=softfloat +go build -gcflags=-S f.go +! stderr ADDD.F[0-9]+,.F[0-9]+,.F[0-9]+ + +-- f.go -- +package f + +func F(x float64) float64 { + return x + x +} diff --git a/libgo/go/cmd/go/testdata/script/build_cache_link.txt b/libgo/go/cmd/go/testdata/script/build_cache_link.txt index 61e7ee46d3a..b9c740ac10e 100644 --- a/libgo/go/cmd/go/testdata/script/build_cache_link.txt +++ b/libgo/go/cmd/go/testdata/script/build_cache_link.txt @@ -1,3 +1,6 @@ +env GO111MODULE=off +[short] skip + # Set up fresh GOCACHE. env GOCACHE=$WORK/gocache mkdir $GOCACHE @@ -13,9 +16,9 @@ go build -o $devnull -x main.go stderr '(link|gccgo)( |\.exe)' # ... but the output binary can serve as a cache. -go build -o main$exe -x main.go +go build -o main$GOEXE -x main.go stderr '(link|gccgo)( |\.exe)' -go build -o main$exe -x main.go +go build -o main$GOEXE -x main.go ! stderr '(link|gccgo)( |\.exe)' -- main.go -- diff --git a/libgo/go/cmd/go/testdata/script/build_cache_output.txt b/libgo/go/cmd/go/testdata/script/build_cache_output.txt index ee4099e5f35..89e3ff0f1ec 100644 --- a/libgo/go/cmd/go/testdata/script/build_cache_output.txt +++ b/libgo/go/cmd/go/testdata/script/build_cache_output.txt @@ -1,4 +1,7 @@ +env GO111MODULE=off + [!gc] skip +[short] skip # clears cache, rebuilds too much # Set up fresh GOCACHE. env GOCACHE=$WORK/gocache diff --git a/libgo/go/cmd/go/testdata/script/build_cache_trimpath.txt b/libgo/go/cmd/go/testdata/script/build_cache_trimpath.txt new file mode 100644 index 00000000000..39367ae3809 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/build_cache_trimpath.txt @@ -0,0 +1,20 @@ +env GO111MODULE=on + +# Set up fresh GOCACHE. +env GOCACHE=$WORK/gocache +mkdir $GOCACHE + +cd $WORK +go build -o a.out + +# Varying -trimpath should cause a rebuild. +go build -x -o a.out -trimpath +stderr '(compile|gccgo)( |\.exe)' +stderr 'link( |\.exe)' + +-- $WORK/hello.go -- +package main +func main() { println("hello") } + +-- $WORK/go.mod -- +module m diff --git a/libgo/go/cmd/go/testdata/script/build_multi_main.txt b/libgo/go/cmd/go/testdata/script/build_multi_main.txt new file mode 100644 index 00000000000..1d4926d9790 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/build_multi_main.txt @@ -0,0 +1,33 @@ +# Verify build -o can output multiple executables to a directory. + +mkdir $WORK/bin +go build -o $WORK/bin ./cmd/c1 ./cmd/c2 +! stderr 'multiple packages' + +! go build -o $WORK/bin ./pkg1 ./pkg1 +stderr 'no main packages' + +! go build ./cmd/c1 +stderr 'already exists and is a directory' + +-- go.mod -- +module exmod + +-- cmd/c1/main.go -- +package main + +func main() {} + +-- cmd/c2/main.go -- +package main + +func main() {} + +-- pkg1/pkg1.go -- +package pkg1 + +-- pkg2/pkg2.go -- +package pkg2 + +-- c1$GOEXE/keep.txt -- +Create c1 directory. diff --git a/libgo/go/cmd/go/testdata/script/build_nocache.txt b/libgo/go/cmd/go/testdata/script/build_nocache.txt new file mode 100644 index 00000000000..1059cad45c7 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/build_nocache.txt @@ -0,0 +1,40 @@ +env GO111MODULE=off + +# As of Go 1.12, the module cache is required. + +# If none of the variables we use to locate GOCACHE are set, the cache is off +# and we cannot build. +env GOCACHE= +env XDG_CACHE_HOME= +env HOME= +[plan9] env home= +[windows] env LocalAppData= +! go build -o triv triv.go +stderr 'build cache is required, but could not be located: GOCACHE is not defined and .*' + +# If GOCACHE is set but is not an absolute path, and we cannot build. +env GOCACHE=test +! go build -o triv triv.go +stderr 'build cache is required, but could not be located: GOCACHE is not an absolute path' + +# An explicit GOCACHE=off also disables builds. +env GOCACHE=off +! go build -o triv triv.go +stderr 'build cache is disabled by GOCACHE=off' + +# If GOCACHE is set to an unwritable directory, we should diagnose it as such. +[windows] stop # Does not support unwritable directories. +[root] skip # Can write to unwritable directories. + +mkdir $WORK/unwritable/home +chmod 0555 $WORK/unwritable/home +[!plan9] env HOME=$WORK/unwritable/home +[plan9] env home=$WORK/unwritable/home + +env GOCACHE=$WORK/unwritable/home +! go build -o triv triv.go +stderr 'failed to initialize build cache.* permission denied' + +-- triv.go -- +package main +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/build_relative_pkgdir.txt b/libgo/go/cmd/go/testdata/script/build_relative_pkgdir.txt new file mode 100644 index 00000000000..0716bcd56a5 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/build_relative_pkgdir.txt @@ -0,0 +1,9 @@ +env GO111MODULE=off + +# Regression test for golang.org/issue/21309: accept relative -pkgdir argument. + +[short] skip + +mkdir $WORK/gocache +env GOCACHE=$WORK/gocache +go build -i -pkgdir=. runtime diff --git a/libgo/go/cmd/go/testdata/script/build_relative_tmpdir.txt b/libgo/go/cmd/go/testdata/script/build_relative_tmpdir.txt new file mode 100644 index 00000000000..3e98a67b813 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/build_relative_tmpdir.txt @@ -0,0 +1,18 @@ +env GO111MODULE=off + +# If GOTMPDIR is relative, 'go build' should derive an absolute $WORK directory. +cd $WORK +mkdir tmp +env GOTMPDIR=tmp +go build -work a +stderr 'WORK=\$WORK' # the test script itself converts the absolute directory back to $WORK + +# Similarly if TMP/TMPDIR is relative. +env GOTMPDIR= +env TMP=tmp # Windows +env TMPDIR=tmp # Unix +go build -work a +stderr 'WORK=\$WORK' + +-- a/a.go -- +package a diff --git a/libgo/go/cmd/go/testdata/script/build_runtime_gcflags.txt b/libgo/go/cmd/go/testdata/script/build_runtime_gcflags.txt new file mode 100644 index 00000000000..da1b65f06c8 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/build_runtime_gcflags.txt @@ -0,0 +1,11 @@ +env GO111MODULE=off +[short] skip # rebuilds all of std + +# Set up fresh GOCACHE. +env GOCACHE=$WORK/gocache +mkdir $GOCACHE + +# Verify the standard library (specifically runtime/internal/atomic) can be +# built with -gcflags when -n is given. See golang.org/issue/29346. +go build -n -gcflags=all='-l' std +stderr 'compile.* -l .* runtime/internal/atomic' diff --git a/libgo/go/cmd/go/testdata/script/build_trimpath.txt b/libgo/go/cmd/go/testdata/script/build_trimpath.txt new file mode 100644 index 00000000000..f785b0cb9ec --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/build_trimpath.txt @@ -0,0 +1,21 @@ +[short] skip + +env -r GOROOT_REGEXP=$GOROOT +env -r WORK_REGEXP=$WORK +env GOROOT GOROOT_REGEXP WORK WORK_REGEXP + +go build -trimpath -o hello.exe hello.go +! grep -q $GOROOT_REGEXP hello.exe +! grep -q $WORK_REGEXP hello.exe + +env GO111MODULE=on +go build -trimpath -o fortune.exe rsc.io/fortune +! grep -q $GOROOT_REGEXP fortune.exe +! grep -q $WORK_REGEXP fortune.exe + +-- hello.go -- +package main +func main() { println("hello") } + +-- go.mod -- +module m diff --git a/libgo/go/cmd/go/testdata/script/cache_unix.txt b/libgo/go/cmd/go/testdata/script/cache_unix.txt new file mode 100644 index 00000000000..0e07ba63823 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/cache_unix.txt @@ -0,0 +1,36 @@ +env GO111MODULE=off + +# Integration test for cache directory calculation (cmd/go/internal/cache). + +[windows] skip +[darwin] skip +[plan9] skip + +mkdir $WORK/gocache +mkdir $WORK/xdg +mkdir $WORK/home + +# Set GOCACHE, XDG_CACHE_HOME, and HOME. +env GOCACHE=$WORK/gocache +env XDG_CACHE_HOME=$WORK/xdg +env HOME=$WORK/home + +# With all three set, we should prefer GOCACHE. +go env GOCACHE +stdout '\$WORK/gocache$' + +# Without GOCACHE, we should prefer XDG_CACHE_HOME over HOME. +env GOCACHE= +go env GOCACHE +stdout '\$WORK/xdg/go-build$$' + +# With only HOME set, we should use $HOME/.cache. +env XDG_CACHE_HOME= +go env GOCACHE +stdout '\$WORK/home/.cache/go-build$' + +# With no guidance from the environment, we must disable the cache, but that +# should not cause commands that do not write to the cache to fail. +env HOME= +go env GOCACHE +stdout 'off' diff --git a/libgo/go/cmd/go/testdata/script/cgo_syso_issue29253.txt b/libgo/go/cmd/go/testdata/script/cgo_syso_issue29253.txt new file mode 100644 index 00000000000..4fb5ccab04e --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/cgo_syso_issue29253.txt @@ -0,0 +1,31 @@ +env GO111MODULE=off +[short] skip + +# This test tests that we can link in-package syso files that provides symbols +# for cgo. See issue 29253. +[!cgo] stop +[!gc] stop +cc -c -o pkg/o.syso ext.c +go build main.go + +-- ext.c -- +// +build ignore + +int f() { return 42; } +-- pkg/pkg.go -- +package pkg + +// extern int f(void); +import "C" + +func init() { + if v := C.f(); v != 42 { + panic(v) + } +} +-- main.go -- +package main + +import _ "pkg" + +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/clean_testcache.txt b/libgo/go/cmd/go/testdata/script/clean_testcache.txt new file mode 100644 index 00000000000..dd7846462e1 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/clean_testcache.txt @@ -0,0 +1,19 @@ +env GO111MODULE=off +[short] skip + +# go clean -testcache +# should work (see golang.org/issue/29757). +cd x +go test x_test.go +go clean -testcache +go test x_test.go +! stdout 'cached' + + +-- x/x_test.go -- +package x_test +import ( + "testing" +) +func TestMain(t *testing.T) { +} \ No newline at end of file diff --git a/libgo/go/cmd/go/testdata/script/cover_atomic_pkgall.txt b/libgo/go/cmd/go/testdata/script/cover_atomic_pkgall.txt index c122c05cb68..c3bc67df534 100644 --- a/libgo/go/cmd/go/testdata/script/cover_atomic_pkgall.txt +++ b/libgo/go/cmd/go/testdata/script/cover_atomic_pkgall.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [short] skip go test -coverpkg=all -covermode=atomic x diff --git a/libgo/go/cmd/go/testdata/script/cover_pkgall_runtime.txt b/libgo/go/cmd/go/testdata/script/cover_pkgall_runtime.txt index 5d169d63126..9927c306907 100644 --- a/libgo/go/cmd/go/testdata/script/cover_pkgall_runtime.txt +++ b/libgo/go/cmd/go/testdata/script/cover_pkgall_runtime.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Issue 23882 [short] skip diff --git a/libgo/go/cmd/go/testdata/script/cpu_profile_twice.txt b/libgo/go/cmd/go/testdata/script/cpu_profile_twice.txt index 142d5ee718d..38d6439fb17 100644 --- a/libgo/go/cmd/go/testdata/script/cpu_profile_twice.txt +++ b/libgo/go/cmd/go/testdata/script/cpu_profile_twice.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Issue 23150 [short] skip diff --git a/libgo/go/cmd/go/testdata/script/env_write.txt b/libgo/go/cmd/go/testdata/script/env_write.txt new file mode 100644 index 00000000000..695cc83f3d7 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/env_write.txt @@ -0,0 +1,87 @@ +env GO111MODULE=off + +# go env should default to the right places +env AppData=$HOME/windowsappdata +env home=$HOME/plan9home +go env GOENV +[aix] stdout $HOME/.config/go/env +[darwin] stdout $HOME'/Library/Application Support/go/env' +[freebsd] stdout $HOME/.config/go/env +[linux] stdout $HOME/.config/go/env +[netbsd] stdout $HOME/.config/go/env +[openbsd] stdout $HOME/.config/go/env +[plan9] stdout $HOME/plan9home/lib/go/env +[windows] stdout $HOME\\windowsappdata\\go\\env + +# Now override it to something writable. +env GOENV=$WORK/envdir/go/env +go env GOENV +stdout envdir[\\/]go[\\/]env + +# go env shows all variables +go env +stdout GOARCH= +stdout GOOS= +stdout GOROOT= + +# go env -w changes default setting +env root= +[windows] env root=c: +env GOPATH= +go env -w GOPATH=$root/non-exist/gopath +! stderr .+ +grep GOPATH=$root/non-exist/gopath $WORK/envdir/go/env +go env GOPATH +stdout /non-exist/gopath + +# go env -w does not override OS environment, and warns about that +env GOPATH=$root/other +go env -w GOPATH=$root/non-exist/gopath2 +stderr 'warning: go env -w GOPATH=... does not override conflicting OS environment variable' +go env GOPATH +stdout $root/other + +# but go env -w does do the update, and unsetting the env var exposes the change +env GOPATH= +go env GOPATH +stdout $root/non-exist/gopath2 + +# unsetting with go env -u does not warn about OS environment overrides, +# nor does it warn about variables that haven't been set by go env -w. +env GOPATH=$root/other +go env -u GOPATH +! stderr .+ +go env -u GOPATH +! stderr .+ + +# go env -w rejects unknown or bad variables +! go env -w GODEBUG=gctrace=1 +stderr 'unknown go command variable GODEBUG' +! go env -w GOEXE=.bat +stderr 'GOEXE cannot be modified' +! go env -w GOENV=/env +stderr 'GOENV can only be set using the OS environment' + +# go env -w can set multiple variables +env CC= +go env CC +! stdout ^xyc$ +go env -w GOOS=$GOOS CC=xyc +grep CC=xyc $GOENV +# file is maintained in sorted order +grep 'CC=xyc\nGOOS=' $GOENV +go env CC +stdout ^xyc$ + +# go env -u unsets effect of go env -w. +go env -u CC +go env CC +! stdout ^xyc$ + +# go env -w rejects double-set variables +! go env -w GOOS=$GOOS GOOS=$GOOS +stderr 'multiple values for key: GOOS' + +# go env -w rejects missing variables +! go env -w GOOS +stderr 'arguments must be KEY=VALUE: invalid argument: GOOS' diff --git a/libgo/go/cmd/go/testdata/script/fileline.txt b/libgo/go/cmd/go/testdata/script/fileline.txt index cdc3be2df8f..5cb35f0dac3 100644 --- a/libgo/go/cmd/go/testdata/script/fileline.txt +++ b/libgo/go/cmd/go/testdata/script/fileline.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # look for short, relative file:line in error message ! go run ../../gopath/x/y/z/err.go stderr ^..[\\/]x[\\/]y[\\/]z[\\/]err.go: diff --git a/libgo/go/cmd/go/testdata/script/gcflags_patterns.txt b/libgo/go/cmd/go/testdata/script/gcflags_patterns.txt new file mode 100644 index 00000000000..dce8e39715d --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/gcflags_patterns.txt @@ -0,0 +1,86 @@ +env GO111MODULE=off + +[!gc] skip 'using -gcflags and -ldflags' +[short] skip + +# -gcflags=-e applies to named packages, not dependencies +go build -n -v -gcflags=-e z1 z2 +stderr 'compile.* -e.* -p z1' +stderr 'compile.* -e.* -p z2' +stderr 'compile.* -p y' +! stderr 'compile.* -e.* -p [^z]' + +# -gcflags can specify package=flags, and can be repeated; last match wins +go build -n -v -gcflags=-e -gcflags=z1=-N z1 z2 +stderr 'compile.* -N.* -p z1' +! stderr 'compile.* -e.* -p z1' +! stderr 'compile.* -N.* -p z2' +stderr 'compile.* -e.* -p z2' +stderr 'compile.* -p y' +! stderr 'compile.* -e.* -p [^z]' +! stderr 'compile.* -N.* -p [^z]' + +# -gcflags can have arbitrary spaces around the flags +go build -n -v -gcflags=' z1 = -e ' z1 +stderr 'compile.* -e.* -p z1' + +# -gcflags='all=-e' should apply to all packages, even with go test +go test -c -n -gcflags='all=-e' z1 +stderr 'compile.* -e.* -p z3 ' + +# this particular -gcflags argument made the compiler crash +! go build -gcflags=-d=ssa/ z1 +stderr 'PhaseOptions usage' + +# -ldflags for implicit test package applies to test binary +go test -c -n -gcflags=-N -ldflags=-X=x.y=z z1 +stderr 'compile.* -N .*z_test.go' +stderr 'link.* -X=x.y=z' + +# -ldflags for explicit test package applies to test binary +go test -c -n -gcflags=z1=-N -ldflags=z1=-X=x.y=z z1 +stderr 'compile.* -N .*z_test.go' +stderr 'link.* -X=x.y=z' + +# -ldflags applies to link of command +go build -n -ldflags=-X=math.pi=3 my/cmd/prog +stderr 'link.* -X=math.pi=3' + +# -ldflags applies to link of command even with strange directory name +go build -n -ldflags=-X=math.pi=3 my/cmd/prog/ +stderr 'link.* -X=math.pi=3' + +# -ldflags applies to current directory +cd my/cmd/prog +go build -n -ldflags=-X=math.pi=3 +stderr 'link.* -X=math.pi=3' + +# -ldflags applies to current directory even if GOPATH is funny +[windows] cd $WORK/GoPath/src/my/cmd/prog +[darwin] cd $WORK/GoPath/src/my/cmd/prog +go build -n -ldflags=-X=math.pi=3 +stderr 'link.* -X=math.pi=3' + +-- z1/z.go -- +package z1 +import _ "y" +import _ "z2" + +-- z1/z_test.go -- +package z1_test +import "testing" +import _ "z3" +func Test(t *testing.T) {} + +-- z2/z.go -- +package z2 + +-- z3/z.go -- +package z3 + +-- y/y.go -- +package y + +-- my/cmd/prog/prog.go -- +package main +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/get_404_meta.txt b/libgo/go/cmd/go/testdata/script/get_404_meta.txt new file mode 100644 index 00000000000..b71cc7fe010 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/get_404_meta.txt @@ -0,0 +1,11 @@ +# golang.org/issue/13037: 'go get' was not parsing tags in 404 served over HTTPS. + +[!net] skip +[!exec:git] skip + +env GO111MODULE=off +go get -d -insecure bazil.org/fuse/fs/fstestutil + +env GO111MODULE=on +env GOPROXY=direct +go get -d -insecure bazil.org/fuse/fs/fstestutil diff --git a/libgo/go/cmd/go/testdata/script/get_brace.txt b/libgo/go/cmd/go/testdata/script/get_brace.txt new file mode 100644 index 00000000000..3449a0c2c82 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/get_brace.txt @@ -0,0 +1,51 @@ +env GO111MODULE=off + +[!exec:git] skip + +# Set up some empty repositories. +cd $WORK/_origin/foo +exec git init +exec git config user.name 'Nameless Gopher' +exec git config user.email 'nobody@golang.org' +exec git commit --allow-empty -m 'create master branch' + +cd $WORK +cd '_origin/{confusing}' +exec git init +exec git config user.name 'Nameless Gopher' +exec git config user.email 'nobody@golang.org' +exec git commit --allow-empty -m 'create master branch' + +# Clone the empty repositories into GOPATH. +# This tells the Go command where to find them: it takes the place of a user's meta-tag redirector. +mkdir $GOPATH/src/example.com +cd $GOPATH/src/example.com +exec git clone $WORK/_origin/foo +exec git clone $WORK/_origin/{confusing} + +# Commit contents to the repositories. +cd $WORK/_origin/foo +exec git add main.go +exec git commit -m 'add main' + +cd $WORK +cd '_origin/{confusing}' +exec git add confusing.go +exec git commit -m 'just try to delete this!' + +# 'go get' should refuse to download or update the confusingly-named repo. +cd $GOPATH/src/example.com/foo +! go get -u 'example.com/{confusing}' +stderr 'invalid char' +! go get -u example.com/foo +stderr 'invalid import path' +! exists example.com/{confusing} + +-- $WORK/_origin/foo/main.go -- +package main +import _ "example.com/{confusing}" + +func main() {} + +-- $WORK/_origin/{confusing}/confusing.go -- +package confusing diff --git a/libgo/go/cmd/go/testdata/script/get_dotfiles.txt b/libgo/go/cmd/go/testdata/script/get_dotfiles.txt new file mode 100644 index 00000000000..6757f9dce34 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/get_dotfiles.txt @@ -0,0 +1,64 @@ +env GO111MODULE=off +[short] skip + +[!exec:git] skip + +# Set up a benign repository and a repository with a dotfile name. +cd $WORK/_origin/foo +exec git init +exec git config user.name 'Nameless Gopher' +exec git config user.email 'nobody@golang.org' +exec git commit --allow-empty -m 'create master branch' + +cd $WORK/_origin/.hidden +exec git init +exec git config user.name 'Nameless Gopher' +exec git config user.email 'nobody@golang.org' +exec git commit --allow-empty -m 'create master branch' + +# Clone the empty repositories into GOPATH. +# This tells the Go command where to find them: it takes the place of a user's meta-tag redirector. +mkdir $GOPATH/src/example.com +cd $GOPATH/src/example.com +exec git clone $WORK/_origin/foo +exec git clone $WORK/_origin/.hidden + +# Add a benign commit. +cd $WORK/_origin/foo +cp _ok/main.go main.go +exec git add main.go +exec git commit -m 'add ok' + +# 'go get' should install the benign commit. +cd $GOPATH +go get -u example.com/foo + +# Now sneak in an import of a dotfile path. +cd $WORK/_origin/.hidden +exec git add hidden.go +exec git commit -m 'nothing to see here, move along' + +cd $WORK/_origin/foo +cp _sneaky/main.go main.go +exec git add main.go +exec git commit -m 'fix typo (heh heh heh)' + +# 'go get -u' should refuse to download or update the dotfile-named repo. +cd $GOPATH/src/example.com/foo +! go get -u example.com/foo +stderr 'leading dot' +! exists example.com/.hidden/hidden.go + +-- $WORK/_origin/foo/_ok/main.go -- +package main + +func main() {} + +-- $WORK/_origin/foo/_sneaky/main.go -- +package main +import _ "example.com/.hidden" + +func main() {} + +-- $WORK/_origin/.hidden/hidden.go -- +package hidden diff --git a/libgo/go/cmd/go/testdata/script/get_insecure_redirect.txt b/libgo/go/cmd/go/testdata/script/get_insecure_redirect.txt new file mode 100644 index 00000000000..a83b17672d4 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/get_insecure_redirect.txt @@ -0,0 +1,13 @@ +# golang.org/issue/29591: 'go get' was following plain-HTTP redirects even without -insecure. + +[!net] skip +[!exec:git] skip + +env GO111MODULE=on +env GOPROXY=direct +env GOSUMDB=off + +! go get -d vcs-test.golang.org/insecure/go/insecure +stderr 'redirected .* to insecure URL' + +go get -d -insecure vcs-test.golang.org/insecure/go/insecure diff --git a/libgo/go/cmd/go/testdata/script/get_tilde.txt b/libgo/go/cmd/go/testdata/script/get_tilde.txt new file mode 100644 index 00000000000..e520957359c --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/get_tilde.txt @@ -0,0 +1,24 @@ +env GO111MODULE=off +[short] skip + +# Paths containing windows short names should be rejected before attempting to fetch. +! go get example.com/longna~1.dir/thing +stderr 'trailing tilde and digits' +! go get example.com/longna~1/thing +stderr 'trailing tilde and digits' +! go get example.com/~9999999/thing +stderr 'trailing tilde and digits' + +# A path containing an element that is just a tilde, or a tilde followed by non-digits, +# should attempt to resolve. +! go get example.com/~glenda/notfound +! stderr 'trailing tilde and digits' +stderr 'unrecognized import path' + +! go get example.com/~glenda2/notfound +! stderr 'trailing tilde and digits' +stderr 'unrecognized import path' + +! go get example.com/~/notfound +! stderr 'trailing tilde and digits' +stderr 'unrecognized import path' diff --git a/libgo/go/cmd/go/testdata/script/get_unicode.txt b/libgo/go/cmd/go/testdata/script/get_unicode.txt new file mode 100644 index 00000000000..d3b82bdf250 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/get_unicode.txt @@ -0,0 +1,40 @@ +env GO111MODULE=off + +[!exec:git] skip +[short] skip + +# Construct a repository that imports a non-ASCII path. +cd $WORK/_origin/example.com/unicode +exec git init +exec git config user.name 'Nameless Gopher' +exec git config user.email 'nobody@golang.org' +exec git add unicode.go +exec git commit -m 'add unicode.go' + +# Clone the repo into GOPATH so that 'go get -u' can find it. +mkdir $GOPATH/src/example.com/unicode +cd $GOPATH/src/example.com/unicode +exec git clone $WORK/_origin/example.com/unicode . + +# Construct the imported repository. +cd $WORK/_origin/example.com/испытание +exec git init +exec git config user.name 'Nameless Gopher' +exec git config user.email 'nobody@golang.org' +exec git add испытание.go +exec git commit -m 'add испытание.go' + +# Clone that repo into GOPATH too. +mkdir $GOPATH/src/example.com/испытание +cd $GOPATH/src/example.com/испытание +exec git clone $WORK/_origin/example.com/испытание . + +# Upgrading the importer should pull from the non-ASCII repo. +cd $GOPATH +go get -u example.com/unicode + +-- $WORK/_origin/example.com/unicode/unicode.go -- +package unicode +import _ "example.com/испытание" +-- $WORK/_origin/example.com/испытание/испытание.go -- +package испытание diff --git a/libgo/go/cmd/go/testdata/script/get_with_git_trace.txt b/libgo/go/cmd/go/testdata/script/get_with_git_trace.txt index 93341a302c8..98854c72ad2 100644 --- a/libgo/go/cmd/go/testdata/script/get_with_git_trace.txt +++ b/libgo/go/cmd/go/testdata/script/get_with_git_trace.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + env GIT_TRACE=1 [!net] skip diff --git a/libgo/go/cmd/go/testdata/script/goflags.txt b/libgo/go/cmd/go/testdata/script/goflags.txt index 20de325ac28..fac6d807202 100644 --- a/libgo/go/cmd/go/testdata/script/goflags.txt +++ b/libgo/go/cmd/go/testdata/script/goflags.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # GOFLAGS sets flags for commands env GOFLAGS='-e -f={{.Dir}} --test.benchtime=1s -count=10' diff --git a/libgo/go/cmd/go/testdata/script/gopath_std_vendor.txt b/libgo/go/cmd/go/testdata/script/gopath_std_vendor.txt new file mode 100644 index 00000000000..a0a41a50de3 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/gopath_std_vendor.txt @@ -0,0 +1,44 @@ +env GO111MODULE=off + +[!gc] skip + +go list -f '{{.Dir}}' vendor/golang.org/x/net/http2/hpack +stdout $GOPATH[/\\]src[/\\]vendor + +# A package importing 'net/http' should resolve its dependencies +# to the package 'vendor/golang.org/x/net/http2/hpack' within GOROOT. +cd importnethttp +go list -deps -f '{{.ImportPath}} {{.Dir}}' +stdout ^vendor/golang.org/x/net/http2/hpack +stdout $GOROOT[/\\]src[/\\]vendor[/\\]golang.org[/\\]x[/\\]net[/\\]http2[/\\]hpack +! stdout $GOPATH[/\\]src[/\\]vendor + +# In the presence of $GOPATH/src/vendor/golang.org/x/net/http2/hpack, +# a package in GOPATH importing 'golang.org/x/net/http2/hpack' should +# resolve its dependencies in GOPATH/src. +cd ../issue16333 +go build . + +go list -deps -f '{{.ImportPath}} {{.Dir}}' . +stdout $GOPATH[/\\]src[/\\]vendor[/\\]golang.org[/\\]x[/\\]net[/\\]http2[/\\]hpack +! stdout $GOROOT[/\\]src[/\\]vendor + +go list -test -deps -f '{{.ImportPath}} {{.Dir}}' . +stdout $GOPATH[/\\]src[/\\]vendor[/\\]golang.org[/\\]x[/\\]net[/\\]http2[/\\]hpack +! stdout $GOROOT[/\\]src[/\\]vendor + +-- issue16333/issue16333.go -- +package vendoring17 + +import _ "golang.org/x/net/http2/hpack" +-- issue16333/issue16333_test.go -- +package vendoring17 + +import _ "testing" +import _ "golang.org/x/net/http2/hpack" +-- importnethttp/http.go -- +package importnethttp + +import _ "net/http" +-- $GOPATH/src/vendor/golang.org/x/net/http2/hpack/hpack.go -- +package hpack diff --git a/libgo/go/cmd/go/testdata/script/help.txt b/libgo/go/cmd/go/testdata/script/help.txt index 9f455256f72..9752ede2e37 100644 --- a/libgo/go/cmd/go/testdata/script/help.txt +++ b/libgo/go/cmd/go/testdata/script/help.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go help shows overview. go help stdout 'Go is a tool' @@ -40,7 +42,7 @@ stderr 'Run ''go tool vet -help'' for the vet tool''s flags' # lines. ! go test -h stderr 'usage: go test' -stderr 'Run ''go help test'' for details' +stderr 'Run ''go help test'' and ''go help testflag'' for details.' # go help get shows usage for get go help get diff --git a/libgo/go/cmd/go/testdata/script/install_cleans_build.txt b/libgo/go/cmd/go/testdata/script/install_cleans_build.txt index b8d322de629..dc85eb8ceff 100644 --- a/libgo/go/cmd/go/testdata/script/install_cleans_build.txt +++ b/libgo/go/cmd/go/testdata/script/install_cleans_build.txt @@ -1,21 +1,24 @@ +env GO111MODULE=off +[short] skip + # 'go install' with no arguments should clean up after go build cd mycmd go build -exists mycmd$exe +exists mycmd$GOEXE go install -! exists mycmd$exe +! exists mycmd$GOEXE # 'go install mycmd' does not clean up, even in the mycmd directory go build -exists mycmd$exe +exists mycmd$GOEXE go install mycmd -exists mycmd$exe +exists mycmd$GOEXE # 'go install mycmd' should not clean up in an unrelated current directory either cd .. -cp mycmd/mycmd$exe mycmd$exe +cp mycmd/mycmd$GOEXE mycmd$GOEXE go install mycmd -exists mycmd$exe +exists mycmd$GOEXE -- mycmd/main.go -- package main diff --git a/libgo/go/cmd/go/testdata/script/install_cmd_gobin.txt b/libgo/go/cmd/go/testdata/script/install_cmd_gobin.txt new file mode 100644 index 00000000000..81649e234ff --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/install_cmd_gobin.txt @@ -0,0 +1,11 @@ +# Check that commands in cmd are install to $GOROOT/bin, not $GOBIN. +# Verifies golang.org/issue/32674. +[gccgo] stop +env GOBIN=gobin +mkdir gobin +go list -f '{{.Target}}' cmd/go +stdout $GOROOT[/\\]bin[/\\]go$GOEXE + +# Check that tools are installed to $GOTOOLDIR, not $GOBIN. +go list -f '{{.Target}}' cmd/compile +stdout $GOROOT[/\\]pkg[/\\]tool[/\\]${GOOS}_${GOARCH}[/\\]compile$GOEXE diff --git a/libgo/go/cmd/go/testdata/script/install_cross_gobin.txt b/libgo/go/cmd/go/testdata/script/install_cross_gobin.txt index f85e896f61e..60aeed689f3 100644 --- a/libgo/go/cmd/go/testdata/script/install_cross_gobin.txt +++ b/libgo/go/cmd/go/testdata/script/install_cross_gobin.txt @@ -1,3 +1,6 @@ +env GO111MODULE=off +[!short] skip # rebuilds std for alternate architecture + cd mycmd go build mycmd diff --git a/libgo/go/cmd/go/testdata/script/install_rebuild_gopath.txt b/libgo/go/cmd/go/testdata/script/install_rebuild_gopath.txt index d42b07004bf..14a6c8611e3 100644 --- a/libgo/go/cmd/go/testdata/script/install_rebuild_gopath.txt +++ b/libgo/go/cmd/go/testdata/script/install_rebuild_gopath.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # GOPATH with p1 in d1, p2 in d2 env GOPATH=$WORK/d1${:}$WORK/d2 diff --git a/libgo/go/cmd/go/testdata/script/install_rebuild_removed.txt b/libgo/go/cmd/go/testdata/script/install_rebuild_removed.txt index e7620a08cae..5db3778d8eb 100644 --- a/libgo/go/cmd/go/testdata/script/install_rebuild_removed.txt +++ b/libgo/go/cmd/go/testdata/script/install_rebuild_removed.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go command should detect package staleness as source file set changes go install mypkg ! stale mypkg diff --git a/libgo/go/cmd/go/testdata/script/linkname.txt b/libgo/go/cmd/go/testdata/script/linkname.txt index e2ec00c6edc..11336594d35 100644 --- a/libgo/go/cmd/go/testdata/script/linkname.txt +++ b/libgo/go/cmd/go/testdata/script/linkname.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # check for linker name in error message about linker crash [!gc] skip ! go build -ldflags=-crash_for_testing x.go diff --git a/libgo/go/cmd/go/testdata/script/list_bad_import.txt b/libgo/go/cmd/go/testdata/script/list_bad_import.txt index 3d9cac0d5f5..b8f9d586f30 100644 --- a/libgo/go/cmd/go/testdata/script/list_bad_import.txt +++ b/libgo/go/cmd/go/testdata/script/list_bad_import.txt @@ -1,3 +1,6 @@ +env GO111MODULE=off +[short] skip + # This test matches mod_list_bad_import, but in GOPATH mode. # Please keep them in sync. diff --git a/libgo/go/cmd/go/testdata/script/list_compiled_imports.txt b/libgo/go/cmd/go/testdata/script/list_compiled_imports.txt index 2c883b60610..bb4faa366f8 100644 --- a/libgo/go/cmd/go/testdata/script/list_compiled_imports.txt +++ b/libgo/go/cmd/go/testdata/script/list_compiled_imports.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [!cgo] skip # go list should report import "C" diff --git a/libgo/go/cmd/go/testdata/script/list_find.txt b/libgo/go/cmd/go/testdata/script/list_find.txt index dbe8fb0ac98..d450fc95549 100644 --- a/libgo/go/cmd/go/testdata/script/list_find.txt +++ b/libgo/go/cmd/go/testdata/script/list_find.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go list -find should not report imports go list -f {{.Incomplete}} x/y/z... # should probably exit non-zero but never has @@ -5,6 +7,16 @@ stdout true go list -find -f '{{.Incomplete}} {{.Imports}}' x/y/z... stdout '^false \[\]' +# go list -find -compiled should use cached sources the second time it's run. +# It might not find the same cached sources as "go build", but the sources +# should be identical. "go build" derives action IDs (which are used as cache +# keys) from dependencies' action IDs. "go list -find" won't know what the +# dependencies are, so it's can't construct the same action IDs. +[short] skip +go list -find -compiled net +go list -find -compiled -x net +! stderr 'cgo' + -- x/y/z/z.go -- package z import "does/not/exist" diff --git a/libgo/go/cmd/go/testdata/script/list_importmap.txt b/libgo/go/cmd/go/testdata/script/list_importmap.txt new file mode 100644 index 00000000000..52ee6028f5b --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/list_importmap.txt @@ -0,0 +1,27 @@ +env GO111MODULE=off + +# gccgo does not have standard packages. +[gccgo] skip + +# fmt should have no rewritten imports. +# The import from a/b should map c/d to a's vendor directory. +go list -f '{{.ImportPath}}: {{.ImportMap}}' fmt a/b +stdout 'fmt: map\[\]' +stdout 'a/b: map\[c/d:a/vendor/c/d\]' + +# flag [fmt.test] should import fmt [fmt.test] as fmt +# fmt.test should import testing [fmt.test] as testing +# fmt.test should not import a modified os +go list -deps -test -f '{{.ImportPath}} MAP: {{.ImportMap}}{{"\n"}}{{.ImportPath}} IMPORT: {{.Imports}}' fmt +stdout '^flag \[fmt\.test\] MAP: map\[fmt:fmt \[fmt\.test\]\]' +stdout '^fmt\.test MAP: map\[(.* )?testing:testing \[fmt\.test\]' +! stdout '^fmt\.test MAP: map\[(.* )?os:' +stdout '^fmt\.test IMPORT: \[fmt \[fmt\.test\] fmt_test \[fmt\.test\] os testing \[fmt\.test\] testing/internal/testdeps \[fmt\.test\]\]' + + +-- a/b/b.go -- +package b + +import _ "c/d" +-- a/vendor/c/d/d.go -- +package d diff --git a/libgo/go/cmd/go/testdata/script/list_std.txt b/libgo/go/cmd/go/testdata/script/list_std.txt index 046bec6ac54..6ab1bd1674c 100644 --- a/libgo/go/cmd/go/testdata/script/list_std.txt +++ b/libgo/go/cmd/go/testdata/script/list_std.txt @@ -1,12 +1,25 @@ +env GO111MODULE=off + [!gc] skip +[short] skip -# listing GOROOT should only find standard packages +# Listing GOROOT should only find standard packages. cd $GOROOT/src go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' ./... ! stdout . -# TODO: ignore _/blah/go/src in output -# our vendored packages should be reported as standard -go list std cmd -stdout internal/x/net/http2/hpack +# Standard packages should include cmd, but not cmd/vendor. +go list ./... +stdout cmd/compile +! stdout vendor/golang.org +! stdout cmd/vendor + +# In GOPATH mode, packages vendored into GOROOT should be reported as standard. +go list -f '{{if .Standard}}{{.ImportPath}}{{end}}' std cmd +stdout golang.org/x/net/http2/hpack stdout cmd/vendor/golang\.org/x/arch/x86/x86asm + +# However, vendored packages should not match wildcard patterns beginning with cmd. +go list cmd/... +stdout cmd/compile +! stdout cmd/vendor diff --git a/libgo/go/cmd/go/testdata/script/list_tags.txt b/libgo/go/cmd/go/testdata/script/list_tags.txt index c5dc99e9fba..49069bd2135 100644 --- a/libgo/go/cmd/go/testdata/script/list_tags.txt +++ b/libgo/go/cmd/go/testdata/script/list_tags.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go list supports -tags go list -tags=thetag ./my... stdout mypkg diff --git a/libgo/go/cmd/go/testdata/script/list_test_e.txt b/libgo/go/cmd/go/testdata/script/list_test_e.txt index f1473322c65..263892ba63f 100644 --- a/libgo/go/cmd/go/testdata/script/list_test_e.txt +++ b/libgo/go/cmd/go/testdata/script/list_test_e.txt @@ -1,5 +1,7 @@ +env GO111MODULE=off + # issue 25980: crash in go list -e -test -go list -e -test -f '{{.Error}}' p +go list -e -test -deps -f '{{.Error}}' p stdout '^p[/\\]d_test.go:2:8: cannot find package "d" in any of:' -- p/d.go -- diff --git a/libgo/go/cmd/go/testdata/script/list_test_err.txt b/libgo/go/cmd/go/testdata/script/list_test_err.txt new file mode 100644 index 00000000000..a174b5e9ad2 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/list_test_err.txt @@ -0,0 +1,126 @@ +env GO111MODULE=off + +# issue 28491: errors in test source files should not prevent +# "go list -test" from returning useful information. + +# go list prints information for package, internal test, +# external test, but not testmain package when there is a +# syntax error in test sources. +! go list -test -deps syntaxerr +stdout pkgdep +stdout testdep_a +stdout testdep_b +stdout ^syntaxerr$ +stdout '^syntaxerr \[syntaxerr.test\]' +stdout '^syntaxerr_test \[syntaxerr.test\]' +! stdout '^syntaxerr\.test' +stderr 'expected declaration' + +# go list -e prints information for all test packages. +# The syntax error is shown in the package error field. +go list -e -test -deps -f '{{.ImportPath}} {{.Error | printf "%q"}}' syntaxerr +stdout 'pkgdep ' +stdout 'testdep_a ' +stdout 'testdep_b ' +stdout 'syntaxerr\.test "[^"]*expected declaration' +! stderr 'expected declaration' + +[short] stop + +# go list prints partial information with test naming error +! go list -test -deps nameerr +stdout pkgdep +stdout testdep_a +stdout testdep_b +stderr 'wrong signature for TestBad' + +go list -e -test -deps -f '{{.ImportPath}} {{.Error | printf "%q"}}' nameerr +stdout 'pkgdep ' +stdout 'testdep_a ' +stdout 'testdep_b ' +stdout 'nameerr\.test "[^"]*wrong signature for TestBad' +! stderr 'wrong signature for TestBad' + +# go list prints partial information with error if test has cyclic import +! go list -test -deps cycleerr +stdout cycleerr +stderr 'import cycle not allowed in test' + +go list -e -test -deps -f '{{.ImportPath}} {{.Error | printf "%q"}}' cycleerr +stdout 'cycleerr ' +stdout 'testdep_a ' +stdout 'testdep_cycle ' +stdout 'cycleerr \[cycleerr.test\] "[^"]*import cycle not allowed in test' +! stderr 'import cycle not allowed in test' + +-- syntaxerr/syntaxerr.go -- +package syntaxerr + +import _ "pkgdep" + +-- syntaxerr/syntaxerr_ie_test.go -- +package syntaxerr + +!!!syntax error + +-- syntaxerr/syntaxerr_xe_test.go -- +package syntaxerr_test + +!!!syntax error + +-- syntaxerr/syntaxerr_i_test.go -- +package syntaxerr + +import _ "testdep_a" + +-- syntaxerr/syntaxerr_x_test.go -- +package syntaxerr + +import _ "testdep_b" + +-- nameerr/nameerr.go -- +package nameerr + +import _ "pkgdep" + +-- nameerr/nameerr_i_test.go -- +package nameerr + +import ( + _ "testdep_a" + "testing" +) + +func TestBad(t *testing.B) {} + +-- nameerr/nameerr_x_test.go -- +package nameerr_test + +import ( + _ "testdep_b" + "testing" +) + +func TestBad(t *testing.B) {} + +-- cycleerr/cycleerr_test.go -- +package cycleerr + +import ( + _ "testdep_a" + _ "testdep_cycle" +) + +-- pkgdep/pkgdep.go -- +package pkgdep + +-- testdep_a/testdep_a.go -- +package testdep_a + +-- testdep_b/testdep_b.go -- +package testdep_b + +-- testdep_cycle/testdep_cycle.go -- +package testdep_cycle + +import _ "cycleerr" diff --git a/libgo/go/cmd/go/testdata/script/list_test_imports.txt b/libgo/go/cmd/go/testdata/script/list_test_imports.txt index 51d1ce9a696..b2a6bc45f9e 100644 --- a/libgo/go/cmd/go/testdata/script/list_test_imports.txt +++ b/libgo/go/cmd/go/testdata/script/list_test_imports.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # issue 26880: list with tests has wrong variant in imports go list -test -f '{{.ImportPath}}:{{with .Imports}} {{join . ", "}}{{end}}' a b cmp stdout imports.txt diff --git a/libgo/go/cmd/go/testdata/script/list_test_non_go_files.txt b/libgo/go/cmd/go/testdata/script/list_test_non_go_files.txt new file mode 100644 index 00000000000..16b98f4a375 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/list_test_non_go_files.txt @@ -0,0 +1,13 @@ +env GO111MODULE=off + +# issue 29899: handling files with non-Go extension +go list -e -test -json -- c.c x.go +stdout '"Err": "named files must be .go files: c.c"' + +! go list -test -json -- c.c x.go +stderr 'can''t load package: named files must be .go files: c.c' + +-- x.go -- +package main +-- c.c -- +package c diff --git a/libgo/go/cmd/go/testdata/script/mod_alt_goroot.txt b/libgo/go/cmd/go/testdata/script/mod_alt_goroot.txt new file mode 100644 index 00000000000..32f94c53038 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_alt_goroot.txt @@ -0,0 +1,20 @@ +env GO111MODULE=on + +# If the working directory is a different GOROOT, then the 'std' module should be +# treated as an ordinary module (with an ordinary module prefix). +# It should not override packages in GOROOT, but should not fail the command. +# See golang.org/issue/30756. +go list -e -deps -f '{{.ImportPath}} {{.Dir}}' ./bytes +stdout ^std/bytes.*$PWD[/\\]bytes +stdout '^bytes/modified' + +-- go.mod -- +module std + +go 1.12 +-- bytes/bytes.go -- +package bytes + +import _"bytes/modified" +-- bytes/modified/modified.go -- +package modified diff --git a/libgo/go/cmd/go/testdata/script/mod_auth.txt b/libgo/go/cmd/go/testdata/script/mod_auth.txt new file mode 100644 index 00000000000..fe1d65794af --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_auth.txt @@ -0,0 +1,32 @@ +[!net] skip + +env GO111MODULE=on +env GOPROXY=direct +env GOSUMDB=off + +# Without credentials, downloading a module from a path that requires HTTPS +# basic auth should fail. +env NETRC=$WORK/empty +! go list all + +# With credentials from a netrc file, it should succeed. +env NETRC=$WORK/netrc +go mod tidy +go list all +stdout vcs-test.golang.org/auth/or401 +stdout vcs-test.golang.org/auth/or404 + +-- go.mod -- +module private.example.com +-- main.go -- +package useprivate + +import ( + _ "vcs-test.golang.org/auth/or401" + _ "vcs-test.golang.org/auth/or404" +) +-- $WORK/empty -- +-- $WORK/netrc -- +machine vcs-test.golang.org + login aladdin + password opensesame diff --git a/libgo/go/cmd/go/testdata/script/mod_build_tags.txt b/libgo/go/cmd/go/testdata/script/mod_build_tags.txt index 1347eaacbf7..ae1d605e1f2 100644 --- a/libgo/go/cmd/go/testdata/script/mod_build_tags.txt +++ b/libgo/go/cmd/go/testdata/script/mod_build_tags.txt @@ -16,6 +16,9 @@ stdout '\[y\.go\]' go list -f {{.GoFiles}} -tags 'tag1 tag2' stdout '\[x\.go y\.go\]' +go list -f {{.GoFiles}} -tags tag1,tag2 # commas allowed as of Go 1.13 +stdout '\[x\.go y\.go\]' + -- x/go.mod -- module x diff --git a/libgo/go/cmd/go/testdata/script/mod_build_versioned.txt b/libgo/go/cmd/go/testdata/script/mod_build_versioned.txt new file mode 100644 index 00000000000..d1d74de10c2 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_build_versioned.txt @@ -0,0 +1,17 @@ +env GO111MODULE=on +[short] skip + +go get -d rsc.io/fortune/v2 + +# The default executable name shouldn't be v2$GOEXE +go build rsc.io/fortune/v2 +! exists v2$GOEXE +exists fortune$GOEXE + +# The default test binary name shouldn't be v2.test$GOEXE +go test -c rsc.io/fortune/v2 +! exists v2.test$GOEXE +exists fortune.test$GOEXE + +-- go.mod -- +module scratch diff --git a/libgo/go/cmd/go/testdata/script/mod_clean_cache.txt b/libgo/go/cmd/go/testdata/script/mod_clean_cache.txt new file mode 100644 index 00000000000..01fbc381e04 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_clean_cache.txt @@ -0,0 +1,58 @@ +env GO111MODULE=on + +# 'mod download' should download the module to the cache. +go mod download rsc.io/quote@v1.5.0 +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip + +# '-n' should print commands but not actually execute them. +go clean -modcache -n +stdout '^rm -rf .*pkg.mod$' +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip + +# 'go clean -modcache' should actually delete the files. +go clean -modcache +! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info +! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod +! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip + +# 'go clean -r -modcache' should clean only the dependencies that are within the +# main module. +# BUG(golang.org/issue/28680): Today, it cleans across module boundaries. +cd r +exists ./test.out +exists ../replaced/test.out +go clean -r -modcache +! exists ./test.out +! exists ../replaced/test.out # BUG: should still exist + +# 'go clean -modcache' should not download anything before cleaning. +go mod edit -require rsc.io/quote@v1.99999999.0-not-a-real-version +go clean -modcache +! stderr 'finding rsc.io' +go mod edit -droprequire rsc.io/quote + +-- go.mod -- +module m +-- m.go -- +package m + +-- r/go.mod -- +module example.com/r +require example.com/r/replaced v0.0.0 +replace example.com/r/replaced => ../replaced +-- r/r.go -- +package r +import _ "example.com/r/replaced" +-- r/test.out -- +DELETE ME + +-- replaced/go.mod -- +module example.com/r/replaced +-- replaced/replaced.go -- +package replaced +-- replaced/test.out -- +DO NOT DELETE diff --git a/libgo/go/cmd/go/testdata/script/mod_concurrent.txt b/libgo/go/cmd/go/testdata/script/mod_concurrent.txt new file mode 100644 index 00000000000..e03e5e5edbe --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_concurrent.txt @@ -0,0 +1,31 @@ +env GO111MODULE=on + +# Concurrent builds should succeed, even if they need to download modules. +go build ./x & +go build ./y +wait + +# Concurrent builds should update go.sum to the union of the hashes for the +# modules they read. +cmp go.sum go.sum.want + +-- go.mod -- +module golang.org/issue/26794 + +require ( + golang.org/x/text v0.3.0 + rsc.io/sampler v1.0.0 +) +-- x/x.go -- +package x + +import _ "golang.org/x/text/language" +-- y/y.go -- +package y + +import _ "rsc.io/sampler" +-- go.sum.want -- +golang.org/x/text v0.3.0 h1:ivTorhoiROmZ1mcs15mO2czVF0uy0tnezXpBVNzgrmA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +rsc.io/sampler v1.0.0 h1:SRJnjyQ07sAtq6G4RcfJEmz8JxqLyj3PoGXG2VhbDWo= +rsc.io/sampler v1.0.0/go.mod h1:cqxpM3ZVz9VtirqxZPmrWzkQ+UkiNiGtkrN+B+i8kx8= diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_dep.txt b/libgo/go/cmd/go/testdata/script/mod_convert_dep.txt index cc1083bcba2..267c90eb3ce 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_dep.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_dep.txt @@ -1,9 +1,31 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found Gopkg.lock in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' +# In Plan 9, directories are automatically created in /n. +# For example, /n/Gopkg.lock always exists, but it's a directory. +# Test that we ignore directories when trying to find alternate config files. +cd $WORK/gopkgdir/x +! go list . +stderr 'cannot find main module' +! stderr 'Gopkg.lock' +! stderr 'go mod init' + -- $WORK/test/Gopkg.lock -- -- $WORK/test/x/x.go -- package x // import "m/x" +-- $WORK/gopkgdir/Gopkg.lock/README.txt -- +../Gopkg.lock is a directory, not a file. +-- $WORK/gopkgdir/x/x.go -- +package x // import "m/x" diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_git.txt b/libgo/go/cmd/go/testdata/script/mod_convert_git.txt index 5ef534a8f88..ece505a7ba2 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_git.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_git.txt @@ -1,10 +1,23 @@ env GO111MODULE=on -# detect root of module tree as root of enclosing git repo +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found .git/config in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' +# We should not suggest creating a go.mod file in $GOROOT, even though there may be a .git/config there. +cd $GOROOT +! go list . +! stderr 'go mod init' + -- $WORK/test/.git/config -- -- $WORK/test/x/x.go -- package x // import "m/x" diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_glide.txt b/libgo/go/cmd/go/testdata/script/mod_convert_glide.txt index 50460bbf365..9f1fff51bf4 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_glide.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_glide.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found glide.lock in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_glockfile.txt b/libgo/go/cmd/go/testdata/script/mod_convert_glockfile.txt index 4d9aaffab50..6aa07948883 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_glockfile.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_glockfile.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found GLOCKFILE in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_godeps.txt b/libgo/go/cmd/go/testdata/script/mod_convert_godeps.txt index 61fbab11240..da7b6c10594 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_godeps.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_godeps.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found Godeps/Godeps.json in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_tsv.txt b/libgo/go/cmd/go/testdata/script/mod_convert_tsv.txt index 5b82d85d653..6015ac87543 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_tsv.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_tsv.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found dependencies.tsv in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_vendor_conf.txt b/libgo/go/cmd/go/testdata/script/mod_convert_vendor_conf.txt index b45d3b69fe2..57ec4191a45 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_vendor_conf.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_vendor_conf.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found vendor.conf in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_vendor_json.txt b/libgo/go/cmd/go/testdata/script/mod_convert_vendor_json.txt index cb6e5fee15f..47d111d4c13 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_vendor_json.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_vendor_json.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found vendor/vendor.json in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_vendor_manifest.txt b/libgo/go/cmd/go/testdata/script/mod_convert_vendor_manifest.txt index bcf185136ba..68edb9dc292 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_vendor_manifest.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_vendor_manifest.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found vendor/manifest in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/libgo/go/cmd/go/testdata/script/mod_convert_vendor_yml.txt b/libgo/go/cmd/go/testdata/script/mod_convert_vendor_yml.txt index 0cd245bace1..4ed140a25a2 100644 --- a/libgo/go/cmd/go/testdata/script/mod_convert_vendor_yml.txt +++ b/libgo/go/cmd/go/testdata/script/mod_convert_vendor_yml.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found vendor.yml in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/libgo/go/cmd/go/testdata/script/mod_dir.txt b/libgo/go/cmd/go/testdata/script/mod_dir.txt new file mode 100644 index 00000000000..05548f63668 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_dir.txt @@ -0,0 +1,20 @@ +# The directory named go.mod should be ignored + +env GO111MODULE=on + +cd $WORK/sub + +go list . +stdout 'x/sub' + +mkdir go.mod +exists go.mod + +go list . +stdout 'x/sub' + +-- $WORK/go.mod -- +module x + +-- $WORK/sub/x.go -- +package x \ No newline at end of file diff --git a/libgo/go/cmd/go/testdata/script/mod_doc.txt b/libgo/go/cmd/go/testdata/script/mod_doc.txt index 450d85754ea..40acbc5ac08 100644 --- a/libgo/go/cmd/go/testdata/script/mod_doc.txt +++ b/libgo/go/cmd/go/testdata/script/mod_doc.txt @@ -1,8 +1,7 @@ # go doc should find module documentation -[gccgo] stop 'no go doc' - env GO111MODULE=on +[short] skip go doc y stdout 'Package y is.*alphabet' diff --git a/libgo/go/cmd/go/testdata/script/mod_download.txt b/libgo/go/cmd/go/testdata/script/mod_download.txt index 22f07c33c75..c6729c71a29 100644 --- a/libgo/go/cmd/go/testdata/script/mod_download.txt +++ b/libgo/go/cmd/go/testdata/script/mod_download.txt @@ -1,4 +1,5 @@ env GO111MODULE=on +env GOPROXY=$GOPROXY/quiet # download with version should print nothing go mod download rsc.io/quote@v1.5.0 @@ -9,6 +10,7 @@ exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip # download of an invalid path should report the error +[short] skip ! go mod download this.domain.is.invalid/somemodule@v1.0.0 stderr 'this.domain.is.invalid' ! go mod download -json this.domain.is.invalid/somemodule@v1.0.0 @@ -81,5 +83,12 @@ exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip go mod download -json rsc.io/quote@v1.5.1 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.1.zip +# allow go mod download without go.mod +env GO111MODULE=auto +rm go.mod +rm $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.2.1.zip +go mod download rsc.io/quote@v1.2.1 +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.2.1.zip + -- go.mod -- module m diff --git a/libgo/go/cmd/go/testdata/script/mod_download_hash.txt b/libgo/go/cmd/go/testdata/script/mod_download_hash.txt new file mode 100644 index 00000000000..5a42c4b0726 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_download_hash.txt @@ -0,0 +1,24 @@ +env GO111MODULE=on + +# Testing mod download with non semantic versions; turn off proxy. +[!net] skip +[!exec:git] skip +env GOPROXY=direct +env GOSUMDB=off + +go mod download rsc.io/quote@a91498bed0a73d4bb9c1fb2597925f7883bc40a7 +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.info +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.mod +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.zip + +go mod download rsc.io/quote@master +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.info +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.mod +exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.zip + + +-- go.mod -- +module m + +-- m.go -- +package m diff --git a/libgo/go/cmd/go/testdata/script/mod_edit.txt b/libgo/go/cmd/go/testdata/script/mod_edit.txt index aa714e8b3cd..42007b13d09 100644 --- a/libgo/go/cmd/go/testdata/script/mod_edit.txt +++ b/libgo/go/cmd/go/testdata/script/mod_edit.txt @@ -25,6 +25,10 @@ cmpenv go.mod $WORK/go.mod.edit2 go mod edit -json cmpenv stdout $WORK/go.mod.json +# go mod edit -json (empty mod file) +go mod edit -json $WORK/go.mod.empty +cmp stdout $WORK/go.mod.empty.json + # go mod edit -replace go mod edit -replace=x.1@v1.3.0=y.1/v2@v2.3.5 -replace=x.1@v1.4.0=y.1/v2@v2.3.5 cmpenv go.mod $WORK/go.mod.edit3 @@ -168,4 +172,14 @@ require x.3 v1.99.0 -- $WORK/m/go.mod.edit -- module x.x/y/z -go $goversion \ No newline at end of file +go $goversion +-- $WORK/go.mod.empty -- +-- $WORK/go.mod.empty.json -- +{ + "Module": { + "Path": "" + }, + "Require": null, + "Exclude": null, + "Replace": null +} diff --git a/libgo/go/cmd/go/testdata/script/mod_edit_go.txt b/libgo/go/cmd/go/testdata/script/mod_edit_go.txt new file mode 100644 index 00000000000..428510293f0 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_edit_go.txt @@ -0,0 +1,18 @@ +# Test support for go mod -edit to set language version. + +[gccgo] stop + +env GO111MODULE=on +! go build +stderr 'type aliases only supported as of' +go mod edit -go=1.9 +grep 'go 1.9' go.mod +go build + +-- go.mod -- +module m +go 1.8 + +-- alias.go -- +package alias +type T = int diff --git a/libgo/go/cmd/go/testdata/script/mod_enabled.txt b/libgo/go/cmd/go/testdata/script/mod_enabled.txt index ab5ee3d6dfa..10fa103fad3 100644 --- a/libgo/go/cmd/go/testdata/script/mod_enabled.txt +++ b/libgo/go/cmd/go/testdata/script/mod_enabled.txt @@ -1,15 +1,15 @@ -# GO111MODULE=auto should only trigger outside GOPATH/src +# GO111MODULE=auto should trigger any time a go.mod exists in a parent directory. env GO111MODULE=auto cd $GOPATH/src/x/y/z go env GOMOD -! stdout . # no non-empty lines -! go list -m -f {{.GoMod}} -stderr 'not using modules' +stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod +go list -m -f {{.GoMod}} +stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod cd $GOPATH/src/x/y/z/w go env GOMOD -! stdout . +stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod cd $GOPATH/src/x/y go env GOMOD @@ -25,6 +25,17 @@ cd $GOPATH/foo/bar/baz go env GOMOD stdout foo[/\\]go.mod +# GO111MODULE unset should be equivalent to auto. +env GO111MODULE= + +cd $GOPATH/src/x/y/z +go env GOMOD +stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod + +cd $GOPATH/src/x/y +go env GOMOD +! stdout . + # GO111MODULE=on should trigger everywhere env GO111MODULE=on diff --git a/libgo/go/cmd/go/testdata/script/mod_file_proxy.txt b/libgo/go/cmd/go/testdata/script/mod_file_proxy.txt index 8de6d7dbb88..38d9fd25fbe 100644 --- a/libgo/go/cmd/go/testdata/script/mod_file_proxy.txt +++ b/libgo/go/cmd/go/testdata/script/mod_file_proxy.txt @@ -1,3 +1,5 @@ +[short] skip + # Allow (cached) downloads for -mod=readonly. env GO111MODULE=on env GOPATH=$WORK/gopath1 @@ -9,17 +11,26 @@ go list grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list # Use download cache as file:/// proxy. -[windows] stop # TODO: file://$WORK puts backslashes in the URL env GOPATH=$WORK/gopath2 -env GOPROXY=file:///nonexist +[windows] env GOPROXY=file:///C:/nonexist +[!windows] env GOPROXY=file:///nonexist ! go list -env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download +[windows] env GOPROXY=file:///$WORK/gopath1/pkg/mod/cache/download +[!windows] env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download go list grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list -- $WORK/x/go.mod -- module x +go 1.13 require rsc.io/quote v1.5.1 -- $WORK/x/x.go -- package x import _ "rsc.io/quote" +-- $WORK/x/go.sum -- +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:pvCbr/wm8HzDD3fVywevekufpn6tCGPY3spdHeZJEsw= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +rsc.io/quote v1.5.1 h1:ZE3OgnVGrhXtFkGw90HwW992ZRqcdli/33DLqEYsoxA= +rsc.io/quote v1.5.1/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0= +rsc.io/sampler v1.3.0 h1:HLGR/BgEtI3r0uymSP/nl2uPLsUnNJX8toRyhfpBTII= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/libgo/go/cmd/go/testdata/script/mod_find.txt b/libgo/go/cmd/go/testdata/script/mod_find.txt index f4ac8d01f56..7fbe9fb7fe6 100644 --- a/libgo/go/cmd/go/testdata/script/mod_find.txt +++ b/libgo/go/cmd/go/testdata/script/mod_find.txt @@ -1,3 +1,5 @@ +env GO111MODULE=on + # Derive module path from import comment. cd $WORK/x exists x.go @@ -10,14 +12,8 @@ addcrlf x.go go mod init stderr 'module x' -# go mod should die in GOPATH if modules are not enabled for GOPATH -cd $GOPATH/src/example.com/x/y -! go mod init -stderr 'go: modules disabled inside GOPATH/src by GO111MODULE=auto; see ''go help modules''' - -env GO111MODULE=on - # Derive module path from location inside GOPATH. +# 'go mod init' should succeed if modules are not explicitly disabled. cd $GOPATH/src/example.com/x/y go mod init stderr 'module example.com/x/y$' @@ -43,6 +39,13 @@ go mod init stderr 'empty' rm go.mod +# In Plan 9, directories are automatically created in /n. +# For example, /n/go.mod always exist, but it's a directory. +# Test that we ignore directories when trying to find go.mod. +cd $WORK/gomoddir +! go list . +stderr 'cannot find main module' + [!symlink] stop # gplink1/src/empty where gopathlink -> GOPATH @@ -89,3 +92,8 @@ package y package z -- $GOPATH/src/example.com/x/y/z/Godeps/Godeps.json -- {"ImportPath": "unexpected.com/z"} + +-- $WORK/gomoddir/go.mod/README.txt -- +../go.mod is a directory, not a file. +-- $WORK/gomoddir/p.go -- +package p diff --git a/libgo/go/cmd/go/testdata/script/mod_get_cmd.txt b/libgo/go/cmd/go/testdata/script/mod_get_cmd.txt new file mode 100644 index 00000000000..d31cee1444a --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_cmd.txt @@ -0,0 +1,20 @@ +env GO111MODULE=on +[short] skip + +# Test that when 'go get' is run from $GOBIN, it does not delete binaries +# after it installs them. Verifies golang.org/issue/32766. + +go get example.com/tools/cmd/hello + +# 'go get' should not delete the command when run from $GOPATH/bin +cd $GOPATH/bin +exists hello$GOEXE +go get example.com/tools/cmd/hello +exists hello$GOEXE + +# 'go get' should not delete the command when run from a different $GOBIN +mkdir $WORK/bin +cd $WORK/bin +env GOBIN=$WORK/bin +go get example.com/tools/cmd/hello +exists hello$GOEXE diff --git a/libgo/go/cmd/go/testdata/script/mod_get_commit.txt b/libgo/go/cmd/go/testdata/script/mod_get_commit.txt index 589a791fd4d..a906babbd5f 100644 --- a/libgo/go/cmd/go/testdata/script/mod_get_commit.txt +++ b/libgo/go/cmd/go/testdata/script/mod_get_commit.txt @@ -1,23 +1,19 @@ env GO111MODULE=on +env GOPROXY=$GOPROXY/quiet +[short] skip # @commit should resolve -# golang.org/x/text/language@commit should not resolve with -m, -# because that's not a module path. -! go get -m golang.org/x/text/language@14c0d48 - -# ... but it should work without -m. -# because of -d, the compiler should not run +# golang.org/x/text/language@commit should resolve. +# Because of -d, the compiler should not run. go get -d -x golang.org/x/text/language@14c0d48 ! stderr 'compile|cp|gccgo .*language\.a$' # go get should skip build with no Go files in root -go get golang.org/x/text@14c0d48 - -# ... and go get should skip build with -m -go get -m golang.org/x/text@14c0d48 +go get -d golang.org/x/text@14c0d48 # dropping -d, we should see a build. +[short] skip go get -x golang.org/x/text/language@14c0d48 stderr 'compile|cp|gccgo .*language\.a$' diff --git a/libgo/go/cmd/go/testdata/script/mod_get_downgrade.txt b/libgo/go/cmd/go/testdata/script/mod_get_downgrade.txt index ac814dae08f..ee9ac964751 100644 --- a/libgo/go/cmd/go/testdata/script/mod_get_downgrade.txt +++ b/libgo/go/cmd/go/testdata/script/mod_get_downgrade.txt @@ -1,6 +1,8 @@ env GO111MODULE=on +[short] skip # downgrade sampler should downgrade quote +cp go.mod.orig go.mod go get rsc.io/sampler@v1.0.0 go list -m all stdout 'rsc.io/quote v1.4.0' @@ -30,9 +32,21 @@ stdout 'rsc.io/quote v1.4.0' stdout 'rsc.io/sampler v1.0.0' ! stdout golang.org/x/text --- go.mod -- +# downgrading away quote should also downgrade away latemigrate/v2, +# since there are no older versions. v2.0.0 is incompatible. +cp go.mod.orig go.mod +go list -m -versions example.com/latemigrate/v2 +stdout v2.0.0 # proxy may serve incompatible versions +go get rsc.io/quote@none +go list -m all +! stdout 'example.com/latemigrate/v2' + +-- go.mod.orig -- module x -require rsc.io/quote v1.5.1 +require ( + rsc.io/quote v1.5.1 + example.com/latemigrate/v2 v2.0.1 +) -- go.mod.empty -- module x -- x.go -- diff --git a/libgo/go/cmd/go/testdata/script/mod_get_hash.txt b/libgo/go/cmd/go/testdata/script/mod_get_hash.txt new file mode 100644 index 00000000000..3bb3ee78809 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_hash.txt @@ -0,0 +1,19 @@ +env GO111MODULE=on +env GOPROXY=direct +env GOSUMDB=off +[!net] skip +[!exec:git] skip + +# fetch commit hash reachable from refs/heads/* and refs/tags/* is OK +go list -m golang.org/x/time@8be79e1e0910c292df4e79c241bb7e8f7e725959 # on master branch + +# fetch other commit hash, even with a non-standard ref, is not OK +! go list -m golang.org/x/time@334d83c35137ac2b376c1dc3e4c7733791855a3a # refs/changes/24/41624/3 +stderr 'unknown revision' +! go list -m golang.org/x/time@v0.0.0-20170424233410-334d83c35137 +stderr 'unknown revision' +! go list -m golang.org/x/time@334d83c35137 +stderr 'unknown revision' + +-- go.mod -- +module m diff --git a/libgo/go/cmd/go/testdata/script/mod_get_indirect.txt b/libgo/go/cmd/go/testdata/script/mod_get_indirect.txt index 3ae5833834b..f25e170a499 100644 --- a/libgo/go/cmd/go/testdata/script/mod_get_indirect.txt +++ b/libgo/go/cmd/go/testdata/script/mod_get_indirect.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +[short] skip -# get -u should find quote v1.5.2 +# get -u should not upgrade anything, since the package +# in the current directory doesn't import anything. +go get -u +go list -m all +stdout 'quote v1.5.1$' +grep 'rsc.io/quote v1.5.1$' go.mod + +# get -u should find quote v1.5.2 once there is a use. +cp $WORK/tmp/usequote.go x.go go get -u go list -m all stdout 'quote v1.5.2$' @@ -11,11 +20,10 @@ go list -m -f '{{.Path}} {{.Version}}{{if .Indirect}} // indirect{{end}}' all stdout '^golang.org/x/text [v0-9a-f\.-]+ // indirect' grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod -# importing an empty module root as a package makes it direct. -# TODO(bcmills): This doesn't seem correct. Fix is in the next change. +# importing an empty module root as a package does not remove indirect tag. cp $WORK/tmp/usetext.go x.go go list -e -grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod +grep 'golang.org/x/text v0.3.0 // indirect$' go.mod # indirect tag should be removed upon seeing direct import. cp $WORK/tmp/uselang.go x.go diff --git a/libgo/go/cmd/go/testdata/script/mod_get_latest_pseudo.txt b/libgo/go/cmd/go/testdata/script/mod_get_latest_pseudo.txt new file mode 100644 index 00000000000..825ee8cf896 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_latest_pseudo.txt @@ -0,0 +1,10 @@ +# Check that we can build a module with no tagged versions by querying +# "@latest" through a proxy. +# Verifies golang.org/issue/32636 + +env GO111MODULE=on + +go mod init m +go list example.com/notags +go list -m all +stdout '^example.com/notags v0.0.0-20190507143103-cc8cbe209b64$' diff --git a/libgo/go/cmd/go/testdata/script/mod_get_local.txt b/libgo/go/cmd/go/testdata/script/mod_get_local.txt index 4edda993f1e..eb09da58b3e 100644 --- a/libgo/go/cmd/go/testdata/script/mod_get_local.txt +++ b/libgo/go/cmd/go/testdata/script/mod_get_local.txt @@ -1,49 +1,50 @@ # Test 'go get' with a local module with a name that is not valid for network lookup. +[short] skip env GO111MODULE=on go mod edit -fmt cp go.mod go.mod.orig -# 'go get -u -m' within the main module should work, even if it has a local-only name. +# 'go get -u' within the main module should work, even if it has a local-only name. cp go.mod.orig go.mod -go get -u -m +go get -d -u ./... grep 'rsc.io/quote.*v1.5.2' go.mod grep 'golang.org/x/text.*v0.3.0' go.mod cp go.mod go.mod.implicitmod -# 'go get -u -m' with the name of the main module should be equivalent to -# 'go get -u -m' without any further arguments. +# 'go get -u local/...' should be equivalent to 'go get -u ./...' +# (assuming no nested modules) cp go.mod.orig go.mod -go get -u -m local +go get -d -u local/... cmp go.mod go.mod.implicitmod -# 'go get -u -d' in the empty root of the main module should update the -# dependencies of all packages in the module. +# For the main module, @patch should be a no-op. cp go.mod.orig go.mod -go get -u -d +go get -d -u local/...@patch cmp go.mod go.mod.implicitmod -# 'go get -u -d .' within a package in the main module updates all dependencies -# of the main module. -# TODO: Determine whether that behavior is a bug. -# (https://golang.org/issue/26902) +# 'go get -u -d' in the empty root of the main module should fail. +# 'go get -u -d .' should also fail. +cp go.mod.orig go.mod +! go get -u -d +! go get -u -d . + +# 'go get -u -d .' within a package in the main module updates the dependencies +# of that package. cp go.mod.orig go.mod cd uselang go get -u -d . cd .. -grep 'rsc.io/quote.*v1.5.2' go.mod +grep 'rsc.io/quote.*v1.3.0' go.mod grep 'golang.org/x/text.*v0.3.0' go.mod cp go.mod go.mod.dotpkg -# 'go get -u -d' with an explicit package in the main module updates -# all dependencies of the main module. -# TODO: Determine whether that behavior is a bug. -# (https://golang.org/issue/26902) +# 'go get -u -d' with an explicit package in the main module updates the +# dependencies of that package. cp go.mod.orig go.mod go get -u -d local/uselang cmp go.mod go.mod.dotpkg - -- go.mod -- module local diff --git a/libgo/go/cmd/go/testdata/script/mod_get_main.txt b/libgo/go/cmd/go/testdata/script/mod_get_main.txt new file mode 100644 index 00000000000..8e06220f9e6 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_main.txt @@ -0,0 +1,32 @@ +env GO111MODULE=on +[short] skip + +# @patch and @latest within the main module refer to the current version. +# The main module won't be upgraded, but missing dependencies will be added. +cp go.mod.orig go.mod +go get -d rsc.io/x@latest +grep 'rsc.io/quote v1.5.2' go.mod +cp go.mod.orig go.mod +go get -d rsc.io/x@patch +grep 'rsc.io/quote v1.5.2' go.mod +cp go.mod.orig go.mod + +# The main module cannot be updated to a specific version. +! go get rsc.io/x@v0.1.0 +stderr '^go get rsc.io/x@v0.1.0: can.t request explicit version of path in main module$' +! go get -d rsc.io/x@v0.1.0 +stderr '^go get rsc.io/x@v0.1.0: can.t request explicit version of path in main module$' + +# Upgrading a package pattern not contained in the main module should not +# attempt to upgrade the main module. +go get -d rsc.io/quote/...@v1.5.1 +grep 'rsc.io/quote v1.5.1' go.mod + +-- go.mod.orig -- +module rsc.io + +go 1.13 +-- x/x.go -- +package x + +import _ "rsc.io/quote" diff --git a/libgo/go/cmd/go/testdata/script/mod_get_moved.txt b/libgo/go/cmd/go/testdata/script/mod_get_moved.txt index be914491552..edc41cf9488 100644 --- a/libgo/go/cmd/go/testdata/script/mod_get_moved.txt +++ b/libgo/go/cmd/go/testdata/script/mod_get_moved.txt @@ -1,4 +1,6 @@ env GO111MODULE=on +env GOPROXY=$GOPROXY/quiet +[short] skip # A 'go get' that worked at a previous version should continue to work at that version, # even if the package was subsequently moved into a submodule. diff --git a/libgo/go/cmd/go/testdata/script/mod_get_newcycle.txt b/libgo/go/cmd/go/testdata/script/mod_get_newcycle.txt new file mode 100644 index 00000000000..9616863383d --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_newcycle.txt @@ -0,0 +1,14 @@ +env GO111MODULE=on + +# Download modules to avoid stderr chatter +go mod download example.com/newcycle/a@v1.0.0 +go mod download example.com/newcycle/a@v1.0.1 +go mod download example.com/newcycle/b@v1.0.0 + +go mod init m +! go get example.com/newcycle/a@v1.0.0 +cmp stderr stderr-expected + +-- stderr-expected -- +go get: inconsistent versions: + example.com/newcycle/a@v1.0.0 requires example.com/newcycle/a@v1.0.1 (not example.com/newcycle/a@v1.0.0) diff --git a/libgo/go/cmd/go/testdata/script/mod_get_patterns.txt b/libgo/go/cmd/go/testdata/script/mod_get_patterns.txt new file mode 100644 index 00000000000..b9931970e0d --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_patterns.txt @@ -0,0 +1,36 @@ +env GO111MODULE=on +[short] skip + +# If a pattern doesn't match any packages provided by modules +# in the build list, we assume the pattern matches a single module +# whose path is a prefix of the part of the pattern before "...". +cp go.mod.orig go.mod +go get -d rsc.io/quote/... +grep 'require rsc.io/quote' go.mod + +cp go.mod.orig go.mod +! go get -d rsc.io/quote/x... +stderr 'go get rsc.io/quote/x...: module rsc.io/quote@latest \(v1.5.2\) found, but does not contain packages matching rsc.io/quote/x...' +! grep 'require rsc.io/quote' go.mod + +! go get -d rsc.io/quote/x/... +stderr 'go get rsc.io/quote/x/...: module rsc.io/quote@latest \(v1.5.2\) found, but does not contain packages matching rsc.io/quote/x/...' +! grep 'require rsc.io/quote' go.mod + +# If a pattern matches no packages within a module, the module should not +# be upgraded, even if the module path matches the pattern. +cp go.mod.orig go.mod +go mod edit -require example.com/nest@v1.0.0 +go get -d example.com/nest/sub/y... +grep 'example.com/nest/sub v1.0.0' go.mod +grep 'example.com/nest v1.0.0' go.mod + +-- go.mod.orig -- +module m + +go 1.13 + +-- use/use.go -- +package use + +import _ "rsc.io/quote" diff --git a/libgo/go/cmd/go/testdata/script/mod_get_private_vcs.txt b/libgo/go/cmd/go/testdata/script/mod_get_private_vcs.txt new file mode 100644 index 00000000000..514b0a7a531 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_private_vcs.txt @@ -0,0 +1,11 @@ +env GO111MODULE=on + +# Testing stderr for git ls-remote; turn off proxy. +[!net] skip +[!exec:git] skip +env GOPROXY=direct + +! go get github.com/golang/nonexist +stderr 'Confirm the import path was entered correctly.' +stderr 'If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.' +! stdout . diff --git a/libgo/go/cmd/go/testdata/script/mod_get_pseudo.txt b/libgo/go/cmd/go/testdata/script/mod_get_pseudo.txt index 3945fdfa893..582837a1665 100644 --- a/libgo/go/cmd/go/testdata/script/mod_get_pseudo.txt +++ b/libgo/go/cmd/go/testdata/script/mod_get_pseudo.txt @@ -3,73 +3,75 @@ env GO111MODULE=on # Testing git->module converter's generation of +incompatible tags; turn off proxy. [!net] skip [!exec:git] skip -env GOPROXY= +env GOPROXY=direct +env GOSUMDB=off # We can resolve the @master branch without unshallowing the local repository # (even with older gits), so try that before we do anything else. # (This replicates https://golang.org/issue/26713 with git 2.7.4.) -go get -m github.com/rsc/legacytest@master +go get -d github.com/rsc/legacytest@master go list -m all stdout '^github.com/rsc/legacytest v2\.0\.1-0\.\d{14}-7303f7796364\+incompatible$' # get should include incompatible tags in "latest" calculation. -go get -m github.com/rsc/legacytest@latest +go mod edit -droprequire github.com/rsc/legacytest +go get -d github.com/rsc/legacytest@latest go list go list -m all stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$' # v2.0.1-0.pseudo+incompatible -go get -m ...test@7303f77 +go get -d ...test@7303f77 go list -m all stdout '^github.com/rsc/legacytest v2\.0\.1-0\.\d{14}-7303f7796364\+incompatible$' # v2.0.0+incompatible by tag+incompatible -go get -m ...test@v2.0.0+incompatible +go get -d ...test@v2.0.0+incompatible go list -m all stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$' # v2.0.0+incompatible by tag -go get -m ...test@v2.0.0 +go get -d ...test@v2.0.0 go list -m all stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$' # v2.0.0+incompatible by hash (back on master) -go get -m ...test@d7ae1e4 +go get -d ...test@d7ae1e4 go list -m all stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$' # v1.2.1-0.pseudo -go get -m ...test@d2d4c3e +go get -d ...test@d2d4c3e go list -m all stdout '^github.com/rsc/legacytest v1\.2\.1-0\.\d{14}-d2d4c3ea6623$' # v1.2.0 -go get -m ...test@9f6f860 +go get -d ...test@9f6f860 go list -m all stdout '^github.com/rsc/legacytest v1\.2\.0$' # v1.1.0-pre.0.pseudo -go get -m ...test@fb3c628 +go get -d ...test@fb3c628 go list -m all stdout '^github.com/rsc/legacytest v1\.1\.0-pre\.0\.\d{14}-fb3c628075e3$' # v1.1.0-pre (no longer on master) -go get -m ...test@731e3b1 +go get -d ...test@731e3b1 go list -m all stdout '^github.com/rsc/legacytest v1\.1\.0-pre$' # v1.0.1-0.pseudo -go get -m ...test@fa4f5d6 +go get -d ...test@fa4f5d6 go list -m all stdout '^github.com/rsc/legacytest v1\.0\.1-0\.\d{14}-fa4f5d6a71c6$' # v1.0.0 -go get -m ...test@7fff7f3 +go get -d ...test@7fff7f3 go list -m all stdout '^github.com/rsc/legacytest v1\.0\.0$' # v0.0.0-pseudo -go get -m ...test@52853eb +go get -d ...test@52853eb go list -m all stdout '^github.com/rsc/legacytest v0\.0\.0-\d{14}-52853eb7b552$' diff --git a/libgo/go/cmd/go/testdata/script/mod_get_pseudo_other_branch.txt b/libgo/go/cmd/go/testdata/script/mod_get_pseudo_other_branch.txt new file mode 100644 index 00000000000..0fbd041f860 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_pseudo_other_branch.txt @@ -0,0 +1,67 @@ +env GO111MODULE=on +env GOPROXY=direct +env GOSUMDB=off + +# Testing that a pseudo-version is based on the semantically-latest +# tag that appears in any commit that is a (transitive) parent of the commit +# supplied to 'go get', regardless of branches + +[!net] skip +[!exec:git] skip + +# For this test repository: +# tag v0.2.1 is most recent tag on master itself +# tag v0.2.2 is on branch2, which was then merged to master +# master is a merge commit with both tags as parents +# +# The pseudo-version hence sorts immediately after v0.2.2 rather +# than v0.2.1, even though the v0.2.2 tag is not on master. + +go get -d vcs-test.golang.org/git/tagtests.git@master +go list -m all +stdout '^vcs-test.golang.org/git/tagtests.git v0.2.3-0\.' + +-- go.mod -- +module x + +go 1.12 +-- x.go -- +package x + +import _ "vcs-test.golang.org/git/tagtests.git" +-- gen_testtags.sh -- +#!/bin/bash + +# This is not part of the test. +# Run this to generate and update the repository on vcs-test.golang.org. + +set -euo pipefail +cd "$(dirname "$0")" +rm -rf tagtests +mkdir tagtests +cd tagtests + +git init +echo module vcs-test.golang.org/git/tagtests.git >go.mod +echo package tagtests >tagtests.go +git add go.mod tagtests.go +git commit -m 'create module tagtests' + +git branch b + +echo v0.2.1 >v0.2.1 +git add v0.2.1 +git commit -m v0.2.1 +git tag v0.2.1 + +git checkout b +echo v0.2.2 >v0.2.2 +git add v0.2.2 +git commit -m v0.2.2 +git tag v0.2.2 + +git checkout master +git merge b -m merge + +zip -r ../tagtests.zip . +gsutil cp ../tagtests.zip gs://vcs-test/git/tagtests.zip diff --git a/libgo/go/cmd/go/testdata/script/mod_get_pseudo_prefix.txt b/libgo/go/cmd/go/testdata/script/mod_get_pseudo_prefix.txt new file mode 100644 index 00000000000..b78e6e644f7 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_pseudo_prefix.txt @@ -0,0 +1,64 @@ +env GO111MODULE=on +env GOPROXY=direct +env GOSUMDB=off + +# Testing that a pseudo-version is based on the semantically-latest +# prefixed tag in any commit that is a parent of the commit supplied +# to 'go get', when using a repo with go.mod in a sub directory. + +[!net] skip +[!exec:git] skip + +# For this test repository go.mod resides in sub/ (only): +# master is not tagged +# tag v0.2.0 is most recent tag before master +# tag sub/v0.0.10 is most recent tag before v0.2.0 +# +# The pseudo-version is based on sub/v0.0.10, since v0.2.0 doesn't +# contain the prefix. +go get -d vcs-test.golang.org/git/prefixtagtests.git/sub +go list -m all +stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.10$' + +go get -d -u vcs-test.golang.org/git/prefixtagtests.git/sub@master +go list -m all +stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.11-0\.' + +-- go.mod -- +module x + +go 1.12 +-- x.go -- +package x + +import _ "vcs-test.golang.org/prefixtagtests.git/sub" +-- gen_prefixtagtests.sh -- +#!/bin/bash + +# This is not part of the test. +# Run this to generate and update the repository on vcs-test.golang.org. + +set -euo pipefail +cd "$(dirname "$0")" +rm -rf prefixtagtests +mkdir prefixtagtests +cd prefixtagtests + +git init +mkdir sub +echo module vcs-test.golang.org/git/prefixtagtests.git/sub >sub/go.mod +echo package sub >sub/sub.go +git add sub +git commit -m 'create module sub' +for i in v0.1.0 sub/v0.0.9 sub/v0.0.10 v0.2.0; do + echo $i >status + git add status + git commit -m $i + git tag $i +done +echo 'after last tag' >status +git add status +git commit -m 'after last tag' + +zip -r ../prefixtagtests.zip . +gsutil cp ../prefixtagtests.zip gs://vcs-test/git/prefixtagtests.zip diff --git a/libgo/go/cmd/go/testdata/script/mod_get_svn.txt b/libgo/go/cmd/go/testdata/script/mod_get_svn.txt new file mode 100644 index 00000000000..b3436284aff --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_svn.txt @@ -0,0 +1,20 @@ +[!net] skip +[!exec:svn] skip + +env GO111MODULE=on +env GOPROXY=direct # obtain llvm.org directory, not via svn. + +# Attempting to get a module zip using svn should fail with a reasonable +# message instead of a panic. +# TODO(golang.org/issue/26092): Really, it shouldn't fail at all. +! go get -d llvm.org/llvm/bindings/go/llvm +stderr 'ReadZip not implemented for svn' +! go install . +stderr 'ReadZip not implemented for svn' + +-- go.mod -- +module golang/go/issues/28943/main +-- main.go -- +package main +import _ "llvm.org/llvm/bindings/go/llvm" +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_get_tags.txt b/libgo/go/cmd/go/testdata/script/mod_get_tags.txt new file mode 100644 index 00000000000..603c76983f7 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_tags.txt @@ -0,0 +1,44 @@ +env GO111MODULE=on + +[short] skip + +# get should add modules needed to build packages, even if those +# dependencies are in sources excluded by build tags. +# All build tags are considered true except "ignore". +go mod init m +go get -d . +go list -m all +stdout 'example.com/version v1.1.0' +stdout 'rsc.io/quote v1.5.2' + +[short] skip + +# Packages that are only imported in excluded files should not be built. +go get -x . +stderr 'compile.* -p m ' +! stderr 'compile.* -p example.com/version ' +! stderr 'compile.* -p rsc.io/quote ' + +-- empty.go -- +package m + +-- excluded.go -- +// +build windows,mips + +package m + +import _ "example.com/version" + +-- tools.go -- +// +build tools + +package tools + +import _ "rsc.io/quote" + +-- ignore.go -- +// +build ignore + +package ignore + +import _ "example.com/doesnotexist" diff --git a/libgo/go/cmd/go/testdata/script/mod_get_test.txt b/libgo/go/cmd/go/testdata/script/mod_get_test.txt new file mode 100644 index 00000000000..f921168ad4f --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_test.txt @@ -0,0 +1,58 @@ +env GO111MODULE=on + +# By default, 'go get' should ignore tests +cp go.mod.empty go.mod +go get m/a +! grep rsc.io/quote go.mod + +# 'go get -t' should consider test dependencies of the named package. +cp go.mod.empty go.mod +go get -d -t m/a +grep 'rsc.io/quote v1.5.2$' go.mod + +# 'go get -t' should not consider test dependencies of imported packages, +# including packages imported from tests. +cp go.mod.empty go.mod +go get -d -t m/b +! grep rsc.io/quote go.mod + +# 'go get -t -u' should update test dependencies of the named package. +cp go.mod.empty go.mod +go mod edit -require=rsc.io/quote@v1.5.1 +go get -d -t -u m/a +grep 'rsc.io/quote v1.5.2$' go.mod + +# 'go get -t -u' should not add or update test dependencies +# of imported packages, including packages imported from tests. +cp go.mod.empty go.mod +go get -d -t -u m/b +! grep rsc.io/quote go.mod +go mod edit -require=rsc.io/quote@v1.5.1 +go get -d -t -u m/b +grep 'rsc.io/quote v1.5.1$' go.mod + +# 'go get all' should consider test dependencies with or without -t. +cp go.mod.empty go.mod +go get all +grep 'rsc.io/quote v1.5.2$' go.mod + +-- go.mod.empty -- +module m + +-- a/a.go -- +package a + +-- a/a_test.go -- +package a_test + +import _ "rsc.io/quote" + +-- b/b.go -- +package b + +import _ "m/a" + +-- b/b_test.go -- +package b_test + +import _ "m/a" diff --git a/libgo/go/cmd/go/testdata/script/mod_get_upgrade.txt b/libgo/go/cmd/go/testdata/script/mod_get_upgrade.txt index 5eb5ff96577..6a14dfdc45d 100644 --- a/libgo/go/cmd/go/testdata/script/mod_get_upgrade.txt +++ b/libgo/go/cmd/go/testdata/script/mod_get_upgrade.txt @@ -5,31 +5,31 @@ go list -m all stdout 'rsc.io/quote v1.5.1' grep 'rsc.io/quote v1.5.1$' go.mod -# get -u should update all dependencies -go get -u +# get -u should update dependencies of the package in the current directory +go get -d -u grep 'rsc.io/quote v1.5.2$' go.mod grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod # get -u rsc.io/sampler should update only sampler's dependencies cp go.mod-v1.5.1 go.mod -go get -u rsc.io/sampler +go get -d -u rsc.io/sampler grep 'rsc.io/quote v1.5.1$' go.mod grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod # move to a pseudo-version after any tags -go get -m rsc.io/quote@dd9747d +go get -d rsc.io/quote@dd9747d grep 'rsc.io/quote v0.0.0-20180628003336-dd9747d19b04' go.mod # get -u should not jump off newer pseudo-version to earlier tag -go get -m -u +go get -d -u grep 'rsc.io/quote v0.0.0-20180628003336-dd9747d19b04' go.mod # move to earlier pseudo-version -go get -m rsc.io/quote@e7a685a342 +go get -d rsc.io/quote@e7a685a342 grep 'rsc.io/quote v0.0.0-20180214005133-e7a685a342c0' go.mod # get -u should jump off earlier pseudo-version to newer tag -go get -m -u +go get -d -u grep 'rsc.io/quote v1.5.2' go.mod -- go.mod -- @@ -39,3 +39,8 @@ require rsc.io/quote v1.1.0 -- go.mod-v1.5.1 -- module x require rsc.io/quote v1.5.1 + +-- use.go -- +package use + +import _ "rsc.io/quote" diff --git a/libgo/go/cmd/go/testdata/script/mod_get_upgrade_pseudo.txt b/libgo/go/cmd/go/testdata/script/mod_get_upgrade_pseudo.txt new file mode 100644 index 00000000000..9184d85f7f3 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_get_upgrade_pseudo.txt @@ -0,0 +1,46 @@ +env GO111MODULE=on + +# For this test module there are three versions: +# * v0.1.1-0.20190429073117-b5426c86b553 +# * v0.1.0 +# * v0.0.0-20190430073000-30950c05d534 +# Only v0.1.0 is tagged. +# +# The v0.1.1 pseudo-version is semantically higher than the latest tag. +# The v0.0.0 pseudo-version is chronologically newer. + +# 'get -u' should not downgrade to the (lower) tagged version. +go get -d example.com/pseudoupgrade@b5426c8 +go get -d -u +go list -m -u all +stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$' + +# 'get example.com/pseudoupgrade@latest' should not downgrade to +# the (lower) tagged version. +go get -d example.com/pseudoupgrade@latest +go list -m all +stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$' + +# We should observe the same behavior with the newer pseudo-version. +go get -d example.com/pseudoupgrade@v0.0.0-20190430073000-30950c05d534 + +# 'get -u' should not downgrade to the chronologically older tagged version. +go get -d -u +go list -m -u all +stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$' + +# 'get example.com/pseudoupgrade@latest' should not downgrade to the +# chronologically older tagged version. +go get -d example.com/pseudoupgrade@latest +go list -m -u all +stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$' + +-- go.mod -- +module x + +go 1.12 + +-- main.go -- +package x + +import _ "example.com/pseudoupgrade" diff --git a/libgo/go/cmd/go/testdata/script/mod_get_warning.txt b/libgo/go/cmd/go/testdata/script/mod_get_warning.txt deleted file mode 100644 index 36b5434c3ba..00000000000 --- a/libgo/go/cmd/go/testdata/script/mod_get_warning.txt +++ /dev/null @@ -1,10 +0,0 @@ -# go get in GO111MODULE=auto should warn when not using modules and go.mod exists - -env GO111MODULE=auto -mkdir z -cd z -! go get # fails because no code in directory, not the warning -stderr 'go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;\n\tignoring ..[/\\]go.mod;\n\tsee ''go help modules''' - --- go.mod -- -module x diff --git a/libgo/go/cmd/go/testdata/script/mod_getmode_vendor.txt b/libgo/go/cmd/go/testdata/script/mod_getmode_vendor.txt index 3dd8d1b888d..7e1f6aa323e 100644 --- a/libgo/go/cmd/go/testdata/script/mod_getmode_vendor.txt +++ b/libgo/go/cmd/go/testdata/script/mod_getmode_vendor.txt @@ -1,6 +1,6 @@ env GO111MODULE=on -go get -m rsc.io/quote@v1.5.1 +go get -d rsc.io/quote@v1.5.1 go mod vendor env GOPATH=$WORK/empty env GOPROXY=file:///nonexist diff --git a/libgo/go/cmd/go/testdata/script/mod_git_export_subst.txt b/libgo/go/cmd/go/testdata/script/mod_git_export_subst.txt new file mode 100644 index 00000000000..a28b4f2d67b --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_git_export_subst.txt @@ -0,0 +1,21 @@ +env GO111MODULE=on +env GOPROXY=direct + +# Testing that git export-subst is disabled +[!net] skip +[!exec:git] skip +go build + +-- x.go -- +package x + +import _ "github.com/jasonkeene/export-subst" + +-- go.mod -- +module x + +require github.com/jasonkeene/export-subst v0.0.0-20180927204031-5845945ec626 + +-- go.sum -- +github.com/jasonkeene/export-subst v0.0.0-20180927204031-5845945ec626 h1:AUkXi/xFnm7lH2pgtvVkGb7buRn1ywFHw+xDpZ29Rz0= +github.com/jasonkeene/export-subst v0.0.0-20180927204031-5845945ec626/go.mod h1:DwJXqVtrgrQkv3Giuf2Jh4YyubVe7y41S1eOIaysTJw= diff --git a/libgo/go/cmd/go/testdata/script/mod_gobuild_import.txt b/libgo/go/cmd/go/testdata/script/mod_gobuild_import.txt index 932b8b66f92..a4eb5d6596f 100644 --- a/libgo/go/cmd/go/testdata/script/mod_gobuild_import.txt +++ b/libgo/go/cmd/go/testdata/script/mod_gobuild_import.txt @@ -1,46 +1,52 @@ +[short] skip + # go/build's Import should find modules by invoking the go command go build -o $WORK/testimport.exe ./testimport # GO111MODULE=off env GO111MODULE=off -! exec $WORK/testimport.exe x/y/z/w . +! exec $WORK/testimport.exe gobuild.example.com/x/y/z/w . # GO111MODULE=auto in GOPATH/src -env GO111MODULE= -! exec $WORK/testimport.exe x/y/z/w . env GO111MODULE=auto -! exec $WORK/testimport.exe x/y/z/w . +exec $WORK/testimport.exe gobuild.example.com/x/y/z/w . # GO111MODULE=auto outside GOPATH/src cd $GOPATH/other -env GO111MODULE= +env GO111MODULE=auto exec $WORK/testimport.exe other/x/y/z/w . stdout w2.go -! exec $WORK/testimport.exe x/y/z/w . -stderr 'cannot find module providing package x/y/z/w' +! exec $WORK/testimport.exe gobuild.example.com/x/y/z/w . +stderr 'cannot find module providing package gobuild.example.com/x/y/z/w' cd z -env GO111MODULE=auto exec $WORK/testimport.exe other/x/y/z/w . stdout w2.go # GO111MODULE=on outside GOPATH/src +env GO111MODULE= +exec $WORK/testimport.exe other/x/y/z/w . +stdout w2.go env GO111MODULE=on exec $WORK/testimport.exe other/x/y/z/w . stdout w2.go # GO111MODULE=on in GOPATH/src cd $GOPATH/src -exec $WORK/testimport.exe x/y/z/w . +env GO111MODULE= +exec $WORK/testimport.exe gobuild.example.com/x/y/z/w . +stdout w1.go +env GO111MODULE=on +exec $WORK/testimport.exe gobuild.example.com/x/y/z/w . stdout w1.go cd w -exec $WORK/testimport.exe x/y/z/w .. +exec $WORK/testimport.exe gobuild.example.com/x/y/z/w .. stdout w1.go -- go.mod -- -module x/y/z +module gobuild.example.com/x/y/z -- z.go -- package z diff --git a/libgo/go/cmd/go/testdata/script/mod_gonoproxy.txt b/libgo/go/cmd/go/testdata/script/mod_gonoproxy.txt new file mode 100644 index 00000000000..2bd94cdee04 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_gonoproxy.txt @@ -0,0 +1,37 @@ +env GO111MODULE=on +env sumdb=$GOSUMDB +env proxy=$GOPROXY +env GOPRIVATE GOPROXY GONOPROXY GOSUMDB GONOSUMDB +env dbname=localhost.localdev/sumdb + +# disagree with sumdb fails +cp go.mod.orig go.mod +env GOSUMDB=$sumdb' '$proxy/sumdb-wrong +! go get rsc.io/quote +stderr 'SECURITY ERROR' + +# but GONOSUMDB bypasses sumdb, for rsc.io/quote, rsc.io/sampler, golang.org/x/text +env GONOSUMDB='*/quote,*/*mple*,golang.org/x' +go get rsc.io/quote +rm go.sum +env GOPRIVATE='*/quote,*/*mple*,golang.org/x' +env GONOPROXY=none # that is, proxy all despite GOPRIVATE +go get rsc.io/quote + +# and GONOPROXY bypasses proxy +[!net] skip +[!exec:git] skip +env GOPRIVATE=none +env GONOPROXY='*/fortune' +! go get rsc.io/fortune # does not exist in real world, only on test proxy +stderr 'git ls-remote' + +env GOSUMDB= +env GONOPROXY= +env GOPRIVATE='*/x' +go get golang.org/x/text +go list -m all +! stdout 'text.*v0.0.0-2017' # should not have the version from the proxy + +-- go.mod.orig -- +module m diff --git a/libgo/go/cmd/go/testdata/script/mod_gopkg_unstable.txt b/libgo/go/cmd/go/testdata/script/mod_gopkg_unstable.txt index d945cf35b43..9d288a64d45 100644 --- a/libgo/go/cmd/go/testdata/script/mod_gopkg_unstable.txt +++ b/libgo/go/cmd/go/testdata/script/mod_gopkg_unstable.txt @@ -8,8 +8,10 @@ cp go.mod.empty go.mod go list [!net] skip +[!exec:git] skip -env GOPROXY= +env GOPROXY=direct +env GOSUMDB=off go get gopkg.in/macaroon-bakery.v2-unstable/bakery go list -m all stdout 'gopkg.in/macaroon-bakery.v2-unstable v2.0.0-[0-9]+-[0-9a-f]+$' diff --git a/libgo/go/cmd/go/testdata/script/mod_help.txt b/libgo/go/cmd/go/testdata/script/mod_help.txt new file mode 100644 index 00000000000..b5cd30c5219 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_help.txt @@ -0,0 +1,6 @@ +env GO111MODULE=on + +# go help get shows usage for get +go help get +stdout 'usage: go get' +stdout 'get using modules to manage source' \ No newline at end of file diff --git a/libgo/go/cmd/go/testdata/script/mod_import_v1suffix.txt b/libgo/go/cmd/go/testdata/script/mod_import_v1suffix.txt new file mode 100644 index 00000000000..a4294504661 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_import_v1suffix.txt @@ -0,0 +1,11 @@ +env GO111MODULE=on + +! go get -d example.com/invalidpath/v1 +! go install . + +-- go.mod -- +module example.com +-- main.go -- +package main +import _ "example.com/invalidpath/v1" +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_init_dep.txt b/libgo/go/cmd/go/testdata/script/mod_init_dep.txt index 29c840b3833..755076eae80 100644 --- a/libgo/go/cmd/go/testdata/script/mod_init_dep.txt +++ b/libgo/go/cmd/go/testdata/script/mod_init_dep.txt @@ -21,6 +21,11 @@ go list go list -m all stdout 'rsc.io/sampler v1.0.0' +# test dep replacement +cd y +go mod init +cmpenv go.mod go.mod.replace + -- go.mod1 -- module x @@ -32,3 +37,21 @@ package x name = "rsc.io/sampler" version = "v1.0.0" +-- y/Gopkg.lock -- +[[projects]] + name = "z" + revision = "v1.0.0" + source = "rsc.io/quote" + +-- y/y.go -- +package y // import "y" +import _ "z" + +-- y/go.mod.replace -- +module y + +go $goversion + +replace z v1.0.0 => rsc.io/quote v1.0.0 + +require rsc.io/quote v1.0.0 \ No newline at end of file diff --git a/libgo/go/cmd/go/testdata/script/mod_init_empty.txt b/libgo/go/cmd/go/testdata/script/mod_init_empty.txt new file mode 100644 index 00000000000..1c3888caed7 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_init_empty.txt @@ -0,0 +1,18 @@ +env GO111MODULE=on + +env GOPATH=$devnull + +go list -m +stdout '^example.com$' + +go list +stdout '^example.com$' + +-- go.mod -- +module example.com + +go 1.13 +-- main.go -- +package main + +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_init_glide.txt b/libgo/go/cmd/go/testdata/script/mod_init_glide.txt new file mode 100644 index 00000000000..a351a6ae4bc --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_init_glide.txt @@ -0,0 +1,34 @@ +[!net] skip +[!exec:git] skip + +env GO111MODULE=on +env GOPROXY=direct + +# Regression test for golang.org/issue/32161: +# 'go mod init' did not locate tags when resolving a commit to a pseudo-version. +go mod init x +cmpenv go.mod go.mod.out + +-- main.go -- +package main + +import ( + _ "github.com/rsc/legacytest" +) + +func main() {} + +-- glide.lock -- +imports: +- name: github.com/rsc/legacytest + version: fb3c628075e32f7f3c248a3abbdafd69ad6e21e1 + +-- glide.yaml -- +package: x + +-- go.mod.out -- +module x + +go $goversion + +require github.com/rsc/legacytest v1.1.0-pre.0.20180717164849-fb3c628075e3 diff --git a/libgo/go/cmd/go/testdata/script/mod_init_path.txt b/libgo/go/cmd/go/testdata/script/mod_init_path.txt new file mode 100644 index 00000000000..637c29f4bcd --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_init_path.txt @@ -0,0 +1,20 @@ +env GO111MODULE=on + +! go mod init . +stderr 'malformed import path' + +cd x +go mod init example.com/x + +cd ../y +go mod init m + +-- x/main.go -- +package main + +func main() {} + +-- y/main.go -- +package main + +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_internal.txt b/libgo/go/cmd/go/testdata/script/mod_internal.txt index 5a47c3fa44a..5a361a4f424 100644 --- a/libgo/go/cmd/go/testdata/script/mod_internal.txt +++ b/libgo/go/cmd/go/testdata/script/mod_internal.txt @@ -1,4 +1,5 @@ env GO111MODULE=on +[short] skip # golang.org/x/internal should be importable from other golang.org/x modules. rm go.mod diff --git a/libgo/go/cmd/go/testdata/script/mod_invalid_version.txt b/libgo/go/cmd/go/testdata/script/mod_invalid_version.txt new file mode 100644 index 00000000000..2be0d01cce9 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_invalid_version.txt @@ -0,0 +1,227 @@ +[!net] skip +[!exec:git] skip + +env GO111MODULE=on +env GOPROXY=direct +env GOSUMDB=off + +# Regression test for golang.org/issue/27173: if the user (or go.mod file) +# requests a pseudo-version that does not match both the module path and commit +# metadata, reject it with a helpful error message. +# +# TODO(bcmills): Replace the github.com/pierrec/lz4 examples with something +# equivalent on vcs-test.golang.org. + +# An incomplete commit hash is not a valid semantic version, +# but can appear in the main go.mod file anyway and should be resolved. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0: parsing ../go.mod: '$WORK'/gopath/src/go.mod:5: require golang.org/x/text: version "14c0d48ead0c" invalid: must be of the form v1.2.3' +cd .. +go list -m golang.org/x/text +stdout 'golang.org/x/text v0.1.1-0.20170915032832-14c0d48ead0c' +grep 'golang.org/x/text v0.1.1-0.20170915032832-14c0d48ead0c' go.mod + +# A module path below the repo root that does not contain a go.mod file is invalid. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text/unicode@v0.0.0-20170915032832-14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text/unicode@v0.0.0-20170915032832-14c0d48ead0c: invalid version: missing golang.org/x/text/unicode/go.mod at revision 14c0d48ead0c' +cd .. +! go list -m golang.org/x/text +stderr 'golang.org/x/text/unicode@v0.0.0-20170915032832-14c0d48ead0c: invalid version: missing golang.org/x/text/unicode/go.mod at revision 14c0d48ead0c' + +# However, arguments to 'go get' can name packages above the root. +cp go.mod.orig go.mod +go get -d golang.org/x/text/unicode@v0.0.0-20170915032832-14c0d48ead0c +go list -m golang.org/x/text/... +stdout 'golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c' +! stdout 'golang.org/x/text/unicode' + +# A major version that does not match the module path is invalid. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@v2.1.1-0.20170915032832-14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0: parsing ../go.mod: '$WORK'/gopath/src/go.mod:5: require golang.org/x/text: version "v2.1.1-0.20170915032832-14c0d48ead0c" invalid: should be v0 or v1, not v2' +cd .. +! go list -m golang.org/x/text +stderr $WORK'/gopath/src/go.mod:5: require golang.org/x/text: version "v2.1.1-0.20170915032832-14c0d48ead0c" invalid: should be v0 or v1, not v2' + +# A pseudo-version with fewer than 12 digits of SHA-1 prefix is invalid. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0 +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0: invalid pseudo-version: revision is shorter than canonical \(14c0d48ead0c\)' +cd .. +! go list -m golang.org/x/text +stderr 'golang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0: invalid pseudo-version: revision is shorter than canonical \(14c0d48ead0c\)' + +# A pseudo-version with more than 12 digits of SHA-1 prefix is invalid. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0cd47e3104ada247d91be04afc7a5a +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0cd47e3104ada247d91be04afc7a5a: invalid pseudo-version: revision is longer than canonical \(14c0d48ead0c\)' +cd .. +! go list -m golang.org/x/text +stderr 'golang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0cd47e3104ada247d91be04afc7a5a: invalid pseudo-version: revision is longer than canonical \(14c0d48ead0c\)' + +# A pseudo-version that does not match the commit timestamp is invalid. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@v0.1.1-0.20190915032832-14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v0.1.1-0.20190915032832-14c0d48ead0c: invalid pseudo-version: does not match version-control timestamp \(2017-09-15T03:28:32Z\)' +cd .. +! go list -m golang.org/x/text +stderr 'golang.org/x/text@v0.1.1-0.20190915032832-14c0d48ead0c: invalid pseudo-version: does not match version-control timestamp \(2017-09-15T03:28:32Z\)' + +# A 'replace' directive in the main module can replace an invalid timestamp +# with a valid one. +go mod edit -replace golang.org/x/text@v0.1.1-0.20190915032832-14c0d48ead0c=golang.org/x/text@14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v0.1.1-0.20190915032832-14c0d48ead0c: invalid pseudo-version: does not match version-control timestamp \(2017-09-15T03:28:32Z\)' +cd .. +go list -m golang.org/x/text +stdout 'golang.org/x/text v0.1.1-0.20190915032832-14c0d48ead0c => golang.org/x/text v0.1.1-0.20170915032832-14c0d48ead0c' + +# A pseudo-version that is not derived from a tag is invalid. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@v1.999.999-0.20170915032832-14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v1.999.999-0.20170915032832-14c0d48ead0c: invalid pseudo-version: preceding tag \(v1.999.998\) not found' +cd .. +! go list -m golang.org/x/text +stderr 'golang.org/x/text@v1.999.999-0.20170915032832-14c0d48ead0c: invalid pseudo-version: preceding tag \(v1.999.998\) not found' + +# A v1.0.0- pseudo-version that is not derived from a tag is invalid: +# v1.0.0- implies no tag, but the correct no-tag prefix for a module path +# without a major-version suffix is v0.0.0-. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@v1.0.0-20170915032832-14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v1.0.0-20170915032832-14c0d48ead0c: invalid pseudo-version: major version without preceding tag must be v0, not v1' +cd .. +! go list -m golang.org/x/text +stderr 'golang.org/x/text@v1.0.0-20170915032832-14c0d48ead0c: invalid pseudo-version: major version without preceding tag must be v0, not v1' + +# A pseudo-version vX.Y.Z+1 cannot have Z+1 == 0, since that would +# imply a base tag with a negative patch field. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@v0.0.0-0.20170915032832-14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v0.0.0-0.20170915032832-14c0d48ead0c: invalid pseudo-version: version before v0.0.0 would have negative patch number' +cd .. +! go list -m golang.org/x/text +stderr 'golang.org/x/text@v0.0.0-0.20170915032832-14c0d48ead0c: invalid pseudo-version: version before v0.0.0 would have negative patch number' + +# A 'replace' directive in the main module can replace an +# invalid pseudo-version base with a valid one. +go mod edit -replace golang.org/x/text@v0.0.0-0.20170915032832-14c0d48ead0c=golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v0.0.0-0.20170915032832-14c0d48ead0c: invalid pseudo-version: version before v0.0.0 would have negative patch number' +cd .. +go list -m golang.org/x/text +stdout 'golang.org/x/text v0.0.0-0.20170915032832-14c0d48ead0c => golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c' + +# A pseudo-version derived from a non-ancestor tag is invalid. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@v0.2.1-0.20170915032832-14c0d48ead0c +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v0.2.1-0.20170915032832-14c0d48ead0c: invalid pseudo-version: revision 14c0d48ead0c is not a descendent of preceding tag \(v0.2.0\)' +cd .. +! go list -m golang.org/x/text +stderr 'golang.org/x/text@v0.2.1-0.20170915032832-14c0d48ead0c: invalid pseudo-version: revision 14c0d48ead0c is not a descendent of preceding tag \(v0.2.0\)' + +# A +incompatible suffix is not allowed on a version that is actually compatible. +cp go.mod.orig go.mod +go mod edit -require golang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0c+incompatible +cd outside +! go list -m golang.org/x/text +stderr 'go: example.com@v0.0.0 requires\n\tgolang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0c\+incompatible: invalid version: \+incompatible suffix not allowed: major version v0 is compatible' +cd .. +! go list -m golang.org/x/text +stderr 'golang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0c\+incompatible: invalid version: \+incompatible suffix not allowed: major version v0 is compatible' + +# The pseudo-version for a commit after a tag with a non-matching major version +# should instead be based on the last matching tag. +cp go.mod.orig go.mod +go mod edit -require github.com/pierrec/lz4@473cd7ce01a1 +go list -m github.com/pierrec/lz4 +stdout 'github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1' +cd outside +go list -m github.com/pierrec/lz4 +stdout 'github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1' +cd .. + +# A +incompatible version for a module that has an explicit go.mod file is invalid. +cp go.mod.orig go.mod +go mod edit -require github.com/pierrec/lz4@v2.0.9-0.20190131084431-473cd7ce01a1+incompatible +cd outside +! go list -m github.com/pierrec/lz4 +stderr 'go: example.com@v0.0.0 requires\n\tgithub.com/pierrec/lz4@v2.0.9-0.20190131084431-473cd7ce01a1\+incompatible: invalid version: \+incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required' +cd .. +! go list -m github.com/pierrec/lz4 +stderr 'github.com/pierrec/lz4@v2.0.9-0.20190131084431-473cd7ce01a1\+incompatible: invalid version: \+incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required' + +# A +incompatible pseudo-version is valid for a revision of the module +# that lacks a go.mod file. +cp go.mod.orig go.mod +go mod edit -require github.com/pierrec/lz4@v2.0.4-0.20180826165652-dbe9298ce099+incompatible +cd outside +go list -m github.com/pierrec/lz4 +stdout 'github.com/pierrec/lz4 v2.0.4-0.20180826165652-dbe9298ce099\+incompatible' +cd .. +go list -m github.com/pierrec/lz4 +stdout 'github.com/pierrec/lz4 v2.0.4-0.20180826165652-dbe9298ce099\+incompatible' + +# 'go get' for a mismatched major version without a go.mod file should resolve +# to the equivalent +incompatible version, not a pseudo-version with a different +# major version. +cp go.mod.orig go.mod +go get -d github.com/pierrec/lz4@v2.0.5 +go list -m github.com/pierrec/lz4 +stdout 'github.com/pierrec/lz4 v2.0.5\+incompatible' + +# 'go get' for a mismatched major version with a go.mod file should error out, +# not resolve to a pseudo-version with a different major version. +cp go.mod.orig go.mod +! go get -d github.com/pierrec/lz4@v2.0.8 +stderr 'go get github.com/pierrec/lz4@v2.0.8: github.com/pierrec/lz4@v2.0.8: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2' + +# An invalid +incompatible suffix for a canonical version should error out, +# not resolve to a pseudo-version. +# +# TODO(bcmills): The "outside" view for this failure mode is missing its import stack. +# Figure out why and fix it. +cp go.mod.orig go.mod +go mod edit -require github.com/pierrec/lz4@v2.0.8+incompatible +cd outside +! go list -m github.com/pierrec/lz4 +stderr 'github.com/pierrec/lz4@v2.0.8\+incompatible: invalid version: \+incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required' +cd .. +! go list -m github.com/pierrec/lz4 +stderr 'github.com/pierrec/lz4@v2.0.8\+incompatible: invalid version: \+incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required' + +-- go.mod.orig -- +module example.com + +go 1.13 +-- outside/go.mod -- +module example.com/outside + +go 1.13 + +require example.com v0.0.0 +replace example.com v0.0.0 => ./.. diff --git a/libgo/go/cmd/go/testdata/script/mod_list.txt b/libgo/go/cmd/go/testdata/script/mod_list.txt index 2fa079f49ae..a15f5bca635 100644 --- a/libgo/go/cmd/go/testdata/script/mod_list.txt +++ b/libgo/go/cmd/go/testdata/script/mod_list.txt @@ -1,4 +1,5 @@ env GO111MODULE=on +[short] skip # list {{.Dir}} shows main module and go.mod but not not-yet-downloaded dependency dir. go list -m -f '{{.Path}} {{.Main}} {{.GoMod}} {{.Dir}}' all @@ -26,7 +27,7 @@ stdout 'v1.3.0.*mod[\\/]rsc.io[\\/]sampler@v1.3.1 .*[\\/]v1.3.1.mod => v1.3.1.*s # list std should work go list std -[!gccgo] stdout ^math/big +stdout ^math/big # rsc.io/quote/buggy should be listable as a package go list rsc.io/quote/buggy @@ -41,10 +42,10 @@ stderr '^go list -m nonexist: module "nonexist" is not a known dependency' stderr '^go list -m rsc.io/quote/buggy: module "rsc.io/quote/buggy" is not a known dependency' # Module loader does not interfere with list -e (golang.org/issue/24149). -[!gccgo] go list -e -f '{{.Error.Err}}' database -[!gccgo] stdout 'no Go files in ' -[!gccgo] ! go list database -[!gccgo] stderr 'no Go files in ' +go list -e -f '{{.Error.Err}}' database +stdout 'no Go files in ' +! go list database +stderr 'no Go files in ' -- go.mod -- module x diff --git a/libgo/go/cmd/go/testdata/script/mod_list_dir.txt b/libgo/go/cmd/go/testdata/script/mod_list_dir.txt index 31cd27d7561..c4db0456311 100644 --- a/libgo/go/cmd/go/testdata/script/mod_list_dir.txt +++ b/libgo/go/cmd/go/testdata/script/mod_list_dir.txt @@ -1,6 +1,6 @@ -# go list with path to directory should work +[short] skip -[gccgo] stop +# go list with path to directory should work env GO111MODULE=off go list -f '{{.ImportPath}}' $GOROOT/src/math diff --git a/libgo/go/cmd/go/testdata/script/mod_list_pseudo.txt b/libgo/go/cmd/go/testdata/script/mod_list_pseudo.txt new file mode 100644 index 00000000000..3a10b3a0407 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_list_pseudo.txt @@ -0,0 +1,50 @@ +env GO111MODULE=on + +# Regression test for golang.org/issue/32715. + +# When using $GOPATH/pkg/mod/cache/download as a proxy, +# 'latest' queries should prefer tagged versions over pseudo-versions. + +go mod download github.com/dmitshur-test/modtest5@v0.0.0-20190619020302-197a620e0c9a +go mod download github.com/dmitshur-test/modtest5@v0.5.0-alpha +go mod download github.com/dmitshur-test/modtest5@v0.5.0-alpha.0.20190619023908-3da23a9deb9e +cmp $GOPATH/pkg/mod/cache/download/github.com/dmitshur-test/modtest5/@v/list $WORK/modtest5.list + +env GOPROXY=file:///$GOPATH/pkg/mod/cache/download +env GOPATH=$WORK/gopath2 +mkdir $GOPATH + +go list -m -json github.com/dmitshur-test/modtest5@latest +cmp stdout $WORK/modtest5.json + +# If the module proxy contains only pseudo-versions, 'latest' should stat +# the version with the most recent timestamp — not the highest semantic +# version — and return its metadata. +env GOPROXY=file:///$WORK/tinyproxy +go list -m -json dmitri.shuralyov.com/test/modtest3@latest +cmp stdout $WORK/modtest3.json + +-- $WORK/modtest5.list -- +v0.0.0-20190619020302-197a620e0c9a +v0.5.0-alpha +v0.5.0-alpha.0.20190619023908-3da23a9deb9e +-- $WORK/modtest5.json -- +{ + "Path": "github.com/dmitshur-test/modtest5", + "Version": "v0.5.0-alpha", + "Time": "2019-06-18T19:04:46-07:00" +} +-- $WORK/tinyproxy/dmitri.shuralyov.com/test/modtest3/@v/list -- +v0.1.0-0.20161023043300-000000000000 +v0.0.0-20181023043359-a85b471d5412 +-- $WORK/tinyproxy/dmitri.shuralyov.com/test/modtest3/@v/v0.0.0-20181023043359-a85b471d5412.info -- +{ + "Version": "v0.0.0-20181023043359-a85b471d5412", + "Time": "2018-10-22T21:33:59-07:00" +} +-- $WORK/modtest3.json -- +{ + "Path": "dmitri.shuralyov.com/test/modtest3", + "Version": "v0.0.0-20181023043359-a85b471d5412", + "Time": "2018-10-22T21:33:59-07:00" +} diff --git a/libgo/go/cmd/go/testdata/script/mod_list_replace_dir.txt b/libgo/go/cmd/go/testdata/script/mod_list_replace_dir.txt new file mode 100644 index 00000000000..37de8825e06 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_list_replace_dir.txt @@ -0,0 +1,19 @@ +# Test that "go list" succeeds when given a directory in a replacement +# module within the module cache. +# Verifies golang.org/issue/29548 + +env GO111MODULE=on +go mod download + +! go list $GOPATH/pkg/mod/rsc.io/quote@v1.5.2 +stderr 'outside available modules' + +go list $GOPATH/pkg/mod/rsc.io/quote@v1.5.1 +stdout 'rsc.io/quote' + +-- go.mod -- +module example.com/quoter + +require rsc.io/quote v1.5.2 + +replace rsc.io/quote => rsc.io/quote v1.5.1 diff --git a/libgo/go/cmd/go/testdata/script/mod_list_std.txt b/libgo/go/cmd/go/testdata/script/mod_list_std.txt new file mode 100644 index 00000000000..8552aebf42c --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_list_std.txt @@ -0,0 +1,58 @@ +env GO111MODULE=on +env GOPROXY=off + +[!gc] skip +[short] skip + +# Outside of GOROOT, our vendored packages should be reported as part of the standard library. +go list -f '{{if .Standard}}{{.ImportPath}}{{end}}' std cmd +stdout ^vendor/golang.org/x/net/http2/hpack +stdout ^cmd/vendor/golang\.org/x/arch/x86/x86asm + +# cmd/... should match the same packages it used to match in GOPATH mode. +go list cmd/... +stdout ^cmd/compile +! stdout ^cmd/vendor/golang\.org/x/arch/x86/x86asm + + +# Within the std module, listing ./... should omit the 'std' prefix: +# the package paths should be the same via ./... or the 'std' meta-pattern. +# TODO(golang.org/issue/30241): Make that work. +# Today, they are listed in 'std' but not './...'. +cd $GOROOT/src +go list ./... +! stdout ^vendor/golang.org/x # TODO: should be included, or should be omitted from 'std'. + +cp stdout $WORK/listdot.txt +go list std +stdout ^vendor/golang.org/x # TODO: remove vendor/ prefix +# TODO: cmp stdout $WORK/listdot.txt + +go list all +stdout ^vendor/golang.org/x # TODO: remove vendor/ prefix. +! stdout ^std/ + + +# Within the std module, the vendored dependencies of std should appear +# to come from the actual modules. +# TODO(golang.org/issue/30241): Make that work. +# Today, they still have the vendor/ prefix. +go list std +stdout ^vendor/golang.org/x/net/http2/hpack # TODO +! stdout ^golang.org/x/net/http2/hpack # TODO + +go list -deps -f '{{if not .Standard}}{{.ImportPath}}{{end}}' std +# ! stdout ^vendor/golang.org/x/net/http2/hpack # TODO +! stdout ^golang.org/x/net/http2/hpack # TODO + + +# Within std, the vendored dependencies of cmd should still appear to be part of cmd. +go list -f '{{if .Standard}}{{.ImportPath}}{{end}}' cmd +stdout ^cmd/vendor/golang\.org/x/arch/x86/x86asm + +go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' cmd +! stdout . + +go list cmd/... +stdout ^cmd/compile +! stdout ^cmd/vendor/golang\.org/x/arch/x86/x86asm diff --git a/libgo/go/cmd/go/testdata/script/mod_list_test.txt b/libgo/go/cmd/go/testdata/script/mod_list_test.txt new file mode 100644 index 00000000000..a99e4f36cd5 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_list_test.txt @@ -0,0 +1,16 @@ +env GO111MODULE=on + +# go list -compiled -test must handle test-only packages +# golang.org/issue/27097. +go list -compiled -test +stdout '^m$' +stdout '^m\.test$' +stdout '^m \[m\.test\]$' + +-- go.mod -- +module m + +-- x_test.go -- +package x +import "testing" +func Test(t *testing.T) {} diff --git a/libgo/go/cmd/go/testdata/script/mod_list_upgrade_pseudo.txt b/libgo/go/cmd/go/testdata/script/mod_list_upgrade_pseudo.txt new file mode 100644 index 00000000000..b983bec73db --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_list_upgrade_pseudo.txt @@ -0,0 +1,26 @@ +env GO111MODULE=on + +# For this test module there are three versions: +# * v0.1.1-0.20190429073117-b5426c86b553 +# * v0.1.0 +# * v0.0.0-20190430073000-30950c05d534 +# Only v0.1.0 is tagged. +# +# The v0.1.1 pseudo-version is semantically higher than the latest tag. +# The v0.0.0 pseudo-version is chronologically newer. + +# The latest pseudo-version is semantically higher than the latest tag. +# 'list -u' should not suggest a lower version as an upgrade. + +go get -d example.com/pseudoupgrade@b5426c8 +go list -m -u all +stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$' + +go get -d example.com/pseudoupgrade@v0.0.0-20190430073000-30950c05d534 +go list -m -u all +stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$' + +-- go.mod -- +module x + +go 1.12 diff --git a/libgo/go/cmd/go/testdata/script/mod_load_badchain.txt b/libgo/go/cmd/go/testdata/script/mod_load_badchain.txt new file mode 100644 index 00000000000..6fdf2c7b6be --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_load_badchain.txt @@ -0,0 +1,75 @@ +[short] skip +env GO111MODULE=on + +# Download everything to avoid "finding" messages in stderr later. +cp go.mod.orig go.mod +go mod download +go mod download example.com@v1.0.0 +go mod download example.com/badchain/a@v1.1.0 +go mod download example.com/badchain/b@v1.1.0 +go mod download example.com/badchain/c@v1.1.0 + +# Try to update example.com/badchain/a (and its dependencies). +! go get -d example.com/badchain/a +cmp stderr update-a-expected +cmp go.mod go.mod.orig + +# Try to update the main module. This updates everything, including +# modules that aren't direct requirements, so the error stack is shorter. +! go get -d -u ./... +cmp stderr update-main-expected +cmp go.mod go.mod.orig + +# Update manually. Listing modules should produce an error. +go mod edit -require=example.com/badchain/a@v1.1.0 +! go list -m +cmp stderr list-expected + +# Try listing a package that imports a package +# in a module without a requirement. +go mod edit -droprequire example.com/badchain/a +! go list m/use +cmp stderr list-missing-expected + +! go list -test m/testuse +cmp stderr list-missing-test-expected + +-- go.mod.orig -- +module m + +go 1.13 + +require example.com/badchain/a v1.0.0 +-- use/use.go -- +package use + +import _ "example.com/badchain/c" +-- testuse/testuse.go -- +package testuse +-- testuse/testuse_test.go -- +package testuse + +import ( + "testing" + _ "example.com/badchain/c" +) + +func Test(t *testing.T) {} +-- update-main-expected -- +go get: example.com/badchain/c@v1.0.0 updating to + example.com/badchain/c@v1.1.0: parsing go.mod: unexpected module path "example.com/badchain/wrong" +-- update-a-expected -- +go get: example.com/badchain/a@v1.1.0 requires + example.com/badchain/b@v1.1.0 requires + example.com/badchain/c@v1.1.0: parsing go.mod: unexpected module path "example.com/badchain/wrong" +-- list-expected -- +go: example.com/badchain/a@v1.1.0 requires + example.com/badchain/b@v1.1.0 requires + example.com/badchain/c@v1.1.0: parsing go.mod: unexpected module path "example.com/badchain/wrong" +-- list-missing-expected -- +go: m/use imports + example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod: unexpected module path "example.com/badchain/wrong" +-- list-missing-test-expected -- +go: m/testuse tested by + m/testuse.test imports + example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod: unexpected module path "example.com/badchain/wrong" diff --git a/libgo/go/cmd/go/testdata/script/mod_load_badzip.txt b/libgo/go/cmd/go/testdata/script/mod_load_badzip.txt new file mode 100644 index 00000000000..c5ba18e9f06 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_load_badzip.txt @@ -0,0 +1,15 @@ +# Zip files with unexpected file names inside should be rejected. +env GO111MODULE=on + +! go get -d rsc.io/badzip +stderr 'zip for rsc.io/badzip@v1.0.0 has unexpected file rsc.io/badzip@v1.0.0.txt' +! grep rsc.io/badzip go.mod + +# TODO(golang.org/issue/31730): 'go build' should print the error below if the +# requirement is not present. +go mod edit -require rsc.io/badzip@v1.0.0 +! go build rsc.io/badzip +stderr 'zip for rsc.io/badzip@v1.0.0 has unexpected file rsc.io/badzip@v1.0.0.txt' + +-- go.mod -- +module m diff --git a/libgo/go/cmd/go/testdata/script/mod_missingpkg_prerelease.txt b/libgo/go/cmd/go/testdata/script/mod_missingpkg_prerelease.txt new file mode 100644 index 00000000000..6203606c22d --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_missingpkg_prerelease.txt @@ -0,0 +1,12 @@ +env GO111MODULE=on + +! go list use.go +stderr 'example.com/missingpkg/deprecated: package provided by example.com/missingpkg at latest version v1.0.0 but not at required version v1.0.1-beta' + +-- use.go -- +package use + +import ( + _ "example.com/missingpkg/deprecated" + _ "example.com/usemissingpre" +) diff --git a/libgo/go/cmd/go/testdata/script/mod_modinfo.txt b/libgo/go/cmd/go/testdata/script/mod_modinfo.txt new file mode 100644 index 00000000000..1e7dd44a13d --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_modinfo.txt @@ -0,0 +1,91 @@ +# Test to ensure runtime/debug.ReadBuildInfo parses +# the modinfo embedded in a binary by the go tool +# when module is enabled. +env GO111MODULE=on + +[gccgo] stop + +cd x +go mod edit -require=rsc.io/quote@v1.5.2 +go mod edit -replace=rsc.io/quote@v1.5.2=rsc.io/quote@v1.0.0 + +# Build a binary and ensure that it can output its own debug info. +# The debug info should be accessible before main starts (golang.org/issue/29628). +go build +exec ./x$GOEXE +stderr 'mod\s+x\s+\(devel\)' +stderr 'dep\s+rsc.io/quote\s+v1.5.2\s+' +stderr '=>\s+rsc.io/quote\s+v1.0.0\s+h1:' +stderr 'Hello, world.' + +[short] skip + +# Build a binary that accesses its debug info by reading the binary directly +# (rather than through debug.ReadBuildInfo). +# The debug info should still be present (golang.org/issue/28753). +cd unused +go build +exec ./unused$GOEXE + +-- x/go.mod -- +module x + +-- x/lib/lib.go -- +// Package lib accesses runtime/debug.modinfo before package main's init +// functions have run. +package lib + +import "runtime/debug" + +func init() { + m, ok := debug.ReadBuildInfo() + if !ok { + panic("failed debug.ReadBuildInfo") + } + println("mod", m.Main.Path, m.Main.Version) + for _, d := range m.Deps { + println("dep", d.Path, d.Version, d.Sum) + if r := d.Replace; r != nil { + println("=>", r.Path, r.Version, r.Sum) + } + } +} + +-- x/main.go -- +package main + +import ( + "rsc.io/quote" + _ "x/lib" +) + +func main() { + println(quote.Hello()) +} + +-- x/unused/main.go -- +// The unused binary does not access runtime/debug.modinfo. +package main + +import ( + "bytes" + "encoding/hex" + "io/ioutil" + "log" + "os" + + _ "rsc.io/quote" +) + +func main() { + b, err := ioutil.ReadFile(os.Args[0]) + if err != nil { + log.Fatal(err) + } + + infoStart, _ := hex.DecodeString("3077af0c9274080241e1c107e6d618e6") + if !bytes.Contains(b, infoStart) { + log.Fatal("infoStart not found in binary") + } + log.Println("ok") +} diff --git a/libgo/go/cmd/go/testdata/script/mod_off.txt b/libgo/go/cmd/go/testdata/script/mod_off.txt new file mode 100644 index 00000000000..cada6deb1dd --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_off.txt @@ -0,0 +1,35 @@ +env GO111MODULE=off + +# This script tests that running go mod with +# GO111MODULE=off when outside of GOPATH will fatal +# with an error message, even with some source code in the directory and a go.mod. +! go mod init +stderr 'go mod init: modules disabled by GO111MODULE=off; see ''go help modules''' +! go mod graph +stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules''' +! go mod verify +stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules''' +! go mod download +stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules''' + +# Same result in an empty directory +mkdir z +cd z +! go mod init +stderr 'go mod init: modules disabled by GO111MODULE=off; see ''go help modules''' +! go mod graph +stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules''' +! go mod verify +stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules''' +! go mod download +stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules''' + +-- sample.go -- +package sample + +func main() {} + +-- go.mod -- +module sample + +go 1.12 diff --git a/libgo/go/cmd/go/testdata/script/mod_off_init.txt b/libgo/go/cmd/go/testdata/script/mod_off_init.txt new file mode 100644 index 00000000000..1339c8aef96 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_off_init.txt @@ -0,0 +1,5 @@ +# 'go mod init' should refuse to initialize a module if it will be +# ignored anyway due to GO111MODULE=off. +env GO111MODULE=off +! go mod init +stderr 'go mod init: modules disabled by GO111MODULE=off; see ''go help modules''' diff --git a/libgo/go/cmd/go/testdata/script/mod_outside.txt b/libgo/go/cmd/go/testdata/script/mod_outside.txt new file mode 100644 index 00000000000..4182e71dde1 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_outside.txt @@ -0,0 +1,250 @@ +env GO111MODULE=on +[short] skip + +# This script tests commands in module mode outside of any module. +# +# First, ensure that we really are in module mode, and that we really don't have +# a go.mod file. +go env GOMOD +stdout 'NUL|/dev/null' + + +# 'go list' without arguments implicitly operates on the current directory, +# which is not in a module. +! go list +stderr 'cannot find main module' +go list -m +stdout '^command-line-arguments$' +# 'go list' in the working directory should fail even if there is a a 'package +# main' present: without a main module, we do not know its package path. +! go list ./foo +stderr 'cannot find main module' + +# 'go list all' lists the transitive import graph of the main module, +# which is empty if there is no main module. +go list all +! stdout . +stderr 'warning: "all" matched no packages' +go list -m all +stderr 'warning: pattern "all" matched no module dependencies' + +# 'go list' on standard-library packages should work, since they do not depend +# on the contents of any module. +go list -deps cmd +stdout '^fmt$' +stdout '^cmd/go$' + +go list $GOROOT/src/fmt +stdout '^fmt$' + +# 'go list' should work with file arguments. +go list ./foo/foo.go +stdout 'command-line-arguments' + +# 'go list -m' with an explicit version should resolve that version. +go list -m example.com/version@latest +stdout 'example.com/version v1.1.0' + +# 'go list -m -versions' should succeed even without an explicit version. +go list -m -versions example.com/version +stdout 'v1.0.0\s+v1.0.1\s+v1.1.0' + +# 'go list -m all' does not include the dependencies of in the computation of 'all'. +go list -m example.com/printversion@v1.0.0 all +stdout 'example.com/printversion v1.0.0' +stderr 'warning: pattern "all" matched no module dependencies' +! stdout 'example.com/version' + + +# 'go clean' should skip the current directory if it isn't in a module. +go clean -n +! stdout . +! stderr . + +# 'go mod graph' should not display anything, since there are no active modules. +go mod graph +! stdout . +! stderr . + +# 'go mod why' should report that nothing is a dependency. +go mod why -m example.com/version +stdout 'does not need' + + +# 'go mod edit', 'go mod tidy', and 'go mod fmt' should fail: +# there is no go.mod file to edit. +! go mod tidy +stderr 'cannot find main module' +! go mod edit -fmt +stderr 'cannot find main module' +! go mod edit -require example.com/version@v1.0.0 +stderr 'cannot find main module' + + +# 'go mod download' should download exactly the requested module without dependencies. +rm -r $GOPATH/pkg/mod/cache/download/example.com +go mod download example.com/printversion@v1.0.0 +exists $GOPATH/pkg/mod/cache/download/example.com/printversion/@v/v1.0.0.zip +! exists $GOPATH/pkg/mod/cache/download/example.com/version/@v/v1.0.0.zip + +# 'go mod vendor' should fail: it starts by clearing the existing vendor +# directory, and we don't know where that is. +! go mod vendor +stderr 'cannot find main module' + +# 'go mod verify' should succeed: we have no modules to verify. +go mod verify +stdout 'all modules verified' +! stderr . + + +# 'go get' without arguments implicitly operates on the main module, and thus +# should fail. +! go get +stderr 'cannot find main module' +! go get -u +stderr 'cannot find main module' +! go get -u ./foo +stderr 'cannot find main module' + +# 'go get -u all' upgrades the transitive import graph of the main module, +# which is empty. +go get -u all +! stdout . +stderr 'warning: "all" matched no packages' + +# 'go get' should check the proposed module graph for consistency, +# even though we won't write it anywhere. +! go get -d example.com/printversion@v1.0.0 example.com/version@none +stderr 'inconsistent versions' + +# 'go get -d' should download and extract the source code needed to build the requested version. +rm -r $GOPATH/pkg/mod/example.com +go get -d example.com/printversion@v1.0.0 +exists $GOPATH/pkg/mod/example.com/printversion@v1.0.0 +exists $GOPATH/pkg/mod/example.com/version@v1.0.0 + + +# 'go build' without arguments implicitly operates on the current directory, and should fail. +cd foo +! go build +stderr 'cannot find main module' +cd .. + +# 'go build' of a non-module directory should fail too. +! go build ./foo +stderr 'cannot find main module' + +# However, 'go build' should succeed for standard-library packages. +go build -n fmt + + +# TODO(golang.org/issue/28992): 'go doc' should document the latest version. +# For now it does not. +! go doc example.com/version +stderr 'no such package' + +# 'go install' with a version should fail due to syntax. +! go install example.com/printversion@v1.0.0 +stderr 'can only use path@version syntax with' + + +# 'go fmt' should be able to format files outside of a module. +go fmt foo/foo.go + + +# The remainder of the test checks dependencies by linking and running binaries. +[short] stop + +# 'go get' of a binary without a go.mod should install the requested version, +# resolving outside dependencies to the latest available versions. +go get example.com/printversion@v0.1.0 +exec ../bin/printversion +stdout 'path is example.com/printversion' +stdout 'main is example.com/printversion v0.1.0' +stdout 'using example.com/version v1.1.0' + +# 'go get' of a versioned binary should build and install the latest version +# using its minimal module requirements, ignoring replacements and exclusions. +go get example.com/printversion +exec ../bin/printversion +stdout 'path is example.com/printversion' +stdout 'main is example.com/printversion v1.0.0' +stdout 'using example.com/version v1.0.0' + +# 'go get -u=patch' should patch dependencies before installing, +# again ignoring replacements and exclusions. +go get -u=patch example.com/printversion@v1.0.0 +exec ../bin/printversion +stdout 'path is example.com/printversion' +stdout 'main is example.com/printversion v1.0.0' +stdout 'using example.com/version v1.0.1' + +# 'go install' without a version should install the latest version +# using its minimal module requirements. +go install example.com/printversion +exec ../bin/printversion +stdout 'path is example.com/printversion' +stdout 'main is example.com/printversion v1.0.0' +stdout 'using example.com/version v1.0.0' + +# 'go run' should use 'main' as the effective module and import path. +go run ./foo/foo.go +stdout 'path is command-line-arguments$' +stdout 'main is command-line-arguments \(devel\)' +stdout 'using example.com/version v1.1.0' + +# 'go generate' should work with file arguments. +[exec:touch] go generate ./foo/foo.go +[exec:touch] exists ./foo/gen.txt + +# 'go install' should work with file arguments. +go install ./foo/foo.go + +# 'go test' should work with file arguments. +go test -v ./foo/foo_test.go +stdout 'foo was tested' + +# 'go vet' should work with file arguments. +go vet ./foo/foo.go + + +-- README.txt -- +There is no go.mod file in the working directory. + +-- foo/foo.go -- +//go:generate touch gen.txt + +package main + +import ( + "fmt" + "os" + "runtime/debug" + + _ "example.com/version" +) + +func main() { + info, ok := debug.ReadBuildInfo() + if !ok { + panic("missing build info") + } + fmt.Fprintf(os.Stdout, "path is %s\n", info.Path) + fmt.Fprintf(os.Stdout, "main is %s %s\n", info.Main.Path, info.Main.Version) + for _, m := range info.Deps { + fmt.Fprintf(os.Stdout, "using %s %s\n", m.Path, m.Version) + } +} + +-- foo/foo_test.go -- +package main + +import ( + "fmt" + "testing" +) + +func TestFoo(t *testing.T) { + fmt.Println("foo was tested") +} diff --git a/libgo/go/cmd/go/testdata/script/mod_patterns.txt b/libgo/go/cmd/go/testdata/script/mod_patterns.txt index 539b64a2461..1b4b4380b44 100644 --- a/libgo/go/cmd/go/testdata/script/mod_patterns.txt +++ b/libgo/go/cmd/go/testdata/script/mod_patterns.txt @@ -1,4 +1,5 @@ env GO111MODULE=on +[short] skip cd m @@ -7,7 +8,6 @@ cd m # library or active modules. # # 'go list ...' should list packages in all active modules and the standard library. -# But not cmd/* - see golang.org/issue/26924. # # 'go list example.com/m/...' should list packages in all modules that begin with 'example.com/m/'. # @@ -23,17 +23,13 @@ stdout 'example.com/m/useunsafe: \[all \.\.\. example.com/m/... ./...\]' [!cgo] ! stdout example.com/m/useC stdout 'example.com/unused/useerrors: \[\.\.\.\]' # but not "all" stdout 'example.com/m/nested/useencoding: \[\.\.\. example.com/m/...\]' # but NOT "all" or "./..." -[!gccgo] stdout '^unicode: \[all \.\.\.\]' -[!gccgo] stdout '^unsafe: \[all \.\.\.\]' -[!gccgo] stdout 'index/suffixarray: \[\.\.\.\]' -! stdout cmd/pprof # golang.org/issue/26924 +stdout '^unicode: \[all \.\.\.\]' +stdout '^unsafe: \[all \.\.\.\]' +stdout 'index/suffixarray: \[\.\.\.\]' +stdout 'cmd/pprof: \[\.\.\.\]' stderr -count=1 '^go: warning: "./xyz..." matched no packages$' -env CGO_ENABLED=0 -go list -f '{{.ImportPath}}: {{.Match}}' all ... example.com/m/... ./... ./xyz... -! stdout example.com/m/useC - # 'go list ./...' should not try to resolve the main module. cd ../empty go list -deps ./... @@ -41,6 +37,12 @@ go list -deps ./... ! stderr 'finding' stderr -count=1 '^go: warning: "./..." matched no packages' +# disabling cgo should drop useC +[short] skip +env CGO_ENABLED=0 +go list -f '{{.ImportPath}}: {{.Match}}' all ... example.com/m/... ./... ./xyz... +! stdout example.com/m/useC + -- m/go.mod -- module example.com/m diff --git a/libgo/go/cmd/go/testdata/script/mod_patterns_vendor.txt b/libgo/go/cmd/go/testdata/script/mod_patterns_vendor.txt new file mode 100644 index 00000000000..b4dc401117d --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_patterns_vendor.txt @@ -0,0 +1,28 @@ +env GO111MODULE=on + +go list -mod=vendor example.com/... +stdout ^example.com/x$ +stdout ^example.com/x/y$ +! stdout ^example.com/x/vendor + +-- go.mod -- +module example.com/m + +-- vendor/modules.txt -- +# example.com/x v0.0.0 +example.com/x +# example.com/x/y v0.1.0 +example.com/x/y + +-- vendor/example.com/x/go.mod -- +module example.com/x +-- vendor/example.com/x/x.go -- +package x + +-- vendor/example.com/x/y/go.mod -- +module example.com/x/y +-- vendor/example.com/x/y/y.go -- +package y + +-- vendor/example.com/x/vendor/z/z.go -- +package z diff --git a/libgo/go/cmd/go/testdata/script/mod_proxy_https.txt b/libgo/go/cmd/go/testdata/script/mod_proxy_https.txt new file mode 100644 index 00000000000..a23090cd0ad --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_proxy_https.txt @@ -0,0 +1,19 @@ +env GO111MODULE=on + +# GOPROXY file paths must provide the "file://" prefix explicitly. +env GOPROXY=$WORK/proxydir +! go list -versions -m golang.org/x/text +stderr 'invalid proxy URL.*proxydir' + +[!net] stop + +# GOPROXY HTTPS paths may elide the "https://" prefix. +# (See golang.org/issue/32191.) +env GOPROXY=proxy.golang.org +go list -versions -m golang.org/x/text + +-- go.mod -- +module example.com +go 1.13 +-- $WORK/proxydir/README.md -- +This proxy contains no data. diff --git a/libgo/go/cmd/go/testdata/script/mod_proxy_list.txt b/libgo/go/cmd/go/testdata/script/mod_proxy_list.txt new file mode 100644 index 00000000000..a48622814a2 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_proxy_list.txt @@ -0,0 +1,29 @@ +env GO111MODULE=on +env proxy=$GOPROXY + +# Proxy that can't serve should fail. +env GOPROXY=$proxy/404 +! go get rsc.io/quote@v1.0.0 +stderr '404 Not Found' + +# get should walk down the proxy list past 404 and 410 responses. +env GOPROXY=$proxy/404,$proxy/410,$proxy +go get rsc.io/quote@v1.1.0 + +# get should not walk past other 4xx errors. +env GOPROXY=$proxy/403,$proxy +! go get rsc.io/quote@v1.2.0 +stderr 'reading.*/403/rsc.io/.*: 403 Forbidden' + +# get should not walk past non-4xx errors. +env GOPROXY=$proxy/500,$proxy +! go get rsc.io/quote@v1.3.0 +stderr 'reading.*/500/rsc.io/.*: 500 Internal Server Error' + +# get should return the final 404/410 if that's all we have. +env GOPROXY=$proxy/404,$proxy/410 +! go get rsc.io/quote@v1.4.0 +stderr 'reading.*/410/rsc.io/.*: 410 Gone' + +-- go.mod -- +module x diff --git a/libgo/go/cmd/go/testdata/script/mod_pseudo_cache.txt b/libgo/go/cmd/go/testdata/script/mod_pseudo_cache.txt new file mode 100644 index 00000000000..dd89614b9f9 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_pseudo_cache.txt @@ -0,0 +1,29 @@ +[!net] skip +[!exec:git] skip + +env GO111MODULE=on +env GOPROXY=direct +env GOSUMDB=off + +# Regression test for golang.org/issue/27171: after resolving an older +# pseudo-version of a commit, future resolution of that commit by hash should +# choose the highest appropriate pseudo-version instead of the cached one. + +go mod download -json golang.org/x/text@v0.0.0-20171215141712-a1b916ed6726 +stdout '"Version": "v0.0.0-20171215141712-a1b916ed6726",' + +# If GOPROXY is 'off', lookups should use whatever pseudo-version is available. +env GOPROXY=off +go mod download -json golang.org/x/text@a1b916ed6726 +stdout '"Version": "v0.0.0-20171215141712-a1b916ed6726",' + +# If we can re-resolve the commit to a pseudo-version, fetching the commit by +# hash should use the highest such pseudo-version appropriate to the commit. +env GOPROXY=direct +go mod download -json golang.org/x/text@a1b916ed6726 +stdout '"Version": "v0.3.1-0.20171215141712-a1b916ed6726",' + +# If GOPROXY is 'off', lookups should use the highest pseudo-version in the cache. +env GOPROXY=off +go mod download -json golang.org/x/text@a1b916ed6726 +stdout '"Version": "v0.3.1-0.20171215141712-a1b916ed6726",' diff --git a/libgo/go/cmd/go/testdata/script/mod_query.txt b/libgo/go/cmd/go/testdata/script/mod_query.txt index 4baaaa89ed9..c41f83d264c 100644 --- a/libgo/go/cmd/go/testdata/script/mod_query.txt +++ b/libgo/go/cmd/go/testdata/script/mod_query.txt @@ -3,13 +3,21 @@ env GO111MODULE=on go list -m -versions rsc.io/quote stdout '^rsc.io/quote v1.0.0 v1.1.0 v1.2.0 v1.2.1 v1.3.0 v1.4.0 v1.5.0 v1.5.1 v1.5.2 v1.5.3-pre1$' -# latest rsc.io/quote should be v1.5.2 not v1.5.3-pre1 +# Latest rsc.io/quote should be v1.5.2, not v1.5.3-pre1. go list -m rsc.io/quote@latest stdout 'rsc.io/quote v1.5.2$' +# Same for rsc.io/quote@v1 and rsc.io/quote@v1.5 (with no patch version). +go list -m rsc.io/quote@v1 +stdout 'rsc.io/quote v1.5.2$' +go list -m rsc.io/quote@v1.5 +stdout 'rsc.io/quote v1.5.2$' + +# We should fall back to prereleases if no release tags match... go list -m rsc.io/quote@>v1.5.2 stdout 'rsc.io/quote v1.5.3-pre1$' +# ...but prefer release versions when given the option. go list -m rsc.io/quote@ ./b' +stdout 'example.com/y v0.0.0-00010101000000-000000000000 => ./y' +stdout 'example.com/x/v3 v3.0.0-00010101000000-000000000000 => ./v3' +stdout 'example.com/v v1.12.0 => ./v12' + +-- go.mod -- +module example.com/m + +replace ( + example.com/a => ./a + example.com/a/b => ./b +) + +replace ( + example.com/x => ./x + example.com/x/v3 => ./v3 +) + +replace ( + example.com/y/z/w => ./w + example.com/y => ./y +) + +replace ( + example.com/v v1.11.0 => ./v11 + example.com/v v1.12.0 => ./v12 + example.com/v => ./v +) + +-- m.go -- +package main +import ( + _ "example.com/a/b" + _ "example.com/x/v3" + _ "example.com/y/z/w" + _ "example.com/v" +) +func main() {} + +-- a/go.mod -- +module a.localhost +-- a/a.go -- +package a +-- a/b/b.go-- +package b + +-- b/go.mod -- +module a.localhost/b +-- b/b.go -- +package b + +-- x/go.mod -- +module x.localhost +-- x/x.go -- +package x +-- x/v3.go -- +package v3 +import _ "x.localhost/v3" + +-- v3/go.mod -- +module x.localhost/v3 +-- v3/x.go -- +package x + +-- w/go.mod -- +module w.localhost +-- w/skip/skip.go -- +// Package skip is nested below nonexistent package w. +package skip + +-- y/go.mod -- +module y.localhost +-- y/z/w/w.go -- +package w + +-- v12/go.mod -- +module v.localhost +-- v12/v.go -- +package v + +-- v11/go.mod -- +module v.localhost +-- v11/v.go -- +package v + +-- v/go.mod -- +module v.localhost +-- v/v.go -- +package v diff --git a/libgo/go/cmd/go/testdata/script/mod_run_internal.txt b/libgo/go/cmd/go/testdata/script/mod_run_internal.txt new file mode 100644 index 00000000000..653ad282be1 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_run_internal.txt @@ -0,0 +1,46 @@ +env GO111MODULE=on + +go list -e -f '{{.Incomplete}}' runbad1.go +stdout true +! go run runbad1.go +stderr 'use of internal package m/x/internal not allowed' + +go list -e -f '{{.Incomplete}}' runbad2.go +stdout true +! go run runbad2.go +stderr 'use of internal package m/x/internal/y not allowed' + +go list -e -f '{{.Incomplete}}' runok.go +stdout false +go run runok.go + +-- go.mod -- +module m + +-- x/internal/internal.go -- +package internal + +-- x/internal/y/y.go -- +package y + +-- internal/internal.go -- +package internal + +-- internal/z/z.go -- +package z + +-- runbad1.go -- +package main +import _ "m/x/internal" +func main() {} + +-- runbad2.go -- +package main +import _ "m/x/internal/y" +func main() {} + +-- runok.go -- +package main +import _ "m/internal" +import _ "m/internal/z" +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_run_path.txt b/libgo/go/cmd/go/testdata/script/mod_run_path.txt new file mode 100644 index 00000000000..4369ee41313 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_run_path.txt @@ -0,0 +1,15 @@ +# Test that go run does not get confused by conflict +# between go.mod's module path and what you'd +# expect from GOPATH. golang.org/issue/26046. + +env GO111MODULE=on + +cd $GOPATH/src/example.com/hello +go run main.go + +-- $GOPATH/src/example.com/hello/go.mod -- +module example.com/hello/v2 + +-- $GOPATH/src/example.com/hello/main.go -- +package main +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_std_vendor.txt b/libgo/go/cmd/go/testdata/script/mod_std_vendor.txt new file mode 100644 index 00000000000..5986cff5946 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_std_vendor.txt @@ -0,0 +1,80 @@ +env GO111MODULE=on +env GOPROXY=off + +[!gc] skip + +# 'go list' should report imports from _test.go in the TestImports field. +go list -f '{{.TestImports}}' +stdout net/http # from .TestImports + +# 'go list' should find standard-vendored packages. +go list -f '{{.Dir}}' vendor/golang.org/x/net/http2/hpack +stdout $GOROOT[/\\]src[/\\]vendor + +# 'go list -test' should report vendored transitive dependencies of _test.go +# imports in the Deps field. +go list -test -f '{{range .Deps}}{{.}}{{"\n"}}{{end}}' +stdout ^vendor/golang.org/x/crypto # dep of .TestImports + + +# Modules outside the standard library should not use the packages vendored there... +cd broken +! go build -mod=readonly +stderr 'disabled by -mod=readonly' +! go build -mod=vendor +stderr 'cannot find package' +stderr 'hpack' + +# ...even if they explicitly use the "cmd/vendor/" or "vendor/" prefix. +cd ../importcmd +! go build . +stderr 'use of vendored package' + +cd ../importstd +! go build . +stderr 'use of vendored package' + + +# When run within the 'std' module, 'go list -test' should report vendored +# transitive dependencies at their original module paths. +# TODO(golang.org/issue/30241): Make that work. +# Today, they're standard packages as long as they exist. +cd $GOROOT/src +go list -test -f '{{range .Deps}}{{.}}{{"\n"}}{{end}}' net/http +stdout ^vendor/golang.org/x/net/http2/hpack # TODO: remove vendor/ prefix +! stdout ^golang.org/x/net/http2/hpack + +-- go.mod -- +module m + +-- x.go -- +package x + +-- x_test.go -- +package x +import "testing" +import _ "net/http" +func Test(t *testing.T) {} + +-- broken/go.mod -- +module broken +-- broken/http.go -- +package broken + +import ( + _ "net/http" + _ "golang.org/x/net/http2/hpack" +) + +-- importcmd/go.mod -- +module importcmd +-- importcmd/x.go -- +package importcmd + +import _ "cmd/vendor/golang.org/x/tools/go/analysis" +-- importstd/go.mod -- +module importvendor +-- importstd/x.go -- +package importstd + +import _ "vendor/golang.org/x/net/http2/hpack" diff --git a/libgo/go/cmd/go/testdata/script/mod_string_alias.txt b/libgo/go/cmd/go/testdata/script/mod_string_alias.txt new file mode 100644 index 00000000000..5c3d4287cc8 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_string_alias.txt @@ -0,0 +1,14 @@ +[short] skip + +env GO111MODULE=on + +go mod init golang.org/issue/27584 + +go build . + +-- main.go -- +package main + +type string = []int + +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_sum_replaced.txt b/libgo/go/cmd/go/testdata/script/mod_sum_replaced.txt new file mode 100644 index 00000000000..b03982d9cff --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_sum_replaced.txt @@ -0,0 +1,28 @@ +env GO111MODULE=on + +# After 'go get -d', the go.sum file should contain the sum for the module. +go get -d rsc.io/quote@v1.5.0 +grep 'rsc.io/quote v1.5.0' go.sum + +# If we replace the module and run 'go mod tidy', we should get a sum for the replacement. +go mod edit -replace rsc.io/quote@v1.5.0=rsc.io/quote@v1.5.1 +go mod tidy +grep 'rsc.io/quote v1.5.1' go.sum +cp go.sum go.sum.tidy + +# 'go mod vendor' should preserve that sum, and should not need to add any new entries. +go mod vendor +grep 'rsc.io/quote v1.5.1' go.sum +cmp go.sum go.sum.tidy + +-- go.mod -- +module golang.org/issue/27868 + +require rsc.io/quote v1.5.0 + +-- main.go -- +package main + +import _ "rsc.io/quote" + +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_sumdb.txt b/libgo/go/cmd/go/testdata/script/mod_sumdb.txt new file mode 100644 index 00000000000..8e1f3d7a7b3 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_sumdb.txt @@ -0,0 +1,33 @@ +env GO111MODULE=on +env sumdb=$GOSUMDB +env proxy=$GOPROXY +env GOPROXY GONOPROXY GOSUMDB GONOSUMDB +env dbname=localhost.localdev/sumdb + +# disagreeing with the sumdb produces security errors +# (this also populates tiles on the sumdb server). +cp go.mod.orig go.mod +env GOSUMDB=$sumdb' '$proxy/sumdb-wrong +! go get -d rsc.io/quote +stderr 'verifying rsc.io/quote@v1.5.2/go.mod: checksum mismatch' +stderr 'downloaded: h1:LzX7' +stderr 'localhost.localdev/sumdb: h1:wrong' +stderr 'SECURITY ERROR\nThis download does NOT match the one reported by the checksum server.' +! go get -d rsc.io/sampler +! go get -d golang.org/x/text +rm go.sum + +# switching to truthful sumdb detects timeline inconsistency +cp go.mod.orig go.mod +env GOSUMDB=$sumdb +! go get -d rsc.io/fortune +stderr 'SECURITY ERROR\ngo.sum database server misbehavior detected!' +stderr 'proof of misbehavior:' + +# removing the cached wrong tree head and cached tiles clears the bad data +rm $GOPATH/pkg/sumdb/$dbname/latest +go clean -modcache +go get -d rsc.io/fortune + +-- go.mod.orig -- +module m diff --git a/libgo/go/cmd/go/testdata/script/mod_sumdb_cache.txt b/libgo/go/cmd/go/testdata/script/mod_sumdb_cache.txt new file mode 100644 index 00000000000..a44a87499a3 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_sumdb_cache.txt @@ -0,0 +1,47 @@ +env GO111MODULE=on +env sumdb=$GOSUMDB +env proxy=$GOPROXY +env GOPROXY GONOPROXY GOSUMDB GONOSUMDB + +# rejected proxy fails verification +cp go.mod.orig go.mod +rm go.sum +env GOPROXY=$proxy/sumdb-503 +! go get -d rsc.io/quote +stderr 503 + +# fetch through working proxy is OK +cp go.mod.orig go.mod +rm go.sum +env GOPROXY=$proxy +go get -d rsc.io/quote + +# repeated fetch works entirely from cache, does not consult sumdb +cp go.mod.orig go.mod +rm go.sum +env GOPROXY=$proxy/sumdb-503 +go get -d rsc.io/quote +rm go.sum + +# fetch specific module can work without proxy, using cache or go.sum +cp go.mod.orig go.mod +rm go.sum +env GOPROXY=off +go get -d rsc.io/quote@v1.5.2 # using cache +rm $GOPATH/pkg/mod/download/cache/sumdb/localhost.localdev/sumdb/lookup/rsc.io/quote@v1.5.2 +go get -d rsc.io/quote@v1.5.2 # using go.sum + +# fetch fails once we lose access to both cache and go.sum +rm go.sum +env GOPROXY=$proxy/sumdb-504 +! go get -d rsc.io/quote@v1.5.2 +stderr 504 + +# but -insecure bypasses the checksum lookup entirely +go get -d -insecure rsc.io/quote@v1.5.2 + +# and then it is in go.sum again +go get -d rsc.io/quote@v1.5.2 + +-- go.mod.orig -- +module m diff --git a/libgo/go/cmd/go/testdata/script/mod_sumdb_file_path.txt b/libgo/go/cmd/go/testdata/script/mod_sumdb_file_path.txt new file mode 100644 index 00000000000..744632ec904 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_sumdb_file_path.txt @@ -0,0 +1,41 @@ +[!net] skip + +env GO111MODULE=on +env GOSUMDB= + +# With a file-based proxy with an empty checksum directory, +# downloading a new module should fail, even if a subsequent +# proxy contains a more complete mirror of the sum database. +[windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org +[!windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org +! go get -d golang.org/x/text@v0.3.2 +stderr '^verifying golang.org/x/text.*: Not Found' + +# If the proxy does not claim to support the database, +# checksum verification should fall through to the next proxy, +# and downloading should succeed. +[windows] env GOPROXY=file:///$WORK/emptyproxy,https://proxy.golang.org +[!windows] env GOPROXY=file://$WORK/emptyproxy,https://proxy.golang.org +go get -d golang.org/x/text@v0.3.2 + +# Once the checksum is present in the go.sum file, +# an empty file-based sumdb can be used in conjunction with +# a fallback module mirror. +grep golang.org/x/text go.sum +go clean -modcache +[windows] env GOPROXY=file:///$WORK/sumproxy +[!windows] env GOPROXY=file://$WORK/sumproxy +! go get -d golang.org/x/text@v0.3.2 +[windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org +[!windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org +go get -d golang.org/x/text@v0.3.2 + +-- go.mod -- +module example.com +go 1.13 +-- $WORK/emptyproxy/README.md -- +This proxy contains no modules. +-- $WORK/sumproxy/README.md -- +This proxy contains no modules. +-- $WORK/sumproxy/sumdb/sum.golang.org/supported -- +This proxy blocks checksum downloads from sum.golang.org. diff --git a/libgo/go/cmd/go/testdata/script/mod_sumdb_golang.txt b/libgo/go/cmd/go/testdata/script/mod_sumdb_golang.txt new file mode 100644 index 00000000000..964501f2ee3 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_sumdb_golang.txt @@ -0,0 +1,44 @@ +# Test default GOPROXY and GOSUMDB +env GOPROXY= +env GOSUMDB= +go env GOPROXY +stdout '^https://proxy.golang.org,direct$' +go env GOSUMDB +stdout '^sum.golang.org$' +env GOPROXY=https://proxy.golang.org +go env GOSUMDB +stdout '^sum.golang.org$' + +# download direct from github +[!net] skip +[!exec:git] skip +env GOSUMDB=sum.golang.org +env GOPROXY=direct +go get -d rsc.io/quote + +# download from proxy.golang.org with go.sum entry already +go clean -modcache +env GOSUMDB= +env GOPROXY= +go get -x -d rsc.io/quote +! stderr github +stderr proxy.golang.org/rsc.io/quote +! stderr sum.golang.org/tile +! stderr sum.golang.org/lookup/rsc.io/quote + +# download again, using checksum database to validate new go.sum lines +rm go.sum +go get -x -d rsc.io/quote +! stderr github +stderr proxy.golang.org/rsc.io/quote +stderr sum.golang.org/tile +stderr sum.golang.org/lookup/rsc.io/quote + +# test fallback to direct +env TESTGOPROXY404=1 +go get -x -d rsc.io/quote +stderr 'proxy.golang.org.*404 testing' +stderr github.com/rsc + +-- go.mod -- +module m diff --git a/libgo/go/cmd/go/testdata/script/mod_sumdb_proxy.txt b/libgo/go/cmd/go/testdata/script/mod_sumdb_proxy.txt new file mode 100644 index 00000000000..6fbf7aeb8a9 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_sumdb_proxy.txt @@ -0,0 +1,50 @@ +env GO111MODULE=on +env sumdb=$GOSUMDB +env proxy=$GOPROXY +env GOPROXY GONOPROXY GOSUMDB GONOSUMDB + +# basic fetch (through proxy) works +cp go.mod.orig go.mod +go get -d rsc.io/fortune@v1.0.0 # note: must use test proxy, does not exist in real world +rm $GOPATH/pkg/mod/download/cache/sumdb # rm sumdb cache but NOT package download cache +rm go.sum + +# can fetch by explicit URL +cp go.mod.orig go.mod +env GOSUMDB=$sumdb' '$proxy/sumdb-direct +go get -d rsc.io/fortune@v1.0.0 +rm $GOPATH/pkg/mod/download/cache/sumdb +rm go.sum + +# direct access fails (because localhost.localdev does not exist) +# The text of the error message is hard to predict because some DNS servers +# will resolve unknown domains like localhost.localdev to a real IP +# to serve ads. +cp go.mod.orig go.mod +env GOSUMDB=$sumdb +env GOPROXY=direct +! go get -d rsc.io/fortune@v1.0.0 +stderr 'verifying.*localhost.localdev' +rm $GOPATH/pkg/mod/download/cache/sumdb +rm go.sum + +# proxy 404 falls back to direct access (which fails) +cp go.mod.orig go.mod +env GOSUMDB=$sumdb +env GOPROXY=$proxy/sumdb-404 +! go get -d rsc.io/fortune@v1.0.0 +stderr 'verifying.*localhost.localdev' +rm $GOPATH/pkg/mod/download/cache/sumdb +rm go.sum + +# proxy non-200/404/410 stops direct access +cp go.mod.orig go.mod +env GOSUMDB=$sumdb +env GOPROXY=$proxy/sumdb-503 +! go get -d rsc.io/fortune@v1.0.0 +stderr '503 Service Unavailable' +rm $GOPATH/pkg/mod/download/cache/sumdb +rm go.sum + +-- go.mod.orig -- +module m diff --git a/libgo/go/cmd/go/testdata/script/mod_symlink.txt b/libgo/go/cmd/go/testdata/script/mod_symlink.txt new file mode 100644 index 00000000000..49bece2b84d --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_symlink.txt @@ -0,0 +1,42 @@ +env GO111MODULE=on +[!symlink] skip + +# 'go list' should resolve modules of imported packages. +go list -deps -f '{{.Module}}' . +stdout golang.org/x/text + +go list -deps -f '{{.Module}}' ./subpkg +stdout golang.org/x/text + +# Create a copy of the module using symlinks in src/links. +mkdir links +symlink links/go.mod -> $GOPATH/src/go.mod +symlink links/issue.go -> $GOPATH/src/issue.go +mkdir links/subpkg +symlink links/subpkg/issue.go -> $GOPATH/src/subpkg/issue.go + +# We should see the copy as a valid module root. +cd links +go env GOMOD +stdout links[/\\]go.mod +go list -m +stdout golang.org/issue/28107 + +# The symlink-based copy should contain the same packages +# and have the same dependencies as the original. +go list -deps -f '{{.Module}}' . +stdout golang.org/x/text +go list -deps -f '{{.Module}}' ./subpkg +stdout golang.org/x/text + +-- go.mod -- +module golang.org/issue/28107 + +-- issue.go -- +package issue + +import _ "golang.org/x/text/language" +-- subpkg/issue.go -- +package issue + +import _ "golang.org/x/text/language" diff --git a/libgo/go/cmd/go/testdata/script/mod_test.txt b/libgo/go/cmd/go/testdata/script/mod_test.txt index af4fd76d706..8f2da2f2a5b 100644 --- a/libgo/go/cmd/go/testdata/script/mod_test.txt +++ b/libgo/go/cmd/go/testdata/script/mod_test.txt @@ -1,4 +1,5 @@ env GO111MODULE=on +[short] skip # TODO(bcmills): Convert the 'go test' calls below to 'go list -test' once 'go # list' is more sensitive to package loading errors. @@ -6,8 +7,8 @@ env GO111MODULE=on # A test in the module's root package should work. cd a/ cp go.mod.empty go.mod -go test -stdout PASS +go list -test +! stderr error cp go.mod.empty go.mod go list -deps @@ -33,27 +34,27 @@ go list -test all stdout '^testing' cp go.mod.empty go.mod -go test -stdout PASS +go list -test +! stderr error # A test with the "_test" suffix in the module root should also work. cd ../b/ -go test -stdout PASS +go list -test +! stderr error # A test with the "_test" suffix of a *package* with a "_test" suffix should # even work (not that you should ever do that). cd ../c_test -go test -stdout PASS +go list -test +! stderr error cd ../d_test -go test -stdout PASS +go list -test +! stderr error cd ../e -go test -stdout PASS +go list -test +! stderr error -- a/go.mod.empty -- module example.com/user/a diff --git a/libgo/go/cmd/go/testdata/script/mod_test_files.txt b/libgo/go/cmd/go/testdata/script/mod_test_files.txt new file mode 100644 index 00000000000..87aecb44f67 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_test_files.txt @@ -0,0 +1,49 @@ +env GO111MODULE=on + +cd foo + +# Testing an explicit source file should use the same import visibility as the +# package in the same directory. +go list -test -deps +go list -test -deps foo_test.go + +# If the file is inside the main module's vendor directory, it should have +# visibility based on the vendor-relative import path. +mkdir vendor/example.com/foo +cp foo_test.go vendor/example.com/foo +go list -test -deps vendor/example.com/foo/foo_test.go + +# If the file is outside the main module entirely, it should be treated as outside. +cp foo_test.go ../foo_test.go +! go list -test -deps ../foo_test.go +stderr 'use of internal package' + +-- foo/go.mod -- +module example.com/foo +require example.com/internal v0.0.0 +replace example.com/internal => ../internal + +-- foo/internal.go -- +package foo +import _ "example.com/internal" + +-- foo/foo_test.go -- +package foo_test + +import ( + "testing" + "example.com/internal" +) + +func TestHacksEnabled(t *testing.T) { + if !internal.Hacks { + t.Fatal("hacks not enabled") + } +} + +-- internal/go.mod -- +module example.com/internal + +-- internal/internal.go -- +package internal +const Hacks = true diff --git a/libgo/go/cmd/go/testdata/script/mod_tidy_replace.txt b/libgo/go/cmd/go/testdata/script/mod_tidy_replace.txt new file mode 100644 index 00000000000..d5c22530944 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_tidy_replace.txt @@ -0,0 +1,111 @@ +env GO111MODULE=on +[short] skip + +# golang.org/issue/30166: 'go mod tidy' should not crash if a replaced module is +# involved in a cycle. +cd cycle +env GOTRACEBACK=off +go mod tidy +cd .. + +# From inside the module, 'go list -m all' should NOT include transitive +# requirements of modules that have been replaced. +go list -m all +stdout 'rsc.io/quote/v3 v3.0.0' +! stdout 'rsc.io/sampler' +! stdout 'golang.org/x/text' + +# From outside the module, 'go list -m all' should include them. +cd outside +go list -m all +stdout 'rsc.io/quote/v3 v3.0.0' +stdout 'rsc.io/sampler v1.3.0' +stdout 'golang.org/x/text' +cd .. + +# 'go list all' should add indirect requirements to satisfy the packages +# imported from replacement modules. +! grep 'rsc.io/sampler' go.mod +! grep 'golang.org/x/text' go.mod +go list all +grep 'rsc.io/sampler' go.mod +grep 'golang.org/x/text' go.mod + +# 'go get' and 'go mod tidy' should follow the requirements of the replacements, +# not the originals, even if that results in a set of versions that are +# misleading or redundant without those replacements. +go get rsc.io/sampler@v1.2.0 +go mod tidy +go list -m all +stdout 'rsc.io/quote/v3 v3.0.0' +stdout 'rsc.io/sampler v1.2.0' +stdout 'golang.org/x/text' + +# The requirements seen from outside may be higher (or lower) +# than those seen from within the module. +grep 'rsc.io/sampler v1.2.0' go.mod +cd outside +go list -m all +stdout 'rsc.io/sampler v1.3.0' + +-- go.mod -- +module example.com/tidy + +require rsc.io/quote/v3 v3.0.0 +replace rsc.io/quote/v3 => ./not-rsc.io/quote/v3 + +-- imports.go -- +package tidy + +import _ "rsc.io/quote/v3" + +-- outside/go.mod -- +module example.com/tidy/outside + +require example.com/tidy v0.0.0 +replace example.com/tidy => ./.. + +-- not-rsc.io/quote/v3/go.mod -- +module not-rsc.io/quote/v3 + +// No requirements specified! + +-- not-rsc.io/quote/v3/quote.go -- +package quote + +import ( + _ "rsc.io/sampler" + _ "golang.org/x/text/language" +) + +-- cycle/go.mod -- +module golang.org/issue/30166 + +require ( + golang.org/issue/30166/a v0.0.0 + golang.org/issue/30166/b v0.0.0 +) + +replace ( + golang.org/issue/30166/a => ./a + golang.org/issue/30166/b => ./b +) +-- cycle/cycle.go -- +package cycle + +import ( + _ "golang.org/issue/30166/a" + _ "golang.org/issue/30166/b" +) +-- cycle/a/a.go -- +package a +-- cycle/a/go.mod -- +module golang.org/issue/30166/a + +require golang.org/issue/30166/b v0.0.0 +-- cycle/b/b.go -- +package b +-- cycle/b/go.mod -- +module golang.org/issue/30166/b + +require golang.org/issue/30166/a v0.0.0 diff --git a/libgo/go/cmd/go/testdata/script/mod_tidy_sum.txt b/libgo/go/cmd/go/testdata/script/mod_tidy_sum.txt index 5a15818543e..c583f560586 100644 --- a/libgo/go/cmd/go/testdata/script/mod_tidy_sum.txt +++ b/libgo/go/cmd/go/testdata/script/mod_tidy_sum.txt @@ -1,12 +1,12 @@ env GO111MODULE=on # go.sum should list directly used modules and dependencies -go get rsc.io/quote@v1.5.2 +go get -d rsc.io/quote@v1.5.2 go mod tidy grep rsc.io/sampler go.sum # go.sum should not normally lose old entries -go get rsc.io/quote@v1.0.0 +go get -d rsc.io/quote@v1.0.0 grep 'rsc.io/quote v1.0.0' go.sum grep 'rsc.io/quote v1.5.2' go.sum grep rsc.io/sampler go.sum diff --git a/libgo/go/cmd/go/testdata/script/mod_upgrade_patch.txt b/libgo/go/cmd/go/testdata/script/mod_upgrade_patch.txt index 3c27cdbf7bb..3939e54c1bf 100644 --- a/libgo/go/cmd/go/testdata/script/mod_upgrade_patch.txt +++ b/libgo/go/cmd/go/testdata/script/mod_upgrade_patch.txt @@ -1,29 +1,94 @@ env GO111MODULE=on +[short] skip +# Initially, we are at v1.0.0 for all dependencies. +cp go.mod go.mod.orig go list -m all -stdout '^rsc.io/quote v1.4.0' -stdout '^rsc.io/sampler v1.0.0' +stdout '^patch.example.com/direct v1.0.0' +stdout '^patch.example.com/indirect v1.0.0' +! stdout '^patch.example.com/depofdirectpatch' -# get -u=patch rsc.io/quote should take latest quote & patch update its deps -go get -m -u=patch rsc.io/quote +# get -u=patch, with no arguments, should patch-update all dependencies +# of the package in the current directory, pulling in transitive dependencies +# and also patching those. +cp go.mod.orig go.mod +go get -d -u=patch go list -m all -stdout '^rsc.io/quote v1.5.2' -stdout '^rsc.io/sampler v1.3.1' -stdout '^golang.org/x/text v0.0.0-' +stdout '^patch.example.com/direct v1.0.1' +stdout '^patch.example.com/indirect v1.0.1' +stdout '^patch.example.com/depofdirectpatch v1.0.0' -# get -u=patch quote@v1.2.0 should take that version of quote & patch update its deps -go get -m -u=patch rsc.io/quote@v1.2.0 +# 'get all@patch' should be equivalent to 'get -u=patch all' +cp go.mod.orig go.mod +go get -d all@patch go list -m all -stdout '^rsc.io/quote v1.2.0' -stdout '^rsc.io/sampler v1.3.1' -stdout '^golang.org/x/text v0.0.0-' +stdout '^patch.example.com/direct v1.0.1' +stdout '^patch.example.com/indirect v1.0.1' +stdout '^patch.example.com/depofdirectpatch v1.0.0' -# get -u=patch with no args applies to all deps -go get -m -u=patch +# Requesting the direct dependency with -u=patch but without an explicit version +# should patch-update it and its dependencies. +cp go.mod.orig go.mod +go get -d -u=patch patch.example.com/direct go list -m all -stdout '^rsc.io/quote v1.2.1' +stdout '^patch.example.com/direct v1.0.1' +stdout '^patch.example.com/indirect v1.0.1' +stdout '^patch.example.com/depofdirectpatch v1.0.0' + +# Requesting only the indirect dependency should not update the direct one. +cp go.mod.orig go.mod +go get -d -u=patch patch.example.com/indirect +go list -m all +stdout '^patch.example.com/direct v1.0.0' +stdout '^patch.example.com/indirect v1.0.1' +! stdout '^patch.example.com/depofdirectpatch' + +# @patch should apply only to the specific module, +# but the result must reflect its upgraded requirements. +cp go.mod.orig go.mod +go get -d patch.example.com/direct@patch +go list -m all +stdout '^patch.example.com/direct v1.0.1' +stdout '^patch.example.com/indirect v1.0.0' +stdout '^patch.example.com/depofdirectpatch v1.0.0' + +# An explicit @patch should override a general -u. +cp go.mod.orig go.mod +go get -d -u patch.example.com/direct@patch +go list -m all +stdout '^patch.example.com/direct v1.0.1' +stdout '^patch.example.com/indirect v1.1.0' +stdout '^patch.example.com/depofdirectpatch v1.0.0' + +# An explicit @latest should override a general -u=patch. +cp go.mod.orig go.mod +go get -d -u=patch patch.example.com/direct@latest +go list -m all +stdout '^patch.example.com/direct v1.1.0' +stdout '^patch.example.com/indirect v1.0.1' +! stdout '^patch.example.com/depofdirectpatch' + +# Standard-library packages cannot be upgraded explicitly. +cp go.mod.orig go.mod +! go get cmd/vet@patch +stderr 'cannot use pattern .* with explicit version' + +# However, standard-library packages without explicit versions are fine. +go get -d -u=patch -d cmd/go + +# We can upgrade to a new version of a module with no root package. +go get -d example.com/noroot@v1.0.0 +go list -m all +stdout '^example.com/noroot v1.0.0$' +go get -d example.com/noroot@patch +go list -m all +stdout '^example.com/noroot v1.0.1$' -- go.mod -- module x -require rsc.io/quote v1.4.0 +require patch.example.com/direct v1.0.0 + +-- main.go -- +package x +import _ "patch.example.com/direct" diff --git a/libgo/go/cmd/go/testdata/script/mod_vcs_missing.txt b/libgo/go/cmd/go/testdata/script/mod_vcs_missing.txt new file mode 100644 index 00000000000..a755935b53e --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_vcs_missing.txt @@ -0,0 +1,28 @@ +[exec:bzr] skip 'tests NOT having bzr' +[!net] skip + +env GO111MODULE=on +env GOPROXY=direct + +cd empty +! go list launchpad.net/gocheck +stderr '"bzr": executable file not found' +cd .. + +# 1.11 used to give the cryptic error "cannot find module for path" here, but +# only for a main package. +cd main +! go build +stderr '"bzr": executable file not found' +cd .. + +-- empty/go.mod -- +module m +-- main/go.mod -- +module m +-- main/main.go -- +package main + +import _ "launchpad.net/gocheck" + +func main() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_vendor.txt b/libgo/go/cmd/go/testdata/script/mod_vendor.txt index 203183be881..eae4f2946ce 100644 --- a/libgo/go/cmd/go/testdata/script/mod_vendor.txt +++ b/libgo/go/cmd/go/testdata/script/mod_vendor.txt @@ -18,6 +18,7 @@ stderr '^y' stderr '^# z v1.0.0 => ./z' stderr '^z' ! stderr '^w' +grep 'a/foo/bar/b\na/foo/bar/c' vendor/modules.txt # must be sorted go list -f {{.Dir}} x stdout 'src[\\/]x' @@ -38,6 +39,7 @@ stdout 'src[\\/]w' stderr 'src[\\/]vendor[\\/]w' ! exists vendor/x/testdata +! exists vendor/a/foo/bar/b/ignored.go ! exists vendor/a/foo/bar/b/main_test.go exists vendor/a/foo/AUTHORS.txt @@ -102,6 +104,14 @@ replace ( -- a/foo/bar/b/main.go -- package b +-- a/foo/bar/b/ignored.go -- +// This file is intended for use with "go run"; it isn't really part of the package. + +// +build ignore + +package main + +func main() {} -- a/foo/bar/b/main_test.go -- package b @@ -117,6 +127,7 @@ func TestDir(t *testing.T) { } -- a/foo/bar/c/main.go -- package c +import _ "a/foo/bar/b" -- a/foo/bar/c/main_test.go -- package c @@ -181,7 +192,6 @@ import _ "a" -- testdata2.go -- package m -import _ "a/foo/bar/b" import _ "a/foo/bar/c" -- v1.go -- package m diff --git a/libgo/go/cmd/go/testdata/script/mod_vendor_build.txt b/libgo/go/cmd/go/testdata/script/mod_vendor_build.txt index 7b304dbb707..24920a36b66 100644 --- a/libgo/go/cmd/go/testdata/script/mod_vendor_build.txt +++ b/libgo/go/cmd/go/testdata/script/mod_vendor_build.txt @@ -1,4 +1,5 @@ env GO111MODULE=on +[short] skip # initial conditions: using sampler v1.3.0, not listed in go.mod. go list -deps @@ -19,6 +20,16 @@ cmp go.mod go.mod.good go list -mod=vendor cmp go.mod go.mod.good +# With a clean (and empty) module cache, 'go list -mod=vendor' should not download modules. +go clean -modcache +env GOPROXY=off +! go list ... +go list -mod=vendor ... + +# However, it should still list packages in the main module. +go list -mod=vendor m/... +stdout m + -- go.mod -- module m diff --git a/libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt b/libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt new file mode 100644 index 00000000000..6bc1c77ed3d --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_vendor_replace.txt @@ -0,0 +1,39 @@ +env GO111MODULE=on + +# Before vendoring, we expect to see the original directory. +go list -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3 +stdout 'v3.0.0' +stdout '.*[/\\]not-rsc.io[/\\]quote[/\\]v3' + +# Since all dependencies are replaced, 'go mod vendor' should not +# have to download anything from the network. +go mod vendor +! stderr 'downloading' +! stderr 'finding' + +# After vendoring, we expect to see the replacement in the vendor directory, +# without attempting to look up the non-replaced version. +cmp vendor/rsc.io/quote/v3/quote.go local/not-rsc.io/quote/v3/quote.go + +go list -mod=vendor -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3 +stdout 'v3.0.0' +stdout '.*[/\\]vendor[/\\]rsc.io[/\\]quote[/\\]v3' +! stderr 'finding' +! stderr 'lookup disabled' + +-- go.mod -- +module example.com/replace + +require rsc.io/quote/v3 v3.0.0 +replace rsc.io/quote/v3 => ./local/not-rsc.io/quote/v3 + +-- imports.go -- +package replace + +import _ "rsc.io/quote/v3" + +-- local/not-rsc.io/quote/v3/go.mod -- +module not-rsc.io/quote/v3 + +-- local/not-rsc.io/quote/v3/quote.go -- +package quote diff --git a/libgo/go/cmd/go/testdata/script/mod_verify.txt b/libgo/go/cmd/go/testdata/script/mod_verify.txt index 50c9b4a4375..646bc62bb70 100644 --- a/libgo/go/cmd/go/testdata/script/mod_verify.txt +++ b/libgo/go/cmd/go/testdata/script/mod_verify.txt @@ -1,4 +1,5 @@ env GO111MODULE=on +[short] skip # With good go.sum, verify succeeds by avoiding download. cp go.sum.good go.sum diff --git a/libgo/go/cmd/go/testdata/script/mod_why.txt b/libgo/go/cmd/go/testdata/script/mod_why.txt index 4d556fc73ff..10a4f9fbea7 100644 --- a/libgo/go/cmd/go/testdata/script/mod_why.txt +++ b/libgo/go/cmd/go/testdata/script/mod_why.txt @@ -1,4 +1,5 @@ env GO111MODULE=on +[short] skip go list -test all stdout rsc.io/quote diff --git a/libgo/go/cmd/go/testdata/script/pattern_syntax_error.txt b/libgo/go/cmd/go/testdata/script/pattern_syntax_error.txt index 8e6549b5c54..9a1f5e52f07 100644 --- a/libgo/go/cmd/go/testdata/script/pattern_syntax_error.txt +++ b/libgo/go/cmd/go/testdata/script/pattern_syntax_error.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # patterns match directories with syntax errors ! go list ./... ! go build ./... diff --git a/libgo/go/cmd/go/testdata/script/prevent_sys_unix_import.txt b/libgo/go/cmd/go/testdata/script/prevent_sys_unix_import.txt new file mode 100644 index 00000000000..ea1ad78d71d --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/prevent_sys_unix_import.txt @@ -0,0 +1,6 @@ +# Policy decision: we shouldn't vendor golang.org/x/sys/unix in std +# See https://golang.org/issue/32102 + +env GO111MODULE=on +go list std +! stdout vendor/golang.org/x/sys/unix diff --git a/libgo/go/cmd/go/testdata/script/run_hello.txt b/libgo/go/cmd/go/testdata/script/run_hello.txt index 8c4c1c16833..939b661e58f 100644 --- a/libgo/go/cmd/go/testdata/script/run_hello.txt +++ b/libgo/go/cmd/go/testdata/script/run_hello.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # hello world go run hello.go stderr 'hello world' diff --git a/libgo/go/cmd/go/testdata/script/run_set_executable_name.txt b/libgo/go/cmd/go/testdata/script/run_set_executable_name.txt new file mode 100644 index 00000000000..54ddee9ae1f --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/run_set_executable_name.txt @@ -0,0 +1,50 @@ +env GO111MODULE=on +[short] skip + +# Check for correct naming of temporary executable + +#Test for single file specified +cd x/y/z +go run foo.go +stderr 'foo' + +#Test for current directory +go run . +stderr 'z' + +#Test for set path +go run m/x/y/z/ +stderr 'z' + +-- m/x/y/z/foo.go -- +package main +import( + "os" + "path/filepath" +) +func main() { + println(filepath.Base(os.Args[0])) +} + +-- x/y/z/foo.go -- +package main +import( + "os" + "path/filepath" +) +func main() { + println(filepath.Base(os.Args[0])) +} + +-- x/y/z/foo.go -- +package main +import( + "os" + "path/filepath" +) +func main() { + println(filepath.Base(os.Args[0])) +} + +-- go.mod -- +module m \ No newline at end of file diff --git a/libgo/go/cmd/go/testdata/script/run_wildcard.txt b/libgo/go/cmd/go/testdata/script/run_wildcard.txt new file mode 100644 index 00000000000..72036d1d8db --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/run_wildcard.txt @@ -0,0 +1,7 @@ +env GO111MODULE=off + +# Fix for https://github.com/golang/go/issues/28696: +# go run x/... should not panic when directory x doesn't exist. + +! go run nonexistent/... +stderr '^go run: no packages loaded from nonexistent/...$' diff --git a/libgo/go/cmd/go/testdata/script/script_wait.txt b/libgo/go/cmd/go/testdata/script/script_wait.txt new file mode 100644 index 00000000000..3cd4ded9dd1 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/script_wait.txt @@ -0,0 +1,24 @@ +env GO111MODULE=off + +[!exec:echo] skip +[!exec:false] skip + +exec echo foo +stdout foo + +exec echo foo & +exec echo bar & +! exec false & + +# Starting a background process should clear previous output. +! stdout foo + +# Wait should set the output to the concatenated outputs of the background +# programs, in the order in which they were started. +wait +stdout 'foo\nbar' + +# The end of the test should interrupt or kill any remaining background +# programs. +[!exec:sleep] skip +! exec sleep 86400 & diff --git a/libgo/go/cmd/go/testdata/script/std_vendor.txt b/libgo/go/cmd/go/testdata/script/std_vendor.txt new file mode 100644 index 00000000000..6cb015fc077 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/std_vendor.txt @@ -0,0 +1,43 @@ +env GO111MODULE=off + +[!gc] skip + +# 'go list' should report imports from _test.go in the TestImports field. +go list -f '{{.TestImports}}' +stdout net/http # from .TestImports + +# 'go list' should report standard-vendored packages by path. +go list -f '{{.Dir}}' vendor/golang.org/x/net/http2/hpack +stdout $GOROOT[/\\]src[/\\]vendor + +# 'go list -test' should report vendored transitive dependencies of _test.go +# imports in the Deps field, with a 'vendor' prefix on their import paths. +go list -test -f '{{.Deps}}' +stdout golang.org/x/crypto # dep of .TestImports + +# Packages outside the standard library should not use its copy of vendored packages. +cd broken +! go build +stderr 'cannot find package' + +-- go.mod -- +module m + +-- x.go -- +package x + +-- x_test.go -- +package x +import "testing" +import _ "net/http" +func Test(t *testing.T) {} + +-- broken/go.mod -- +module broken +-- broken/http.go -- +package broken + +import ( + _ "net/http" + _ "golang.org/x/net/http/httpproxy" +) diff --git a/libgo/go/cmd/go/testdata/script/sum_readonly.txt b/libgo/go/cmd/go/testdata/script/sum_readonly.txt new file mode 100644 index 00000000000..8aa61166acf --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/sum_readonly.txt @@ -0,0 +1,29 @@ +# Test that go.sum does not get updated when -mod=readonly flag is set +env GO111MODULE=on + +go get -d rsc.io/quote +go mod tidy + +# go.sum != dirty; -mod=readonly +go list -mod=readonly + +# dirty up go.sum by removing it. +rm go.sum + +# go.sum == dirty; -mod=readonly +! go list -mod=readonly + +stderr 'go: updates to go.sum needed, disabled by -mod=readonly' + +-- go.mod -- +module m + +-- main.go -- + +package main + +import "rsc.io/quote" + +func main() { + println(quote.Hello()) +} \ No newline at end of file diff --git a/libgo/go/cmd/go/testdata/script/test_badtest.txt b/libgo/go/cmd/go/testdata/script/test_badtest.txt index 42fcfed2fcc..f5db6941a0d 100644 --- a/libgo/go/cmd/go/testdata/script/test_badtest.txt +++ b/libgo/go/cmd/go/testdata/script/test_badtest.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + ! go test badtest/... ! stdout ^ok stdout ^FAIL\tbadtest/badexec diff --git a/libgo/go/cmd/go/testdata/script/test_compile_binary.txt b/libgo/go/cmd/go/testdata/script/test_compile_binary.txt index 6c01bc5729e..6562f2453ff 100644 --- a/libgo/go/cmd/go/testdata/script/test_compile_binary.txt +++ b/libgo/go/cmd/go/testdata/script/test_compile_binary.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + ! go test -c compile_binary/... stderr 'build comment' diff --git a/libgo/go/cmd/go/testdata/script/test_devnull.txt b/libgo/go/cmd/go/testdata/script/test_devnull.txt new file mode 100644 index 00000000000..33071679a29 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/test_devnull.txt @@ -0,0 +1,15 @@ +env GO111MODULE=off + +# go test -c -o NUL +# should work (see golang.org/issue/28035). +cd x +go test -o=$devnull -c +! exists x.test$GOEXE + +-- x/x_test.go -- +package x_test +import ( + "testing" +) +func TestNUL(t *testing.T) { +} diff --git a/libgo/go/cmd/go/testdata/script/test_generated_main.txt b/libgo/go/cmd/go/testdata/script/test_generated_main.txt new file mode 100644 index 00000000000..75ffa9cde2c --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/test_generated_main.txt @@ -0,0 +1,35 @@ +# Tests that the generated test main file has a generated code comment. +# This is needed by analyzers that access source files through 'go list'. +# Verifies golang.org/issue/31971. +# TODO(jayconrod): This test is brittle. We should write _testmain.go as +# a build action instead of with an ad-hoc WriteFile call +# in internal/test/test.go. Then we could just grep 'go get -n'. +go test x_test.go + +-- x_test.go -- +package x + +import ( + "os" + "path/filepath" + "io/ioutil" + "regexp" + "testing" +) + +func Test(t *testing.T) { + exePath, err := os.Executable() + if err != nil { + t.Fatal(err) + } + testmainPath := filepath.Join(filepath.Dir(exePath), "_testmain.go") + source, err := ioutil.ReadFile(testmainPath) + if err != nil { + t.Fatal(err) + } + if matched, err := regexp.Match(`(?m)^// Code generated .* DO NOT EDIT\.$`, source); err != nil { + t.Fatal(err) + } else if !matched { + t.Error("_testmain.go does not have generated code comment") + } +} diff --git a/libgo/go/cmd/go/testdata/script/test_init.txt b/libgo/go/cmd/go/testdata/script/test_init.txt new file mode 100644 index 00000000000..73b4f3c7686 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/test_init.txt @@ -0,0 +1,86 @@ +# Tests for automatic testing.Init calls when using 'go test'. + +env GO111MODULE=on + +# A TestMain should be able to access testing flags if it calls flag.Parse +# without needing to use testing.Init. +# Test code can use the name 'testing' without colliding with generated +# testinginit code. +# Tests running under 'go test' should observe that testing.Init is called +# before any user package initialization code runs. +go test +stdout TestMain +stdout TestInit +stdout TestExt + +-- go.mod -- +module m + +-- init_test.go -- +package testinitflag + +import ( + "flag" + "fmt" + "os" + Testing "testing" +) + +func testFlagsInitialized() bool { + found := false + flag.VisitAll(func(f *flag.Flag) { + if f.Name == "test.count" { + found = true + } + }) + return found +} + +var testing int +var testingInitAtInitialization = testFlagsInitialized() + +func TestInit(t *Testing.T) { + if !testingInitAtInitialization { + t.Fatal("testing.Init not called before package initialization") + } + fmt.Printf("TestInit\n") +} + +func TestMain(m *Testing.M) { + fmt.Printf("TestMain\n") + flag.Parse() + if !testFlagsInitialized() { + fmt.Println("testing flags not registered") + os.Exit(1) + } + os.Exit(m.Run()) +} + +-- external_test.go -- +package testinitflag_test + +import ( + "flag" + "fmt" + Testing "testing" +) + +func testFlagsInitialized() bool { + found := false + flag.VisitAll(func(f *flag.Flag) { + if f.Name == "test.count" { + found = true + } + }) + return found +} + +var testing int +var testingInitAtInitialization = testFlagsInitialized() + +func TestExt(t *Testing.T) { + fmt.Printf("TestExt\n") + if !testingInitAtInitialization { + t.Fatal("testing.Init not called before package initialization") + } +} diff --git a/libgo/go/cmd/go/testdata/script/test_status.txt b/libgo/go/cmd/go/testdata/script/test_status.txt new file mode 100644 index 00000000000..aa6ad3c50da --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/test_status.txt @@ -0,0 +1,18 @@ +env GO111MODULE=off + +! go test x y +stdout ^FAIL\s+x +stdout ^ok\s+y +stdout (?-m)FAIL\n$ + +-- x/x_test.go -- +package x + +import "testing" + +func TestNothingJustFail(t *testing.T) { + t.Fail() +} + +-- y/y_test.go -- +package y diff --git a/libgo/go/cmd/go/testdata/script/test_timeout.txt b/libgo/go/cmd/go/testdata/script/test_timeout.txt new file mode 100644 index 00000000000..8dead0a439a --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/test_timeout.txt @@ -0,0 +1,22 @@ +[short] skip +env GO111MODULE=off +cd a + +# No timeout is passed via 'go test' command. +go test -v +stdout '10m0s' + +# Timeout is passed via 'go test' command. +go test -v -timeout 30m +stdout '30m0s' + +-- a/timeout_test.go -- +package t +import ( + "flag" + "fmt" + "testing" +) +func TestTimeout(t *testing.T) { + fmt.Println(flag.Lookup("test.timeout").Value.String()) +} \ No newline at end of file diff --git a/libgo/go/cmd/go/testdata/script/vendor_complex.txt b/libgo/go/cmd/go/testdata/script/vendor_complex.txt index 6513451df85..9ca94e72c52 100644 --- a/libgo/go/cmd/go/testdata/script/vendor_complex.txt +++ b/libgo/go/cmd/go/testdata/script/vendor_complex.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # smoke test for complex build configuration go build -o complex.exe complex [exec:gccgo] go build -compiler=gccgo -o complex.exe complex diff --git a/libgo/go/cmd/go/testdata/script/version.txt b/libgo/go/cmd/go/testdata/script/version.txt new file mode 100644 index 00000000000..cb4881f7a72 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/version.txt @@ -0,0 +1,12 @@ +env GO111MODULE=on +[short] skip + +go build -o fortune.exe rsc.io/fortune +go version fortune.exe +stdout '^fortune.exe: .+' +go version -m fortune.exe +stdout '^\tpath\trsc.io/fortune' +stdout '^\tmod\trsc.io/fortune\tv1.0.0' + +-- go.mod -- +module m diff --git a/libgo/go/cmd/go/testdata/script/vet_asm.txt b/libgo/go/cmd/go/testdata/script/vet_asm.txt new file mode 100644 index 00000000000..59b35ec7c28 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/vet_asm.txt @@ -0,0 +1,32 @@ +env GO111MODULE=off + +# Issue 27665. Verify that "go vet" analyzes non-Go files. + +[!amd64] skip +! go vet -asmdecl a +stderr 'f: invalid MOVW of x' + +# -c flag shows context +! go vet -c=2 -asmdecl a +stderr '...invalid MOVW...' +stderr '1 .*TEXT' +stderr '2 MOVW' +stderr '3 RET' +stderr '4' + +# -json causes success, even with diagnostics and errors. +go vet -json -asmdecl a +stderr '"a": {' +stderr '"asmdecl":' +stderr '"posn": ".*asm.s:2:1",' +stderr '"message": ".*invalid MOVW.*"' + +-- a/a.go -- +package a + +func f(x int8) + +-- a/asm.s -- +TEXT ·f(SB),0,$0-1 + MOVW x+0(FP), AX + RET diff --git a/libgo/go/cmd/go/testdata/script/vet_deps.txt b/libgo/go/cmd/go/testdata/script/vet_deps.txt new file mode 100644 index 00000000000..b2a8f168b30 --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/vet_deps.txt @@ -0,0 +1,34 @@ +env GO111MODULE=off + +# Issue 30296. Verify that "go vet" uses only immediate dependencies. + +# First run fills the cache. +go vet a + +go vet -x a +! stderr 'transitive' + +-- a/a.go -- +package a + +import "b" + +func F() { + b.F() +} + +-- b/b.go -- +package b + +import "transitive" + +func F() { + transitive.F() +} + +-- transitive/c.go -- +package transitive + +func F() { +} + diff --git a/libgo/go/cmd/go/testdata/testcover/pkg4/a.go b/libgo/go/cmd/go/testdata/testcover/pkg4/a.go new file mode 100644 index 00000000000..cf09e6f1b0e --- /dev/null +++ b/libgo/go/cmd/go/testdata/testcover/pkg4/a.go @@ -0,0 +1,5 @@ +package pkg4 + +type T struct { + X bool +} diff --git a/libgo/go/cmd/go/testdata/testcover/pkg4/a_test.go b/libgo/go/cmd/go/testdata/testcover/pkg4/a_test.go new file mode 100644 index 00000000000..12b8685294d --- /dev/null +++ b/libgo/go/cmd/go/testdata/testcover/pkg4/a_test.go @@ -0,0 +1,9 @@ +package pkg4 + +import ( + "testing" +) + +func TestT(t *testing.T) { + _ = T{} +} diff --git a/libgo/go/cmd/go/testdata/vendormod.txt b/libgo/go/cmd/go/testdata/vendormod.txt index cd009db5cf0..1bdaf2abb05 100644 --- a/libgo/go/cmd/go/testdata/vendormod.txt +++ b/libgo/go/cmd/go/testdata/vendormod.txt @@ -46,7 +46,7 @@ func TestDir(t *testing.T) { } -- a/foo/bar/c/testdata/1 -- -- a/foo/bar/testdata/1 -- --- a/gcc/go/gofrontend.mod -- +-- a/go.mod -- module a -- a/main.go -- package a diff --git a/libgo/go/cmd/go/vendor_test.go b/libgo/go/cmd/go/vendor_test.go index c302d7e9b58..8b67de06ca6 100644 --- a/libgo/go/cmd/go/vendor_test.go +++ b/libgo/go/cmd/go/vendor_test.go @@ -181,6 +181,7 @@ func TestVendorGet(t *testing.T) { func TestVendorGetUpdate(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -192,6 +193,7 @@ func TestVendorGetUpdate(t *testing.T) { func TestVendorGetU(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -202,6 +204,7 @@ func TestVendorGetU(t *testing.T) { func TestVendorGetTU(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -212,6 +215,7 @@ func TestVendorGetTU(t *testing.T) { func TestVendorGetBadVendor(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") for _, suffix := range []string{"bad/imp", "bad/imp2", "bad/imp3", "..."} { t.Run(suffix, func(t *testing.T) { @@ -228,6 +232,7 @@ func TestVendorGetBadVendor(t *testing.T) { func TestGetSubmodules(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -248,6 +253,7 @@ func TestVendorCache(t *testing.T) { func TestVendorTest2(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -273,6 +279,7 @@ func TestVendorTest2(t *testing.T) { func TestVendorTest3(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -299,6 +306,7 @@ func TestVendorTest3(t *testing.T) { func TestVendorList(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() @@ -349,6 +357,7 @@ func TestLegacyMod(t *testing.T) { func TestLegacyModGet(t *testing.T) { testenv.MustHaveExternalNetwork(t) + testenv.MustHaveExecPath(t, "git") tg := testgo(t) defer tg.cleanup() diff --git a/libgo/go/cmd/gofmt/gofmt.go b/libgo/go/cmd/gofmt/gofmt.go index ac6852f2e4e..d7a77a96823 100644 --- a/libgo/go/cmd/gofmt/gofmt.go +++ b/libgo/go/cmd/gofmt/gofmt.go @@ -112,6 +112,8 @@ func processFile(filename string, in io.Reader, out io.Writer, stdin bool) error simplify(file) } + ast.Inspect(file, normalizeNumbers) + res, err := format(fileSet, file, sourceAdj, indentAdj, src, printer.Config{Mode: printerMode, Tabwidth: tabWidth}) if err != nil { return err @@ -326,3 +328,56 @@ func backupFile(filename string, data []byte, perm os.FileMode) (string, error) return bakname, err } + +// normalizeNumbers rewrites base prefixes and exponents to +// use lower-case letters, and removes leading 0's from +// integer imaginary literals. It leaves hexadecimal digits +// alone. +func normalizeNumbers(n ast.Node) bool { + lit, _ := n.(*ast.BasicLit) + if lit == nil || (lit.Kind != token.INT && lit.Kind != token.FLOAT && lit.Kind != token.IMAG) { + return true + } + if len(lit.Value) < 2 { + return false // only one digit (common case) - nothing to do + } + // len(lit.Value) >= 2 + + // We ignore lit.Kind because for lit.Kind == token.IMAG the literal may be an integer + // or floating-point value, decimal or not. Instead, just consider the literal pattern. + x := lit.Value + switch x[:2] { + default: + // 0-prefix octal, decimal int, or float (possibly with 'i' suffix) + if i := strings.LastIndexByte(x, 'E'); i >= 0 { + x = x[:i] + "e" + x[i+1:] + break + } + // remove leading 0's from integer (but not floating-point) imaginary literals + if x[len(x)-1] == 'i' && strings.IndexByte(x, '.') < 0 && strings.IndexByte(x, 'e') < 0 { + x = strings.TrimLeft(x, "0_") + if x == "i" { + x = "0i" + } + } + case "0X": + x = "0x" + x[2:] + fallthrough + case "0x": + // possibly a hexadecimal float + if i := strings.LastIndexByte(x, 'P'); i >= 0 { + x = x[:i] + "p" + x[i+1:] + } + case "0O": + x = "0o" + x[2:] + case "0o": + // nothing to do + case "0B": + x = "0b" + x[2:] + case "0b": + // nothing to do + } + + lit.Value = x + return false +} diff --git a/libgo/go/cmd/internal/objabi/funcdata.go b/libgo/go/cmd/internal/objabi/funcdata.go index 231d11b1857..addbd2ac88b 100644 --- a/libgo/go/cmd/internal/objabi/funcdata.go +++ b/libgo/go/cmd/internal/objabi/funcdata.go @@ -11,14 +11,15 @@ package objabi // ../../../runtime/symtab.go. const ( - PCDATA_StackMapIndex = 0 - PCDATA_InlTreeIndex = 1 - PCDATA_RegMapIndex = 2 + PCDATA_RegMapIndex = 0 + PCDATA_StackMapIndex = 1 + PCDATA_InlTreeIndex = 2 + FUNCDATA_ArgsPointerMaps = 0 FUNCDATA_LocalsPointerMaps = 1 - FUNCDATA_InlTree = 2 - FUNCDATA_RegPointerMaps = 3 - FUNCDATA_StackObjects = 4 + FUNCDATA_RegPointerMaps = 2 + FUNCDATA_StackObjects = 3 + FUNCDATA_InlTree = 4 // ArgsSizeUnknown is set in Func.argsize to mark all functions // whose argument size is unknown (C vararg functions, and diff --git a/libgo/go/cmd/internal/objabi/head.go b/libgo/go/cmd/internal/objabi/head.go index db2221d6b14..0a542282284 100644 --- a/libgo/go/cmd/internal/objabi/head.go +++ b/libgo/go/cmd/internal/objabi/head.go @@ -73,7 +73,7 @@ func (h *HeadType) Set(s string) error { *h = Hopenbsd case "plan9": *h = Hplan9 - case "solaris": + case "illumos", "solaris": *h = Hsolaris case "windows": *h = Hwindows diff --git a/libgo/go/cmd/internal/objabi/line.go b/libgo/go/cmd/internal/objabi/line.go index 1c671b211f8..178c8363d95 100644 --- a/libgo/go/cmd/internal/objabi/line.go +++ b/libgo/go/cmd/internal/objabi/line.go @@ -7,6 +7,7 @@ package objabi import ( "os" "path/filepath" + "strings" ) // WorkingDir returns the current working directory @@ -21,32 +22,63 @@ func WorkingDir() string { return filepath.ToSlash(path) } -// AbsFile returns the absolute filename for file in the given directory. -// It also removes a leading pathPrefix, or else rewrites a leading $GOROOT -// prefix to the literal "$GOROOT". +// AbsFile returns the absolute filename for file in the given directory, +// as rewritten by the rewrites argument. +// For unrewritten paths, AbsFile rewrites a leading $GOROOT prefix to the literal "$GOROOT". // If the resulting path is the empty string, the result is "??". -func AbsFile(dir, file, pathPrefix string) string { +// +// The rewrites argument is a ;-separated list of rewrites. +// Each rewrite is of the form "prefix" or "prefix=>replace", +// where prefix must match a leading sequence of path elements +// and is either removed entirely or replaced by the replacement. +func AbsFile(dir, file, rewrites string) string { abs := file if dir != "" && !filepath.IsAbs(file) { abs = filepath.Join(dir, file) } - if pathPrefix != "" && hasPathPrefix(abs, pathPrefix) { - if abs == pathPrefix { - abs = "" - } else { - abs = abs[len(pathPrefix)+1:] + start := 0 + for i := 0; i <= len(rewrites); i++ { + if i == len(rewrites) || rewrites[i] == ';' { + if new, ok := applyRewrite(abs, rewrites[start:i]); ok { + abs = new + goto Rewritten + } + start = i + 1 } - } else if hasPathPrefix(abs, GOROOT) { + } + if hasPathPrefix(abs, GOROOT) { abs = "$GOROOT" + abs[len(GOROOT):] } + +Rewritten: if abs == "" { abs = "??" } - return abs } +// applyRewrite applies the rewrite to the path, +// returning the rewritten path and a boolean +// indicating whether the rewrite applied at all. +func applyRewrite(path, rewrite string) (string, bool) { + prefix, replace := rewrite, "" + if j := strings.LastIndex(rewrite, "=>"); j >= 0 { + prefix, replace = rewrite[:j], rewrite[j+len("=>"):] + } + + if prefix == "" || !hasPathPrefix(path, prefix) { + return path, false + } + if len(path) == len(prefix) { + return replace, true + } + if replace == "" { + return path[len(prefix)+1:], true + } + return replace + path[len(prefix):], true +} + // Does s have t as a path prefix? // That is, does s == t or does s begin with t followed by a slash? // For portability, we allow ASCII case folding, so that hasPathPrefix("a/b/c", "A/B") is true. diff --git a/libgo/go/cmd/internal/objabi/line_test.go b/libgo/go/cmd/internal/objabi/line_test.go new file mode 100644 index 00000000000..1fa0ff112ce --- /dev/null +++ b/libgo/go/cmd/internal/objabi/line_test.go @@ -0,0 +1,50 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package objabi + +import ( + "path/filepath" + "runtime" + "testing" +) + +// On Windows, "/foo" is reported as a relative path +// (it is relative to the current drive letter), +// so we need add a drive letter to test absolute path cases. +func drive() string { + if runtime.GOOS == "windows" { + return "c:" + } + return "" +} + +var absFileTests = []struct { + dir string + file string + rewrites string + abs string +}{ + {"/d", "f", "", "/d/f"}, + {"/d", drive() + "/f", "", drive() + "/f"}, + {"/d", "f/g", "", "/d/f/g"}, + {"/d", drive() + "/f/g", "", drive() + "/f/g"}, + + {"/d", "f", "/d/f", "??"}, + {"/d", "f/g", "/d/f", "g"}, + {"/d", "f/g", "/d/f=>h", "h/g"}, + {"/d", "f/g", "/d/f=>/h", "/h/g"}, + {"/d", "f/g", "/d/f=>/h;/d/e=>/i", "/h/g"}, + {"/d", "e/f", "/d/f=>/h;/d/e=>/i", "/i/f"}, +} + +func TestAbsFile(t *testing.T) { + for _, tt := range absFileTests { + abs := filepath.FromSlash(AbsFile(filepath.FromSlash(tt.dir), filepath.FromSlash(tt.file), tt.rewrites)) + want := filepath.FromSlash(tt.abs) + if abs != want { + t.Errorf("AbsFile(%q, %q, %q) = %q, want %q", tt.dir, tt.file, tt.rewrites, abs, want) + } + } +} diff --git a/libgo/go/cmd/internal/objabi/reloctype.go b/libgo/go/cmd/internal/objabi/reloctype.go index 355882c6388..5dc9356fe17 100644 --- a/libgo/go/cmd/internal/objabi/reloctype.go +++ b/libgo/go/cmd/internal/objabi/reloctype.go @@ -30,7 +30,7 @@ package objabi -type RelocType int32 +type RelocType int16 //go:generate stringer -type=RelocType const ( @@ -132,6 +132,26 @@ const ( // slot of the referenced symbol. R_ARM64_GOTPCREL + // R_ARM64_GOT resolves a GOT-relative instruction sequence, usually an adrp + // followed by another ld instruction. + R_ARM64_GOT + + // R_ARM64_PCREL resolves a PC-relative addresses instruction sequence, usually an + // adrp followed by another add instruction. + R_ARM64_PCREL + + // R_ARM64_LDST8 sets a LD/ST immediate value to bits [11:0] of a local address. + R_ARM64_LDST8 + + // R_ARM64_LDST32 sets a LD/ST immediate value to bits [11:2] of a local address. + R_ARM64_LDST32 + + // R_ARM64_LDST64 sets a LD/ST immediate value to bits [11:3] of a local address. + R_ARM64_LDST64 + + // R_ARM64_LDST128 sets a LD/ST immediate value to bits [11:4] of a local address. + R_ARM64_LDST128 + // PPC64. // R_POWER_TLS_LE is used to implement the "local exec" model for tls @@ -196,6 +216,11 @@ const ( // R_WASMIMPORT resolves to the index of the WebAssembly function import. R_WASMIMPORT + + // R_XCOFFREF (only used on aix/ppc64) prevents garbage collection by ld + // of a symbol. This isn't a real relocation, it can be placed in anywhere + // in a symbol and target any symbols. + R_XCOFFREF ) // IsDirectJump reports whether r is a relocation for a direct jump. diff --git a/libgo/go/cmd/internal/objabi/reloctype_string.go b/libgo/go/cmd/internal/objabi/reloctype_string.go index 2cd3a940454..a1c4c1aa518 100644 --- a/libgo/go/cmd/internal/objabi/reloctype_string.go +++ b/libgo/go/cmd/internal/objabi/reloctype_string.go @@ -4,9 +4,9 @@ package objabi import "strconv" -const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_WEAKADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_METHODOFFR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_PCRELDBLR_ADDRMIPSUR_ADDRMIPSTLSR_ADDRCUOFFR_WASMIMPORT" +const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_WEAKADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_METHODOFFR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_ARM64_GOTR_ARM64_PCRELR_ARM64_LDST8R_ARM64_LDST32R_ARM64_LDST64R_ARM64_LDST128R_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_PCRELDBLR_ADDRMIPSUR_ADDRMIPSTLSR_ADDRCUOFFR_WASMIMPORTR_XCOFFREF" -var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 60, 66, 72, 81, 92, 101, 112, 122, 129, 136, 144, 152, 160, 166, 172, 178, 188, 197, 208, 219, 229, 238, 251, 265, 279, 293, 309, 323, 337, 348, 362, 377, 394, 412, 433, 443, 454, 467, 478, 490} +var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 60, 66, 72, 81, 92, 101, 112, 122, 129, 136, 144, 152, 160, 166, 172, 178, 188, 197, 208, 219, 229, 238, 251, 265, 279, 293, 309, 320, 333, 346, 360, 374, 389, 403, 417, 428, 442, 457, 474, 492, 513, 523, 534, 547, 558, 570, 580} func (i RelocType) String() string { i -= 1 diff --git a/libgo/go/cmd/internal/objabi/typekind.go b/libgo/go/cmd/internal/objabi/typekind.go index f0e6f472e5b..990ff1888de 100644 --- a/libgo/go/cmd/internal/objabi/typekind.go +++ b/libgo/go/cmd/internal/objabi/typekind.go @@ -36,6 +36,5 @@ const ( KindUnsafePointer KindDirectIface = 1 << 5 KindGCProg = 1 << 6 - KindNoPointers = 1 << 7 KindMask = (1 << 5) - 1 ) diff --git a/libgo/go/cmd/internal/objabi/util.go b/libgo/go/cmd/internal/objabi/util.go index da49f706f60..bf71b6b0c02 100644 --- a/libgo/go/cmd/internal/objabi/util.go +++ b/libgo/go/cmd/internal/objabi/util.go @@ -19,7 +19,7 @@ func envOr(key, value string) string { } var ( - defaultGOROOT string // set by linker + defaultGOROOT = defaultGOROOTValue() GOROOT = envOr("GOROOT", defaultGOROOT) GOARCH = envOr("GOARCH", defaultGOARCH) @@ -28,9 +28,17 @@ var ( GOARM = goarm() GOMIPS = gomips() GOMIPS64 = gomips64() + GOPPC64 = goppc64() + GOWASM = gowasm() + GO_LDSO = defaultGO_LDSO Version = version ) +const ( + ElfRelocOffset = 256 + MachoRelocOffset = 2048 // reserve enough space for ELF relocations +) + func goarm() int { switch v := envOr("GOARM", defaultGOARM); v { case "5": @@ -63,6 +71,49 @@ func gomips64() string { panic("unreachable") } +func goppc64() int { + switch v := envOr("GOPPC64", defaultGOPPC64); v { + case "power8": + return 8 + case "power9": + return 9 + } + log.Fatalf("Invalid GOPPC64 value. Must be power8 or power9.") + panic("unreachable") +} + +type gowasmFeatures struct { + SignExt bool + SatConv bool +} + +func (f gowasmFeatures) String() string { + var flags []string + if f.SatConv { + flags = append(flags, "satconv") + } + if f.SignExt { + flags = append(flags, "signext") + } + return strings.Join(flags, ",") +} + +func gowasm() (f gowasmFeatures) { + for _, opt := range strings.Split(envOr("GOWASM", ""), ",") { + switch opt { + case "satconv": + f.SatConv = true + case "signext": + f.SignExt = true + case "": + // ignore + default: + log.Fatalf("Invalid GOWASM value. No such feature: " + opt) + } + } + return +} + func Getgoextlinkenabled() string { return envOr("GO_EXTLINK_ENABLED", defaultGO_EXTLINK_ENABLED) } diff --git a/libgo/go/cmd/internal/sys/supported.go b/libgo/go/cmd/internal/sys/supported.go index a53da6ed2cb..4162858ac1b 100644 --- a/libgo/go/cmd/internal/sys/supported.go +++ b/libgo/go/cmd/internal/sys/supported.go @@ -6,6 +6,9 @@ package sys // RaceDetectorSupported reports whether goos/goarch supports the race // detector. There is a copy of this function in cmd/dist/test.go. +// Race detector only supports 48-bit VMA on arm64. But it will always +// return true for arm64, because we don't have VMA size information during +// the compile time. func RaceDetectorSupported(goos, goarch string) bool { switch goos { case "linux": @@ -27,3 +30,16 @@ func MSanSupported(goos, goarch string) bool { return false } } + +// MustLinkExternal reports whether goos/goarch requires external linking. +func MustLinkExternal(goos, goarch string) bool { + switch goos { + case "android": + return true + case "darwin": + if goarch == "arm" || goarch == "arm64" { + return true + } + } + return false +} diff --git a/libgo/go/cmd/vet/all/main.go b/libgo/go/cmd/vet/all/main.go deleted file mode 100644 index 2500c690bfd..00000000000 --- a/libgo/go/cmd/vet/all/main.go +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// The vet/all command runs go vet on the standard library and commands. -// It compares the output against a set of whitelists -// maintained in the whitelist directory. -// -// This program attempts to build packages from golang.org/x/tools, -// which must be in your GOPATH. -package main - -import ( - "bufio" - "bytes" - "flag" - "fmt" - "go/build" - "go/types" - "internal/testenv" - "io" - "io/ioutil" - "log" - "os" - "os/exec" - "path/filepath" - "runtime" - "strings" - "sync/atomic" -) - -var ( - flagPlatforms = flag.String("p", "", "platform(s) to use e.g. linux/amd64,darwin/386") - flagAll = flag.Bool("all", false, "run all platforms") - flagNoLines = flag.Bool("n", false, "don't print line numbers") -) - -var cmdGoPath string -var failed uint32 // updated atomically - -func main() { - log.SetPrefix("vet/all: ") - log.SetFlags(0) - - var err error - cmdGoPath, err = testenv.GoTool() - if err != nil { - log.Print("could not find cmd/go; skipping") - // We're on a platform that can't run cmd/go. - // We want this script to be able to run as part of all.bash, - // so return cleanly rather than with exit code 1. - return - } - - flag.Parse() - switch { - case *flagAll && *flagPlatforms != "": - log.Print("-all and -p flags are incompatible") - flag.Usage() - os.Exit(2) - case *flagPlatforms != "": - vetPlatforms(parseFlagPlatforms()) - case *flagAll: - vetPlatforms(allPlatforms()) - default: - hostPlatform.vet() - } - if atomic.LoadUint32(&failed) != 0 { - os.Exit(1) - } -} - -var hostPlatform = platform{os: build.Default.GOOS, arch: build.Default.GOARCH} - -func allPlatforms() []platform { - var pp []platform - cmd := exec.Command(cmdGoPath, "tool", "dist", "list") - out, err := cmd.Output() - if err != nil { - log.Fatal(err) - } - lines := bytes.Split(out, []byte{'\n'}) - for _, line := range lines { - if len(line) == 0 { - continue - } - pp = append(pp, parsePlatform(string(line))) - } - return pp -} - -func parseFlagPlatforms() []platform { - var pp []platform - components := strings.Split(*flagPlatforms, ",") - for _, c := range components { - pp = append(pp, parsePlatform(c)) - } - return pp -} - -func parsePlatform(s string) platform { - vv := strings.Split(s, "/") - if len(vv) != 2 { - log.Fatalf("could not parse platform %s, must be of form goos/goarch", s) - } - return platform{os: vv[0], arch: vv[1]} -} - -type whitelist map[string]int - -// load adds entries from the whitelist file, if present, for os/arch to w. -func (w whitelist) load(goos string, goarch string) { - sz := types.SizesFor("gc", goarch) - if sz == nil { - log.Fatalf("unknown type sizes for arch %q", goarch) - } - archbits := 8 * sz.Sizeof(types.Typ[types.UnsafePointer]) - - // Look up whether goarch has a shared arch suffix, - // such as mips64x for mips64 and mips64le. - archsuff := goarch - if x, ok := archAsmX[goarch]; ok { - archsuff = x - } - - // Load whitelists. - filenames := []string{ - "all.txt", - goos + ".txt", - goarch + ".txt", - goos + "_" + goarch + ".txt", - fmt.Sprintf("%dbit.txt", archbits), - } - if goarch != archsuff { - filenames = append(filenames, - archsuff+".txt", - goos+"_"+archsuff+".txt", - ) - } - - // We allow error message templates using GOOS and GOARCH. - if goos == "android" { - goos = "linux" // so many special cases :( - } - - // Read whitelists and do template substitution. - replace := strings.NewReplacer("GOOS", goos, "GOARCH", goarch, "ARCHSUFF", archsuff) - - for _, filename := range filenames { - path := filepath.Join("whitelist", filename) - f, err := os.Open(path) - if err != nil { - // Allow not-exist errors; not all combinations have whitelists. - if os.IsNotExist(err) { - continue - } - log.Fatal(err) - } - scan := bufio.NewScanner(f) - for scan.Scan() { - line := scan.Text() - if len(line) == 0 || strings.HasPrefix(line, "//") { - continue - } - w[replace.Replace(line)]++ - } - if err := scan.Err(); err != nil { - log.Fatal(err) - } - } -} - -type platform struct { - os string - arch string -} - -func (p platform) String() string { - return p.os + "/" + p.arch -} - -// ignorePathPrefixes are file path prefixes that should be ignored wholesale. -var ignorePathPrefixes = [...]string{ - // These testdata dirs have lots of intentionally broken/bad code for tests. - "cmd/go/testdata/", - "cmd/vet/testdata/", - "go/printer/testdata/", -} - -func vetPlatforms(pp []platform) { - for _, p := range pp { - p.vet() - } -} - -func (p platform) vet() { - if p.os == "linux" && (p.arch == "riscv64" || p.arch == "sparc64") { - // TODO(tklauser): enable as soon as these ports have fully landed - fmt.Printf("skipping %s/%s\n", p.os, p.arch) - return - } - - if p.os == "windows" && p.arch == "arm" { - // TODO(jordanrh1): enable as soon as the windows/arm port has fully landed - fmt.Println("skipping windows/arm") - return - } - - if p.os == "aix" && p.arch == "ppc64" { - // TODO(aix): enable as soon as the aix/ppc64 port has fully landed - fmt.Println("skipping aix/ppc64") - return - } - - var buf bytes.Buffer - fmt.Fprintf(&buf, "go run main.go -p %s\n", p) - - // Load whitelist(s). - w := make(whitelist) - w.load(p.os, p.arch) - - tmpdir, err := ioutil.TempDir("", "cmd-vet-all") - if err != nil { - log.Fatal(err) - } - defer os.RemoveAll(tmpdir) - - // Build the go/packages-based vet command from the x/tools - // repo. It is considerably faster than "go vet", which rebuilds - // the standard library. - vetTool := filepath.Join(tmpdir, "vet") - cmd := exec.Command(cmdGoPath, "build", "-o", vetTool, "golang.org/x/tools/go/analysis/cmd/vet") - cmd.Dir = filepath.Join(runtime.GOROOT(), "src") - cmd.Stderr = os.Stderr - cmd.Stdout = os.Stderr - if err := cmd.Run(); err != nil { - log.Fatal(err) - } - - // TODO: The unsafeptr checks are disabled for now, - // because there are so many false positives, - // and no clear way to improve vet to eliminate large chunks of them. - // And having them in the whitelists will just cause annoyance - // and churn when working on the runtime. - cmd = exec.Command(vetTool, - "-unsafeptr=0", - "-nilness=0", // expensive, uses SSA - "std", - "cmd/...", - "cmd/compile/internal/gc/testdata", - ) - cmd.Dir = filepath.Join(runtime.GOROOT(), "src") - cmd.Env = append(os.Environ(), "GOOS="+p.os, "GOARCH="+p.arch, "CGO_ENABLED=0") - stderr, err := cmd.StderrPipe() - if err != nil { - log.Fatal(err) - } - if err := cmd.Start(); err != nil { - log.Fatal(err) - } - - // Process vet output. - scan := bufio.NewScanner(stderr) - var parseFailed bool -NextLine: - for scan.Scan() { - line := scan.Text() - if strings.HasPrefix(line, "vet: ") { - // Typecheck failure: Malformed syntax or multiple packages or the like. - // This will yield nicer error messages elsewhere, so ignore them here. - - // This includes warnings from asmdecl of the form: - // "vet: foo.s:16: [amd64] cannot check cross-package assembly function" - continue - } - - if strings.HasPrefix(line, "panic: ") { - // Panic in vet. Don't filter anything, we want the complete output. - parseFailed = true - fmt.Fprintf(os.Stderr, "panic in vet (to reproduce: go run main.go -p %s):\n", p) - fmt.Fprintln(os.Stderr, line) - io.Copy(os.Stderr, stderr) - break - } - if strings.HasPrefix(line, "# ") { - // 'go vet' prefixes the output of each vet invocation by a comment: - // # [package] - continue - } - - // Parse line. - // Assume the part before the first ": " - // is the "file:line:col: " information. - // TODO(adonovan): parse vet -json output. - var file, lineno, msg string - if i := strings.Index(line, ": "); i >= 0 { - msg = line[i+len(": "):] - - words := strings.Split(line[:i], ":") - switch len(words) { - case 3: - _ = words[2] // ignore column - fallthrough - case 2: - lineno = words[1] - fallthrough - case 1: - file = words[0] - - // Make the file name relative to GOROOT/src. - if rel, err := filepath.Rel(cmd.Dir, file); err == nil { - file = rel - } - default: - // error: too many columns - } - } - if file == "" { - if !parseFailed { - parseFailed = true - fmt.Fprintf(os.Stderr, "failed to parse %s vet output:\n", p) - } - fmt.Fprintln(os.Stderr, line) - continue - } - - msg = strings.TrimSpace(msg) - - for _, ignore := range ignorePathPrefixes { - if strings.HasPrefix(file, filepath.FromSlash(ignore)) { - continue NextLine - } - } - - key := file + ": " + msg - if w[key] == 0 { - // Vet error with no match in the whitelist. Print it. - if *flagNoLines { - fmt.Fprintf(&buf, "%s: %s\n", file, msg) - } else { - fmt.Fprintf(&buf, "%s:%s: %s\n", file, lineno, msg) - } - atomic.StoreUint32(&failed, 1) - continue - } - w[key]-- - } - if parseFailed { - atomic.StoreUint32(&failed, 1) - return - } - if scan.Err() != nil { - log.Fatalf("failed to scan vet output: %v", scan.Err()) - } - err = cmd.Wait() - // We expect vet to fail. - // Make sure it has failed appropriately, though (for example, not a PathError). - if _, ok := err.(*exec.ExitError); !ok { - log.Fatalf("unexpected go vet execution failure: %v", err) - } - printedHeader := false - if len(w) > 0 { - for k, v := range w { - if v != 0 { - if !printedHeader { - fmt.Fprintln(&buf, "unmatched whitelist entries:") - printedHeader = true - } - for i := 0; i < v; i++ { - fmt.Fprintln(&buf, k) - } - atomic.StoreUint32(&failed, 1) - } - } - } - - os.Stdout.Write(buf.Bytes()) -} - -// archAsmX maps architectures to the suffix usually used for their assembly files, -// if different than the arch name itself. -var archAsmX = map[string]string{ - "android": "linux", - "mips64": "mips64x", - "mips64le": "mips64x", - "mips": "mipsx", - "mipsle": "mipsx", - "ppc64": "ppc64x", - "ppc64le": "ppc64x", -} diff --git a/libgo/go/cmd/vet/main.go b/libgo/go/cmd/vet/main.go index 4ec174b3cd1..2a4f929d609 100644 --- a/libgo/go/cmd/vet/main.go +++ b/libgo/go/cmd/vet/main.go @@ -1,6 +1,8 @@ package main import ( + "cmd/internal/objabi" + "golang.org/x/tools/go/analysis/unitchecker" "golang.org/x/tools/go/analysis/passes/asmdecl" @@ -11,6 +13,7 @@ import ( "golang.org/x/tools/go/analysis/passes/cgocall" "golang.org/x/tools/go/analysis/passes/composite" "golang.org/x/tools/go/analysis/passes/copylock" + "golang.org/x/tools/go/analysis/passes/errorsas" "golang.org/x/tools/go/analysis/passes/httpresponse" "golang.org/x/tools/go/analysis/passes/loopclosure" "golang.org/x/tools/go/analysis/passes/lostcancel" @@ -27,6 +30,8 @@ import ( ) func main() { + objabi.AddVersionFlag() + unitchecker.Main( asmdecl.Analyzer, assign.Analyzer, @@ -36,6 +41,7 @@ func main() { cgocall.Analyzer, composite.Analyzer, copylock.Analyzer, + errorsas.Analyzer, httpresponse.Analyzer, loopclosure.Analyzer, lostcancel.Analyzer, diff --git a/libgo/go/cmd/vet/testdata/src/asm/asm.go b/libgo/go/cmd/vet/testdata/asm/asm.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/asm/asm.go rename to libgo/go/cmd/vet/testdata/asm/asm.go diff --git a/libgo/go/cmd/vet/testdata/src/assign/assign.go b/libgo/go/cmd/vet/testdata/assign/assign.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/assign/assign.go rename to libgo/go/cmd/vet/testdata/assign/assign.go diff --git a/libgo/go/cmd/vet/testdata/src/atomic/atomic.go b/libgo/go/cmd/vet/testdata/atomic/atomic.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/atomic/atomic.go rename to libgo/go/cmd/vet/testdata/atomic/atomic.go diff --git a/libgo/go/cmd/vet/testdata/src/bool/bool.go b/libgo/go/cmd/vet/testdata/bool/bool.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/bool/bool.go rename to libgo/go/cmd/vet/testdata/bool/bool.go diff --git a/libgo/go/cmd/vet/testdata/src/buildtag/buildtag.go b/libgo/go/cmd/vet/testdata/buildtag/buildtag.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/buildtag/buildtag.go rename to libgo/go/cmd/vet/testdata/buildtag/buildtag.go diff --git a/libgo/go/cmd/vet/testdata/src/cgo/cgo.go b/libgo/go/cmd/vet/testdata/cgo/cgo.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/cgo/cgo.go rename to libgo/go/cmd/vet/testdata/cgo/cgo.go diff --git a/libgo/go/cmd/vet/testdata/src/composite/composite.go b/libgo/go/cmd/vet/testdata/composite/composite.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/composite/composite.go rename to libgo/go/cmd/vet/testdata/composite/composite.go diff --git a/libgo/go/cmd/vet/testdata/src/copylock/copylock.go b/libgo/go/cmd/vet/testdata/copylock/copylock.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/copylock/copylock.go rename to libgo/go/cmd/vet/testdata/copylock/copylock.go diff --git a/libgo/go/cmd/vet/testdata/src/deadcode/deadcode.go b/libgo/go/cmd/vet/testdata/deadcode/deadcode.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/deadcode/deadcode.go rename to libgo/go/cmd/vet/testdata/deadcode/deadcode.go diff --git a/libgo/go/cmd/vet/testdata/src/httpresponse/httpresponse.go b/libgo/go/cmd/vet/testdata/httpresponse/httpresponse.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/httpresponse/httpresponse.go rename to libgo/go/cmd/vet/testdata/httpresponse/httpresponse.go diff --git a/libgo/go/cmd/vet/testdata/src/lostcancel/lostcancel.go b/libgo/go/cmd/vet/testdata/lostcancel/lostcancel.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/lostcancel/lostcancel.go rename to libgo/go/cmd/vet/testdata/lostcancel/lostcancel.go diff --git a/libgo/go/cmd/vet/testdata/src/method/method.go b/libgo/go/cmd/vet/testdata/method/method.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/method/method.go rename to libgo/go/cmd/vet/testdata/method/method.go diff --git a/libgo/go/cmd/vet/testdata/src/nilfunc/nilfunc.go b/libgo/go/cmd/vet/testdata/nilfunc/nilfunc.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/nilfunc/nilfunc.go rename to libgo/go/cmd/vet/testdata/nilfunc/nilfunc.go diff --git a/libgo/go/cmd/vet/testdata/print/print.go b/libgo/go/cmd/vet/testdata/print/print.go new file mode 100644 index 00000000000..7a4783aee4f --- /dev/null +++ b/libgo/go/cmd/vet/testdata/print/print.go @@ -0,0 +1,681 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This file contains tests for the printf checker. + +package print + +import ( + "fmt" + logpkg "log" // renamed to make it harder to see + "math" + "os" + "testing" + "unsafe" // just for test case printing unsafe.Pointer + // For testing printf-like functions from external package. + // "github.com/foobar/externalprintf" +) + +func UnsafePointerPrintfTest() { + var up unsafe.Pointer + fmt.Printf("%p, %x %X", up, up, up) +} + +// Error methods that do not satisfy the Error interface and should be checked. +type errorTest1 int + +func (errorTest1) Error(...interface{}) string { + return "hi" +} + +type errorTest2 int // Analogous to testing's *T type. +func (errorTest2) Error(...interface{}) { +} + +type errorTest3 int + +func (errorTest3) Error() { // No return value. +} + +type errorTest4 int + +func (errorTest4) Error() int { // Different return type. + return 3 +} + +type errorTest5 int + +func (errorTest5) error() { // niladic; don't complain if no args (was bug) +} + +// This function never executes, but it serves as a simple test for the program. +// Test with make test. +func PrintfTests() { + var b bool + var i int + var r rune + var s string + var x float64 + var p *int + var imap map[int]int + var fslice []float64 + var c complex64 + // Some good format/argtypes + fmt.Printf("") + fmt.Printf("%b %b %b", 3, i, x) + fmt.Printf("%c %c %c %c", 3, i, 'x', r) + fmt.Printf("%d %d %d", 3, i, imap) + fmt.Printf("%e %e %e %e", 3e9, x, fslice, c) + fmt.Printf("%E %E %E %E", 3e9, x, fslice, c) + fmt.Printf("%f %f %f %f", 3e9, x, fslice, c) + fmt.Printf("%F %F %F %F", 3e9, x, fslice, c) + fmt.Printf("%g %g %g %g", 3e9, x, fslice, c) + fmt.Printf("%G %G %G %G", 3e9, x, fslice, c) + fmt.Printf("%b %b %b %b", 3e9, x, fslice, c) + fmt.Printf("%o %o", 3, i) + fmt.Printf("%p", p) + fmt.Printf("%q %q %q %q", 3, i, 'x', r) + fmt.Printf("%s %s %s", "hi", s, []byte{65}) + fmt.Printf("%t %t", true, b) + fmt.Printf("%T %T", 3, i) + fmt.Printf("%U %U", 3, i) + fmt.Printf("%v %v", 3, i) + fmt.Printf("%x %x %x %x", 3, i, "hi", s) + fmt.Printf("%X %X %X %X", 3, i, "hi", s) + fmt.Printf("%.*s %d %g", 3, "hi", 23, 2.3) + fmt.Printf("%s", &stringerv) + fmt.Printf("%v", &stringerv) + fmt.Printf("%T", &stringerv) + fmt.Printf("%s", &embeddedStringerv) + fmt.Printf("%v", &embeddedStringerv) + fmt.Printf("%T", &embeddedStringerv) + fmt.Printf("%v", notstringerv) + fmt.Printf("%T", notstringerv) + fmt.Printf("%q", stringerarrayv) + fmt.Printf("%v", stringerarrayv) + fmt.Printf("%s", stringerarrayv) + fmt.Printf("%v", notstringerarrayv) + fmt.Printf("%T", notstringerarrayv) + fmt.Printf("%d", new(fmt.Formatter)) + fmt.Printf("%*%", 2) // Ridiculous but allowed. + fmt.Printf("%s", interface{}(nil)) // Nothing useful we can say. + + fmt.Printf("%g", 1+2i) + fmt.Printf("%#e %#E %#f %#F %#g %#G", 1.2, 1.2, 1.2, 1.2, 1.2, 1.2) // OK since Go 1.9 + // Some bad format/argTypes + fmt.Printf("%b", "hi") // ERROR "Printf format %b has arg \x22hi\x22 of wrong type string" + fmt.Printf("%t", c) // ERROR "Printf format %t has arg c of wrong type complex64" + fmt.Printf("%t", 1+2i) // ERROR "Printf format %t has arg 1 \+ 2i of wrong type complex128" + fmt.Printf("%c", 2.3) // ERROR "Printf format %c has arg 2.3 of wrong type float64" + fmt.Printf("%d", 2.3) // ERROR "Printf format %d has arg 2.3 of wrong type float64" + fmt.Printf("%e", "hi") // ERROR "Printf format %e has arg \x22hi\x22 of wrong type string" + fmt.Printf("%E", true) // ERROR "Printf format %E has arg true of wrong type bool" + fmt.Printf("%f", "hi") // ERROR "Printf format %f has arg \x22hi\x22 of wrong type string" + fmt.Printf("%F", 'x') // ERROR "Printf format %F has arg 'x' of wrong type rune" + fmt.Printf("%g", "hi") // ERROR "Printf format %g has arg \x22hi\x22 of wrong type string" + fmt.Printf("%g", imap) // ERROR "Printf format %g has arg imap of wrong type map\[int\]int" + fmt.Printf("%G", i) // ERROR "Printf format %G has arg i of wrong type int" + fmt.Printf("%o", x) // ERROR "Printf format %o has arg x of wrong type float64" + fmt.Printf("%p", nil) // ERROR "Printf format %p has arg nil of wrong type untyped nil" + fmt.Printf("%p", 23) // ERROR "Printf format %p has arg 23 of wrong type int" + fmt.Printf("%q", x) // ERROR "Printf format %q has arg x of wrong type float64" + fmt.Printf("%s", b) // ERROR "Printf format %s has arg b of wrong type bool" + fmt.Printf("%s", byte(65)) // ERROR "Printf format %s has arg byte\(65\) of wrong type byte" + fmt.Printf("%t", 23) // ERROR "Printf format %t has arg 23 of wrong type int" + fmt.Printf("%U", x) // ERROR "Printf format %U has arg x of wrong type float64" + fmt.Printf("%x", nil) // ERROR "Printf format %x has arg nil of wrong type untyped nil" + fmt.Printf("%X", 2.3) // ERROR "Printf format %X has arg 2.3 of wrong type float64" + fmt.Printf("%s", stringerv) // ERROR "Printf format %s has arg stringerv of wrong type .*print.ptrStringer" + fmt.Printf("%t", stringerv) // ERROR "Printf format %t has arg stringerv of wrong type .*print.ptrStringer" + fmt.Printf("%s", embeddedStringerv) // ERROR "Printf format %s has arg embeddedStringerv of wrong type .*print.embeddedStringer" + fmt.Printf("%t", embeddedStringerv) // ERROR "Printf format %t has arg embeddedStringerv of wrong type .*print.embeddedStringer" + fmt.Printf("%q", notstringerv) // ERROR "Printf format %q has arg notstringerv of wrong type .*print.notstringer" + fmt.Printf("%t", notstringerv) // ERROR "Printf format %t has arg notstringerv of wrong type .*print.notstringer" + fmt.Printf("%t", stringerarrayv) // ERROR "Printf format %t has arg stringerarrayv of wrong type .*print.stringerarray" + fmt.Printf("%t", notstringerarrayv) // ERROR "Printf format %t has arg notstringerarrayv of wrong type .*print.notstringerarray" + fmt.Printf("%q", notstringerarrayv) // ERROR "Printf format %q has arg notstringerarrayv of wrong type .*print.notstringerarray" + fmt.Printf("%d", BoolFormatter(true)) // ERROR "Printf format %d has arg BoolFormatter\(true\) of wrong type .*print.BoolFormatter" + fmt.Printf("%z", FormatterVal(true)) // correct (the type is responsible for formatting) + fmt.Printf("%d", FormatterVal(true)) // correct (the type is responsible for formatting) + fmt.Printf("%s", nonemptyinterface) // correct (the type is responsible for formatting) + fmt.Printf("%.*s %d %6g", 3, "hi", 23, 'x') // ERROR "Printf format %6g has arg 'x' of wrong type rune" + fmt.Println() // not an error + fmt.Println("%s", "hi") // ERROR "Println call has possible formatting directive %s" + fmt.Println("%v", "hi") // ERROR "Println call has possible formatting directive %v" + fmt.Println("%T", "hi") // ERROR "Println call has possible formatting directive %T" + fmt.Println("0.0%") // correct (trailing % couldn't be a formatting directive) + fmt.Printf("%s", "hi", 3) // ERROR "Printf call needs 1 arg but has 2 args" + _ = fmt.Sprintf("%"+("s"), "hi", 3) // ERROR "Sprintf call needs 1 arg but has 2 args" + fmt.Printf("%s%%%d", "hi", 3) // correct + fmt.Printf("%08s", "woo") // correct + fmt.Printf("% 8s", "woo") // correct + fmt.Printf("%.*d", 3, 3) // correct + fmt.Printf("%.*d x", 3, 3, 3, 3) // ERROR "Printf call needs 2 args but has 4 args" + fmt.Printf("%.*d x", "hi", 3) // ERROR "Printf format %.*d uses non-int \x22hi\x22 as argument of \*" + fmt.Printf("%.*d x", i, 3) // correct + fmt.Printf("%.*d x", s, 3) // ERROR "Printf format %.\*d uses non-int s as argument of \*" + fmt.Printf("%*% x", 0.22) // ERROR "Printf format %\*% uses non-int 0.22 as argument of \*" + fmt.Printf("%q %q", multi()...) // ok + fmt.Printf("%#q", `blah`) // ok + // printf("now is the time", "buddy") // no error "printf call has arguments but no formatting directives" + Printf("now is the time", "buddy") // ERROR "Printf call has arguments but no formatting directives" + Printf("hi") // ok + const format = "%s %s\n" + Printf(format, "hi", "there") + Printf(format, "hi") // ERROR "Printf format %s reads arg #2, but call has 1 arg$" + Printf("%s %d %.3v %q", "str", 4) // ERROR "Printf format %.3v reads arg #3, but call has 2 args" + f := new(ptrStringer) + f.Warn(0, "%s", "hello", 3) // ERROR "Warn call has possible formatting directive %s" + f.Warnf(0, "%s", "hello", 3) // ERROR "Warnf call needs 1 arg but has 2 args" + f.Warnf(0, "%r", "hello") // ERROR "Warnf format %r has unknown verb r" + f.Warnf(0, "%#s", "hello") // ERROR "Warnf format %#s has unrecognized flag #" + f.Warn2(0, "%s", "hello", 3) // ERROR "Warn2 call has possible formatting directive %s" + f.Warnf2(0, "%s", "hello", 3) // ERROR "Warnf2 call needs 1 arg but has 2 args" + f.Warnf2(0, "%r", "hello") // ERROR "Warnf2 format %r has unknown verb r" + f.Warnf2(0, "%#s", "hello") // ERROR "Warnf2 format %#s has unrecognized flag #" + f.Wrap(0, "%s", "hello", 3) // ERROR "Wrap call has possible formatting directive %s" + f.Wrapf(0, "%s", "hello", 3) // ERROR "Wrapf call needs 1 arg but has 2 args" + f.Wrapf(0, "%r", "hello") // ERROR "Wrapf format %r has unknown verb r" + f.Wrapf(0, "%#s", "hello") // ERROR "Wrapf format %#s has unrecognized flag #" + f.Wrap2(0, "%s", "hello", 3) // ERROR "Wrap2 call has possible formatting directive %s" + f.Wrapf2(0, "%s", "hello", 3) // ERROR "Wrapf2 call needs 1 arg but has 2 args" + f.Wrapf2(0, "%r", "hello") // ERROR "Wrapf2 format %r has unknown verb r" + f.Wrapf2(0, "%#s", "hello") // ERROR "Wrapf2 format %#s has unrecognized flag #" + fmt.Printf("%#s", FormatterVal(true)) // correct (the type is responsible for formatting) + Printf("d%", 2) // ERROR "Printf format % is missing verb at end of string" + Printf("%d", percentDV) + Printf("%d", &percentDV) + Printf("%d", notPercentDV) // ERROR "Printf format %d has arg notPercentDV of wrong type .*print.notPercentDStruct" + Printf("%d", ¬PercentDV) // ERROR "Printf format %d has arg ¬PercentDV of wrong type \*.*print.notPercentDStruct" + Printf("%p", ¬PercentDV) // Works regardless: we print it as a pointer. + Printf("%q", &percentDV) // ERROR "Printf format %q has arg &percentDV of wrong type \*.*print.percentDStruct" + Printf("%s", percentSV) + Printf("%s", &percentSV) + // Good argument reorderings. + Printf("%[1]d", 3) + Printf("%[1]*d", 3, 1) + Printf("%[2]*[1]d", 1, 3) + Printf("%[2]*.[1]*[3]d", 2, 3, 4) + fmt.Fprintf(os.Stderr, "%[2]*.[1]*[3]d", 2, 3, 4) // Use Fprintf to make sure we count arguments correctly. + // Bad argument reorderings. + Printf("%[xd", 3) // ERROR "Printf format %\[xd is missing closing \]" + Printf("%[x]d x", 3) // ERROR "Printf format has invalid argument index \[x\]" + Printf("%[3]*s x", "hi", 2) // ERROR "Printf format has invalid argument index \[3\]" + _ = fmt.Sprintf("%[3]d x", 2) // ERROR "Sprintf format has invalid argument index \[3\]" + Printf("%[2]*.[1]*[3]d x", 2, "hi", 4) // ERROR "Printf format %\[2]\*\.\[1\]\*\[3\]d uses non-int \x22hi\x22 as argument of \*" + Printf("%[0]s x", "arg1") // ERROR "Printf format has invalid argument index \[0\]" + Printf("%[0]d x", 1) // ERROR "Printf format has invalid argument index \[0\]" + // Something that satisfies the error interface. + var e error + fmt.Println(e.Error()) // ok + // Something that looks like an error interface but isn't, such as the (*T).Error method + // in the testing package. + var et1 *testing.T + et1.Error() // ok + et1.Error("hi") // ok + et1.Error("%d", 3) // ERROR "Error call has possible formatting directive %d" + var et3 errorTest3 + et3.Error() // ok, not an error method. + var et4 errorTest4 + et4.Error() // ok, not an error method. + var et5 errorTest5 + et5.error() // ok, not an error method. + // Interfaces can be used with any verb. + var iface interface { + ToTheMadness() bool // Method ToTheMadness usually returns false + } + fmt.Printf("%f", iface) // ok: fmt treats interfaces as transparent and iface may well have a float concrete type + // Can't print a function. + Printf("%d", someFunction) // ERROR "Printf format %d arg someFunction is a func value, not called" + Printf("%v", someFunction) // ERROR "Printf format %v arg someFunction is a func value, not called" + Println(someFunction) // ERROR "Println arg someFunction is a func value, not called" + Printf("%p", someFunction) // ok: maybe someone wants to see the pointer + Printf("%T", someFunction) // ok: maybe someone wants to see the type + // Bug: used to recur forever. + Printf("%p %x", recursiveStructV, recursiveStructV.next) + Printf("%p %x", recursiveStruct1V, recursiveStruct1V.next) // ERROR "Printf format %x has arg recursiveStruct1V\.next of wrong type \*.*print\.RecursiveStruct2" + Printf("%p %x", recursiveSliceV, recursiveSliceV) + Printf("%p %x", recursiveMapV, recursiveMapV) + // Special handling for Log. + math.Log(3) // OK + var t *testing.T + t.Log("%d", 3) // ERROR "Log call has possible formatting directive %d" + t.Logf("%d", 3) + t.Logf("%d", "hi") // ERROR "Logf format %d has arg \x22hi\x22 of wrong type string" + + Errorf(1, "%d", 3) // OK + Errorf(1, "%d", "hi") // ERROR "Errorf format %d has arg \x22hi\x22 of wrong type string" + + // Multiple string arguments before variadic args + errorf("WARNING", "foobar") // OK + errorf("INFO", "s=%s, n=%d", "foo", 1) // OK + errorf("ERROR", "%d") // ERROR "errorf format %d reads arg #1, but call has 0 args" + + // Printf from external package + // externalprintf.Printf("%d", 42) // OK + // externalprintf.Printf("foobar") // OK + // level := 123 + // externalprintf.Logf(level, "%d", 42) // OK + // externalprintf.Errorf(level, level, "foo %q bar", "foobar") // OK + // externalprintf.Logf(level, "%d") // no error "Logf format %d reads arg #1, but call has 0 args" + // var formatStr = "%s %s" + // externalprintf.Sprintf(formatStr, "a", "b") // OK + // externalprintf.Logf(level, formatStr, "a", "b") // OK + + // user-defined Println-like functions + ss := &someStruct{} + ss.Log(someFunction, "foo") // OK + ss.Error(someFunction, someFunction) // OK + ss.Println() // OK + ss.Println(1.234, "foo") // OK + ss.Println(1, someFunction) // no error "Println arg someFunction is a func value, not called" + ss.log(someFunction) // OK + ss.log(someFunction, "bar", 1.33) // OK + ss.log(someFunction, someFunction) // no error "log arg someFunction is a func value, not called" + + // indexed arguments + Printf("%d %[3]d %d %[2]d x", 1, 2, 3, 4) // OK + Printf("%d %[0]d %d %[2]d x", 1, 2, 3, 4) // ERROR "Printf format has invalid argument index \[0\]" + Printf("%d %[3]d %d %[-2]d x", 1, 2, 3, 4) // ERROR "Printf format has invalid argument index \[-2\]" + Printf("%d %[3]d %d %[2234234234234]d x", 1, 2, 3, 4) // ERROR "Printf format has invalid argument index \[2234234234234\]" + Printf("%d %[3]d %-10d %[2]d x", 1, 2, 3) // ERROR "Printf format %-10d reads arg #4, but call has 3 args" + Printf("%[1][3]d x", 1, 2) // ERROR "Printf format %\[1\]\[ has unknown verb \[" + Printf("%[1]d x", 1, 2) // OK + Printf("%d %[3]d %d %[2]d x", 1, 2, 3, 4, 5) // OK + + // wrote Println but meant Fprintln + Printf("%p\n", os.Stdout) // OK + Println(os.Stdout, "hello") // ERROR "Println does not take io.Writer but has first arg os.Stdout" + + Printf(someString(), "hello") // OK + + // Printf wrappers in package log should be detected automatically + logpkg.Fatal("%d", 1) // ERROR "Fatal call has possible formatting directive %d" + logpkg.Fatalf("%d", "x") // ERROR "Fatalf format %d has arg \x22x\x22 of wrong type string" + logpkg.Fatalln("%d", 1) // ERROR "Fatalln call has possible formatting directive %d" + logpkg.Panic("%d", 1) // ERROR "Panic call has possible formatting directive %d" + logpkg.Panicf("%d", "x") // ERROR "Panicf format %d has arg \x22x\x22 of wrong type string" + logpkg.Panicln("%d", 1) // ERROR "Panicln call has possible formatting directive %d" + logpkg.Print("%d", 1) // ERROR "Print call has possible formatting directive %d" + logpkg.Printf("%d", "x") // ERROR "Printf format %d has arg \x22x\x22 of wrong type string" + logpkg.Println("%d", 1) // ERROR "Println call has possible formatting directive %d" + + // Methods too. + var l *logpkg.Logger + l.Fatal("%d", 1) // ERROR "Fatal call has possible formatting directive %d" + l.Fatalf("%d", "x") // ERROR "Fatalf format %d has arg \x22x\x22 of wrong type string" + l.Fatalln("%d", 1) // ERROR "Fatalln call has possible formatting directive %d" + l.Panic("%d", 1) // ERROR "Panic call has possible formatting directive %d" + l.Panicf("%d", "x") // ERROR "Panicf format %d has arg \x22x\x22 of wrong type string" + l.Panicln("%d", 1) // ERROR "Panicln call has possible formatting directive %d" + l.Print("%d", 1) // ERROR "Print call has possible formatting directive %d" + l.Printf("%d", "x") // ERROR "Printf format %d has arg \x22x\x22 of wrong type string" + l.Println("%d", 1) // ERROR "Println call has possible formatting directive %d" + + // Issue 26486 + dbg("", 1) // no error "call has arguments but no formatting directive" +} + +func someString() string { return "X" } + +type someStruct struct{} + +// Log is non-variadic user-define Println-like function. +// Calls to this func must be skipped when checking +// for Println-like arguments. +func (ss *someStruct) Log(f func(), s string) {} + +// Error is variadic user-define Println-like function. +// Calls to this func mustn't be checked for Println-like arguments, +// since variadic arguments type isn't interface{}. +func (ss *someStruct) Error(args ...func()) {} + +// Println is variadic user-defined Println-like function. +// Calls to this func must be checked for Println-like arguments. +func (ss *someStruct) Println(args ...interface{}) {} + +// log is variadic user-defined Println-like function. +// Calls to this func must be checked for Println-like arguments. +func (ss *someStruct) log(f func(), args ...interface{}) {} + +// A function we use as a function value; it has no other purpose. +func someFunction() {} + +// Printf is used by the test so we must declare it. +func Printf(format string, args ...interface{}) { + fmt.Printf(format, args...) +} + +// Println is used by the test so we must declare it. +func Println(args ...interface{}) { + fmt.Println(args...) +} + +// printf is used by the test so we must declare it. +func printf(format string, args ...interface{}) { + fmt.Printf(format, args...) +} + +// Errorf is used by the test for a case in which the first parameter +// is not a format string. +func Errorf(i int, format string, args ...interface{}) { + _ = fmt.Errorf(format, args...) +} + +// errorf is used by the test for a case in which the function accepts multiple +// string parameters before variadic arguments +func errorf(level, format string, args ...interface{}) { + _ = fmt.Errorf(format, args...) +} + +// multi is used by the test. +func multi() []interface{} { + panic("don't call - testing only") +} + +type stringer int + +func (stringer) String() string { return "string" } + +type ptrStringer float64 + +var stringerv ptrStringer + +func (*ptrStringer) String() string { + return "string" +} + +func (p *ptrStringer) Warn2(x int, args ...interface{}) string { + return p.Warn(x, args...) +} + +func (p *ptrStringer) Warnf2(x int, format string, args ...interface{}) string { + return p.Warnf(x, format, args...) +} + +func (*ptrStringer) Warn(x int, args ...interface{}) string { + return "warn" +} + +func (*ptrStringer) Warnf(x int, format string, args ...interface{}) string { + return "warnf" +} + +func (p *ptrStringer) Wrap2(x int, args ...interface{}) string { + return p.Wrap(x, args...) +} + +func (p *ptrStringer) Wrapf2(x int, format string, args ...interface{}) string { + return p.Wrapf(x, format, args...) +} + +func (*ptrStringer) Wrap(x int, args ...interface{}) string { + return fmt.Sprint(args...) +} + +func (*ptrStringer) Wrapf(x int, format string, args ...interface{}) string { + return fmt.Sprintf(format, args...) +} + +func (*ptrStringer) BadWrap(x int, args ...interface{}) string { + return fmt.Sprint(args) // ERROR "missing ... in args forwarded to print-like function" +} + +func (*ptrStringer) BadWrapf(x int, format string, args ...interface{}) string { + return fmt.Sprintf(format, args) // ERROR "missing ... in args forwarded to printf-like function" +} + +func (*ptrStringer) WrapfFalsePositive(x int, arg1 string, arg2 ...interface{}) string { + return fmt.Sprintf("%s %v", arg1, arg2) +} + +type embeddedStringer struct { + foo string + ptrStringer + bar int +} + +var embeddedStringerv embeddedStringer + +type notstringer struct { + f float64 +} + +var notstringerv notstringer + +type stringerarray [4]float64 + +func (stringerarray) String() string { + return "string" +} + +var stringerarrayv stringerarray + +type notstringerarray [4]float64 + +var notstringerarrayv notstringerarray + +var nonemptyinterface = interface { + f() +}(nil) + +// A data type we can print with "%d". +type percentDStruct struct { + a int + b []byte + c *float64 +} + +var percentDV percentDStruct + +// A data type we cannot print correctly with "%d". +type notPercentDStruct struct { + a int + b []byte + c bool +} + +var notPercentDV notPercentDStruct + +// A data type we can print with "%s". +type percentSStruct struct { + a string + b []byte + C stringerarray +} + +var percentSV percentSStruct + +type recursiveStringer int + +func (s recursiveStringer) String() string { + _ = fmt.Sprintf("%d", s) + _ = fmt.Sprintf("%#v", s) + _ = fmt.Sprintf("%v", s) // ERROR "Sprintf format %v with arg s causes recursive String method call" + _ = fmt.Sprintf("%v", &s) // ERROR "Sprintf format %v with arg &s causes recursive String method call" + _ = fmt.Sprintf("%T", s) // ok; does not recursively call String + return fmt.Sprintln(s) // ERROR "Sprintln arg s causes recursive call to String method" +} + +type recursivePtrStringer int + +func (p *recursivePtrStringer) String() string { + _ = fmt.Sprintf("%v", *p) + _ = fmt.Sprint(&p) // ok; prints address + return fmt.Sprintln(p) // ERROR "Sprintln arg p causes recursive call to String method" +} + +type BoolFormatter bool + +func (*BoolFormatter) Format(fmt.State, rune) { +} + +// Formatter with value receiver +type FormatterVal bool + +func (FormatterVal) Format(fmt.State, rune) { +} + +type RecursiveSlice []RecursiveSlice + +var recursiveSliceV = &RecursiveSlice{} + +type RecursiveMap map[int]RecursiveMap + +var recursiveMapV = make(RecursiveMap) + +type RecursiveStruct struct { + next *RecursiveStruct +} + +var recursiveStructV = &RecursiveStruct{} + +type RecursiveStruct1 struct { + next *RecursiveStruct2 +} + +type RecursiveStruct2 struct { + next *RecursiveStruct1 +} + +var recursiveStruct1V = &RecursiveStruct1{} + +type unexportedInterface struct { + f interface{} +} + +// Issue 17798: unexported ptrStringer cannot be formatted. +type unexportedStringer struct { + t ptrStringer +} +type unexportedStringerOtherFields struct { + s string + t ptrStringer + S string +} + +// Issue 17798: unexported error cannot be formatted. +type unexportedError struct { + e error +} +type unexportedErrorOtherFields struct { + s string + e error + S string +} + +type errorer struct{} + +func (e errorer) Error() string { return "errorer" } + +type unexportedCustomError struct { + e errorer +} + +type errorInterface interface { + error + ExtraMethod() +} + +type unexportedErrorInterface struct { + e errorInterface +} + +func UnexportedStringerOrError() { + fmt.Printf("%s", unexportedInterface{"foo"}) // ok; prints {foo} + fmt.Printf("%s", unexportedInterface{3}) // ok; we can't see the problem + + us := unexportedStringer{} + fmt.Printf("%s", us) // ERROR "Printf format %s has arg us of wrong type .*print.unexportedStringer" + fmt.Printf("%s", &us) // ERROR "Printf format %s has arg &us of wrong type [*].*print.unexportedStringer" + + usf := unexportedStringerOtherFields{ + s: "foo", + S: "bar", + } + fmt.Printf("%s", usf) // ERROR "Printf format %s has arg usf of wrong type .*print.unexportedStringerOtherFields" + fmt.Printf("%s", &usf) // ERROR "Printf format %s has arg &usf of wrong type [*].*print.unexportedStringerOtherFields" + + ue := unexportedError{ + e: &errorer{}, + } + fmt.Printf("%s", ue) // ERROR "Printf format %s has arg ue of wrong type .*print.unexportedError" + fmt.Printf("%s", &ue) // ERROR "Printf format %s has arg &ue of wrong type [*].*print.unexportedError" + + uef := unexportedErrorOtherFields{ + s: "foo", + e: &errorer{}, + S: "bar", + } + fmt.Printf("%s", uef) // ERROR "Printf format %s has arg uef of wrong type .*print.unexportedErrorOtherFields" + fmt.Printf("%s", &uef) // ERROR "Printf format %s has arg &uef of wrong type [*].*print.unexportedErrorOtherFields" + + uce := unexportedCustomError{ + e: errorer{}, + } + fmt.Printf("%s", uce) // ERROR "Printf format %s has arg uce of wrong type .*print.unexportedCustomError" + + uei := unexportedErrorInterface{} + fmt.Printf("%s", uei) // ERROR "Printf format %s has arg uei of wrong type .*print.unexportedErrorInterface" + fmt.Println("foo\n", "bar") // not an error + + fmt.Println("foo\n") // ERROR "Println arg list ends with redundant newline" + fmt.Println("foo\\n") // not an error + fmt.Println(`foo\n`) // not an error + + intSlice := []int{3, 4} + fmt.Printf("%s", intSlice) // ERROR "Printf format %s has arg intSlice of wrong type \[\]int" + nonStringerArray := [1]unexportedStringer{{}} + fmt.Printf("%s", nonStringerArray) // ERROR "Printf format %s has arg nonStringerArray of wrong type \[1\].*print.unexportedStringer" + fmt.Printf("%s", []stringer{3, 4}) // not an error + fmt.Printf("%s", [2]stringer{3, 4}) // not an error +} + +// TODO: Disable complaint about '0' for Go 1.10. To be fixed properly in 1.11. +// See issues 23598 and 23605. +func DisableErrorForFlag0() { + fmt.Printf("%0t", true) +} + +// Issue 26486. +func dbg(format string, args ...interface{}) { + if format == "" { + format = "%v" + } + fmt.Printf(format, args...) +} + +func PointersToCompoundTypes() { + stringSlice := []string{"a", "b"} + fmt.Printf("%s", &stringSlice) // not an error + + intSlice := []int{3, 4} + fmt.Printf("%s", &intSlice) // ERROR "Printf format %s has arg &intSlice of wrong type \*\[\]int" + + stringArray := [2]string{"a", "b"} + fmt.Printf("%s", &stringArray) // not an error + + intArray := [2]int{3, 4} + fmt.Printf("%s", &intArray) // ERROR "Printf format %s has arg &intArray of wrong type \*\[2\]int" + + stringStruct := struct{ F string }{"foo"} + fmt.Printf("%s", &stringStruct) // not an error + + intStruct := struct{ F int }{3} + fmt.Printf("%s", &intStruct) // ERROR "Printf format %s has arg &intStruct of wrong type \*struct{F int}" + + stringMap := map[string]string{"foo": "bar"} + fmt.Printf("%s", &stringMap) // not an error + + intMap := map[int]int{3: 4} + fmt.Printf("%s", &intMap) // ERROR "Printf format %s has arg &intMap of wrong type \*map\[int\]int" + + type T2 struct { + X string + } + type T1 struct { + X *T2 + } + fmt.Printf("%s\n", T1{&T2{"x"}}) // ERROR "Printf format %s has arg T1{&T2{.x.}} of wrong type .*print\.T1" +} diff --git a/libgo/go/cmd/vet/testdata/src/rangeloop/rangeloop.go b/libgo/go/cmd/vet/testdata/rangeloop/rangeloop.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/rangeloop/rangeloop.go rename to libgo/go/cmd/vet/testdata/rangeloop/rangeloop.go diff --git a/libgo/go/cmd/vet/testdata/src/shift/shift.go b/libgo/go/cmd/vet/testdata/shift/shift.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/shift/shift.go rename to libgo/go/cmd/vet/testdata/shift/shift.go diff --git a/libgo/go/cmd/vet/testdata/src/print/print.go b/libgo/go/cmd/vet/testdata/src/print/print.go deleted file mode 100644 index 6bacd0fd747..00000000000 --- a/libgo/go/cmd/vet/testdata/src/print/print.go +++ /dev/null @@ -1,681 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file contains tests for the printf checker. - -package print - -import ( - "fmt" - logpkg "log" // renamed to make it harder to see - "math" - "os" - "testing" - "unsafe" // just for test case printing unsafe.Pointer - // For testing printf-like functions from external package. - // "github.com/foobar/externalprintf" -) - -func UnsafePointerPrintfTest() { - var up unsafe.Pointer - fmt.Printf("%p, %x %X", up, up, up) -} - -// Error methods that do not satisfy the Error interface and should be checked. -type errorTest1 int - -func (errorTest1) Error(...interface{}) string { - return "hi" -} - -type errorTest2 int // Analogous to testing's *T type. -func (errorTest2) Error(...interface{}) { -} - -type errorTest3 int - -func (errorTest3) Error() { // No return value. -} - -type errorTest4 int - -func (errorTest4) Error() int { // Different return type. - return 3 -} - -type errorTest5 int - -func (errorTest5) error() { // niladic; don't complain if no args (was bug) -} - -// This function never executes, but it serves as a simple test for the program. -// Test with make test. -func PrintfTests() { - var b bool - var i int - var r rune - var s string - var x float64 - var p *int - var imap map[int]int - var fslice []float64 - var c complex64 - // Some good format/argtypes - fmt.Printf("") - fmt.Printf("%b %b %b", 3, i, x) - fmt.Printf("%c %c %c %c", 3, i, 'x', r) - fmt.Printf("%d %d %d", 3, i, imap) - fmt.Printf("%e %e %e %e", 3e9, x, fslice, c) - fmt.Printf("%E %E %E %E", 3e9, x, fslice, c) - fmt.Printf("%f %f %f %f", 3e9, x, fslice, c) - fmt.Printf("%F %F %F %F", 3e9, x, fslice, c) - fmt.Printf("%g %g %g %g", 3e9, x, fslice, c) - fmt.Printf("%G %G %G %G", 3e9, x, fslice, c) - fmt.Printf("%b %b %b %b", 3e9, x, fslice, c) - fmt.Printf("%o %o", 3, i) - fmt.Printf("%p", p) - fmt.Printf("%q %q %q %q", 3, i, 'x', r) - fmt.Printf("%s %s %s", "hi", s, []byte{65}) - fmt.Printf("%t %t", true, b) - fmt.Printf("%T %T", 3, i) - fmt.Printf("%U %U", 3, i) - fmt.Printf("%v %v", 3, i) - fmt.Printf("%x %x %x %x", 3, i, "hi", s) - fmt.Printf("%X %X %X %X", 3, i, "hi", s) - fmt.Printf("%.*s %d %g", 3, "hi", 23, 2.3) - fmt.Printf("%s", &stringerv) - fmt.Printf("%v", &stringerv) - fmt.Printf("%T", &stringerv) - fmt.Printf("%s", &embeddedStringerv) - fmt.Printf("%v", &embeddedStringerv) - fmt.Printf("%T", &embeddedStringerv) - fmt.Printf("%v", notstringerv) - fmt.Printf("%T", notstringerv) - fmt.Printf("%q", stringerarrayv) - fmt.Printf("%v", stringerarrayv) - fmt.Printf("%s", stringerarrayv) - fmt.Printf("%v", notstringerarrayv) - fmt.Printf("%T", notstringerarrayv) - fmt.Printf("%d", new(fmt.Formatter)) - fmt.Printf("%*%", 2) // Ridiculous but allowed. - fmt.Printf("%s", interface{}(nil)) // Nothing useful we can say. - - fmt.Printf("%g", 1+2i) - fmt.Printf("%#e %#E %#f %#F %#g %#G", 1.2, 1.2, 1.2, 1.2, 1.2, 1.2) // OK since Go 1.9 - // Some bad format/argTypes - fmt.Printf("%b", "hi") // ERROR "Printf format %b has arg \x22hi\x22 of wrong type string" - fmt.Printf("%t", c) // ERROR "Printf format %t has arg c of wrong type complex64" - fmt.Printf("%t", 1+2i) // ERROR "Printf format %t has arg 1 \+ 2i of wrong type complex128" - fmt.Printf("%c", 2.3) // ERROR "Printf format %c has arg 2.3 of wrong type float64" - fmt.Printf("%d", 2.3) // ERROR "Printf format %d has arg 2.3 of wrong type float64" - fmt.Printf("%e", "hi") // ERROR "Printf format %e has arg \x22hi\x22 of wrong type string" - fmt.Printf("%E", true) // ERROR "Printf format %E has arg true of wrong type bool" - fmt.Printf("%f", "hi") // ERROR "Printf format %f has arg \x22hi\x22 of wrong type string" - fmt.Printf("%F", 'x') // ERROR "Printf format %F has arg 'x' of wrong type rune" - fmt.Printf("%g", "hi") // ERROR "Printf format %g has arg \x22hi\x22 of wrong type string" - fmt.Printf("%g", imap) // ERROR "Printf format %g has arg imap of wrong type map\[int\]int" - fmt.Printf("%G", i) // ERROR "Printf format %G has arg i of wrong type int" - fmt.Printf("%o", x) // ERROR "Printf format %o has arg x of wrong type float64" - fmt.Printf("%p", nil) // ERROR "Printf format %p has arg nil of wrong type untyped nil" - fmt.Printf("%p", 23) // ERROR "Printf format %p has arg 23 of wrong type int" - fmt.Printf("%q", x) // ERROR "Printf format %q has arg x of wrong type float64" - fmt.Printf("%s", b) // ERROR "Printf format %s has arg b of wrong type bool" - fmt.Printf("%s", byte(65)) // ERROR "Printf format %s has arg byte\(65\) of wrong type byte" - fmt.Printf("%t", 23) // ERROR "Printf format %t has arg 23 of wrong type int" - fmt.Printf("%U", x) // ERROR "Printf format %U has arg x of wrong type float64" - fmt.Printf("%x", nil) // ERROR "Printf format %x has arg nil of wrong type untyped nil" - fmt.Printf("%X", 2.3) // ERROR "Printf format %X has arg 2.3 of wrong type float64" - fmt.Printf("%s", stringerv) // ERROR "Printf format %s has arg stringerv of wrong type print.ptrStringer" - fmt.Printf("%t", stringerv) // ERROR "Printf format %t has arg stringerv of wrong type print.ptrStringer" - fmt.Printf("%s", embeddedStringerv) // ERROR "Printf format %s has arg embeddedStringerv of wrong type print.embeddedStringer" - fmt.Printf("%t", embeddedStringerv) // ERROR "Printf format %t has arg embeddedStringerv of wrong type print.embeddedStringer" - fmt.Printf("%q", notstringerv) // ERROR "Printf format %q has arg notstringerv of wrong type print.notstringer" - fmt.Printf("%t", notstringerv) // ERROR "Printf format %t has arg notstringerv of wrong type print.notstringer" - fmt.Printf("%t", stringerarrayv) // ERROR "Printf format %t has arg stringerarrayv of wrong type print.stringerarray" - fmt.Printf("%t", notstringerarrayv) // ERROR "Printf format %t has arg notstringerarrayv of wrong type print.notstringerarray" - fmt.Printf("%q", notstringerarrayv) // ERROR "Printf format %q has arg notstringerarrayv of wrong type print.notstringerarray" - fmt.Printf("%d", BoolFormatter(true)) // ERROR "Printf format %d has arg BoolFormatter\(true\) of wrong type print.BoolFormatter" - fmt.Printf("%z", FormatterVal(true)) // correct (the type is responsible for formatting) - fmt.Printf("%d", FormatterVal(true)) // correct (the type is responsible for formatting) - fmt.Printf("%s", nonemptyinterface) // correct (the type is responsible for formatting) - fmt.Printf("%.*s %d %6g", 3, "hi", 23, 'x') // ERROR "Printf format %6g has arg 'x' of wrong type rune" - fmt.Println() // not an error - fmt.Println("%s", "hi") // ERROR "Println call has possible formatting directive %s" - fmt.Println("%v", "hi") // ERROR "Println call has possible formatting directive %v" - fmt.Println("%T", "hi") // ERROR "Println call has possible formatting directive %T" - fmt.Println("0.0%") // correct (trailing % couldn't be a formatting directive) - fmt.Printf("%s", "hi", 3) // ERROR "Printf call needs 1 arg but has 2 args" - _ = fmt.Sprintf("%"+("s"), "hi", 3) // ERROR "Sprintf call needs 1 arg but has 2 args" - fmt.Printf("%s%%%d", "hi", 3) // correct - fmt.Printf("%08s", "woo") // correct - fmt.Printf("% 8s", "woo") // correct - fmt.Printf("%.*d", 3, 3) // correct - fmt.Printf("%.*d x", 3, 3, 3, 3) // ERROR "Printf call needs 2 args but has 4 args" - fmt.Printf("%.*d x", "hi", 3) // ERROR "Printf format %.*d uses non-int \x22hi\x22 as argument of \*" - fmt.Printf("%.*d x", i, 3) // correct - fmt.Printf("%.*d x", s, 3) // ERROR "Printf format %.\*d uses non-int s as argument of \*" - fmt.Printf("%*% x", 0.22) // ERROR "Printf format %\*% uses non-int 0.22 as argument of \*" - fmt.Printf("%q %q", multi()...) // ok - fmt.Printf("%#q", `blah`) // ok - // printf("now is the time", "buddy") // no error "printf call has arguments but no formatting directives" - Printf("now is the time", "buddy") // ERROR "Printf call has arguments but no formatting directives" - Printf("hi") // ok - const format = "%s %s\n" - Printf(format, "hi", "there") - Printf(format, "hi") // ERROR "Printf format %s reads arg #2, but call has 1 arg$" - Printf("%s %d %.3v %q", "str", 4) // ERROR "Printf format %.3v reads arg #3, but call has 2 args" - f := new(ptrStringer) - f.Warn(0, "%s", "hello", 3) // ERROR "Warn call has possible formatting directive %s" - f.Warnf(0, "%s", "hello", 3) // ERROR "Warnf call needs 1 arg but has 2 args" - f.Warnf(0, "%r", "hello") // ERROR "Warnf format %r has unknown verb r" - f.Warnf(0, "%#s", "hello") // ERROR "Warnf format %#s has unrecognized flag #" - f.Warn2(0, "%s", "hello", 3) // ERROR "Warn2 call has possible formatting directive %s" - f.Warnf2(0, "%s", "hello", 3) // ERROR "Warnf2 call needs 1 arg but has 2 args" - f.Warnf2(0, "%r", "hello") // ERROR "Warnf2 format %r has unknown verb r" - f.Warnf2(0, "%#s", "hello") // ERROR "Warnf2 format %#s has unrecognized flag #" - f.Wrap(0, "%s", "hello", 3) // ERROR "Wrap call has possible formatting directive %s" - f.Wrapf(0, "%s", "hello", 3) // ERROR "Wrapf call needs 1 arg but has 2 args" - f.Wrapf(0, "%r", "hello") // ERROR "Wrapf format %r has unknown verb r" - f.Wrapf(0, "%#s", "hello") // ERROR "Wrapf format %#s has unrecognized flag #" - f.Wrap2(0, "%s", "hello", 3) // ERROR "Wrap2 call has possible formatting directive %s" - f.Wrapf2(0, "%s", "hello", 3) // ERROR "Wrapf2 call needs 1 arg but has 2 args" - f.Wrapf2(0, "%r", "hello") // ERROR "Wrapf2 format %r has unknown verb r" - f.Wrapf2(0, "%#s", "hello") // ERROR "Wrapf2 format %#s has unrecognized flag #" - fmt.Printf("%#s", FormatterVal(true)) // correct (the type is responsible for formatting) - Printf("d%", 2) // ERROR "Printf format % is missing verb at end of string" - Printf("%d", percentDV) - Printf("%d", &percentDV) - Printf("%d", notPercentDV) // ERROR "Printf format %d has arg notPercentDV of wrong type print.notPercentDStruct" - Printf("%d", ¬PercentDV) // ERROR "Printf format %d has arg ¬PercentDV of wrong type \*print.notPercentDStruct" - Printf("%p", ¬PercentDV) // Works regardless: we print it as a pointer. - Printf("%q", &percentDV) // ERROR "Printf format %q has arg &percentDV of wrong type \*print.percentDStruct" - Printf("%s", percentSV) - Printf("%s", &percentSV) - // Good argument reorderings. - Printf("%[1]d", 3) - Printf("%[1]*d", 3, 1) - Printf("%[2]*[1]d", 1, 3) - Printf("%[2]*.[1]*[3]d", 2, 3, 4) - fmt.Fprintf(os.Stderr, "%[2]*.[1]*[3]d", 2, 3, 4) // Use Fprintf to make sure we count arguments correctly. - // Bad argument reorderings. - Printf("%[xd", 3) // ERROR "Printf format %\[xd is missing closing \]" - Printf("%[x]d x", 3) // ERROR "Printf format has invalid argument index \[x\]" - Printf("%[3]*s x", "hi", 2) // ERROR "Printf format has invalid argument index \[3\]" - _ = fmt.Sprintf("%[3]d x", 2) // ERROR "Sprintf format has invalid argument index \[3\]" - Printf("%[2]*.[1]*[3]d x", 2, "hi", 4) // ERROR "Printf format %\[2]\*\.\[1\]\*\[3\]d uses non-int \x22hi\x22 as argument of \*" - Printf("%[0]s x", "arg1") // ERROR "Printf format has invalid argument index \[0\]" - Printf("%[0]d x", 1) // ERROR "Printf format has invalid argument index \[0\]" - // Something that satisfies the error interface. - var e error - fmt.Println(e.Error()) // ok - // Something that looks like an error interface but isn't, such as the (*T).Error method - // in the testing package. - var et1 *testing.T - et1.Error() // ok - et1.Error("hi") // ok - et1.Error("%d", 3) // ERROR "Error call has possible formatting directive %d" - var et3 errorTest3 - et3.Error() // ok, not an error method. - var et4 errorTest4 - et4.Error() // ok, not an error method. - var et5 errorTest5 - et5.error() // ok, not an error method. - // Interfaces can be used with any verb. - var iface interface { - ToTheMadness() bool // Method ToTheMadness usually returns false - } - fmt.Printf("%f", iface) // ok: fmt treats interfaces as transparent and iface may well have a float concrete type - // Can't print a function. - Printf("%d", someFunction) // ERROR "Printf format %d arg someFunction is a func value, not called" - Printf("%v", someFunction) // ERROR "Printf format %v arg someFunction is a func value, not called" - Println(someFunction) // ERROR "Println arg someFunction is a func value, not called" - Printf("%p", someFunction) // ok: maybe someone wants to see the pointer - Printf("%T", someFunction) // ok: maybe someone wants to see the type - // Bug: used to recur forever. - Printf("%p %x", recursiveStructV, recursiveStructV.next) - Printf("%p %x", recursiveStruct1V, recursiveStruct1V.next) // ERROR "Printf format %x has arg recursiveStruct1V\.next of wrong type \*print\.RecursiveStruct2" - Printf("%p %x", recursiveSliceV, recursiveSliceV) - Printf("%p %x", recursiveMapV, recursiveMapV) - // Special handling for Log. - math.Log(3) // OK - var t *testing.T - t.Log("%d", 3) // ERROR "Log call has possible formatting directive %d" - t.Logf("%d", 3) - t.Logf("%d", "hi") // ERROR "Logf format %d has arg \x22hi\x22 of wrong type string" - - Errorf(1, "%d", 3) // OK - Errorf(1, "%d", "hi") // ERROR "Errorf format %d has arg \x22hi\x22 of wrong type string" - - // Multiple string arguments before variadic args - errorf("WARNING", "foobar") // OK - errorf("INFO", "s=%s, n=%d", "foo", 1) // OK - errorf("ERROR", "%d") // ERROR "errorf format %d reads arg #1, but call has 0 args" - - // Printf from external package - // externalprintf.Printf("%d", 42) // OK - // externalprintf.Printf("foobar") // OK - // level := 123 - // externalprintf.Logf(level, "%d", 42) // OK - // externalprintf.Errorf(level, level, "foo %q bar", "foobar") // OK - // externalprintf.Logf(level, "%d") // no error "Logf format %d reads arg #1, but call has 0 args" - // var formatStr = "%s %s" - // externalprintf.Sprintf(formatStr, "a", "b") // OK - // externalprintf.Logf(level, formatStr, "a", "b") // OK - - // user-defined Println-like functions - ss := &someStruct{} - ss.Log(someFunction, "foo") // OK - ss.Error(someFunction, someFunction) // OK - ss.Println() // OK - ss.Println(1.234, "foo") // OK - ss.Println(1, someFunction) // no error "Println arg someFunction is a func value, not called" - ss.log(someFunction) // OK - ss.log(someFunction, "bar", 1.33) // OK - ss.log(someFunction, someFunction) // no error "log arg someFunction is a func value, not called" - - // indexed arguments - Printf("%d %[3]d %d %[2]d x", 1, 2, 3, 4) // OK - Printf("%d %[0]d %d %[2]d x", 1, 2, 3, 4) // ERROR "Printf format has invalid argument index \[0\]" - Printf("%d %[3]d %d %[-2]d x", 1, 2, 3, 4) // ERROR "Printf format has invalid argument index \[-2\]" - Printf("%d %[3]d %d %[2234234234234]d x", 1, 2, 3, 4) // ERROR "Printf format has invalid argument index \[2234234234234\]" - Printf("%d %[3]d %-10d %[2]d x", 1, 2, 3) // ERROR "Printf format %-10d reads arg #4, but call has 3 args" - Printf("%[1][3]d x", 1, 2) // ERROR "Printf format %\[1\]\[ has unknown verb \[" - Printf("%[1]d x", 1, 2) // OK - Printf("%d %[3]d %d %[2]d x", 1, 2, 3, 4, 5) // OK - - // wrote Println but meant Fprintln - Printf("%p\n", os.Stdout) // OK - Println(os.Stdout, "hello") // ERROR "Println does not take io.Writer but has first arg os.Stdout" - - Printf(someString(), "hello") // OK - - // Printf wrappers in package log should be detected automatically - logpkg.Fatal("%d", 1) // ERROR "Fatal call has possible formatting directive %d" - logpkg.Fatalf("%d", "x") // ERROR "Fatalf format %d has arg \x22x\x22 of wrong type string" - logpkg.Fatalln("%d", 1) // ERROR "Fatalln call has possible formatting directive %d" - logpkg.Panic("%d", 1) // ERROR "Panic call has possible formatting directive %d" - logpkg.Panicf("%d", "x") // ERROR "Panicf format %d has arg \x22x\x22 of wrong type string" - logpkg.Panicln("%d", 1) // ERROR "Panicln call has possible formatting directive %d" - logpkg.Print("%d", 1) // ERROR "Print call has possible formatting directive %d" - logpkg.Printf("%d", "x") // ERROR "Printf format %d has arg \x22x\x22 of wrong type string" - logpkg.Println("%d", 1) // ERROR "Println call has possible formatting directive %d" - - // Methods too. - var l *logpkg.Logger - l.Fatal("%d", 1) // ERROR "Fatal call has possible formatting directive %d" - l.Fatalf("%d", "x") // ERROR "Fatalf format %d has arg \x22x\x22 of wrong type string" - l.Fatalln("%d", 1) // ERROR "Fatalln call has possible formatting directive %d" - l.Panic("%d", 1) // ERROR "Panic call has possible formatting directive %d" - l.Panicf("%d", "x") // ERROR "Panicf format %d has arg \x22x\x22 of wrong type string" - l.Panicln("%d", 1) // ERROR "Panicln call has possible formatting directive %d" - l.Print("%d", 1) // ERROR "Print call has possible formatting directive %d" - l.Printf("%d", "x") // ERROR "Printf format %d has arg \x22x\x22 of wrong type string" - l.Println("%d", 1) // ERROR "Println call has possible formatting directive %d" - - // Issue 26486 - dbg("", 1) // no error "call has arguments but no formatting directive" -} - -func someString() string { return "X" } - -type someStruct struct{} - -// Log is non-variadic user-define Println-like function. -// Calls to this func must be skipped when checking -// for Println-like arguments. -func (ss *someStruct) Log(f func(), s string) {} - -// Error is variadic user-define Println-like function. -// Calls to this func mustn't be checked for Println-like arguments, -// since variadic arguments type isn't interface{}. -func (ss *someStruct) Error(args ...func()) {} - -// Println is variadic user-defined Println-like function. -// Calls to this func must be checked for Println-like arguments. -func (ss *someStruct) Println(args ...interface{}) {} - -// log is variadic user-defined Println-like function. -// Calls to this func must be checked for Println-like arguments. -func (ss *someStruct) log(f func(), args ...interface{}) {} - -// A function we use as a function value; it has no other purpose. -func someFunction() {} - -// Printf is used by the test so we must declare it. -func Printf(format string, args ...interface{}) { - fmt.Printf(format, args...) -} - -// Println is used by the test so we must declare it. -func Println(args ...interface{}) { - fmt.Println(args...) -} - -// printf is used by the test so we must declare it. -func printf(format string, args ...interface{}) { - fmt.Printf(format, args...) -} - -// Errorf is used by the test for a case in which the first parameter -// is not a format string. -func Errorf(i int, format string, args ...interface{}) { - _ = fmt.Errorf(format, args...) -} - -// errorf is used by the test for a case in which the function accepts multiple -// string parameters before variadic arguments -func errorf(level, format string, args ...interface{}) { - _ = fmt.Errorf(format, args...) -} - -// multi is used by the test. -func multi() []interface{} { - panic("don't call - testing only") -} - -type stringer int - -func (stringer) String() string { return "string" } - -type ptrStringer float64 - -var stringerv ptrStringer - -func (*ptrStringer) String() string { - return "string" -} - -func (p *ptrStringer) Warn2(x int, args ...interface{}) string { - return p.Warn(x, args...) -} - -func (p *ptrStringer) Warnf2(x int, format string, args ...interface{}) string { - return p.Warnf(x, format, args...) -} - -func (*ptrStringer) Warn(x int, args ...interface{}) string { - return "warn" -} - -func (*ptrStringer) Warnf(x int, format string, args ...interface{}) string { - return "warnf" -} - -func (p *ptrStringer) Wrap2(x int, args ...interface{}) string { - return p.Wrap(x, args...) -} - -func (p *ptrStringer) Wrapf2(x int, format string, args ...interface{}) string { - return p.Wrapf(x, format, args...) -} - -func (*ptrStringer) Wrap(x int, args ...interface{}) string { - return fmt.Sprint(args...) -} - -func (*ptrStringer) Wrapf(x int, format string, args ...interface{}) string { - return fmt.Sprintf(format, args...) -} - -func (*ptrStringer) BadWrap(x int, args ...interface{}) string { - return fmt.Sprint(args) // ERROR "missing ... in args forwarded to print-like function" -} - -func (*ptrStringer) BadWrapf(x int, format string, args ...interface{}) string { - return fmt.Sprintf(format, args) // ERROR "missing ... in args forwarded to printf-like function" -} - -func (*ptrStringer) WrapfFalsePositive(x int, arg1 string, arg2 ...interface{}) string { - return fmt.Sprintf("%s %v", arg1, arg2) -} - -type embeddedStringer struct { - foo string - ptrStringer - bar int -} - -var embeddedStringerv embeddedStringer - -type notstringer struct { - f float64 -} - -var notstringerv notstringer - -type stringerarray [4]float64 - -func (stringerarray) String() string { - return "string" -} - -var stringerarrayv stringerarray - -type notstringerarray [4]float64 - -var notstringerarrayv notstringerarray - -var nonemptyinterface = interface { - f() -}(nil) - -// A data type we can print with "%d". -type percentDStruct struct { - a int - b []byte - c *float64 -} - -var percentDV percentDStruct - -// A data type we cannot print correctly with "%d". -type notPercentDStruct struct { - a int - b []byte - c bool -} - -var notPercentDV notPercentDStruct - -// A data type we can print with "%s". -type percentSStruct struct { - a string - b []byte - C stringerarray -} - -var percentSV percentSStruct - -type recursiveStringer int - -func (s recursiveStringer) String() string { - _ = fmt.Sprintf("%d", s) - _ = fmt.Sprintf("%#v", s) - _ = fmt.Sprintf("%v", s) // ERROR "Sprintf format %v with arg s causes recursive String method call" - _ = fmt.Sprintf("%v", &s) // ERROR "Sprintf format %v with arg &s causes recursive String method call" - _ = fmt.Sprintf("%T", s) // ok; does not recursively call String - return fmt.Sprintln(s) // ERROR "Sprintln arg s causes recursive call to String method" -} - -type recursivePtrStringer int - -func (p *recursivePtrStringer) String() string { - _ = fmt.Sprintf("%v", *p) - _ = fmt.Sprint(&p) // ok; prints address - return fmt.Sprintln(p) // ERROR "Sprintln arg p causes recursive call to String method" -} - -type BoolFormatter bool - -func (*BoolFormatter) Format(fmt.State, rune) { -} - -// Formatter with value receiver -type FormatterVal bool - -func (FormatterVal) Format(fmt.State, rune) { -} - -type RecursiveSlice []RecursiveSlice - -var recursiveSliceV = &RecursiveSlice{} - -type RecursiveMap map[int]RecursiveMap - -var recursiveMapV = make(RecursiveMap) - -type RecursiveStruct struct { - next *RecursiveStruct -} - -var recursiveStructV = &RecursiveStruct{} - -type RecursiveStruct1 struct { - next *RecursiveStruct2 -} - -type RecursiveStruct2 struct { - next *RecursiveStruct1 -} - -var recursiveStruct1V = &RecursiveStruct1{} - -type unexportedInterface struct { - f interface{} -} - -// Issue 17798: unexported ptrStringer cannot be formatted. -type unexportedStringer struct { - t ptrStringer -} -type unexportedStringerOtherFields struct { - s string - t ptrStringer - S string -} - -// Issue 17798: unexported error cannot be formatted. -type unexportedError struct { - e error -} -type unexportedErrorOtherFields struct { - s string - e error - S string -} - -type errorer struct{} - -func (e errorer) Error() string { return "errorer" } - -type unexportedCustomError struct { - e errorer -} - -type errorInterface interface { - error - ExtraMethod() -} - -type unexportedErrorInterface struct { - e errorInterface -} - -func UnexportedStringerOrError() { - fmt.Printf("%s", unexportedInterface{"foo"}) // ok; prints {foo} - fmt.Printf("%s", unexportedInterface{3}) // ok; we can't see the problem - - us := unexportedStringer{} - fmt.Printf("%s", us) // ERROR "Printf format %s has arg us of wrong type print.unexportedStringer" - fmt.Printf("%s", &us) // ERROR "Printf format %s has arg &us of wrong type [*]print.unexportedStringer" - - usf := unexportedStringerOtherFields{ - s: "foo", - S: "bar", - } - fmt.Printf("%s", usf) // ERROR "Printf format %s has arg usf of wrong type print.unexportedStringerOtherFields" - fmt.Printf("%s", &usf) // ERROR "Printf format %s has arg &usf of wrong type [*]print.unexportedStringerOtherFields" - - ue := unexportedError{ - e: &errorer{}, - } - fmt.Printf("%s", ue) // ERROR "Printf format %s has arg ue of wrong type print.unexportedError" - fmt.Printf("%s", &ue) // ERROR "Printf format %s has arg &ue of wrong type [*]print.unexportedError" - - uef := unexportedErrorOtherFields{ - s: "foo", - e: &errorer{}, - S: "bar", - } - fmt.Printf("%s", uef) // ERROR "Printf format %s has arg uef of wrong type print.unexportedErrorOtherFields" - fmt.Printf("%s", &uef) // ERROR "Printf format %s has arg &uef of wrong type [*]print.unexportedErrorOtherFields" - - uce := unexportedCustomError{ - e: errorer{}, - } - fmt.Printf("%s", uce) // ERROR "Printf format %s has arg uce of wrong type print.unexportedCustomError" - - uei := unexportedErrorInterface{} - fmt.Printf("%s", uei) // ERROR "Printf format %s has arg uei of wrong type print.unexportedErrorInterface" - fmt.Println("foo\n", "bar") // not an error - - fmt.Println("foo\n") // ERROR "Println arg list ends with redundant newline" - fmt.Println("foo\\n") // not an error - fmt.Println(`foo\n`) // not an error - - intSlice := []int{3, 4} - fmt.Printf("%s", intSlice) // ERROR "Printf format %s has arg intSlice of wrong type \[\]int" - nonStringerArray := [1]unexportedStringer{{}} - fmt.Printf("%s", nonStringerArray) // ERROR "Printf format %s has arg nonStringerArray of wrong type \[1\]print.unexportedStringer" - fmt.Printf("%s", []stringer{3, 4}) // not an error - fmt.Printf("%s", [2]stringer{3, 4}) // not an error -} - -// TODO: Disable complaint about '0' for Go 1.10. To be fixed properly in 1.11. -// See issues 23598 and 23605. -func DisableErrorForFlag0() { - fmt.Printf("%0t", true) -} - -// Issue 26486. -func dbg(format string, args ...interface{}) { - if format == "" { - format = "%v" - } - fmt.Printf(format, args...) -} - -func PointersToCompoundTypes() { - stringSlice := []string{"a", "b"} - fmt.Printf("%s", &stringSlice) // not an error - - intSlice := []int{3, 4} - fmt.Printf("%s", &intSlice) // ERROR "Printf format %s has arg &intSlice of wrong type \*\[\]int" - - stringArray := [2]string{"a", "b"} - fmt.Printf("%s", &stringArray) // not an error - - intArray := [2]int{3, 4} - fmt.Printf("%s", &intArray) // ERROR "Printf format %s has arg &intArray of wrong type \*\[2\]int" - - stringStruct := struct{ F string }{"foo"} - fmt.Printf("%s", &stringStruct) // not an error - - intStruct := struct{ F int }{3} - fmt.Printf("%s", &intStruct) // ERROR "Printf format %s has arg &intStruct of wrong type \*struct{F int}" - - stringMap := map[string]string{"foo": "bar"} - fmt.Printf("%s", &stringMap) // not an error - - intMap := map[int]int{3: 4} - fmt.Printf("%s", &intMap) // ERROR "Printf format %s has arg &intMap of wrong type \*map\[int\]int" - - type T2 struct { - X string - } - type T1 struct { - X *T2 - } - fmt.Printf("%s\n", T1{&T2{"x"}}) // ERROR "Printf format %s has arg T1{&T2{.x.}} of wrong type print\.T1" -} diff --git a/libgo/go/cmd/vet/testdata/src/structtag/structtag.go b/libgo/go/cmd/vet/testdata/structtag/structtag.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/structtag/structtag.go rename to libgo/go/cmd/vet/testdata/structtag/structtag.go diff --git a/libgo/go/cmd/vet/testdata/src/tagtest/file1.go b/libgo/go/cmd/vet/testdata/tagtest/file1.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/tagtest/file1.go rename to libgo/go/cmd/vet/testdata/tagtest/file1.go diff --git a/libgo/go/cmd/vet/testdata/src/tagtest/file2.go b/libgo/go/cmd/vet/testdata/tagtest/file2.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/tagtest/file2.go rename to libgo/go/cmd/vet/testdata/tagtest/file2.go diff --git a/libgo/go/cmd/vet/testdata/src/testingpkg/tests.go b/libgo/go/cmd/vet/testdata/testingpkg/tests.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/testingpkg/tests.go rename to libgo/go/cmd/vet/testdata/testingpkg/tests.go diff --git a/libgo/go/cmd/vet/testdata/src/testingpkg/tests_test.go b/libgo/go/cmd/vet/testdata/testingpkg/tests_test.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/testingpkg/tests_test.go rename to libgo/go/cmd/vet/testdata/testingpkg/tests_test.go diff --git a/libgo/go/cmd/vet/testdata/src/unmarshal/unmarshal.go b/libgo/go/cmd/vet/testdata/unmarshal/unmarshal.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/unmarshal/unmarshal.go rename to libgo/go/cmd/vet/testdata/unmarshal/unmarshal.go diff --git a/libgo/go/cmd/vet/testdata/src/unsafeptr/unsafeptr.go b/libgo/go/cmd/vet/testdata/unsafeptr/unsafeptr.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/unsafeptr/unsafeptr.go rename to libgo/go/cmd/vet/testdata/unsafeptr/unsafeptr.go diff --git a/libgo/go/cmd/vet/testdata/src/unused/unused.go b/libgo/go/cmd/vet/testdata/unused/unused.go similarity index 100% rename from libgo/go/cmd/vet/testdata/src/unused/unused.go rename to libgo/go/cmd/vet/testdata/unused/unused.go diff --git a/libgo/go/cmd/vet/vet_test.go b/libgo/go/cmd/vet/vet_test.go index 1c7b8625f35..66732ad6f64 100644 --- a/libgo/go/cmd/vet/vet_test.go +++ b/libgo/go/cmd/vet/vet_test.go @@ -13,6 +13,7 @@ import ( "log" "os" "os/exec" + "path" "path/filepath" "regexp" "runtime" @@ -22,16 +23,25 @@ import ( "testing" ) -const ( - dataDir = "testdata" - binary = "./testvet.exe" -) +const dataDir = "testdata" + +var binary string // We implement TestMain so remove the test binary when all is done. func TestMain(m *testing.M) { - result := m.Run() - os.Remove(binary) - os.Exit(result) + os.Exit(testMain(m)) +} + +func testMain(m *testing.M) int { + dir, err := ioutil.TempDir("", "vet_test") + if err != nil { + fmt.Fprintln(os.Stderr, err) + return 1 + } + defer os.RemoveAll(dir) + binary = filepath.Join(dir, "testvet.exe") + + return m.Run() } var ( @@ -60,14 +70,9 @@ func Build(t *testing.T) { built = true } -func vetCmd(t *testing.T, args ...string) *exec.Cmd { - cmd := exec.Command(testenv.GoToolPath(t), "vet", "-vettool="+binary) - cmd.Args = append(cmd.Args, args...) - testdata, err := filepath.Abs("testdata") - if err != nil { - t.Fatal(err) - } - cmd.Env = append(os.Environ(), "GOPATH="+testdata) +func vetCmd(t *testing.T, arg, pkg string) *exec.Cmd { + cmd := exec.Command(testenv.GoToolPath(t), "vet", "-vettool="+binary, arg, path.Join("cmd/vet/testdata", pkg)) + cmd.Env = os.Environ() return cmd } @@ -117,7 +122,7 @@ func TestVet(t *testing.T) { cmd.Env = append(cmd.Env, "GOOS=linux", "GOARCH=amd64") } - dir := filepath.Join("testdata/src", pkg) + dir := filepath.Join("testdata", pkg) gos, err := filepath.Glob(filepath.Join(dir, "*.go")) if err != nil { t.Fatal(err) diff --git a/libgo/go/compress/flate/deflate_test.go b/libgo/go/compress/flate/deflate_test.go index 034040e56de..4288f62a8d1 100644 --- a/libgo/go/compress/flate/deflate_test.go +++ b/libgo/go/compress/flate/deflate_test.go @@ -161,7 +161,7 @@ func TestVeryLongSparseChunk(t *testing.T) { t.Errorf("NewWriter: %v", err) return } - if _, err = io.Copy(w, &sparseReader{l: 23E8}); err != nil { + if _, err = io.Copy(w, &sparseReader{l: 23e8}); err != nil { t.Errorf("Compress failed: %v", err) return } @@ -345,6 +345,9 @@ func testToFromWithLimit(t *testing.T, input []byte, name string, limit [11]int) func TestDeflateInflate(t *testing.T) { t.Parallel() for i, h := range deflateInflateTests { + if testing.Short() && len(h.in) > 10000 { + continue + } testToFromWithLimit(t, h.in, fmt.Sprintf("#%d", i), [11]int{}) } } @@ -591,6 +594,9 @@ func TestBestSpeed(t *testing.T) { } for i, tc := range testCases { + if i >= 3 && testing.Short() { + break + } for _, firstN := range []int{1, 65534, 65535, 65536, 65537, 131072} { tc[0] = firstN outer: diff --git a/libgo/go/compress/flate/huffman_bit_writer.go b/libgo/go/compress/flate/huffman_bit_writer.go index f42a921e674..3e19061f8b5 100644 --- a/libgo/go/compress/flate/huffman_bit_writer.go +++ b/libgo/go/compress/flate/huffman_bit_writer.go @@ -609,10 +609,10 @@ func (w *huffmanBitWriter) writeTokens(tokens []token, leCodes, oeCodes []hcode) var huffOffset *huffmanEncoder func init() { - w := newHuffmanBitWriter(nil) - w.offsetFreq[0] = 1 + offsetFreq := make([]int32, offsetCodeCount) + offsetFreq[0] = 1 huffOffset = newHuffmanEncoder(offsetCodeCount) - huffOffset.generate(w.offsetFreq, 15) + huffOffset.generate(offsetFreq, 15) } // writeBlockHuff encodes a block of bytes as either diff --git a/libgo/go/compress/gzip/gunzip.go b/libgo/go/compress/gzip/gunzip.go index 85d52e85009..924bce10b7c 100644 --- a/libgo/go/compress/gzip/gunzip.go +++ b/libgo/go/compress/gzip/gunzip.go @@ -126,8 +126,8 @@ func (z *Reader) Reset(r io.Reader) error { // can be useful when reading file formats that distinguish individual gzip // data streams or mix gzip data streams with other data streams. // In this mode, when the Reader reaches the end of the data stream, -// Read returns io.EOF. If the underlying reader implements io.ByteReader, -// it will be left positioned just after the gzip stream. +// Read returns io.EOF. The underlying reader must implement io.ByteReader +// in order to be left positioned just after the gzip stream. // To start the next stream, call z.Reset(r) followed by z.Multistream(false). // If there is no next stream, z.Reset(r) will return io.EOF. func (z *Reader) Multistream(ok bool) { diff --git a/libgo/go/compress/gzip/gzip_test.go b/libgo/go/compress/gzip/gzip_test.go index e16aba1572d..f18c5cb4547 100644 --- a/libgo/go/compress/gzip/gzip_test.go +++ b/libgo/go/compress/gzip/gzip_test.go @@ -214,6 +214,9 @@ func TestConcat(t *testing.T) { w.Close() r, err := NewReader(&buf) + if err != nil { + t.Fatal(err) + } data, err := ioutil.ReadAll(r) if string(data) != "hello world\n" || err != nil { t.Fatalf("ReadAll = %q, %v, want %q, nil", data, err, "hello world") diff --git a/libgo/go/container/ring/ring_test.go b/libgo/go/container/ring/ring_test.go index 552f0e24b55..41d18abf8b6 100644 --- a/libgo/go/container/ring/ring_test.go +++ b/libgo/go/container/ring/ring_test.go @@ -179,7 +179,7 @@ func TestLink2(t *testing.T) { func TestLink3(t *testing.T) { var r Ring n := 1 - for i := 1; i < 100; i++ { + for i := 1; i < 10; i++ { n += i verify(t, r.Link(New(i)), n, -1) } diff --git a/libgo/go/context/context.go b/libgo/go/context/context.go index 21a40d59477..05d01d0294a 100644 --- a/libgo/go/context/context.go +++ b/libgo/go/context/context.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package context defines the Context type, which carries deadlines, -// cancelation signals, and other request-scoped values across API boundaries +// cancellation signals, and other request-scoped values across API boundaries // and between processes. // // Incoming requests to a server should create a Context, and outgoing @@ -49,13 +49,13 @@ package context import ( "errors" - "fmt" - "reflect" + "internal/oserror" + "internal/reflectlite" "sync" "time" ) -// A Context carries a deadline, a cancelation signal, and other values across +// A Context carries a deadline, a cancellation signal, and other values across // API boundaries. // // Context's methods may be called by multiple goroutines simultaneously. @@ -93,7 +93,7 @@ type Context interface { // } // // See https://blog.golang.org/pipelines for more examples of how to use - // a Done channel for cancelation. + // a Done channel for cancellation. Done() <-chan struct{} // If Done is not yet closed, Err returns nil. @@ -163,6 +163,9 @@ type deadlineExceededError struct{} func (deadlineExceededError) Error() string { return "context deadline exceeded" } func (deadlineExceededError) Timeout() bool { return true } func (deadlineExceededError) Temporary() bool { return true } +func (deadlineExceededError) Is(target error) bool { + return target == oserror.ErrTimeout || target == oserror.ErrTemporary +} // An emptyCtx is never canceled, has no values, and has no deadline. It is not // struct{}, since vars of this type must have distinct addresses. @@ -217,6 +220,7 @@ func TODO() Context { // A CancelFunc tells an operation to abandon its work. // A CancelFunc does not wait for the work to stop. +// A CancelFunc may be called by multiple goroutines simultaneously. // After the first call, subsequent calls to a CancelFunc do nothing. type CancelFunc func() @@ -338,8 +342,19 @@ func (c *cancelCtx) Err() error { return err } +type stringer interface { + String() string +} + +func contextName(c Context) string { + if s, ok := c.(stringer); ok { + return s.String() + } + return reflectlite.TypeOf(c).String() +} + func (c *cancelCtx) String() string { - return fmt.Sprintf("%v.WithCancel", c.Context) + return contextName(c.Context) + ".WithCancel" } // cancel closes c.done, cancels each of c's children, and, if @@ -420,7 +435,9 @@ func (c *timerCtx) Deadline() (deadline time.Time, ok bool) { } func (c *timerCtx) String() string { - return fmt.Sprintf("%v.WithDeadline(%s [%s])", c.cancelCtx.Context, c.deadline, time.Until(c.deadline)) + return contextName(c.cancelCtx.Context) + ".WithDeadline(" + + c.deadline.String() + " [" + + time.Until(c.deadline).String() + "])" } func (c *timerCtx) cancel(removeFromParent bool, err error) { @@ -468,7 +485,7 @@ func WithValue(parent Context, key, val interface{}) Context { if key == nil { panic("nil key") } - if !reflect.TypeOf(key).Comparable() { + if !reflectlite.TypeOf(key).Comparable() { panic("key is not comparable") } return &valueCtx{parent, key, val} @@ -481,8 +498,23 @@ type valueCtx struct { key, val interface{} } +// stringify tries a bit to stringify v, without using fmt, since we don't +// want context depending on the unicode tables. This is only used by +// *valueCtx.String(). +func stringify(v interface{}) string { + switch s := v.(type) { + case stringer: + return s.String() + case string: + return s + } + return "" +} + func (c *valueCtx) String() string { - return fmt.Sprintf("%v.WithValue(%#v, %#v)", c.Context, c.key, c.val) + return contextName(c.Context) + ".WithValue(type " + + reflectlite.TypeOf(c.key).String() + + ", val " + stringify(c.val) + ")" } func (c *valueCtx) Value(key interface{}) interface{} { diff --git a/libgo/go/context/context_test.go b/libgo/go/context/context_test.go index 548476f290d..96ad14627c3 100644 --- a/libgo/go/context/context_test.go +++ b/libgo/go/context/context_test.go @@ -5,8 +5,10 @@ package context import ( + "errors" "fmt" "math/rand" + "os" "runtime" "strings" "sync" @@ -94,7 +96,7 @@ func XTestWithCancel(t testingT) { } cancel() - time.Sleep(100 * time.Millisecond) // let cancelation propagate + time.Sleep(100 * time.Millisecond) // let cancellation propagate for i, c := range contexts { select { @@ -306,7 +308,7 @@ func XTestCanceledTimeout(t testingT) { o := otherContext{c} c, cancel := WithTimeout(o, 2*time.Second) cancel() - time.Sleep(100 * time.Millisecond) // let cancelation propagate + time.Sleep(100 * time.Millisecond) // let cancellation propagate select { case <-c.Done(): default: @@ -343,7 +345,7 @@ func XTestValues(t testingT) { c1 := WithValue(Background(), k1, "c1k1") check(c1, "c1", "c1k1", "", "") - if got, want := fmt.Sprint(c1), `context.Background.WithValue(1, "c1k1")`; got != want { + if got, want := fmt.Sprint(c1), `context.Background.WithValue(type context.key1, val c1k1)`; got != want { t.Errorf("c.String() = %q want %q", got, want) } @@ -647,4 +649,7 @@ func XTestDeadlineExceededSupportsTimeout(t testingT) { if !i.Timeout() { t.Fatal("wrong value for timeout") } + if !errors.Is(DeadlineExceeded, os.ErrTimeout) { + t.Fatal("errors.Is(DeadlineExceeded, os.ErrTimeout) = false, want true") + } } diff --git a/libgo/go/context/example_test.go b/libgo/go/context/example_test.go index 2b28b577042..b91a8acef3a 100644 --- a/libgo/go/context/example_test.go +++ b/libgo/go/context/example_test.go @@ -59,7 +59,7 @@ func ExampleWithDeadline() { ctx, cancel := context.WithDeadline(context.Background(), d) // Even though ctx will be expired, it is good practice to call its - // cancelation function in any case. Failure to do so may keep the + // cancellation function in any case. Failure to do so may keep the // context and its parent alive longer than necessary. defer cancel() diff --git a/libgo/go/crypto/cipher/cfb_test.go b/libgo/go/crypto/cipher/cfb_test.go index ecb716df015..72f62e69d3d 100644 --- a/libgo/go/crypto/cipher/cfb_test.go +++ b/libgo/go/crypto/cipher/cfb_test.go @@ -81,7 +81,7 @@ func TestCFBVectors(t *testing.T) { plaintextCopy := make([]byte, len(ciphertext)) cfbdec.XORKeyStream(plaintextCopy, ciphertext) - if !bytes.Equal(plaintextCopy, plaintextCopy) { + if !bytes.Equal(plaintextCopy, plaintext) { t.Errorf("#%d: wrong plaintext: got %x, expected %x", i, plaintextCopy, plaintext) } } diff --git a/libgo/go/crypto/cipher/xor_test.go b/libgo/go/crypto/cipher/xor_test.go index 24877efc367..4f829e94619 100644 --- a/libgo/go/crypto/cipher/xor_test.go +++ b/libgo/go/crypto/cipher/xor_test.go @@ -15,6 +15,9 @@ import ( func TestXOR(t *testing.T) { for j := 1; j <= 1024; j++ { + if testing.Short() && j > 16 { + break + } for alignP := 0; alignP < 2; alignP++ { for alignQ := 0; alignQ < 2; alignQ++ { for alignD := 0; alignD < 2; alignD++ { diff --git a/libgo/go/crypto/des/block.go b/libgo/go/crypto/des/block.go index 21e6d4e82f6..3e3fe06c023 100644 --- a/libgo/go/crypto/des/block.go +++ b/libgo/go/crypto/des/block.go @@ -4,7 +4,10 @@ package des -import "encoding/binary" +import ( + "encoding/binary" + "sync" +) func cryptBlock(subkeys []uint64, dst, src []byte, decrypt bool) { b := binary.BigEndian.Uint64(src) @@ -42,7 +45,8 @@ func decryptBlock(subkeys []uint64, dst, src []byte) { cryptBlock(subkeys, dst, src, true) } -// DES Feistel function +// DES Feistel function. feistelBox must be initialized via +// feistelBoxOnce.Do(initFeistelBox) first. func feistel(l, r uint32, k0, k1 uint64) (lout, rout uint32) { var t uint32 @@ -77,6 +81,8 @@ func feistel(l, r uint32, k0, k1 uint64) (lout, rout uint32) { // for sBoxes[s][i][j] << 4*(7-s) var feistelBox [8][64]uint32 +var feistelBoxOnce sync.Once + // general purpose function to perform DES block permutations func permuteBlock(src uint64, permutation []uint8) (block uint64) { for position, n := range permutation { @@ -86,7 +92,7 @@ func permuteBlock(src uint64, permutation []uint8) (block uint64) { return } -func init() { +func initFeistelBox() { for s := range sBoxes { for i := 0; i < 4; i++ { for j := 0; j < 16; j++ { @@ -219,6 +225,8 @@ func ksRotate(in uint32) (out []uint32) { // creates 16 56-bit subkeys from the original key func (c *desCipher) generateSubkeys(keyBytes []byte) { + feistelBoxOnce.Do(initFeistelBox) + // apply PC1 permutation to key key := binary.BigEndian.Uint64(keyBytes) permutedKey := permuteBlock(key, permutedChoice1[:]) diff --git a/libgo/go/crypto/ecdsa/ecdsa.go b/libgo/go/crypto/ecdsa/ecdsa.go index e059f181c7e..ddc3b35ba30 100644 --- a/libgo/go/crypto/ecdsa/ecdsa.go +++ b/libgo/go/crypto/ecdsa/ecdsa.go @@ -21,13 +21,12 @@ import ( "crypto/aes" "crypto/cipher" "crypto/elliptic" + "crypto/internal/randutil" "crypto/sha512" "encoding/asn1" "errors" "io" "math/big" - - "crypto/internal/randutil" ) // A invertible implements fast inverse mod Curve.Params().N @@ -190,14 +189,21 @@ func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err err // See [NSA] 3.4.1 c := priv.PublicKey.Curve + e := hashToInt(hash, c) + r, s, err = sign(priv, &csprng, c, e) + return +} + +func signGeneric(priv *PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve, e *big.Int) (r, s *big.Int, err error) { N := c.Params().N if N.Sign() == 0 { return nil, nil, errZeroParam } + var k, kInv *big.Int for { for { - k, err = randFieldElement(c, csprng) + k, err = randFieldElement(c, *csprng) if err != nil { r = nil return @@ -215,8 +221,6 @@ func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err err break } } - - e := hashToInt(hash, c) s = new(big.Int).Mul(priv.D, r) s.Add(s, e) s.Mul(s, kInv) @@ -225,7 +229,6 @@ func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err err break } } - return } @@ -243,8 +246,12 @@ func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool { return false } e := hashToInt(hash, c) + return verify(pub, c, e, r, s) +} +func verifyGeneric(pub *PublicKey, c elliptic.Curve, e, r, s *big.Int) bool { var w *big.Int + N := c.Params().N if in, ok := c.(invertible); ok { w = in.Inverse(s) } else { diff --git a/libgo/go/crypto/ecdsa/ecdsa_noasm.go b/libgo/go/crypto/ecdsa/ecdsa_noasm.go new file mode 100644 index 00000000000..d9f9cffd855 --- /dev/null +++ b/libgo/go/crypto/ecdsa/ecdsa_noasm.go @@ -0,0 +1,22 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !s390x gccgo + +package ecdsa + +import ( + "crypto/cipher" + "crypto/elliptic" + "math/big" +) + +func sign(priv *PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve, e *big.Int) (r, s *big.Int, err error) { + r, s, err = signGeneric(priv, csprng, c, e) + return +} + +func verify(pub *PublicKey, c elliptic.Curve, e, r, s *big.Int) bool { + return verifyGeneric(pub, c, e, r, s) +} diff --git a/libgo/go/crypto/ecdsa/ecdsa_s390x.go b/libgo/go/crypto/ecdsa/ecdsa_s390x.go new file mode 100644 index 00000000000..f07c3bf50c2 --- /dev/null +++ b/libgo/go/crypto/ecdsa/ecdsa_s390x.go @@ -0,0 +1,153 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build s390x,!gccgo + +package ecdsa + +import ( + "crypto/cipher" + "crypto/elliptic" + "internal/cpu" + "math/big" +) + +// s390x accelerated signatures +//go:noescape +func kdsaSig(fc uint64, block *[1720]byte) (errn uint64) + +type signverify int + +const ( + signing signverify = iota + verifying +) + +// bufferOffsets represents the offset of a particular parameter in +// the buffer passed to the KDSA instruction. +type bufferOffsets struct { + baseSize int + hashSize int + offsetHash int + offsetKey1 int + offsetRNorKey2 int + offsetR int + offsetS int + functionCode uint64 +} + +func canUseKDSA(sv signverify, c elliptic.Curve, bo *bufferOffsets) bool { + if !cpu.S390X.HasECDSA { + return false + } + + switch c.Params().Name { + case "P-256": + bo.baseSize = 32 + bo.hashSize = 32 + bo.offsetHash = 64 + bo.offsetKey1 = 96 + bo.offsetRNorKey2 = 128 + bo.offsetR = 0 + bo.offsetS = 32 + if sv == signing { + bo.functionCode = 137 + } else { + bo.functionCode = 1 + } + return true + case "P-384": + bo.baseSize = 48 + bo.hashSize = 48 + bo.offsetHash = 96 + bo.offsetKey1 = 144 + bo.offsetRNorKey2 = 192 + bo.offsetR = 0 + bo.offsetS = 48 + if sv == signing { + bo.functionCode = 138 + } else { + bo.functionCode = 2 + } + return true + case "P-521": + bo.baseSize = 66 + bo.hashSize = 80 + bo.offsetHash = 160 + bo.offsetKey1 = 254 + bo.offsetRNorKey2 = 334 + bo.offsetR = 14 + bo.offsetS = 94 + if sv == signing { + bo.functionCode = 139 + } else { + bo.functionCode = 3 + } + return true + } + return false +} + +// zeroExtendAndCopy pads src with leading zeros until it has the size given. +// It then copies the padded src into the dst. Bytes beyond size in dst are +// not modified. +func zeroExtendAndCopy(dst, src []byte, size int) { + nz := size - len(src) + if nz < 0 { + panic("src is too long") + } + // the compiler should replace this loop with a memclr call + z := dst[:nz] + for i := range z { + z[i] = 0 + } + copy(dst[nz:size], src[:size-nz]) + return +} + +func sign(priv *PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve, e *big.Int) (r, s *big.Int, err error) { + var bo bufferOffsets + if canUseKDSA(signing, c, &bo) && e.Sign() != 0 { + var buffer [1720]byte + for { + var k *big.Int + k, err = randFieldElement(c, csprng) + if err != nil { + return nil, nil, err + } + zeroExtendAndCopy(buffer[bo.offsetHash:], e.Bytes(), bo.hashSize) + zeroExtendAndCopy(buffer[bo.offsetKey1:], priv.D.Bytes(), bo.baseSize) + zeroExtendAndCopy(buffer[bo.offsetRNorKey2:], k.Bytes(), bo.baseSize) + errn := kdsaSig(bo.functionCode, &buffer) + if errn == 2 { + return nil, nil, errZeroParam + } + if errn == 0 { // success == 0 means successful signing + r = new(big.Int) + r.SetBytes(buffer[bo.offsetR : bo.offsetR+bo.baseSize]) + s = new(big.Int) + s.SetBytes(buffer[bo.offsetS : bo.offsetS+bo.baseSize]) + return + } + //at this point, it must be that errn == 1: retry + } + } + r, s, err = signGeneric(priv, csprng, c, e) + return +} + +func verify(pub *PublicKey, c elliptic.Curve, e, r, s *big.Int) bool { + var bo bufferOffsets + if canUseKDSA(verifying, c, &bo) && e.Sign() != 0 { + var buffer [1720]byte + zeroExtendAndCopy(buffer[bo.offsetR:], r.Bytes(), bo.baseSize) + zeroExtendAndCopy(buffer[bo.offsetS:], s.Bytes(), bo.baseSize) + zeroExtendAndCopy(buffer[bo.offsetHash:], e.Bytes(), bo.hashSize) + zeroExtendAndCopy(buffer[bo.offsetKey1:], pub.X.Bytes(), bo.baseSize) + zeroExtendAndCopy(buffer[bo.offsetRNorKey2:], pub.Y.Bytes(), bo.baseSize) + errn := kdsaSig(bo.functionCode, &buffer) + return errn == 0 + } + return verifyGeneric(pub, c, e, r, s) +} diff --git a/libgo/go/crypto/ecdsa/ecdsa_s390x_test.go b/libgo/go/crypto/ecdsa/ecdsa_s390x_test.go new file mode 100644 index 00000000000..80babc9cb42 --- /dev/null +++ b/libgo/go/crypto/ecdsa/ecdsa_s390x_test.go @@ -0,0 +1,33 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build s390x,!gccgo + +package ecdsa + +import ( + "crypto/elliptic" + "testing" +) + +func TestNoAsm(t *testing.T) { + curves := [...]elliptic.Curve{ + elliptic.P256(), + elliptic.P384(), + elliptic.P521(), + } + + for _, curve := range curves { + // override the name of the curve to stop the assembly path being taken + params := *curve.Params() + name := params.Name + params.Name = name + "_GENERIC_OVERRIDE" + + testKeyGeneration(t, ¶ms, name) + testSignAndVerify(t, ¶ms, name) + testNonceSafety(t, ¶ms, name) + testINDCCA(t, ¶ms, name) + testNegativeInputs(t, ¶ms, name) + } +} diff --git a/libgo/go/crypto/ed25519/ed25519.go b/libgo/go/crypto/ed25519/ed25519.go new file mode 100644 index 00000000000..dc47e5585d6 --- /dev/null +++ b/libgo/go/crypto/ed25519/ed25519.go @@ -0,0 +1,216 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package ed25519 implements the Ed25519 signature algorithm. See +// https://ed25519.cr.yp.to/. +// +// These functions are also compatible with the “Ed25519” function defined in +// RFC 8032. However, unlike RFC 8032's formulation, this package's private key +// representation includes a public key suffix to make multiple signing +// operations with the same key more efficient. This package refers to the RFC +// 8032 private key as the “seed”. +package ed25519 + +// This code is a port of the public domain, “ref10” implementation of ed25519 +// from SUPERCOP. + +import ( + "bytes" + "crypto" + "crypto/ed25519/internal/edwards25519" + cryptorand "crypto/rand" + "crypto/sha512" + "errors" + "io" + "strconv" +) + +const ( + // PublicKeySize is the size, in bytes, of public keys as used in this package. + PublicKeySize = 32 + // PrivateKeySize is the size, in bytes, of private keys as used in this package. + PrivateKeySize = 64 + // SignatureSize is the size, in bytes, of signatures generated and verified by this package. + SignatureSize = 64 + // SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032. + SeedSize = 32 +) + +// PublicKey is the type of Ed25519 public keys. +type PublicKey []byte + +// PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer. +type PrivateKey []byte + +// Public returns the PublicKey corresponding to priv. +func (priv PrivateKey) Public() crypto.PublicKey { + publicKey := make([]byte, PublicKeySize) + copy(publicKey, priv[32:]) + return PublicKey(publicKey) +} + +// Seed returns the private key seed corresponding to priv. It is provided for +// interoperability with RFC 8032. RFC 8032's private keys correspond to seeds +// in this package. +func (priv PrivateKey) Seed() []byte { + seed := make([]byte, SeedSize) + copy(seed, priv[:32]) + return seed +} + +// Sign signs the given message with priv. +// Ed25519 performs two passes over messages to be signed and therefore cannot +// handle pre-hashed messages. Thus opts.HashFunc() must return zero to +// indicate the message hasn't been hashed. This can be achieved by passing +// crypto.Hash(0) as the value for opts. +func (priv PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error) { + if opts.HashFunc() != crypto.Hash(0) { + return nil, errors.New("ed25519: cannot sign hashed message") + } + + return Sign(priv, message), nil +} + +// GenerateKey generates a public/private key pair using entropy from rand. +// If rand is nil, crypto/rand.Reader will be used. +func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) { + if rand == nil { + rand = cryptorand.Reader + } + + seed := make([]byte, SeedSize) + if _, err := io.ReadFull(rand, seed); err != nil { + return nil, nil, err + } + + privateKey := NewKeyFromSeed(seed) + publicKey := make([]byte, PublicKeySize) + copy(publicKey, privateKey[32:]) + + return publicKey, privateKey, nil +} + +// NewKeyFromSeed calculates a private key from a seed. It will panic if +// len(seed) is not SeedSize. This function is provided for interoperability +// with RFC 8032. RFC 8032's private keys correspond to seeds in this +// package. +func NewKeyFromSeed(seed []byte) PrivateKey { + if l := len(seed); l != SeedSize { + panic("ed25519: bad seed length: " + strconv.Itoa(l)) + } + + digest := sha512.Sum512(seed) + digest[0] &= 248 + digest[31] &= 127 + digest[31] |= 64 + + var A edwards25519.ExtendedGroupElement + var hBytes [32]byte + copy(hBytes[:], digest[:]) + edwards25519.GeScalarMultBase(&A, &hBytes) + var publicKeyBytes [32]byte + A.ToBytes(&publicKeyBytes) + + privateKey := make([]byte, PrivateKeySize) + copy(privateKey, seed) + copy(privateKey[32:], publicKeyBytes[:]) + + return privateKey +} + +// Sign signs the message with privateKey and returns a signature. It will +// panic if len(privateKey) is not PrivateKeySize. +func Sign(privateKey PrivateKey, message []byte) []byte { + if l := len(privateKey); l != PrivateKeySize { + panic("ed25519: bad private key length: " + strconv.Itoa(l)) + } + + h := sha512.New() + h.Write(privateKey[:32]) + + var digest1, messageDigest, hramDigest [64]byte + var expandedSecretKey [32]byte + h.Sum(digest1[:0]) + copy(expandedSecretKey[:], digest1[:]) + expandedSecretKey[0] &= 248 + expandedSecretKey[31] &= 63 + expandedSecretKey[31] |= 64 + + h.Reset() + h.Write(digest1[32:]) + h.Write(message) + h.Sum(messageDigest[:0]) + + var messageDigestReduced [32]byte + edwards25519.ScReduce(&messageDigestReduced, &messageDigest) + var R edwards25519.ExtendedGroupElement + edwards25519.GeScalarMultBase(&R, &messageDigestReduced) + + var encodedR [32]byte + R.ToBytes(&encodedR) + + h.Reset() + h.Write(encodedR[:]) + h.Write(privateKey[32:]) + h.Write(message) + h.Sum(hramDigest[:0]) + var hramDigestReduced [32]byte + edwards25519.ScReduce(&hramDigestReduced, &hramDigest) + + var s [32]byte + edwards25519.ScMulAdd(&s, &hramDigestReduced, &expandedSecretKey, &messageDigestReduced) + + signature := make([]byte, SignatureSize) + copy(signature[:], encodedR[:]) + copy(signature[32:], s[:]) + + return signature +} + +// Verify reports whether sig is a valid signature of message by publicKey. It +// will panic if len(publicKey) is not PublicKeySize. +func Verify(publicKey PublicKey, message, sig []byte) bool { + if l := len(publicKey); l != PublicKeySize { + panic("ed25519: bad public key length: " + strconv.Itoa(l)) + } + + if len(sig) != SignatureSize || sig[63]&224 != 0 { + return false + } + + var A edwards25519.ExtendedGroupElement + var publicKeyBytes [32]byte + copy(publicKeyBytes[:], publicKey) + if !A.FromBytes(&publicKeyBytes) { + return false + } + edwards25519.FeNeg(&A.X, &A.X) + edwards25519.FeNeg(&A.T, &A.T) + + h := sha512.New() + h.Write(sig[:32]) + h.Write(publicKey[:]) + h.Write(message) + var digest [64]byte + h.Sum(digest[:0]) + + var hReduced [32]byte + edwards25519.ScReduce(&hReduced, &digest) + + var R edwards25519.ProjectiveGroupElement + var s [32]byte + copy(s[:], sig[32:]) + + // https://tools.ietf.org/html/rfc8032#section-5.1.7 requires that s be in + // the range [0, order) in order to prevent signature malleability. + if !edwards25519.ScMinimal(&s) { + return false + } + + edwards25519.GeDoubleScalarMultVartime(&R, &hReduced, &A, &s) + + var checkR [32]byte + R.ToBytes(&checkR) + return bytes.Equal(sig[:32], checkR[:]) +} diff --git a/libgo/go/crypto/ed25519/ed25519_test.go b/libgo/go/crypto/ed25519/ed25519_test.go new file mode 100644 index 00000000000..9c980fceff3 --- /dev/null +++ b/libgo/go/crypto/ed25519/ed25519_test.go @@ -0,0 +1,219 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ed25519 + +import ( + "bufio" + "bytes" + "compress/gzip" + "crypto" + "crypto/ed25519/internal/edwards25519" + "crypto/rand" + "encoding/hex" + "os" + "strings" + "testing" +) + +type zeroReader struct{} + +func (zeroReader) Read(buf []byte) (int, error) { + for i := range buf { + buf[i] = 0 + } + return len(buf), nil +} + +func TestUnmarshalMarshal(t *testing.T) { + pub, _, _ := GenerateKey(rand.Reader) + + var A edwards25519.ExtendedGroupElement + var pubBytes [32]byte + copy(pubBytes[:], pub) + if !A.FromBytes(&pubBytes) { + t.Fatalf("ExtendedGroupElement.FromBytes failed") + } + + var pub2 [32]byte + A.ToBytes(&pub2) + + if pubBytes != pub2 { + t.Errorf("FromBytes(%v)->ToBytes does not round-trip, got %x\n", pubBytes, pub2) + } +} + +func TestSignVerify(t *testing.T) { + var zero zeroReader + public, private, _ := GenerateKey(zero) + + message := []byte("test message") + sig := Sign(private, message) + if !Verify(public, message, sig) { + t.Errorf("valid signature rejected") + } + + wrongMessage := []byte("wrong message") + if Verify(public, wrongMessage, sig) { + t.Errorf("signature of different message accepted") + } +} + +func TestCryptoSigner(t *testing.T) { + var zero zeroReader + public, private, _ := GenerateKey(zero) + + signer := crypto.Signer(private) + + publicInterface := signer.Public() + public2, ok := publicInterface.(PublicKey) + if !ok { + t.Fatalf("expected PublicKey from Public() but got %T", publicInterface) + } + + if !bytes.Equal(public, public2) { + t.Errorf("public keys do not match: original:%x vs Public():%x", public, public2) + } + + message := []byte("message") + var noHash crypto.Hash + signature, err := signer.Sign(zero, message, noHash) + if err != nil { + t.Fatalf("error from Sign(): %s", err) + } + + if !Verify(public, message, signature) { + t.Errorf("Verify failed on signature from Sign()") + } +} + +func TestGolden(t *testing.T) { + // sign.input.gz is a selection of test cases from + // https://ed25519.cr.yp.to/python/sign.input + testDataZ, err := os.Open("testdata/sign.input.gz") + if err != nil { + t.Fatal(err) + } + defer testDataZ.Close() + testData, err := gzip.NewReader(testDataZ) + if err != nil { + t.Fatal(err) + } + defer testData.Close() + + scanner := bufio.NewScanner(testData) + lineNo := 0 + + for scanner.Scan() { + lineNo++ + + line := scanner.Text() + parts := strings.Split(line, ":") + if len(parts) != 5 { + t.Fatalf("bad number of parts on line %d", lineNo) + } + + privBytes, _ := hex.DecodeString(parts[0]) + pubKey, _ := hex.DecodeString(parts[1]) + msg, _ := hex.DecodeString(parts[2]) + sig, _ := hex.DecodeString(parts[3]) + // The signatures in the test vectors also include the message + // at the end, but we just want R and S. + sig = sig[:SignatureSize] + + if l := len(pubKey); l != PublicKeySize { + t.Fatalf("bad public key length on line %d: got %d bytes", lineNo, l) + } + + var priv [PrivateKeySize]byte + copy(priv[:], privBytes) + copy(priv[32:], pubKey) + + sig2 := Sign(priv[:], msg) + if !bytes.Equal(sig, sig2[:]) { + t.Errorf("different signature result on line %d: %x vs %x", lineNo, sig, sig2) + } + + if !Verify(pubKey, msg, sig2) { + t.Errorf("signature failed to verify on line %d", lineNo) + } + + priv2 := NewKeyFromSeed(priv[:32]) + if !bytes.Equal(priv[:], priv2) { + t.Errorf("recreating key pair gave different private key on line %d: %x vs %x", lineNo, priv[:], priv2) + } + + if pubKey2 := priv2.Public().(PublicKey); !bytes.Equal(pubKey, pubKey2) { + t.Errorf("recreating key pair gave different public key on line %d: %x vs %x", lineNo, pubKey, pubKey2) + } + + if seed := priv2.Seed(); !bytes.Equal(priv[:32], seed) { + t.Errorf("recreating key pair gave different seed on line %d: %x vs %x", lineNo, priv[:32], seed) + } + } + + if err := scanner.Err(); err != nil { + t.Fatalf("error reading test data: %s", err) + } +} + +func TestMalleability(t *testing.T) { + // https://tools.ietf.org/html/rfc8032#section-5.1.7 adds an additional test + // that s be in [0, order). This prevents someone from adding a multiple of + // order to s and obtaining a second valid signature for the same message. + msg := []byte{0x54, 0x65, 0x73, 0x74} + sig := []byte{ + 0x7c, 0x38, 0xe0, 0x26, 0xf2, 0x9e, 0x14, 0xaa, 0xbd, 0x05, 0x9a, + 0x0f, 0x2d, 0xb8, 0xb0, 0xcd, 0x78, 0x30, 0x40, 0x60, 0x9a, 0x8b, + 0xe6, 0x84, 0xdb, 0x12, 0xf8, 0x2a, 0x27, 0x77, 0x4a, 0xb0, 0x67, + 0x65, 0x4b, 0xce, 0x38, 0x32, 0xc2, 0xd7, 0x6f, 0x8f, 0x6f, 0x5d, + 0xaf, 0xc0, 0x8d, 0x93, 0x39, 0xd4, 0xee, 0xf6, 0x76, 0x57, 0x33, + 0x36, 0xa5, 0xc5, 0x1e, 0xb6, 0xf9, 0x46, 0xb3, 0x1d, + } + publicKey := []byte{ + 0x7d, 0x4d, 0x0e, 0x7f, 0x61, 0x53, 0xa6, 0x9b, 0x62, 0x42, 0xb5, + 0x22, 0xab, 0xbe, 0xe6, 0x85, 0xfd, 0xa4, 0x42, 0x0f, 0x88, 0x34, + 0xb1, 0x08, 0xc3, 0xbd, 0xae, 0x36, 0x9e, 0xf5, 0x49, 0xfa, + } + + if Verify(publicKey, msg, sig) { + t.Fatal("non-canonical signature accepted") + } +} + +func BenchmarkKeyGeneration(b *testing.B) { + var zero zeroReader + for i := 0; i < b.N; i++ { + if _, _, err := GenerateKey(zero); err != nil { + b.Fatal(err) + } + } +} + +func BenchmarkSigning(b *testing.B) { + var zero zeroReader + _, priv, err := GenerateKey(zero) + if err != nil { + b.Fatal(err) + } + message := []byte("Hello, world!") + b.ResetTimer() + for i := 0; i < b.N; i++ { + Sign(priv, message) + } +} + +func BenchmarkVerification(b *testing.B) { + var zero zeroReader + pub, priv, err := GenerateKey(zero) + if err != nil { + b.Fatal(err) + } + message := []byte("Hello, world!") + signature := Sign(priv, message) + b.ResetTimer() + for i := 0; i < b.N; i++ { + Verify(pub, message, signature) + } +} diff --git a/libgo/go/crypto/ed25519/internal/edwards25519/const.go b/libgo/go/crypto/ed25519/internal/edwards25519/const.go new file mode 100644 index 00000000000..e39f086c1d8 --- /dev/null +++ b/libgo/go/crypto/ed25519/internal/edwards25519/const.go @@ -0,0 +1,1422 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edwards25519 + +// These values are from the public domain, “ref10” implementation of ed25519 +// from SUPERCOP. + +// d is a constant in the Edwards curve equation. +var d = FieldElement{ + -10913610, 13857413, -15372611, 6949391, 114729, -8787816, -6275908, -3247719, -18696448, -12055116, +} + +// d2 is 2*d. +var d2 = FieldElement{ + -21827239, -5839606, -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199, +} + +// SqrtM1 is the square-root of -1 in the field. +var SqrtM1 = FieldElement{ + -32595792, -7943725, 9377950, 3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482, +} + +// A is a constant in the Montgomery-form of curve25519. +var A = FieldElement{ + 486662, 0, 0, 0, 0, 0, 0, 0, 0, 0, +} + +// bi contains precomputed multiples of the base-point. See the Ed25519 paper +// for a discussion about how these values are used. +var bi = [8]PreComputedGroupElement{ + { + FieldElement{25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605}, + FieldElement{-12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378}, + FieldElement{-8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546}, + }, + { + FieldElement{15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024}, + FieldElement{16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574}, + FieldElement{30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357}, + }, + { + FieldElement{10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380}, + FieldElement{4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306}, + FieldElement{19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942}, + }, + { + FieldElement{5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766}, + FieldElement{-30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701}, + FieldElement{28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300}, + }, + { + FieldElement{-22518993, -6692182, 14201702, -8745502, -23510406, 8844726, 18474211, -1361450, -13062696, 13821877}, + FieldElement{-6455177, -7839871, 3374702, -4740862, -27098617, -10571707, 31655028, -7212327, 18853322, -14220951}, + FieldElement{4566830, -12963868, -28974889, -12240689, -7602672, -2830569, -8514358, -10431137, 2207753, -3209784}, + }, + { + FieldElement{-25154831, -4185821, 29681144, 7868801, -6854661, -9423865, -12437364, -663000, -31111463, -16132436}, + FieldElement{25576264, -2703214, 7349804, -11814844, 16472782, 9300885, 3844789, 15725684, 171356, 6466918}, + FieldElement{23103977, 13316479, 9739013, -16149481, 817875, -15038942, 8965339, -14088058, -30714912, 16193877}, + }, + { + FieldElement{-33521811, 3180713, -2394130, 14003687, -16903474, -16270840, 17238398, 4729455, -18074513, 9256800}, + FieldElement{-25182317, -4174131, 32336398, 5036987, -21236817, 11360617, 22616405, 9761698, -19827198, 630305}, + FieldElement{-13720693, 2639453, -24237460, -7406481, 9494427, -5774029, -6554551, -15960994, -2449256, -14291300}, + }, + { + FieldElement{-3151181, -5046075, 9282714, 6866145, -31907062, -863023, -18940575, 15033784, 25105118, -7894876}, + FieldElement{-24326370, 15950226, -31801215, -14592823, -11662737, -5090925, 1573892, -2625887, 2198790, -15804619}, + FieldElement{-3099351, 10324967, -2241613, 7453183, -5446979, -2735503, -13812022, -16236442, -32461234, -12290683}, + }, +} + +// base contains precomputed multiples of the base-point. See the Ed25519 paper +// for a discussion about how these values are used. +var base = [32][8]PreComputedGroupElement{ + { + { + FieldElement{25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605}, + FieldElement{-12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378}, + FieldElement{-8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546}, + }, + { + FieldElement{-12815894, -12976347, -21581243, 11784320, -25355658, -2750717, -11717903, -3814571, -358445, -10211303}, + FieldElement{-21703237, 6903825, 27185491, 6451973, -29577724, -9554005, -15616551, 11189268, -26829678, -5319081}, + FieldElement{26966642, 11152617, 32442495, 15396054, 14353839, -12752335, -3128826, -9541118, -15472047, -4166697}, + }, + { + FieldElement{15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024}, + FieldElement{16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574}, + FieldElement{30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357}, + }, + { + FieldElement{-17036878, 13921892, 10945806, -6033431, 27105052, -16084379, -28926210, 15006023, 3284568, -6276540}, + FieldElement{23599295, -8306047, -11193664, -7687416, 13236774, 10506355, 7464579, 9656445, 13059162, 10374397}, + FieldElement{7798556, 16710257, 3033922, 2874086, 28997861, 2835604, 32406664, -3839045, -641708, -101325}, + }, + { + FieldElement{10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380}, + FieldElement{4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306}, + FieldElement{19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942}, + }, + { + FieldElement{-15371964, -12862754, 32573250, 4720197, -26436522, 5875511, -19188627, -15224819, -9818940, -12085777}, + FieldElement{-8549212, 109983, 15149363, 2178705, 22900618, 4543417, 3044240, -15689887, 1762328, 14866737}, + FieldElement{-18199695, -15951423, -10473290, 1707278, -17185920, 3916101, -28236412, 3959421, 27914454, 4383652}, + }, + { + FieldElement{5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766}, + FieldElement{-30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701}, + FieldElement{28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300}, + }, + { + FieldElement{14499471, -2729599, -33191113, -4254652, 28494862, 14271267, 30290735, 10876454, -33154098, 2381726}, + FieldElement{-7195431, -2655363, -14730155, 462251, -27724326, 3941372, -6236617, 3696005, -32300832, 15351955}, + FieldElement{27431194, 8222322, 16448760, -3907995, -18707002, 11938355, -32961401, -2970515, 29551813, 10109425}, + }, + }, + { + { + FieldElement{-13657040, -13155431, -31283750, 11777098, 21447386, 6519384, -2378284, -1627556, 10092783, -4764171}, + FieldElement{27939166, 14210322, 4677035, 16277044, -22964462, -12398139, -32508754, 12005538, -17810127, 12803510}, + FieldElement{17228999, -15661624, -1233527, 300140, -1224870, -11714777, 30364213, -9038194, 18016357, 4397660}, + }, + { + FieldElement{-10958843, -7690207, 4776341, -14954238, 27850028, -15602212, -26619106, 14544525, -17477504, 982639}, + FieldElement{29253598, 15796703, -2863982, -9908884, 10057023, 3163536, 7332899, -4120128, -21047696, 9934963}, + FieldElement{5793303, 16271923, -24131614, -10116404, 29188560, 1206517, -14747930, 4559895, -30123922, -10897950}, + }, + { + FieldElement{-27643952, -11493006, 16282657, -11036493, 28414021, -15012264, 24191034, 4541697, -13338309, 5500568}, + FieldElement{12650548, -1497113, 9052871, 11355358, -17680037, -8400164, -17430592, 12264343, 10874051, 13524335}, + FieldElement{25556948, -3045990, 714651, 2510400, 23394682, -10415330, 33119038, 5080568, -22528059, 5376628}, + }, + { + FieldElement{-26088264, -4011052, -17013699, -3537628, -6726793, 1920897, -22321305, -9447443, 4535768, 1569007}, + FieldElement{-2255422, 14606630, -21692440, -8039818, 28430649, 8775819, -30494562, 3044290, 31848280, 12543772}, + FieldElement{-22028579, 2943893, -31857513, 6777306, 13784462, -4292203, -27377195, -2062731, 7718482, 14474653}, + }, + { + FieldElement{2385315, 2454213, -22631320, 46603, -4437935, -15680415, 656965, -7236665, 24316168, -5253567}, + FieldElement{13741529, 10911568, -33233417, -8603737, -20177830, -1033297, 33040651, -13424532, -20729456, 8321686}, + FieldElement{21060490, -2212744, 15712757, -4336099, 1639040, 10656336, 23845965, -11874838, -9984458, 608372}, + }, + { + FieldElement{-13672732, -15087586, -10889693, -7557059, -6036909, 11305547, 1123968, -6780577, 27229399, 23887}, + FieldElement{-23244140, -294205, -11744728, 14712571, -29465699, -2029617, 12797024, -6440308, -1633405, 16678954}, + FieldElement{-29500620, 4770662, -16054387, 14001338, 7830047, 9564805, -1508144, -4795045, -17169265, 4904953}, + }, + { + FieldElement{24059557, 14617003, 19037157, -15039908, 19766093, -14906429, 5169211, 16191880, 2128236, -4326833}, + FieldElement{-16981152, 4124966, -8540610, -10653797, 30336522, -14105247, -29806336, 916033, -6882542, -2986532}, + FieldElement{-22630907, 12419372, -7134229, -7473371, -16478904, 16739175, 285431, 2763829, 15736322, 4143876}, + }, + { + FieldElement{2379352, 11839345, -4110402, -5988665, 11274298, 794957, 212801, -14594663, 23527084, -16458268}, + FieldElement{33431127, -11130478, -17838966, -15626900, 8909499, 8376530, -32625340, 4087881, -15188911, -14416214}, + FieldElement{1767683, 7197987, -13205226, -2022635, -13091350, 448826, 5799055, 4357868, -4774191, -16323038}, + }, + }, + { + { + FieldElement{6721966, 13833823, -23523388, -1551314, 26354293, -11863321, 23365147, -3949732, 7390890, 2759800}, + FieldElement{4409041, 2052381, 23373853, 10530217, 7676779, -12885954, 21302353, -4264057, 1244380, -12919645}, + FieldElement{-4421239, 7169619, 4982368, -2957590, 30256825, -2777540, 14086413, 9208236, 15886429, 16489664}, + }, + { + FieldElement{1996075, 10375649, 14346367, 13311202, -6874135, -16438411, -13693198, 398369, -30606455, -712933}, + FieldElement{-25307465, 9795880, -2777414, 14878809, -33531835, 14780363, 13348553, 12076947, -30836462, 5113182}, + FieldElement{-17770784, 11797796, 31950843, 13929123, -25888302, 12288344, -30341101, -7336386, 13847711, 5387222}, + }, + { + FieldElement{-18582163, -3416217, 17824843, -2340966, 22744343, -10442611, 8763061, 3617786, -19600662, 10370991}, + FieldElement{20246567, -14369378, 22358229, -543712, 18507283, -10413996, 14554437, -8746092, 32232924, 16763880}, + FieldElement{9648505, 10094563, 26416693, 14745928, -30374318, -6472621, 11094161, 15689506, 3140038, -16510092}, + }, + { + FieldElement{-16160072, 5472695, 31895588, 4744994, 8823515, 10365685, -27224800, 9448613, -28774454, 366295}, + FieldElement{19153450, 11523972, -11096490, -6503142, -24647631, 5420647, 28344573, 8041113, 719605, 11671788}, + FieldElement{8678025, 2694440, -6808014, 2517372, 4964326, 11152271, -15432916, -15266516, 27000813, -10195553}, + }, + { + FieldElement{-15157904, 7134312, 8639287, -2814877, -7235688, 10421742, 564065, 5336097, 6750977, -14521026}, + FieldElement{11836410, -3979488, 26297894, 16080799, 23455045, 15735944, 1695823, -8819122, 8169720, 16220347}, + FieldElement{-18115838, 8653647, 17578566, -6092619, -8025777, -16012763, -11144307, -2627664, -5990708, -14166033}, + }, + { + FieldElement{-23308498, -10968312, 15213228, -10081214, -30853605, -11050004, 27884329, 2847284, 2655861, 1738395}, + FieldElement{-27537433, -14253021, -25336301, -8002780, -9370762, 8129821, 21651608, -3239336, -19087449, -11005278}, + FieldElement{1533110, 3437855, 23735889, 459276, 29970501, 11335377, 26030092, 5821408, 10478196, 8544890}, + }, + { + FieldElement{32173121, -16129311, 24896207, 3921497, 22579056, -3410854, 19270449, 12217473, 17789017, -3395995}, + FieldElement{-30552961, -2228401, -15578829, -10147201, 13243889, 517024, 15479401, -3853233, 30460520, 1052596}, + FieldElement{-11614875, 13323618, 32618793, 8175907, -15230173, 12596687, 27491595, -4612359, 3179268, -9478891}, + }, + { + FieldElement{31947069, -14366651, -4640583, -15339921, -15125977, -6039709, -14756777, -16411740, 19072640, -9511060}, + FieldElement{11685058, 11822410, 3158003, -13952594, 33402194, -4165066, 5977896, -5215017, 473099, 5040608}, + FieldElement{-20290863, 8198642, -27410132, 11602123, 1290375, -2799760, 28326862, 1721092, -19558642, -3131606}, + }, + }, + { + { + FieldElement{7881532, 10687937, 7578723, 7738378, -18951012, -2553952, 21820786, 8076149, -27868496, 11538389}, + FieldElement{-19935666, 3899861, 18283497, -6801568, -15728660, -11249211, 8754525, 7446702, -5676054, 5797016}, + FieldElement{-11295600, -3793569, -15782110, -7964573, 12708869, -8456199, 2014099, -9050574, -2369172, -5877341}, + }, + { + FieldElement{-22472376, -11568741, -27682020, 1146375, 18956691, 16640559, 1192730, -3714199, 15123619, 10811505}, + FieldElement{14352098, -3419715, -18942044, 10822655, 32750596, 4699007, -70363, 15776356, -28886779, -11974553}, + FieldElement{-28241164, -8072475, -4978962, -5315317, 29416931, 1847569, -20654173, -16484855, 4714547, -9600655}, + }, + { + FieldElement{15200332, 8368572, 19679101, 15970074, -31872674, 1959451, 24611599, -4543832, -11745876, 12340220}, + FieldElement{12876937, -10480056, 33134381, 6590940, -6307776, 14872440, 9613953, 8241152, 15370987, 9608631}, + FieldElement{-4143277, -12014408, 8446281, -391603, 4407738, 13629032, -7724868, 15866074, -28210621, -8814099}, + }, + { + FieldElement{26660628, -15677655, 8393734, 358047, -7401291, 992988, -23904233, 858697, 20571223, 8420556}, + FieldElement{14620715, 13067227, -15447274, 8264467, 14106269, 15080814, 33531827, 12516406, -21574435, -12476749}, + FieldElement{236881, 10476226, 57258, -14677024, 6472998, 2466984, 17258519, 7256740, 8791136, 15069930}, + }, + { + FieldElement{1276410, -9371918, 22949635, -16322807, -23493039, -5702186, 14711875, 4874229, -30663140, -2331391}, + FieldElement{5855666, 4990204, -13711848, 7294284, -7804282, 1924647, -1423175, -7912378, -33069337, 9234253}, + FieldElement{20590503, -9018988, 31529744, -7352666, -2706834, 10650548, 31559055, -11609587, 18979186, 13396066}, + }, + { + FieldElement{24474287, 4968103, 22267082, 4407354, 24063882, -8325180, -18816887, 13594782, 33514650, 7021958}, + FieldElement{-11566906, -6565505, -21365085, 15928892, -26158305, 4315421, -25948728, -3916677, -21480480, 12868082}, + FieldElement{-28635013, 13504661, 19988037, -2132761, 21078225, 6443208, -21446107, 2244500, -12455797, -8089383}, + }, + { + FieldElement{-30595528, 13793479, -5852820, 319136, -25723172, -6263899, 33086546, 8957937, -15233648, 5540521}, + FieldElement{-11630176, -11503902, -8119500, -7643073, 2620056, 1022908, -23710744, -1568984, -16128528, -14962807}, + FieldElement{23152971, 775386, 27395463, 14006635, -9701118, 4649512, 1689819, 892185, -11513277, -15205948}, + }, + { + FieldElement{9770129, 9586738, 26496094, 4324120, 1556511, -3550024, 27453819, 4763127, -19179614, 5867134}, + FieldElement{-32765025, 1927590, 31726409, -4753295, 23962434, -16019500, 27846559, 5931263, -29749703, -16108455}, + FieldElement{27461885, -2977536, 22380810, 1815854, -23033753, -3031938, 7283490, -15148073, -19526700, 7734629}, + }, + }, + { + { + FieldElement{-8010264, -9590817, -11120403, 6196038, 29344158, -13430885, 7585295, -3176626, 18549497, 15302069}, + FieldElement{-32658337, -6171222, -7672793, -11051681, 6258878, 13504381, 10458790, -6418461, -8872242, 8424746}, + FieldElement{24687205, 8613276, -30667046, -3233545, 1863892, -1830544, 19206234, 7134917, -11284482, -828919}, + }, + { + FieldElement{11334899, -9218022, 8025293, 12707519, 17523892, -10476071, 10243738, -14685461, -5066034, 16498837}, + FieldElement{8911542, 6887158, -9584260, -6958590, 11145641, -9543680, 17303925, -14124238, 6536641, 10543906}, + FieldElement{-28946384, 15479763, -17466835, 568876, -1497683, 11223454, -2669190, -16625574, -27235709, 8876771}, + }, + { + FieldElement{-25742899, -12566864, -15649966, -846607, -33026686, -796288, -33481822, 15824474, -604426, -9039817}, + FieldElement{10330056, 70051, 7957388, -9002667, 9764902, 15609756, 27698697, -4890037, 1657394, 3084098}, + FieldElement{10477963, -7470260, 12119566, -13250805, 29016247, -5365589, 31280319, 14396151, -30233575, 15272409}, + }, + { + FieldElement{-12288309, 3169463, 28813183, 16658753, 25116432, -5630466, -25173957, -12636138, -25014757, 1950504}, + FieldElement{-26180358, 9489187, 11053416, -14746161, -31053720, 5825630, -8384306, -8767532, 15341279, 8373727}, + FieldElement{28685821, 7759505, -14378516, -12002860, -31971820, 4079242, 298136, -10232602, -2878207, 15190420}, + }, + { + FieldElement{-32932876, 13806336, -14337485, -15794431, -24004620, 10940928, 8669718, 2742393, -26033313, -6875003}, + FieldElement{-1580388, -11729417, -25979658, -11445023, -17411874, -10912854, 9291594, -16247779, -12154742, 6048605}, + FieldElement{-30305315, 14843444, 1539301, 11864366, 20201677, 1900163, 13934231, 5128323, 11213262, 9168384}, + }, + { + FieldElement{-26280513, 11007847, 19408960, -940758, -18592965, -4328580, -5088060, -11105150, 20470157, -16398701}, + FieldElement{-23136053, 9282192, 14855179, -15390078, -7362815, -14408560, -22783952, 14461608, 14042978, 5230683}, + FieldElement{29969567, -2741594, -16711867, -8552442, 9175486, -2468974, 21556951, 3506042, -5933891, -12449708}, + }, + { + FieldElement{-3144746, 8744661, 19704003, 4581278, -20430686, 6830683, -21284170, 8971513, -28539189, 15326563}, + FieldElement{-19464629, 10110288, -17262528, -3503892, -23500387, 1355669, -15523050, 15300988, -20514118, 9168260}, + FieldElement{-5353335, 4488613, -23803248, 16314347, 7780487, -15638939, -28948358, 9601605, 33087103, -9011387}, + }, + { + FieldElement{-19443170, -15512900, -20797467, -12445323, -29824447, 10229461, -27444329, -15000531, -5996870, 15664672}, + FieldElement{23294591, -16632613, -22650781, -8470978, 27844204, 11461195, 13099750, -2460356, 18151676, 13417686}, + FieldElement{-24722913, -4176517, -31150679, 5988919, -26858785, 6685065, 1661597, -12551441, 15271676, -15452665}, + }, + }, + { + { + FieldElement{11433042, -13228665, 8239631, -5279517, -1985436, -725718, -18698764, 2167544, -6921301, -13440182}, + FieldElement{-31436171, 15575146, 30436815, 12192228, -22463353, 9395379, -9917708, -8638997, 12215110, 12028277}, + FieldElement{14098400, 6555944, 23007258, 5757252, -15427832, -12950502, 30123440, 4617780, -16900089, -655628}, + }, + { + FieldElement{-4026201, -15240835, 11893168, 13718664, -14809462, 1847385, -15819999, 10154009, 23973261, -12684474}, + FieldElement{-26531820, -3695990, -1908898, 2534301, -31870557, -16550355, 18341390, -11419951, 32013174, -10103539}, + FieldElement{-25479301, 10876443, -11771086, -14625140, -12369567, 1838104, 21911214, 6354752, 4425632, -837822}, + }, + { + FieldElement{-10433389, -14612966, 22229858, -3091047, -13191166, 776729, -17415375, -12020462, 4725005, 14044970}, + FieldElement{19268650, -7304421, 1555349, 8692754, -21474059, -9910664, 6347390, -1411784, -19522291, -16109756}, + FieldElement{-24864089, 12986008, -10898878, -5558584, -11312371, -148526, 19541418, 8180106, 9282262, 10282508}, + }, + { + FieldElement{-26205082, 4428547, -8661196, -13194263, 4098402, -14165257, 15522535, 8372215, 5542595, -10702683}, + FieldElement{-10562541, 14895633, 26814552, -16673850, -17480754, -2489360, -2781891, 6993761, -18093885, 10114655}, + FieldElement{-20107055, -929418, 31422704, 10427861, -7110749, 6150669, -29091755, -11529146, 25953725, -106158}, + }, + { + FieldElement{-4234397, -8039292, -9119125, 3046000, 2101609, -12607294, 19390020, 6094296, -3315279, 12831125}, + FieldElement{-15998678, 7578152, 5310217, 14408357, -33548620, -224739, 31575954, 6326196, 7381791, -2421839}, + FieldElement{-20902779, 3296811, 24736065, -16328389, 18374254, 7318640, 6295303, 8082724, -15362489, 12339664}, + }, + { + FieldElement{27724736, 2291157, 6088201, -14184798, 1792727, 5857634, 13848414, 15768922, 25091167, 14856294}, + FieldElement{-18866652, 8331043, 24373479, 8541013, -701998, -9269457, 12927300, -12695493, -22182473, -9012899}, + FieldElement{-11423429, -5421590, 11632845, 3405020, 30536730, -11674039, -27260765, 13866390, 30146206, 9142070}, + }, + { + FieldElement{3924129, -15307516, -13817122, -10054960, 12291820, -668366, -27702774, 9326384, -8237858, 4171294}, + FieldElement{-15921940, 16037937, 6713787, 16606682, -21612135, 2790944, 26396185, 3731949, 345228, -5462949}, + FieldElement{-21327538, 13448259, 25284571, 1143661, 20614966, -8849387, 2031539, -12391231, -16253183, -13582083}, + }, + { + FieldElement{31016211, -16722429, 26371392, -14451233, -5027349, 14854137, 17477601, 3842657, 28012650, -16405420}, + FieldElement{-5075835, 9368966, -8562079, -4600902, -15249953, 6970560, -9189873, 16292057, -8867157, 3507940}, + FieldElement{29439664, 3537914, 23333589, 6997794, -17555561, -11018068, -15209202, -15051267, -9164929, 6580396}, + }, + }, + { + { + FieldElement{-12185861, -7679788, 16438269, 10826160, -8696817, -6235611, 17860444, -9273846, -2095802, 9304567}, + FieldElement{20714564, -4336911, 29088195, 7406487, 11426967, -5095705, 14792667, -14608617, 5289421, -477127}, + FieldElement{-16665533, -10650790, -6160345, -13305760, 9192020, -1802462, 17271490, 12349094, 26939669, -3752294}, + }, + { + FieldElement{-12889898, 9373458, 31595848, 16374215, 21471720, 13221525, -27283495, -12348559, -3698806, 117887}, + FieldElement{22263325, -6560050, 3984570, -11174646, -15114008, -566785, 28311253, 5358056, -23319780, 541964}, + FieldElement{16259219, 3261970, 2309254, -15534474, -16885711, -4581916, 24134070, -16705829, -13337066, -13552195}, + }, + { + FieldElement{9378160, -13140186, -22845982, -12745264, 28198281, -7244098, -2399684, -717351, 690426, 14876244}, + FieldElement{24977353, -314384, -8223969, -13465086, 28432343, -1176353, -13068804, -12297348, -22380984, 6618999}, + FieldElement{-1538174, 11685646, 12944378, 13682314, -24389511, -14413193, 8044829, -13817328, 32239829, -5652762}, + }, + { + FieldElement{-18603066, 4762990, -926250, 8885304, -28412480, -3187315, 9781647, -10350059, 32779359, 5095274}, + FieldElement{-33008130, -5214506, -32264887, -3685216, 9460461, -9327423, -24601656, 14506724, 21639561, -2630236}, + FieldElement{-16400943, -13112215, 25239338, 15531969, 3987758, -4499318, -1289502, -6863535, 17874574, 558605}, + }, + { + FieldElement{-13600129, 10240081, 9171883, 16131053, -20869254, 9599700, 33499487, 5080151, 2085892, 5119761}, + FieldElement{-22205145, -2519528, -16381601, 414691, -25019550, 2170430, 30634760, -8363614, -31999993, -5759884}, + FieldElement{-6845704, 15791202, 8550074, -1312654, 29928809, -12092256, 27534430, -7192145, -22351378, 12961482}, + }, + { + FieldElement{-24492060, -9570771, 10368194, 11582341, -23397293, -2245287, 16533930, 8206996, -30194652, -5159638}, + FieldElement{-11121496, -3382234, 2307366, 6362031, -135455, 8868177, -16835630, 7031275, 7589640, 8945490}, + FieldElement{-32152748, 8917967, 6661220, -11677616, -1192060, -15793393, 7251489, -11182180, 24099109, -14456170}, + }, + { + FieldElement{5019558, -7907470, 4244127, -14714356, -26933272, 6453165, -19118182, -13289025, -6231896, -10280736}, + FieldElement{10853594, 10721687, 26480089, 5861829, -22995819, 1972175, -1866647, -10557898, -3363451, -6441124}, + FieldElement{-17002408, 5906790, 221599, -6563147, 7828208, -13248918, 24362661, -2008168, -13866408, 7421392}, + }, + { + FieldElement{8139927, -6546497, 32257646, -5890546, 30375719, 1886181, -21175108, 15441252, 28826358, -4123029}, + FieldElement{6267086, 9695052, 7709135, -16603597, -32869068, -1886135, 14795160, -7840124, 13746021, -1742048}, + FieldElement{28584902, 7787108, -6732942, -15050729, 22846041, -7571236, -3181936, -363524, 4771362, -8419958}, + }, + }, + { + { + FieldElement{24949256, 6376279, -27466481, -8174608, -18646154, -9930606, 33543569, -12141695, 3569627, 11342593}, + FieldElement{26514989, 4740088, 27912651, 3697550, 19331575, -11472339, 6809886, 4608608, 7325975, -14801071}, + FieldElement{-11618399, -14554430, -24321212, 7655128, -1369274, 5214312, -27400540, 10258390, -17646694, -8186692}, + }, + { + FieldElement{11431204, 15823007, 26570245, 14329124, 18029990, 4796082, -31446179, 15580664, 9280358, -3973687}, + FieldElement{-160783, -10326257, -22855316, -4304997, -20861367, -13621002, -32810901, -11181622, -15545091, 4387441}, + FieldElement{-20799378, 12194512, 3937617, -5805892, -27154820, 9340370, -24513992, 8548137, 20617071, -7482001}, + }, + { + FieldElement{-938825, -3930586, -8714311, 16124718, 24603125, -6225393, -13775352, -11875822, 24345683, 10325460}, + FieldElement{-19855277, -1568885, -22202708, 8714034, 14007766, 6928528, 16318175, -1010689, 4766743, 3552007}, + FieldElement{-21751364, -16730916, 1351763, -803421, -4009670, 3950935, 3217514, 14481909, 10988822, -3994762}, + }, + { + FieldElement{15564307, -14311570, 3101243, 5684148, 30446780, -8051356, 12677127, -6505343, -8295852, 13296005}, + FieldElement{-9442290, 6624296, -30298964, -11913677, -4670981, -2057379, 31521204, 9614054, -30000824, 12074674}, + FieldElement{4771191, -135239, 14290749, -13089852, 27992298, 14998318, -1413936, -1556716, 29832613, -16391035}, + }, + { + FieldElement{7064884, -7541174, -19161962, -5067537, -18891269, -2912736, 25825242, 5293297, -27122660, 13101590}, + FieldElement{-2298563, 2439670, -7466610, 1719965, -27267541, -16328445, 32512469, -5317593, -30356070, -4190957}, + FieldElement{-30006540, 10162316, -33180176, 3981723, -16482138, -13070044, 14413974, 9515896, 19568978, 9628812}, + }, + { + FieldElement{33053803, 199357, 15894591, 1583059, 27380243, -4580435, -17838894, -6106839, -6291786, 3437740}, + FieldElement{-18978877, 3884493, 19469877, 12726490, 15913552, 13614290, -22961733, 70104, 7463304, 4176122}, + FieldElement{-27124001, 10659917, 11482427, -16070381, 12771467, -6635117, -32719404, -5322751, 24216882, 5944158}, + }, + { + FieldElement{8894125, 7450974, -2664149, -9765752, -28080517, -12389115, 19345746, 14680796, 11632993, 5847885}, + FieldElement{26942781, -2315317, 9129564, -4906607, 26024105, 11769399, -11518837, 6367194, -9727230, 4782140}, + FieldElement{19916461, -4828410, -22910704, -11414391, 25606324, -5972441, 33253853, 8220911, 6358847, -1873857}, + }, + { + FieldElement{801428, -2081702, 16569428, 11065167, 29875704, 96627, 7908388, -4480480, -13538503, 1387155}, + FieldElement{19646058, 5720633, -11416706, 12814209, 11607948, 12749789, 14147075, 15156355, -21866831, 11835260}, + FieldElement{19299512, 1155910, 28703737, 14890794, 2925026, 7269399, 26121523, 15467869, -26560550, 5052483}, + }, + }, + { + { + FieldElement{-3017432, 10058206, 1980837, 3964243, 22160966, 12322533, -6431123, -12618185, 12228557, -7003677}, + FieldElement{32944382, 14922211, -22844894, 5188528, 21913450, -8719943, 4001465, 13238564, -6114803, 8653815}, + FieldElement{22865569, -4652735, 27603668, -12545395, 14348958, 8234005, 24808405, 5719875, 28483275, 2841751}, + }, + { + FieldElement{-16420968, -1113305, -327719, -12107856, 21886282, -15552774, -1887966, -315658, 19932058, -12739203}, + FieldElement{-11656086, 10087521, -8864888, -5536143, -19278573, -3055912, 3999228, 13239134, -4777469, -13910208}, + FieldElement{1382174, -11694719, 17266790, 9194690, -13324356, 9720081, 20403944, 11284705, -14013818, 3093230}, + }, + { + FieldElement{16650921, -11037932, -1064178, 1570629, -8329746, 7352753, -302424, 16271225, -24049421, -6691850}, + FieldElement{-21911077, -5927941, -4611316, -5560156, -31744103, -10785293, 24123614, 15193618, -21652117, -16739389}, + FieldElement{-9935934, -4289447, -25279823, 4372842, 2087473, 10399484, 31870908, 14690798, 17361620, 11864968}, + }, + { + FieldElement{-11307610, 6210372, 13206574, 5806320, -29017692, -13967200, -12331205, -7486601, -25578460, -16240689}, + FieldElement{14668462, -12270235, 26039039, 15305210, 25515617, 4542480, 10453892, 6577524, 9145645, -6443880}, + FieldElement{5974874, 3053895, -9433049, -10385191, -31865124, 3225009, -7972642, 3936128, -5652273, -3050304}, + }, + { + FieldElement{30625386, -4729400, -25555961, -12792866, -20484575, 7695099, 17097188, -16303496, -27999779, 1803632}, + FieldElement{-3553091, 9865099, -5228566, 4272701, -5673832, -16689700, 14911344, 12196514, -21405489, 7047412}, + FieldElement{20093277, 9920966, -11138194, -5343857, 13161587, 12044805, -32856851, 4124601, -32343828, -10257566}, + }, + { + FieldElement{-20788824, 14084654, -13531713, 7842147, 19119038, -13822605, 4752377, -8714640, -21679658, 2288038}, + FieldElement{-26819236, -3283715, 29965059, 3039786, -14473765, 2540457, 29457502, 14625692, -24819617, 12570232}, + FieldElement{-1063558, -11551823, 16920318, 12494842, 1278292, -5869109, -21159943, -3498680, -11974704, 4724943}, + }, + { + FieldElement{17960970, -11775534, -4140968, -9702530, -8876562, -1410617, -12907383, -8659932, -29576300, 1903856}, + FieldElement{23134274, -14279132, -10681997, -1611936, 20684485, 15770816, -12989750, 3190296, 26955097, 14109738}, + FieldElement{15308788, 5320727, -30113809, -14318877, 22902008, 7767164, 29425325, -11277562, 31960942, 11934971}, + }, + { + FieldElement{-27395711, 8435796, 4109644, 12222639, -24627868, 14818669, 20638173, 4875028, 10491392, 1379718}, + FieldElement{-13159415, 9197841, 3875503, -8936108, -1383712, -5879801, 33518459, 16176658, 21432314, 12180697}, + FieldElement{-11787308, 11500838, 13787581, -13832590, -22430679, 10140205, 1465425, 12689540, -10301319, -13872883}, + }, + }, + { + { + FieldElement{5414091, -15386041, -21007664, 9643570, 12834970, 1186149, -2622916, -1342231, 26128231, 6032912}, + FieldElement{-26337395, -13766162, 32496025, -13653919, 17847801, -12669156, 3604025, 8316894, -25875034, -10437358}, + FieldElement{3296484, 6223048, 24680646, -12246460, -23052020, 5903205, -8862297, -4639164, 12376617, 3188849}, + }, + { + FieldElement{29190488, -14659046, 27549113, -1183516, 3520066, -10697301, 32049515, -7309113, -16109234, -9852307}, + FieldElement{-14744486, -9309156, 735818, -598978, -20407687, -5057904, 25246078, -15795669, 18640741, -960977}, + FieldElement{-6928835, -16430795, 10361374, 5642961, 4910474, 12345252, -31638386, -494430, 10530747, 1053335}, + }, + { + FieldElement{-29265967, -14186805, -13538216, -12117373, -19457059, -10655384, -31462369, -2948985, 24018831, 15026644}, + FieldElement{-22592535, -3145277, -2289276, 5953843, -13440189, 9425631, 25310643, 13003497, -2314791, -15145616}, + FieldElement{-27419985, -603321, -8043984, -1669117, -26092265, 13987819, -27297622, 187899, -23166419, -2531735}, + }, + { + FieldElement{-21744398, -13810475, 1844840, 5021428, -10434399, -15911473, 9716667, 16266922, -5070217, 726099}, + FieldElement{29370922, -6053998, 7334071, -15342259, 9385287, 2247707, -13661962, -4839461, 30007388, -15823341}, + FieldElement{-936379, 16086691, 23751945, -543318, -1167538, -5189036, 9137109, 730663, 9835848, 4555336}, + }, + { + FieldElement{-23376435, 1410446, -22253753, -12899614, 30867635, 15826977, 17693930, 544696, -11985298, 12422646}, + FieldElement{31117226, -12215734, -13502838, 6561947, -9876867, -12757670, -5118685, -4096706, 29120153, 13924425}, + FieldElement{-17400879, -14233209, 19675799, -2734756, -11006962, -5858820, -9383939, -11317700, 7240931, -237388}, + }, + { + FieldElement{-31361739, -11346780, -15007447, -5856218, -22453340, -12152771, 1222336, 4389483, 3293637, -15551743}, + FieldElement{-16684801, -14444245, 11038544, 11054958, -13801175, -3338533, -24319580, 7733547, 12796905, -6335822}, + FieldElement{-8759414, -10817836, -25418864, 10783769, -30615557, -9746811, -28253339, 3647836, 3222231, -11160462}, + }, + { + FieldElement{18606113, 1693100, -25448386, -15170272, 4112353, 10045021, 23603893, -2048234, -7550776, 2484985}, + FieldElement{9255317, -3131197, -12156162, -1004256, 13098013, -9214866, 16377220, -2102812, -19802075, -3034702}, + FieldElement{-22729289, 7496160, -5742199, 11329249, 19991973, -3347502, -31718148, 9936966, -30097688, -10618797}, + }, + { + FieldElement{21878590, -5001297, 4338336, 13643897, -3036865, 13160960, 19708896, 5415497, -7360503, -4109293}, + FieldElement{27736861, 10103576, 12500508, 8502413, -3413016, -9633558, 10436918, -1550276, -23659143, -8132100}, + FieldElement{19492550, -12104365, -29681976, -852630, -3208171, 12403437, 30066266, 8367329, 13243957, 8709688}, + }, + }, + { + { + FieldElement{12015105, 2801261, 28198131, 10151021, 24818120, -4743133, -11194191, -5645734, 5150968, 7274186}, + FieldElement{2831366, -12492146, 1478975, 6122054, 23825128, -12733586, 31097299, 6083058, 31021603, -9793610}, + FieldElement{-2529932, -2229646, 445613, 10720828, -13849527, -11505937, -23507731, 16354465, 15067285, -14147707}, + }, + { + FieldElement{7840942, 14037873, -33364863, 15934016, -728213, -3642706, 21403988, 1057586, -19379462, -12403220}, + FieldElement{915865, -16469274, 15608285, -8789130, -24357026, 6060030, -17371319, 8410997, -7220461, 16527025}, + FieldElement{32922597, -556987, 20336074, -16184568, 10903705, -5384487, 16957574, 52992, 23834301, 6588044}, + }, + { + FieldElement{32752030, 11232950, 3381995, -8714866, 22652988, -10744103, 17159699, 16689107, -20314580, -1305992}, + FieldElement{-4689649, 9166776, -25710296, -10847306, 11576752, 12733943, 7924251, -2752281, 1976123, -7249027}, + FieldElement{21251222, 16309901, -2983015, -6783122, 30810597, 12967303, 156041, -3371252, 12331345, -8237197}, + }, + { + FieldElement{8651614, -4477032, -16085636, -4996994, 13002507, 2950805, 29054427, -5106970, 10008136, -4667901}, + FieldElement{31486080, 15114593, -14261250, 12951354, 14369431, -7387845, 16347321, -13662089, 8684155, -10532952}, + FieldElement{19443825, 11385320, 24468943, -9659068, -23919258, 2187569, -26263207, -6086921, 31316348, 14219878}, + }, + { + FieldElement{-28594490, 1193785, 32245219, 11392485, 31092169, 15722801, 27146014, 6992409, 29126555, 9207390}, + FieldElement{32382935, 1110093, 18477781, 11028262, -27411763, -7548111, -4980517, 10843782, -7957600, -14435730}, + FieldElement{2814918, 7836403, 27519878, -7868156, -20894015, -11553689, -21494559, 8550130, 28346258, 1994730}, + }, + { + FieldElement{-19578299, 8085545, -14000519, -3948622, 2785838, -16231307, -19516951, 7174894, 22628102, 8115180}, + FieldElement{-30405132, 955511, -11133838, -15078069, -32447087, -13278079, -25651578, 3317160, -9943017, 930272}, + FieldElement{-15303681, -6833769, 28856490, 1357446, 23421993, 1057177, 24091212, -1388970, -22765376, -10650715}, + }, + { + FieldElement{-22751231, -5303997, -12907607, -12768866, -15811511, -7797053, -14839018, -16554220, -1867018, 8398970}, + FieldElement{-31969310, 2106403, -4736360, 1362501, 12813763, 16200670, 22981545, -6291273, 18009408, -15772772}, + FieldElement{-17220923, -9545221, -27784654, 14166835, 29815394, 7444469, 29551787, -3727419, 19288549, 1325865}, + }, + { + FieldElement{15100157, -15835752, -23923978, -1005098, -26450192, 15509408, 12376730, -3479146, 33166107, -8042750}, + FieldElement{20909231, 13023121, -9209752, 16251778, -5778415, -8094914, 12412151, 10018715, 2213263, -13878373}, + FieldElement{32529814, -11074689, 30361439, -16689753, -9135940, 1513226, 22922121, 6382134, -5766928, 8371348}, + }, + }, + { + { + FieldElement{9923462, 11271500, 12616794, 3544722, -29998368, -1721626, 12891687, -8193132, -26442943, 10486144}, + FieldElement{-22597207, -7012665, 8587003, -8257861, 4084309, -12970062, 361726, 2610596, -23921530, -11455195}, + FieldElement{5408411, -1136691, -4969122, 10561668, 24145918, 14240566, 31319731, -4235541, 19985175, -3436086}, + }, + { + FieldElement{-13994457, 16616821, 14549246, 3341099, 32155958, 13648976, -17577068, 8849297, 65030, 8370684}, + FieldElement{-8320926, -12049626, 31204563, 5839400, -20627288, -1057277, -19442942, 6922164, 12743482, -9800518}, + FieldElement{-2361371, 12678785, 28815050, 4759974, -23893047, 4884717, 23783145, 11038569, 18800704, 255233}, + }, + { + FieldElement{-5269658, -1773886, 13957886, 7990715, 23132995, 728773, 13393847, 9066957, 19258688, -14753793}, + FieldElement{-2936654, -10827535, -10432089, 14516793, -3640786, 4372541, -31934921, 2209390, -1524053, 2055794}, + FieldElement{580882, 16705327, 5468415, -2683018, -30926419, -14696000, -7203346, -8994389, -30021019, 7394435}, + }, + { + FieldElement{23838809, 1822728, -15738443, 15242727, 8318092, -3733104, -21672180, -3492205, -4821741, 14799921}, + FieldElement{13345610, 9759151, 3371034, -16137791, 16353039, 8577942, 31129804, 13496856, -9056018, 7402518}, + FieldElement{2286874, -4435931, -20042458, -2008336, -13696227, 5038122, 11006906, -15760352, 8205061, 1607563}, + }, + { + FieldElement{14414086, -8002132, 3331830, -3208217, 22249151, -5594188, 18364661, -2906958, 30019587, -9029278}, + FieldElement{-27688051, 1585953, -10775053, 931069, -29120221, -11002319, -14410829, 12029093, 9944378, 8024}, + FieldElement{4368715, -3709630, 29874200, -15022983, -20230386, -11410704, -16114594, -999085, -8142388, 5640030}, + }, + { + FieldElement{10299610, 13746483, 11661824, 16234854, 7630238, 5998374, 9809887, -16694564, 15219798, -14327783}, + FieldElement{27425505, -5719081, 3055006, 10660664, 23458024, 595578, -15398605, -1173195, -18342183, 9742717}, + FieldElement{6744077, 2427284, 26042789, 2720740, -847906, 1118974, 32324614, 7406442, 12420155, 1994844}, + }, + { + FieldElement{14012521, -5024720, -18384453, -9578469, -26485342, -3936439, -13033478, -10909803, 24319929, -6446333}, + FieldElement{16412690, -4507367, 10772641, 15929391, -17068788, -4658621, 10555945, -10484049, -30102368, -4739048}, + FieldElement{22397382, -7767684, -9293161, -12792868, 17166287, -9755136, -27333065, 6199366, 21880021, -12250760}, + }, + { + FieldElement{-4283307, 5368523, -31117018, 8163389, -30323063, 3209128, 16557151, 8890729, 8840445, 4957760}, + FieldElement{-15447727, 709327, -6919446, -10870178, -29777922, 6522332, -21720181, 12130072, -14796503, 5005757}, + FieldElement{-2114751, -14308128, 23019042, 15765735, -25269683, 6002752, 10183197, -13239326, -16395286, -2176112}, + }, + }, + { + { + FieldElement{-19025756, 1632005, 13466291, -7995100, -23640451, 16573537, -32013908, -3057104, 22208662, 2000468}, + FieldElement{3065073, -1412761, -25598674, -361432, -17683065, -5703415, -8164212, 11248527, -3691214, -7414184}, + FieldElement{10379208, -6045554, 8877319, 1473647, -29291284, -12507580, 16690915, 2553332, -3132688, 16400289}, + }, + { + FieldElement{15716668, 1254266, -18472690, 7446274, -8448918, 6344164, -22097271, -7285580, 26894937, 9132066}, + FieldElement{24158887, 12938817, 11085297, -8177598, -28063478, -4457083, -30576463, 64452, -6817084, -2692882}, + FieldElement{13488534, 7794716, 22236231, 5989356, 25426474, -12578208, 2350710, -3418511, -4688006, 2364226}, + }, + { + FieldElement{16335052, 9132434, 25640582, 6678888, 1725628, 8517937, -11807024, -11697457, 15445875, -7798101}, + FieldElement{29004207, -7867081, 28661402, -640412, -12794003, -7943086, 31863255, -4135540, -278050, -15759279}, + FieldElement{-6122061, -14866665, -28614905, 14569919, -10857999, -3591829, 10343412, -6976290, -29828287, -10815811}, + }, + { + FieldElement{27081650, 3463984, 14099042, -4517604, 1616303, -6205604, 29542636, 15372179, 17293797, 960709}, + FieldElement{20263915, 11434237, -5765435, 11236810, 13505955, -10857102, -16111345, 6493122, -19384511, 7639714}, + FieldElement{-2830798, -14839232, 25403038, -8215196, -8317012, -16173699, 18006287, -16043750, 29994677, -15808121}, + }, + { + FieldElement{9769828, 5202651, -24157398, -13631392, -28051003, -11561624, -24613141, -13860782, -31184575, 709464}, + FieldElement{12286395, 13076066, -21775189, -1176622, -25003198, 4057652, -32018128, -8890874, 16102007, 13205847}, + FieldElement{13733362, 5599946, 10557076, 3195751, -5557991, 8536970, -25540170, 8525972, 10151379, 10394400}, + }, + { + FieldElement{4024660, -16137551, 22436262, 12276534, -9099015, -2686099, 19698229, 11743039, -33302334, 8934414}, + FieldElement{-15879800, -4525240, -8580747, -2934061, 14634845, -698278, -9449077, 3137094, -11536886, 11721158}, + FieldElement{17555939, -5013938, 8268606, 2331751, -22738815, 9761013, 9319229, 8835153, -9205489, -1280045}, + }, + { + FieldElement{-461409, -7830014, 20614118, 16688288, -7514766, -4807119, 22300304, 505429, 6108462, -6183415}, + FieldElement{-5070281, 12367917, -30663534, 3234473, 32617080, -8422642, 29880583, -13483331, -26898490, -7867459}, + FieldElement{-31975283, 5726539, 26934134, 10237677, -3173717, -605053, 24199304, 3795095, 7592688, -14992079}, + }, + { + FieldElement{21594432, -14964228, 17466408, -4077222, 32537084, 2739898, 6407723, 12018833, -28256052, 4298412}, + FieldElement{-20650503, -11961496, -27236275, 570498, 3767144, -1717540, 13891942, -1569194, 13717174, 10805743}, + FieldElement{-14676630, -15644296, 15287174, 11927123, 24177847, -8175568, -796431, 14860609, -26938930, -5863836}, + }, + }, + { + { + FieldElement{12962541, 5311799, -10060768, 11658280, 18855286, -7954201, 13286263, -12808704, -4381056, 9882022}, + FieldElement{18512079, 11319350, -20123124, 15090309, 18818594, 5271736, -22727904, 3666879, -23967430, -3299429}, + FieldElement{-6789020, -3146043, 16192429, 13241070, 15898607, -14206114, -10084880, -6661110, -2403099, 5276065}, + }, + { + FieldElement{30169808, -5317648, 26306206, -11750859, 27814964, 7069267, 7152851, 3684982, 1449224, 13082861}, + FieldElement{10342826, 3098505, 2119311, 193222, 25702612, 12233820, 23697382, 15056736, -21016438, -8202000}, + FieldElement{-33150110, 3261608, 22745853, 7948688, 19370557, -15177665, -26171976, 6482814, -10300080, -11060101}, + }, + { + FieldElement{32869458, -5408545, 25609743, 15678670, -10687769, -15471071, 26112421, 2521008, -22664288, 6904815}, + FieldElement{29506923, 4457497, 3377935, -9796444, -30510046, 12935080, 1561737, 3841096, -29003639, -6657642}, + FieldElement{10340844, -6630377, -18656632, -2278430, 12621151, -13339055, 30878497, -11824370, -25584551, 5181966}, + }, + { + FieldElement{25940115, -12658025, 17324188, -10307374, -8671468, 15029094, 24396252, -16450922, -2322852, -12388574}, + FieldElement{-21765684, 9916823, -1300409, 4079498, -1028346, 11909559, 1782390, 12641087, 20603771, -6561742}, + FieldElement{-18882287, -11673380, 24849422, 11501709, 13161720, -4768874, 1925523, 11914390, 4662781, 7820689}, + }, + { + FieldElement{12241050, -425982, 8132691, 9393934, 32846760, -1599620, 29749456, 12172924, 16136752, 15264020}, + FieldElement{-10349955, -14680563, -8211979, 2330220, -17662549, -14545780, 10658213, 6671822, 19012087, 3772772}, + FieldElement{3753511, -3421066, 10617074, 2028709, 14841030, -6721664, 28718732, -15762884, 20527771, 12988982}, + }, + { + FieldElement{-14822485, -5797269, -3707987, 12689773, -898983, -10914866, -24183046, -10564943, 3299665, -12424953}, + FieldElement{-16777703, -15253301, -9642417, 4978983, 3308785, 8755439, 6943197, 6461331, -25583147, 8991218}, + FieldElement{-17226263, 1816362, -1673288, -6086439, 31783888, -8175991, -32948145, 7417950, -30242287, 1507265}, + }, + { + FieldElement{29692663, 6829891, -10498800, 4334896, 20945975, -11906496, -28887608, 8209391, 14606362, -10647073}, + FieldElement{-3481570, 8707081, 32188102, 5672294, 22096700, 1711240, -33020695, 9761487, 4170404, -2085325}, + FieldElement{-11587470, 14855945, -4127778, -1531857, -26649089, 15084046, 22186522, 16002000, -14276837, -8400798}, + }, + { + FieldElement{-4811456, 13761029, -31703877, -2483919, -3312471, 7869047, -7113572, -9620092, 13240845, 10965870}, + FieldElement{-7742563, -8256762, -14768334, -13656260, -23232383, 12387166, 4498947, 14147411, 29514390, 4302863}, + FieldElement{-13413405, -12407859, 20757302, -13801832, 14785143, 8976368, -5061276, -2144373, 17846988, -13971927}, + }, + }, + { + { + FieldElement{-2244452, -754728, -4597030, -1066309, -6247172, 1455299, -21647728, -9214789, -5222701, 12650267}, + FieldElement{-9906797, -16070310, 21134160, 12198166, -27064575, 708126, 387813, 13770293, -19134326, 10958663}, + FieldElement{22470984, 12369526, 23446014, -5441109, -21520802, -9698723, -11772496, -11574455, -25083830, 4271862}, + }, + { + FieldElement{-25169565, -10053642, -19909332, 15361595, -5984358, 2159192, 75375, -4278529, -32526221, 8469673}, + FieldElement{15854970, 4148314, -8893890, 7259002, 11666551, 13824734, -30531198, 2697372, 24154791, -9460943}, + FieldElement{15446137, -15806644, 29759747, 14019369, 30811221, -9610191, -31582008, 12840104, 24913809, 9815020}, + }, + { + FieldElement{-4709286, -5614269, -31841498, -12288893, -14443537, 10799414, -9103676, 13438769, 18735128, 9466238}, + FieldElement{11933045, 9281483, 5081055, -5183824, -2628162, -4905629, -7727821, -10896103, -22728655, 16199064}, + FieldElement{14576810, 379472, -26786533, -8317236, -29426508, -10812974, -102766, 1876699, 30801119, 2164795}, + }, + { + FieldElement{15995086, 3199873, 13672555, 13712240, -19378835, -4647646, -13081610, -15496269, -13492807, 1268052}, + FieldElement{-10290614, -3659039, -3286592, 10948818, 23037027, 3794475, -3470338, -12600221, -17055369, 3565904}, + FieldElement{29210088, -9419337, -5919792, -4952785, 10834811, -13327726, -16512102, -10820713, -27162222, -14030531}, + }, + { + FieldElement{-13161890, 15508588, 16663704, -8156150, -28349942, 9019123, -29183421, -3769423, 2244111, -14001979}, + FieldElement{-5152875, -3800936, -9306475, -6071583, 16243069, 14684434, -25673088, -16180800, 13491506, 4641841}, + FieldElement{10813417, 643330, -19188515, -728916, 30292062, -16600078, 27548447, -7721242, 14476989, -12767431}, + }, + { + FieldElement{10292079, 9984945, 6481436, 8279905, -7251514, 7032743, 27282937, -1644259, -27912810, 12651324}, + FieldElement{-31185513, -813383, 22271204, 11835308, 10201545, 15351028, 17099662, 3988035, 21721536, -3148940}, + FieldElement{10202177, -6545839, -31373232, -9574638, -32150642, -8119683, -12906320, 3852694, 13216206, 14842320}, + }, + { + FieldElement{-15815640, -10601066, -6538952, -7258995, -6984659, -6581778, -31500847, 13765824, -27434397, 9900184}, + FieldElement{14465505, -13833331, -32133984, -14738873, -27443187, 12990492, 33046193, 15796406, -7051866, -8040114}, + FieldElement{30924417, -8279620, 6359016, -12816335, 16508377, 9071735, -25488601, 15413635, 9524356, -7018878}, + }, + { + FieldElement{12274201, -13175547, 32627641, -1785326, 6736625, 13267305, 5237659, -5109483, 15663516, 4035784}, + FieldElement{-2951309, 8903985, 17349946, 601635, -16432815, -4612556, -13732739, -15889334, -22258478, 4659091}, + FieldElement{-16916263, -4952973, -30393711, -15158821, 20774812, 15897498, 5736189, 15026997, -2178256, -13455585}, + }, + }, + { + { + FieldElement{-8858980, -2219056, 28571666, -10155518, -474467, -10105698, -3801496, 278095, 23440562, -290208}, + FieldElement{10226241, -5928702, 15139956, 120818, -14867693, 5218603, 32937275, 11551483, -16571960, -7442864}, + FieldElement{17932739, -12437276, -24039557, 10749060, 11316803, 7535897, 22503767, 5561594, -3646624, 3898661}, + }, + { + FieldElement{7749907, -969567, -16339731, -16464, -25018111, 15122143, -1573531, 7152530, 21831162, 1245233}, + FieldElement{26958459, -14658026, 4314586, 8346991, -5677764, 11960072, -32589295, -620035, -30402091, -16716212}, + FieldElement{-12165896, 9166947, 33491384, 13673479, 29787085, 13096535, 6280834, 14587357, -22338025, 13987525}, + }, + { + FieldElement{-24349909, 7778775, 21116000, 15572597, -4833266, -5357778, -4300898, -5124639, -7469781, -2858068}, + FieldElement{9681908, -6737123, -31951644, 13591838, -6883821, 386950, 31622781, 6439245, -14581012, 4091397}, + FieldElement{-8426427, 1470727, -28109679, -1596990, 3978627, -5123623, -19622683, 12092163, 29077877, -14741988}, + }, + { + FieldElement{5269168, -6859726, -13230211, -8020715, 25932563, 1763552, -5606110, -5505881, -20017847, 2357889}, + FieldElement{32264008, -15407652, -5387735, -1160093, -2091322, -3946900, 23104804, -12869908, 5727338, 189038}, + FieldElement{14609123, -8954470, -6000566, -16622781, -14577387, -7743898, -26745169, 10942115, -25888931, -14884697}, + }, + { + FieldElement{20513500, 5557931, -15604613, 7829531, 26413943, -2019404, -21378968, 7471781, 13913677, -5137875}, + FieldElement{-25574376, 11967826, 29233242, 12948236, -6754465, 4713227, -8940970, 14059180, 12878652, 8511905}, + FieldElement{-25656801, 3393631, -2955415, -7075526, -2250709, 9366908, -30223418, 6812974, 5568676, -3127656}, + }, + { + FieldElement{11630004, 12144454, 2116339, 13606037, 27378885, 15676917, -17408753, -13504373, -14395196, 8070818}, + FieldElement{27117696, -10007378, -31282771, -5570088, 1127282, 12772488, -29845906, 10483306, -11552749, -1028714}, + FieldElement{10637467, -5688064, 5674781, 1072708, -26343588, -6982302, -1683975, 9177853, -27493162, 15431203}, + }, + { + FieldElement{20525145, 10892566, -12742472, 12779443, -29493034, 16150075, -28240519, 14943142, -15056790, -7935931}, + FieldElement{-30024462, 5626926, -551567, -9981087, 753598, 11981191, 25244767, -3239766, -3356550, 9594024}, + FieldElement{-23752644, 2636870, -5163910, -10103818, 585134, 7877383, 11345683, -6492290, 13352335, -10977084}, + }, + { + FieldElement{-1931799, -5407458, 3304649, -12884869, 17015806, -4877091, -29783850, -7752482, -13215537, -319204}, + FieldElement{20239939, 6607058, 6203985, 3483793, -18386976, -779229, -20723742, 15077870, -22750759, 14523817}, + FieldElement{27406042, -6041657, 27423596, -4497394, 4996214, 10002360, -28842031, -4545494, -30172742, -4805667}, + }, + }, + { + { + FieldElement{11374242, 12660715, 17861383, -12540833, 10935568, 1099227, -13886076, -9091740, -27727044, 11358504}, + FieldElement{-12730809, 10311867, 1510375, 10778093, -2119455, -9145702, 32676003, 11149336, -26123651, 4985768}, + FieldElement{-19096303, 341147, -6197485, -239033, 15756973, -8796662, -983043, 13794114, -19414307, -15621255}, + }, + { + FieldElement{6490081, 11940286, 25495923, -7726360, 8668373, -8751316, 3367603, 6970005, -1691065, -9004790}, + FieldElement{1656497, 13457317, 15370807, 6364910, 13605745, 8362338, -19174622, -5475723, -16796596, -5031438}, + FieldElement{-22273315, -13524424, -64685, -4334223, -18605636, -10921968, -20571065, -7007978, -99853, -10237333}, + }, + { + FieldElement{17747465, 10039260, 19368299, -4050591, -20630635, -16041286, 31992683, -15857976, -29260363, -5511971}, + FieldElement{31932027, -4986141, -19612382, 16366580, 22023614, 88450, 11371999, -3744247, 4882242, -10626905}, + FieldElement{29796507, 37186, 19818052, 10115756, -11829032, 3352736, 18551198, 3272828, -5190932, -4162409}, + }, + { + FieldElement{12501286, 4044383, -8612957, -13392385, -32430052, 5136599, -19230378, -3529697, 330070, -3659409}, + FieldElement{6384877, 2899513, 17807477, 7663917, -2358888, 12363165, 25366522, -8573892, -271295, 12071499}, + FieldElement{-8365515, -4042521, 25133448, -4517355, -6211027, 2265927, -32769618, 1936675, -5159697, 3829363}, + }, + { + FieldElement{28425966, -5835433, -577090, -4697198, -14217555, 6870930, 7921550, -6567787, 26333140, 14267664}, + FieldElement{-11067219, 11871231, 27385719, -10559544, -4585914, -11189312, 10004786, -8709488, -21761224, 8930324}, + FieldElement{-21197785, -16396035, 25654216, -1725397, 12282012, 11008919, 1541940, 4757911, -26491501, -16408940}, + }, + { + FieldElement{13537262, -7759490, -20604840, 10961927, -5922820, -13218065, -13156584, 6217254, -15943699, 13814990}, + FieldElement{-17422573, 15157790, 18705543, 29619, 24409717, -260476, 27361681, 9257833, -1956526, -1776914}, + FieldElement{-25045300, -10191966, 15366585, 15166509, -13105086, 8423556, -29171540, 12361135, -18685978, 4578290}, + }, + { + FieldElement{24579768, 3711570, 1342322, -11180126, -27005135, 14124956, -22544529, 14074919, 21964432, 8235257}, + FieldElement{-6528613, -2411497, 9442966, -5925588, 12025640, -1487420, -2981514, -1669206, 13006806, 2355433}, + FieldElement{-16304899, -13605259, -6632427, -5142349, 16974359, -10911083, 27202044, 1719366, 1141648, -12796236}, + }, + { + FieldElement{-12863944, -13219986, -8318266, -11018091, -6810145, -4843894, 13475066, -3133972, 32674895, 13715045}, + FieldElement{11423335, -5468059, 32344216, 8962751, 24989809, 9241752, -13265253, 16086212, -28740881, -15642093}, + FieldElement{-1409668, 12530728, -6368726, 10847387, 19531186, -14132160, -11709148, 7791794, -27245943, 4383347}, + }, + }, + { + { + FieldElement{-28970898, 5271447, -1266009, -9736989, -12455236, 16732599, -4862407, -4906449, 27193557, 6245191}, + FieldElement{-15193956, 5362278, -1783893, 2695834, 4960227, 12840725, 23061898, 3260492, 22510453, 8577507}, + FieldElement{-12632451, 11257346, -32692994, 13548177, -721004, 10879011, 31168030, 13952092, -29571492, -3635906}, + }, + { + FieldElement{3877321, -9572739, 32416692, 5405324, -11004407, -13656635, 3759769, 11935320, 5611860, 8164018}, + FieldElement{-16275802, 14667797, 15906460, 12155291, -22111149, -9039718, 32003002, -8832289, 5773085, -8422109}, + FieldElement{-23788118, -8254300, 1950875, 8937633, 18686727, 16459170, -905725, 12376320, 31632953, 190926}, + }, + { + FieldElement{-24593607, -16138885, -8423991, 13378746, 14162407, 6901328, -8288749, 4508564, -25341555, -3627528}, + FieldElement{8884438, -5884009, 6023974, 10104341, -6881569, -4941533, 18722941, -14786005, -1672488, 827625}, + FieldElement{-32720583, -16289296, -32503547, 7101210, 13354605, 2659080, -1800575, -14108036, -24878478, 1541286}, + }, + { + FieldElement{2901347, -1117687, 3880376, -10059388, -17620940, -3612781, -21802117, -3567481, 20456845, -1885033}, + FieldElement{27019610, 12299467, -13658288, -1603234, -12861660, -4861471, -19540150, -5016058, 29439641, 15138866}, + FieldElement{21536104, -6626420, -32447818, -10690208, -22408077, 5175814, -5420040, -16361163, 7779328, 109896}, + }, + { + FieldElement{30279744, 14648750, -8044871, 6425558, 13639621, -743509, 28698390, 12180118, 23177719, -554075}, + FieldElement{26572847, 3405927, -31701700, 12890905, -19265668, 5335866, -6493768, 2378492, 4439158, -13279347}, + FieldElement{-22716706, 3489070, -9225266, -332753, 18875722, -1140095, 14819434, -12731527, -17717757, -5461437}, + }, + { + FieldElement{-5056483, 16566551, 15953661, 3767752, -10436499, 15627060, -820954, 2177225, 8550082, -15114165}, + FieldElement{-18473302, 16596775, -381660, 15663611, 22860960, 15585581, -27844109, -3582739, -23260460, -8428588}, + FieldElement{-32480551, 15707275, -8205912, -5652081, 29464558, 2713815, -22725137, 15860482, -21902570, 1494193}, + }, + { + FieldElement{-19562091, -14087393, -25583872, -9299552, 13127842, 759709, 21923482, 16529112, 8742704, 12967017}, + FieldElement{-28464899, 1553205, 32536856, -10473729, -24691605, -406174, -8914625, -2933896, -29903758, 15553883}, + FieldElement{21877909, 3230008, 9881174, 10539357, -4797115, 2841332, 11543572, 14513274, 19375923, -12647961}, + }, + { + FieldElement{8832269, -14495485, 13253511, 5137575, 5037871, 4078777, 24880818, -6222716, 2862653, 9455043}, + FieldElement{29306751, 5123106, 20245049, -14149889, 9592566, 8447059, -2077124, -2990080, 15511449, 4789663}, + FieldElement{-20679756, 7004547, 8824831, -9434977, -4045704, -3750736, -5754762, 108893, 23513200, 16652362}, + }, + }, + { + { + FieldElement{-33256173, 4144782, -4476029, -6579123, 10770039, -7155542, -6650416, -12936300, -18319198, 10212860}, + FieldElement{2756081, 8598110, 7383731, -6859892, 22312759, -1105012, 21179801, 2600940, -9988298, -12506466}, + FieldElement{-24645692, 13317462, -30449259, -15653928, 21365574, -10869657, 11344424, 864440, -2499677, -16710063}, + }, + { + FieldElement{-26432803, 6148329, -17184412, -14474154, 18782929, -275997, -22561534, 211300, 2719757, 4940997}, + FieldElement{-1323882, 3911313, -6948744, 14759765, -30027150, 7851207, 21690126, 8518463, 26699843, 5276295}, + FieldElement{-13149873, -6429067, 9396249, 365013, 24703301, -10488939, 1321586, 149635, -15452774, 7159369}, + }, + { + FieldElement{9987780, -3404759, 17507962, 9505530, 9731535, -2165514, 22356009, 8312176, 22477218, -8403385}, + FieldElement{18155857, -16504990, 19744716, 9006923, 15154154, -10538976, 24256460, -4864995, -22548173, 9334109}, + FieldElement{2986088, -4911893, 10776628, -3473844, 10620590, -7083203, -21413845, 14253545, -22587149, 536906}, + }, + { + FieldElement{4377756, 8115836, 24567078, 15495314, 11625074, 13064599, 7390551, 10589625, 10838060, -15420424}, + FieldElement{-19342404, 867880, 9277171, -3218459, -14431572, -1986443, 19295826, -15796950, 6378260, 699185}, + FieldElement{7895026, 4057113, -7081772, -13077756, -17886831, -323126, -716039, 15693155, -5045064, -13373962}, + }, + { + FieldElement{-7737563, -5869402, -14566319, -7406919, 11385654, 13201616, 31730678, -10962840, -3918636, -9669325}, + FieldElement{10188286, -15770834, -7336361, 13427543, 22223443, 14896287, 30743455, 7116568, -21786507, 5427593}, + FieldElement{696102, 13206899, 27047647, -10632082, 15285305, -9853179, 10798490, -4578720, 19236243, 12477404}, + }, + { + FieldElement{-11229439, 11243796, -17054270, -8040865, -788228, -8167967, -3897669, 11180504, -23169516, 7733644}, + FieldElement{17800790, -14036179, -27000429, -11766671, 23887827, 3149671, 23466177, -10538171, 10322027, 15313801}, + FieldElement{26246234, 11968874, 32263343, -5468728, 6830755, -13323031, -15794704, -101982, -24449242, 10890804}, + }, + { + FieldElement{-31365647, 10271363, -12660625, -6267268, 16690207, -13062544, -14982212, 16484931, 25180797, -5334884}, + FieldElement{-586574, 10376444, -32586414, -11286356, 19801893, 10997610, 2276632, 9482883, 316878, 13820577}, + FieldElement{-9882808, -4510367, -2115506, 16457136, -11100081, 11674996, 30756178, -7515054, 30696930, -3712849}, + }, + { + FieldElement{32988917, -9603412, 12499366, 7910787, -10617257, -11931514, -7342816, -9985397, -32349517, 7392473}, + FieldElement{-8855661, 15927861, 9866406, -3649411, -2396914, -16655781, -30409476, -9134995, 25112947, -2926644}, + FieldElement{-2504044, -436966, 25621774, -5678772, 15085042, -5479877, -24884878, -13526194, 5537438, -13914319}, + }, + }, + { + { + FieldElement{-11225584, 2320285, -9584280, 10149187, -33444663, 5808648, -14876251, -1729667, 31234590, 6090599}, + FieldElement{-9633316, 116426, 26083934, 2897444, -6364437, -2688086, 609721, 15878753, -6970405, -9034768}, + FieldElement{-27757857, 247744, -15194774, -9002551, 23288161, -10011936, -23869595, 6503646, 20650474, 1804084}, + }, + { + FieldElement{-27589786, 15456424, 8972517, 8469608, 15640622, 4439847, 3121995, -10329713, 27842616, -202328}, + FieldElement{-15306973, 2839644, 22530074, 10026331, 4602058, 5048462, 28248656, 5031932, -11375082, 12714369}, + FieldElement{20807691, -7270825, 29286141, 11421711, -27876523, -13868230, -21227475, 1035546, -19733229, 12796920}, + }, + { + FieldElement{12076899, -14301286, -8785001, -11848922, -25012791, 16400684, -17591495, -12899438, 3480665, -15182815}, + FieldElement{-32361549, 5457597, 28548107, 7833186, 7303070, -11953545, -24363064, -15921875, -33374054, 2771025}, + FieldElement{-21389266, 421932, 26597266, 6860826, 22486084, -6737172, -17137485, -4210226, -24552282, 15673397}, + }, + { + FieldElement{-20184622, 2338216, 19788685, -9620956, -4001265, -8740893, -20271184, 4733254, 3727144, -12934448}, + FieldElement{6120119, 814863, -11794402, -622716, 6812205, -15747771, 2019594, 7975683, 31123697, -10958981}, + FieldElement{30069250, -11435332, 30434654, 2958439, 18399564, -976289, 12296869, 9204260, -16432438, 9648165}, + }, + { + FieldElement{32705432, -1550977, 30705658, 7451065, -11805606, 9631813, 3305266, 5248604, -26008332, -11377501}, + FieldElement{17219865, 2375039, -31570947, -5575615, -19459679, 9219903, 294711, 15298639, 2662509, -16297073}, + FieldElement{-1172927, -7558695, -4366770, -4287744, -21346413, -8434326, 32087529, -1222777, 32247248, -14389861}, + }, + { + FieldElement{14312628, 1221556, 17395390, -8700143, -4945741, -8684635, -28197744, -9637817, -16027623, -13378845}, + FieldElement{-1428825, -9678990, -9235681, 6549687, -7383069, -468664, 23046502, 9803137, 17597934, 2346211}, + FieldElement{18510800, 15337574, 26171504, 981392, -22241552, 7827556, -23491134, -11323352, 3059833, -11782870}, + }, + { + FieldElement{10141598, 6082907, 17829293, -1947643, 9830092, 13613136, -25556636, -5544586, -33502212, 3592096}, + FieldElement{33114168, -15889352, -26525686, -13343397, 33076705, 8716171, 1151462, 1521897, -982665, -6837803}, + FieldElement{-32939165, -4255815, 23947181, -324178, -33072974, -12305637, -16637686, 3891704, 26353178, 693168}, + }, + { + FieldElement{30374239, 1595580, -16884039, 13186931, 4600344, 406904, 9585294, -400668, 31375464, 14369965}, + FieldElement{-14370654, -7772529, 1510301, 6434173, -18784789, -6262728, 32732230, -13108839, 17901441, 16011505}, + FieldElement{18171223, -11934626, -12500402, 15197122, -11038147, -15230035, -19172240, -16046376, 8764035, 12309598}, + }, + }, + { + { + FieldElement{5975908, -5243188, -19459362, -9681747, -11541277, 14015782, -23665757, 1228319, 17544096, -10593782}, + FieldElement{5811932, -1715293, 3442887, -2269310, -18367348, -8359541, -18044043, -15410127, -5565381, 12348900}, + FieldElement{-31399660, 11407555, 25755363, 6891399, -3256938, 14872274, -24849353, 8141295, -10632534, -585479}, + }, + { + FieldElement{-12675304, 694026, -5076145, 13300344, 14015258, -14451394, -9698672, -11329050, 30944593, 1130208}, + FieldElement{8247766, -6710942, -26562381, -7709309, -14401939, -14648910, 4652152, 2488540, 23550156, -271232}, + FieldElement{17294316, -3788438, 7026748, 15626851, 22990044, 113481, 2267737, -5908146, -408818, -137719}, + }, + { + FieldElement{16091085, -16253926, 18599252, 7340678, 2137637, -1221657, -3364161, 14550936, 3260525, -7166271}, + FieldElement{-4910104, -13332887, 18550887, 10864893, -16459325, -7291596, -23028869, -13204905, -12748722, 2701326}, + FieldElement{-8574695, 16099415, 4629974, -16340524, -20786213, -6005432, -10018363, 9276971, 11329923, 1862132}, + }, + { + FieldElement{14763076, -15903608, -30918270, 3689867, 3511892, 10313526, -21951088, 12219231, -9037963, -940300}, + FieldElement{8894987, -3446094, 6150753, 3013931, 301220, 15693451, -31981216, -2909717, -15438168, 11595570}, + FieldElement{15214962, 3537601, -26238722, -14058872, 4418657, -15230761, 13947276, 10730794, -13489462, -4363670}, + }, + { + FieldElement{-2538306, 7682793, 32759013, 263109, -29984731, -7955452, -22332124, -10188635, 977108, 699994}, + FieldElement{-12466472, 4195084, -9211532, 550904, -15565337, 12917920, 19118110, -439841, -30534533, -14337913}, + FieldElement{31788461, -14507657, 4799989, 7372237, 8808585, -14747943, 9408237, -10051775, 12493932, -5409317}, + }, + { + FieldElement{-25680606, 5260744, -19235809, -6284470, -3695942, 16566087, 27218280, 2607121, 29375955, 6024730}, + FieldElement{842132, -2794693, -4763381, -8722815, 26332018, -12405641, 11831880, 6985184, -9940361, 2854096}, + FieldElement{-4847262, -7969331, 2516242, -5847713, 9695691, -7221186, 16512645, 960770, 12121869, 16648078}, + }, + { + FieldElement{-15218652, 14667096, -13336229, 2013717, 30598287, -464137, -31504922, -7882064, 20237806, 2838411}, + FieldElement{-19288047, 4453152, 15298546, -16178388, 22115043, -15972604, 12544294, -13470457, 1068881, -12499905}, + FieldElement{-9558883, -16518835, 33238498, 13506958, 30505848, -1114596, -8486907, -2630053, 12521378, 4845654}, + }, + { + FieldElement{-28198521, 10744108, -2958380, 10199664, 7759311, -13088600, 3409348, -873400, -6482306, -12885870}, + FieldElement{-23561822, 6230156, -20382013, 10655314, -24040585, -11621172, 10477734, -1240216, -3113227, 13974498}, + FieldElement{12966261, 15550616, -32038948, -1615346, 21025980, -629444, 5642325, 7188737, 18895762, 12629579}, + }, + }, + { + { + FieldElement{14741879, -14946887, 22177208, -11721237, 1279741, 8058600, 11758140, 789443, 32195181, 3895677}, + FieldElement{10758205, 15755439, -4509950, 9243698, -4879422, 6879879, -2204575, -3566119, -8982069, 4429647}, + FieldElement{-2453894, 15725973, -20436342, -10410672, -5803908, -11040220, -7135870, -11642895, 18047436, -15281743}, + }, + { + FieldElement{-25173001, -11307165, 29759956, 11776784, -22262383, -15820455, 10993114, -12850837, -17620701, -9408468}, + FieldElement{21987233, 700364, -24505048, 14972008, -7774265, -5718395, 32155026, 2581431, -29958985, 8773375}, + FieldElement{-25568350, 454463, -13211935, 16126715, 25240068, 8594567, 20656846, 12017935, -7874389, -13920155}, + }, + { + FieldElement{6028182, 6263078, -31011806, -11301710, -818919, 2461772, -31841174, -5468042, -1721788, -2776725}, + FieldElement{-12278994, 16624277, 987579, -5922598, 32908203, 1248608, 7719845, -4166698, 28408820, 6816612}, + FieldElement{-10358094, -8237829, 19549651, -12169222, 22082623, 16147817, 20613181, 13982702, -10339570, 5067943}, + }, + { + FieldElement{-30505967, -3821767, 12074681, 13582412, -19877972, 2443951, -19719286, 12746132, 5331210, -10105944}, + FieldElement{30528811, 3601899, -1957090, 4619785, -27361822, -15436388, 24180793, -12570394, 27679908, -1648928}, + FieldElement{9402404, -13957065, 32834043, 10838634, -26580150, -13237195, 26653274, -8685565, 22611444, -12715406}, + }, + { + FieldElement{22190590, 1118029, 22736441, 15130463, -30460692, -5991321, 19189625, -4648942, 4854859, 6622139}, + FieldElement{-8310738, -2953450, -8262579, -3388049, -10401731, -271929, 13424426, -3567227, 26404409, 13001963}, + FieldElement{-31241838, -15415700, -2994250, 8939346, 11562230, -12840670, -26064365, -11621720, -15405155, 11020693}, + }, + { + FieldElement{1866042, -7949489, -7898649, -10301010, 12483315, 13477547, 3175636, -12424163, 28761762, 1406734}, + FieldElement{-448555, -1777666, 13018551, 3194501, -9580420, -11161737, 24760585, -4347088, 25577411, -13378680}, + FieldElement{-24290378, 4759345, -690653, -1852816, 2066747, 10693769, -29595790, 9884936, -9368926, 4745410}, + }, + { + FieldElement{-9141284, 6049714, -19531061, -4341411, -31260798, 9944276, -15462008, -11311852, 10931924, -11931931}, + FieldElement{-16561513, 14112680, -8012645, 4817318, -8040464, -11414606, -22853429, 10856641, -20470770, 13434654}, + FieldElement{22759489, -10073434, -16766264, -1871422, 13637442, -10168091, 1765144, -12654326, 28445307, -5364710}, + }, + { + FieldElement{29875063, 12493613, 2795536, -3786330, 1710620, 15181182, -10195717, -8788675, 9074234, 1167180}, + FieldElement{-26205683, 11014233, -9842651, -2635485, -26908120, 7532294, -18716888, -9535498, 3843903, 9367684}, + FieldElement{-10969595, -6403711, 9591134, 9582310, 11349256, 108879, 16235123, 8601684, -139197, 4242895}, + }, + }, + { + { + FieldElement{22092954, -13191123, -2042793, -11968512, 32186753, -11517388, -6574341, 2470660, -27417366, 16625501}, + FieldElement{-11057722, 3042016, 13770083, -9257922, 584236, -544855, -7770857, 2602725, -27351616, 14247413}, + FieldElement{6314175, -10264892, -32772502, 15957557, -10157730, 168750, -8618807, 14290061, 27108877, -1180880}, + }, + { + FieldElement{-8586597, -7170966, 13241782, 10960156, -32991015, -13794596, 33547976, -11058889, -27148451, 981874}, + FieldElement{22833440, 9293594, -32649448, -13618667, -9136966, 14756819, -22928859, -13970780, -10479804, -16197962}, + FieldElement{-7768587, 3326786, -28111797, 10783824, 19178761, 14905060, 22680049, 13906969, -15933690, 3797899}, + }, + { + FieldElement{21721356, -4212746, -12206123, 9310182, -3882239, -13653110, 23740224, -2709232, 20491983, -8042152}, + FieldElement{9209270, -15135055, -13256557, -6167798, -731016, 15289673, 25947805, 15286587, 30997318, -6703063}, + FieldElement{7392032, 16618386, 23946583, -8039892, -13265164, -1533858, -14197445, -2321576, 17649998, -250080}, + }, + { + FieldElement{-9301088, -14193827, 30609526, -3049543, -25175069, -1283752, -15241566, -9525724, -2233253, 7662146}, + FieldElement{-17558673, 1763594, -33114336, 15908610, -30040870, -12174295, 7335080, -8472199, -3174674, 3440183}, + FieldElement{-19889700, -5977008, -24111293, -9688870, 10799743, -16571957, 40450, -4431835, 4862400, 1133}, + }, + { + FieldElement{-32856209, -7873957, -5422389, 14860950, -16319031, 7956142, 7258061, 311861, -30594991, -7379421}, + FieldElement{-3773428, -1565936, 28985340, 7499440, 24445838, 9325937, 29727763, 16527196, 18278453, 15405622}, + FieldElement{-4381906, 8508652, -19898366, -3674424, -5984453, 15149970, -13313598, 843523, -21875062, 13626197}, + }, + { + FieldElement{2281448, -13487055, -10915418, -2609910, 1879358, 16164207, -10783882, 3953792, 13340839, 15928663}, + FieldElement{31727126, -7179855, -18437503, -8283652, 2875793, -16390330, -25269894, -7014826, -23452306, 5964753}, + FieldElement{4100420, -5959452, -17179337, 6017714, -18705837, 12227141, -26684835, 11344144, 2538215, -7570755}, + }, + { + FieldElement{-9433605, 6123113, 11159803, -2156608, 30016280, 14966241, -20474983, 1485421, -629256, -15958862}, + FieldElement{-26804558, 4260919, 11851389, 9658551, -32017107, 16367492, -20205425, -13191288, 11659922, -11115118}, + FieldElement{26180396, 10015009, -30844224, -8581293, 5418197, 9480663, 2231568, -10170080, 33100372, -1306171}, + }, + { + FieldElement{15121113, -5201871, -10389905, 15427821, -27509937, -15992507, 21670947, 4486675, -5931810, -14466380}, + FieldElement{16166486, -9483733, -11104130, 6023908, -31926798, -1364923, 2340060, -16254968, -10735770, -10039824}, + FieldElement{28042865, -3557089, -12126526, 12259706, -3717498, -6945899, 6766453, -8689599, 18036436, 5803270}, + }, + }, + { + { + FieldElement{-817581, 6763912, 11803561, 1585585, 10958447, -2671165, 23855391, 4598332, -6159431, -14117438}, + FieldElement{-31031306, -14256194, 17332029, -2383520, 31312682, -5967183, 696309, 50292, -20095739, 11763584}, + FieldElement{-594563, -2514283, -32234153, 12643980, 12650761, 14811489, 665117, -12613632, -19773211, -10713562}, + }, + { + FieldElement{30464590, -11262872, -4127476, -12734478, 19835327, -7105613, -24396175, 2075773, -17020157, 992471}, + FieldElement{18357185, -6994433, 7766382, 16342475, -29324918, 411174, 14578841, 8080033, -11574335, -10601610}, + FieldElement{19598397, 10334610, 12555054, 2555664, 18821899, -10339780, 21873263, 16014234, 26224780, 16452269}, + }, + { + FieldElement{-30223925, 5145196, 5944548, 16385966, 3976735, 2009897, -11377804, -7618186, -20533829, 3698650}, + FieldElement{14187449, 3448569, -10636236, -10810935, -22663880, -3433596, 7268410, -10890444, 27394301, 12015369}, + FieldElement{19695761, 16087646, 28032085, 12999827, 6817792, 11427614, 20244189, -1312777, -13259127, -3402461}, + }, + { + FieldElement{30860103, 12735208, -1888245, -4699734, -16974906, 2256940, -8166013, 12298312, -8550524, -10393462}, + FieldElement{-5719826, -11245325, -1910649, 15569035, 26642876, -7587760, -5789354, -15118654, -4976164, 12651793}, + FieldElement{-2848395, 9953421, 11531313, -5282879, 26895123, -12697089, -13118820, -16517902, 9768698, -2533218}, + }, + { + FieldElement{-24719459, 1894651, -287698, -4704085, 15348719, -8156530, 32767513, 12765450, 4940095, 10678226}, + FieldElement{18860224, 15980149, -18987240, -1562570, -26233012, -11071856, -7843882, 13944024, -24372348, 16582019}, + FieldElement{-15504260, 4970268, -29893044, 4175593, -20993212, -2199756, -11704054, 15444560, -11003761, 7989037}, + }, + { + FieldElement{31490452, 5568061, -2412803, 2182383, -32336847, 4531686, -32078269, 6200206, -19686113, -14800171}, + FieldElement{-17308668, -15879940, -31522777, -2831, -32887382, 16375549, 8680158, -16371713, 28550068, -6857132}, + FieldElement{-28126887, -5688091, 16837845, -1820458, -6850681, 12700016, -30039981, 4364038, 1155602, 5988841}, + }, + { + FieldElement{21890435, -13272907, -12624011, 12154349, -7831873, 15300496, 23148983, -4470481, 24618407, 8283181}, + FieldElement{-33136107, -10512751, 9975416, 6841041, -31559793, 16356536, 3070187, -7025928, 1466169, 10740210}, + FieldElement{-1509399, -15488185, -13503385, -10655916, 32799044, 909394, -13938903, -5779719, -32164649, -15327040}, + }, + { + FieldElement{3960823, -14267803, -28026090, -15918051, -19404858, 13146868, 15567327, 951507, -3260321, -573935}, + FieldElement{24740841, 5052253, -30094131, 8961361, 25877428, 6165135, -24368180, 14397372, -7380369, -6144105}, + FieldElement{-28888365, 3510803, -28103278, -1158478, -11238128, -10631454, -15441463, -14453128, -1625486, -6494814}, + }, + }, + { + { + FieldElement{793299, -9230478, 8836302, -6235707, -27360908, -2369593, 33152843, -4885251, -9906200, -621852}, + FieldElement{5666233, 525582, 20782575, -8038419, -24538499, 14657740, 16099374, 1468826, -6171428, -15186581}, + FieldElement{-4859255, -3779343, -2917758, -6748019, 7778750, 11688288, -30404353, -9871238, -1558923, -9863646}, + }, + { + FieldElement{10896332, -7719704, 824275, 472601, -19460308, 3009587, 25248958, 14783338, -30581476, -15757844}, + FieldElement{10566929, 12612572, -31944212, 11118703, -12633376, 12362879, 21752402, 8822496, 24003793, 14264025}, + FieldElement{27713862, -7355973, -11008240, 9227530, 27050101, 2504721, 23886875, -13117525, 13958495, -5732453}, + }, + { + FieldElement{-23481610, 4867226, -27247128, 3900521, 29838369, -8212291, -31889399, -10041781, 7340521, -15410068}, + FieldElement{4646514, -8011124, -22766023, -11532654, 23184553, 8566613, 31366726, -1381061, -15066784, -10375192}, + FieldElement{-17270517, 12723032, -16993061, 14878794, 21619651, -6197576, 27584817, 3093888, -8843694, 3849921}, + }, + { + FieldElement{-9064912, 2103172, 25561640, -15125738, -5239824, 9582958, 32477045, -9017955, 5002294, -15550259}, + FieldElement{-12057553, -11177906, 21115585, -13365155, 8808712, -12030708, 16489530, 13378448, -25845716, 12741426}, + FieldElement{-5946367, 10645103, -30911586, 15390284, -3286982, -7118677, 24306472, 15852464, 28834118, -7646072}, + }, + { + FieldElement{-17335748, -9107057, -24531279, 9434953, -8472084, -583362, -13090771, 455841, 20461858, 5491305}, + FieldElement{13669248, -16095482, -12481974, -10203039, -14569770, -11893198, -24995986, 11293807, -28588204, -9421832}, + FieldElement{28497928, 6272777, -33022994, 14470570, 8906179, -1225630, 18504674, -14165166, 29867745, -8795943}, + }, + { + FieldElement{-16207023, 13517196, -27799630, -13697798, 24009064, -6373891, -6367600, -13175392, 22853429, -4012011}, + FieldElement{24191378, 16712145, -13931797, 15217831, 14542237, 1646131, 18603514, -11037887, 12876623, -2112447}, + FieldElement{17902668, 4518229, -411702, -2829247, 26878217, 5258055, -12860753, 608397, 16031844, 3723494}, + }, + { + FieldElement{-28632773, 12763728, -20446446, 7577504, 33001348, -13017745, 17558842, -7872890, 23896954, -4314245}, + FieldElement{-20005381, -12011952, 31520464, 605201, 2543521, 5991821, -2945064, 7229064, -9919646, -8826859}, + FieldElement{28816045, 298879, -28165016, -15920938, 19000928, -1665890, -12680833, -2949325, -18051778, -2082915}, + }, + { + FieldElement{16000882, -344896, 3493092, -11447198, -29504595, -13159789, 12577740, 16041268, -19715240, 7847707}, + FieldElement{10151868, 10572098, 27312476, 7922682, 14825339, 4723128, -32855931, -6519018, -10020567, 3852848}, + FieldElement{-11430470, 15697596, -21121557, -4420647, 5386314, 15063598, 16514493, -15932110, 29330899, -15076224}, + }, + }, + { + { + FieldElement{-25499735, -4378794, -15222908, -6901211, 16615731, 2051784, 3303702, 15490, -27548796, 12314391}, + FieldElement{15683520, -6003043, 18109120, -9980648, 15337968, -5997823, -16717435, 15921866, 16103996, -3731215}, + FieldElement{-23169824, -10781249, 13588192, -1628807, -3798557, -1074929, -19273607, 5402699, -29815713, -9841101}, + }, + { + FieldElement{23190676, 2384583, -32714340, 3462154, -29903655, -1529132, -11266856, 8911517, -25205859, 2739713}, + FieldElement{21374101, -3554250, -33524649, 9874411, 15377179, 11831242, -33529904, 6134907, 4931255, 11987849}, + FieldElement{-7732, -2978858, -16223486, 7277597, 105524, -322051, -31480539, 13861388, -30076310, 10117930}, + }, + { + FieldElement{-29501170, -10744872, -26163768, 13051539, -25625564, 5089643, -6325503, 6704079, 12890019, 15728940}, + FieldElement{-21972360, -11771379, -951059, -4418840, 14704840, 2695116, 903376, -10428139, 12885167, 8311031}, + FieldElement{-17516482, 5352194, 10384213, -13811658, 7506451, 13453191, 26423267, 4384730, 1888765, -5435404}, + }, + { + FieldElement{-25817338, -3107312, -13494599, -3182506, 30896459, -13921729, -32251644, -12707869, -19464434, -3340243}, + FieldElement{-23607977, -2665774, -526091, 4651136, 5765089, 4618330, 6092245, 14845197, 17151279, -9854116}, + FieldElement{-24830458, -12733720, -15165978, 10367250, -29530908, -265356, 22825805, -7087279, -16866484, 16176525}, + }, + { + FieldElement{-23583256, 6564961, 20063689, 3798228, -4740178, 7359225, 2006182, -10363426, -28746253, -10197509}, + FieldElement{-10626600, -4486402, -13320562, -5125317, 3432136, -6393229, 23632037, -1940610, 32808310, 1099883}, + FieldElement{15030977, 5768825, -27451236, -2887299, -6427378, -15361371, -15277896, -6809350, 2051441, -15225865}, + }, + { + FieldElement{-3362323, -7239372, 7517890, 9824992, 23555850, 295369, 5148398, -14154188, -22686354, 16633660}, + FieldElement{4577086, -16752288, 13249841, -15304328, 19958763, -14537274, 18559670, -10759549, 8402478, -9864273}, + FieldElement{-28406330, -1051581, -26790155, -907698, -17212414, -11030789, 9453451, -14980072, 17983010, 9967138}, + }, + { + FieldElement{-25762494, 6524722, 26585488, 9969270, 24709298, 1220360, -1677990, 7806337, 17507396, 3651560}, + FieldElement{-10420457, -4118111, 14584639, 15971087, -15768321, 8861010, 26556809, -5574557, -18553322, -11357135}, + FieldElement{2839101, 14284142, 4029895, 3472686, 14402957, 12689363, -26642121, 8459447, -5605463, -7621941}, + }, + { + FieldElement{-4839289, -3535444, 9744961, 2871048, 25113978, 3187018, -25110813, -849066, 17258084, -7977739}, + FieldElement{18164541, -10595176, -17154882, -1542417, 19237078, -9745295, 23357533, -15217008, 26908270, 12150756}, + FieldElement{-30264870, -7647865, 5112249, -7036672, -1499807, -6974257, 43168, -5537701, -32302074, 16215819}, + }, + }, + { + { + FieldElement{-6898905, 9824394, -12304779, -4401089, -31397141, -6276835, 32574489, 12532905, -7503072, -8675347}, + FieldElement{-27343522, -16515468, -27151524, -10722951, 946346, 16291093, 254968, 7168080, 21676107, -1943028}, + FieldElement{21260961, -8424752, -16831886, -11920822, -23677961, 3968121, -3651949, -6215466, -3556191, -7913075}, + }, + { + FieldElement{16544754, 13250366, -16804428, 15546242, -4583003, 12757258, -2462308, -8680336, -18907032, -9662799}, + FieldElement{-2415239, -15577728, 18312303, 4964443, -15272530, -12653564, 26820651, 16690659, 25459437, -4564609}, + FieldElement{-25144690, 11425020, 28423002, -11020557, -6144921, -15826224, 9142795, -2391602, -6432418, -1644817}, + }, + { + FieldElement{-23104652, 6253476, 16964147, -3768872, -25113972, -12296437, -27457225, -16344658, 6335692, 7249989}, + FieldElement{-30333227, 13979675, 7503222, -12368314, -11956721, -4621693, -30272269, 2682242, 25993170, -12478523}, + FieldElement{4364628, 5930691, 32304656, -10044554, -8054781, 15091131, 22857016, -10598955, 31820368, 15075278}, + }, + { + FieldElement{31879134, -8918693, 17258761, 90626, -8041836, -4917709, 24162788, -9650886, -17970238, 12833045}, + FieldElement{19073683, 14851414, -24403169, -11860168, 7625278, 11091125, -19619190, 2074449, -9413939, 14905377}, + FieldElement{24483667, -11935567, -2518866, -11547418, -1553130, 15355506, -25282080, 9253129, 27628530, -7555480}, + }, + { + FieldElement{17597607, 8340603, 19355617, 552187, 26198470, -3176583, 4593324, -9157582, -14110875, 15297016}, + FieldElement{510886, 14337390, -31785257, 16638632, 6328095, 2713355, -20217417, -11864220, 8683221, 2921426}, + FieldElement{18606791, 11874196, 27155355, -5281482, -24031742, 6265446, -25178240, -1278924, 4674690, 13890525}, + }, + { + FieldElement{13609624, 13069022, -27372361, -13055908, 24360586, 9592974, 14977157, 9835105, 4389687, 288396}, + FieldElement{9922506, -519394, 13613107, 5883594, -18758345, -434263, -12304062, 8317628, 23388070, 16052080}, + FieldElement{12720016, 11937594, -31970060, -5028689, 26900120, 8561328, -20155687, -11632979, -14754271, -10812892}, + }, + { + FieldElement{15961858, 14150409, 26716931, -665832, -22794328, 13603569, 11829573, 7467844, -28822128, 929275}, + FieldElement{11038231, -11582396, -27310482, -7316562, -10498527, -16307831, -23479533, -9371869, -21393143, 2465074}, + FieldElement{20017163, -4323226, 27915242, 1529148, 12396362, 15675764, 13817261, -9658066, 2463391, -4622140}, + }, + { + FieldElement{-16358878, -12663911, -12065183, 4996454, -1256422, 1073572, 9583558, 12851107, 4003896, 12673717}, + FieldElement{-1731589, -15155870, -3262930, 16143082, 19294135, 13385325, 14741514, -9103726, 7903886, 2348101}, + FieldElement{24536016, -16515207, 12715592, -3862155, 1511293, 10047386, -3842346, -7129159, -28377538, 10048127}, + }, + }, + { + { + FieldElement{-12622226, -6204820, 30718825, 2591312, -10617028, 12192840, 18873298, -7297090, -32297756, 15221632}, + FieldElement{-26478122, -11103864, 11546244, -1852483, 9180880, 7656409, -21343950, 2095755, 29769758, 6593415}, + FieldElement{-31994208, -2907461, 4176912, 3264766, 12538965, -868111, 26312345, -6118678, 30958054, 8292160}, + }, + { + FieldElement{31429822, -13959116, 29173532, 15632448, 12174511, -2760094, 32808831, 3977186, 26143136, -3148876}, + FieldElement{22648901, 1402143, -22799984, 13746059, 7936347, 365344, -8668633, -1674433, -3758243, -2304625}, + FieldElement{-15491917, 8012313, -2514730, -12702462, -23965846, -10254029, -1612713, -1535569, -16664475, 8194478}, + }, + { + FieldElement{27338066, -7507420, -7414224, 10140405, -19026427, -6589889, 27277191, 8855376, 28572286, 3005164}, + FieldElement{26287124, 4821776, 25476601, -4145903, -3764513, -15788984, -18008582, 1182479, -26094821, -13079595}, + FieldElement{-7171154, 3178080, 23970071, 6201893, -17195577, -4489192, -21876275, -13982627, 32208683, -1198248}, + }, + { + FieldElement{-16657702, 2817643, -10286362, 14811298, 6024667, 13349505, -27315504, -10497842, -27672585, -11539858}, + FieldElement{15941029, -9405932, -21367050, 8062055, 31876073, -238629, -15278393, -1444429, 15397331, -4130193}, + FieldElement{8934485, -13485467, -23286397, -13423241, -32446090, 14047986, 31170398, -1441021, -27505566, 15087184}, + }, + { + FieldElement{-18357243, -2156491, 24524913, -16677868, 15520427, -6360776, -15502406, 11461896, 16788528, -5868942}, + FieldElement{-1947386, 16013773, 21750665, 3714552, -17401782, -16055433, -3770287, -10323320, 31322514, -11615635}, + FieldElement{21426655, -5650218, -13648287, -5347537, -28812189, -4920970, -18275391, -14621414, 13040862, -12112948}, + }, + { + FieldElement{11293895, 12478086, -27136401, 15083750, -29307421, 14748872, 14555558, -13417103, 1613711, 4896935}, + FieldElement{-25894883, 15323294, -8489791, -8057900, 25967126, -13425460, 2825960, -4897045, -23971776, -11267415}, + FieldElement{-15924766, -5229880, -17443532, 6410664, 3622847, 10243618, 20615400, 12405433, -23753030, -8436416}, + }, + { + FieldElement{-7091295, 12556208, -20191352, 9025187, -17072479, 4333801, 4378436, 2432030, 23097949, -566018}, + FieldElement{4565804, -16025654, 20084412, -7842817, 1724999, 189254, 24767264, 10103221, -18512313, 2424778}, + FieldElement{366633, -11976806, 8173090, -6890119, 30788634, 5745705, -7168678, 1344109, -3642553, 12412659}, + }, + { + FieldElement{-24001791, 7690286, 14929416, -168257, -32210835, -13412986, 24162697, -15326504, -3141501, 11179385}, + FieldElement{18289522, -14724954, 8056945, 16430056, -21729724, 7842514, -6001441, -1486897, -18684645, -11443503}, + FieldElement{476239, 6601091, -6152790, -9723375, 17503545, -4863900, 27672959, 13403813, 11052904, 5219329}, + }, + }, + { + { + FieldElement{20678546, -8375738, -32671898, 8849123, -5009758, 14574752, 31186971, -3973730, 9014762, -8579056}, + FieldElement{-13644050, -10350239, -15962508, 5075808, -1514661, -11534600, -33102500, 9160280, 8473550, -3256838}, + FieldElement{24900749, 14435722, 17209120, -15292541, -22592275, 9878983, -7689309, -16335821, -24568481, 11788948}, + }, + { + FieldElement{-3118155, -11395194, -13802089, 14797441, 9652448, -6845904, -20037437, 10410733, -24568470, -1458691}, + FieldElement{-15659161, 16736706, -22467150, 10215878, -9097177, 7563911, 11871841, -12505194, -18513325, 8464118}, + FieldElement{-23400612, 8348507, -14585951, -861714, -3950205, -6373419, 14325289, 8628612, 33313881, -8370517}, + }, + { + FieldElement{-20186973, -4967935, 22367356, 5271547, -1097117, -4788838, -24805667, -10236854, -8940735, -5818269}, + FieldElement{-6948785, -1795212, -32625683, -16021179, 32635414, -7374245, 15989197, -12838188, 28358192, -4253904}, + FieldElement{-23561781, -2799059, -32351682, -1661963, -9147719, 10429267, -16637684, 4072016, -5351664, 5596589}, + }, + { + FieldElement{-28236598, -3390048, 12312896, 6213178, 3117142, 16078565, 29266239, 2557221, 1768301, 15373193}, + FieldElement{-7243358, -3246960, -4593467, -7553353, -127927, -912245, -1090902, -4504991, -24660491, 3442910}, + FieldElement{-30210571, 5124043, 14181784, 8197961, 18964734, -11939093, 22597931, 7176455, -18585478, 13365930}, + }, + { + FieldElement{-7877390, -1499958, 8324673, 4690079, 6261860, 890446, 24538107, -8570186, -9689599, -3031667}, + FieldElement{25008904, -10771599, -4305031, -9638010, 16265036, 15721635, 683793, -11823784, 15723479, -15163481}, + FieldElement{-9660625, 12374379, -27006999, -7026148, -7724114, -12314514, 11879682, 5400171, 519526, -1235876}, + }, + { + FieldElement{22258397, -16332233, -7869817, 14613016, -22520255, -2950923, -20353881, 7315967, 16648397, 7605640}, + FieldElement{-8081308, -8464597, -8223311, 9719710, 19259459, -15348212, 23994942, -5281555, -9468848, 4763278}, + FieldElement{-21699244, 9220969, -15730624, 1084137, -25476107, -2852390, 31088447, -7764523, -11356529, 728112}, + }, + { + FieldElement{26047220, -11751471, -6900323, -16521798, 24092068, 9158119, -4273545, -12555558, -29365436, -5498272}, + FieldElement{17510331, -322857, 5854289, 8403524, 17133918, -3112612, -28111007, 12327945, 10750447, 10014012}, + FieldElement{-10312768, 3936952, 9156313, -8897683, 16498692, -994647, -27481051, -666732, 3424691, 7540221}, + }, + { + FieldElement{30322361, -6964110, 11361005, -4143317, 7433304, 4989748, -7071422, -16317219, -9244265, 15258046}, + FieldElement{13054562, -2779497, 19155474, 469045, -12482797, 4566042, 5631406, 2711395, 1062915, -5136345}, + FieldElement{-19240248, -11254599, -29509029, -7499965, -5835763, 13005411, -6066489, 12194497, 32960380, 1459310}, + }, + }, + { + { + FieldElement{19852034, 7027924, 23669353, 10020366, 8586503, -6657907, 394197, -6101885, 18638003, -11174937}, + FieldElement{31395534, 15098109, 26581030, 8030562, -16527914, -5007134, 9012486, -7584354, -6643087, -5442636}, + FieldElement{-9192165, -2347377, -1997099, 4529534, 25766844, 607986, -13222, 9677543, -32294889, -6456008}, + }, + { + FieldElement{-2444496, -149937, 29348902, 8186665, 1873760, 12489863, -30934579, -7839692, -7852844, -8138429}, + FieldElement{-15236356, -15433509, 7766470, 746860, 26346930, -10221762, -27333451, 10754588, -9431476, 5203576}, + FieldElement{31834314, 14135496, -770007, 5159118, 20917671, -16768096, -7467973, -7337524, 31809243, 7347066}, + }, + { + FieldElement{-9606723, -11874240, 20414459, 13033986, 13716524, -11691881, 19797970, -12211255, 15192876, -2087490}, + FieldElement{-12663563, -2181719, 1168162, -3804809, 26747877, -14138091, 10609330, 12694420, 33473243, -13382104}, + FieldElement{33184999, 11180355, 15832085, -11385430, -1633671, 225884, 15089336, -11023903, -6135662, 14480053}, + }, + { + FieldElement{31308717, -5619998, 31030840, -1897099, 15674547, -6582883, 5496208, 13685227, 27595050, 8737275}, + FieldElement{-20318852, -15150239, 10933843, -16178022, 8335352, -7546022, -31008351, -12610604, 26498114, 66511}, + FieldElement{22644454, -8761729, -16671776, 4884562, -3105614, -13559366, 30540766, -4286747, -13327787, -7515095}, + }, + { + FieldElement{-28017847, 9834845, 18617207, -2681312, -3401956, -13307506, 8205540, 13585437, -17127465, 15115439}, + FieldElement{23711543, -672915, 31206561, -8362711, 6164647, -9709987, -33535882, -1426096, 8236921, 16492939}, + FieldElement{-23910559, -13515526, -26299483, -4503841, 25005590, -7687270, 19574902, 10071562, 6708380, -6222424}, + }, + { + FieldElement{2101391, -4930054, 19702731, 2367575, -15427167, 1047675, 5301017, 9328700, 29955601, -11678310}, + FieldElement{3096359, 9271816, -21620864, -15521844, -14847996, -7592937, -25892142, -12635595, -9917575, 6216608}, + FieldElement{-32615849, 338663, -25195611, 2510422, -29213566, -13820213, 24822830, -6146567, -26767480, 7525079}, + }, + { + FieldElement{-23066649, -13985623, 16133487, -7896178, -3389565, 778788, -910336, -2782495, -19386633, 11994101}, + FieldElement{21691500, -13624626, -641331, -14367021, 3285881, -3483596, -25064666, 9718258, -7477437, 13381418}, + FieldElement{18445390, -4202236, 14979846, 11622458, -1727110, -3582980, 23111648, -6375247, 28535282, 15779576}, + }, + { + FieldElement{30098053, 3089662, -9234387, 16662135, -21306940, 11308411, -14068454, 12021730, 9955285, -16303356}, + FieldElement{9734894, -14576830, -7473633, -9138735, 2060392, 11313496, -18426029, 9924399, 20194861, 13380996}, + FieldElement{-26378102, -7965207, -22167821, 15789297, -18055342, -6168792, -1984914, 15707771, 26342023, 10146099}, + }, + }, + { + { + FieldElement{-26016874, -219943, 21339191, -41388, 19745256, -2878700, -29637280, 2227040, 21612326, -545728}, + FieldElement{-13077387, 1184228, 23562814, -5970442, -20351244, -6348714, 25764461, 12243797, -20856566, 11649658}, + FieldElement{-10031494, 11262626, 27384172, 2271902, 26947504, -15997771, 39944, 6114064, 33514190, 2333242}, + }, + { + FieldElement{-21433588, -12421821, 8119782, 7219913, -21830522, -9016134, -6679750, -12670638, 24350578, -13450001}, + FieldElement{-4116307, -11271533, -23886186, 4843615, -30088339, 690623, -31536088, -10406836, 8317860, 12352766}, + FieldElement{18200138, -14475911, -33087759, -2696619, -23702521, -9102511, -23552096, -2287550, 20712163, 6719373}, + }, + { + FieldElement{26656208, 6075253, -7858556, 1886072, -28344043, 4262326, 11117530, -3763210, 26224235, -3297458}, + FieldElement{-17168938, -14854097, -3395676, -16369877, -19954045, 14050420, 21728352, 9493610, 18620611, -16428628}, + FieldElement{-13323321, 13325349, 11432106, 5964811, 18609221, 6062965, -5269471, -9725556, -30701573, -16479657}, + }, + { + FieldElement{-23860538, -11233159, 26961357, 1640861, -32413112, -16737940, 12248509, -5240639, 13735342, 1934062}, + FieldElement{25089769, 6742589, 17081145, -13406266, 21909293, -16067981, -15136294, -3765346, -21277997, 5473616}, + FieldElement{31883677, -7961101, 1083432, -11572403, 22828471, 13290673, -7125085, 12469656, 29111212, -5451014}, + }, + { + FieldElement{24244947, -15050407, -26262976, 2791540, -14997599, 16666678, 24367466, 6388839, -10295587, 452383}, + FieldElement{-25640782, -3417841, 5217916, 16224624, 19987036, -4082269, -24236251, -5915248, 15766062, 8407814}, + FieldElement{-20406999, 13990231, 15495425, 16395525, 5377168, 15166495, -8917023, -4388953, -8067909, 2276718}, + }, + { + FieldElement{30157918, 12924066, -17712050, 9245753, 19895028, 3368142, -23827587, 5096219, 22740376, -7303417}, + FieldElement{2041139, -14256350, 7783687, 13876377, -25946985, -13352459, 24051124, 13742383, -15637599, 13295222}, + FieldElement{33338237, -8505733, 12532113, 7977527, 9106186, -1715251, -17720195, -4612972, -4451357, -14669444}, + }, + { + FieldElement{-20045281, 5454097, -14346548, 6447146, 28862071, 1883651, -2469266, -4141880, 7770569, 9620597}, + FieldElement{23208068, 7979712, 33071466, 8149229, 1758231, -10834995, 30945528, -1694323, -33502340, -14767970}, + FieldElement{1439958, -16270480, -1079989, -793782, 4625402, 10647766, -5043801, 1220118, 30494170, -11440799}, + }, + { + FieldElement{-5037580, -13028295, -2970559, -3061767, 15640974, -6701666, -26739026, 926050, -1684339, -13333647}, + FieldElement{13908495, -3549272, 30919928, -6273825, -21521863, 7989039, 9021034, 9078865, 3353509, 4033511}, + FieldElement{-29663431, -15113610, 32259991, -344482, 24295849, -12912123, 23161163, 8839127, 27485041, 7356032}, + }, + }, + { + { + FieldElement{9661027, 705443, 11980065, -5370154, -1628543, 14661173, -6346142, 2625015, 28431036, -16771834}, + FieldElement{-23839233, -8311415, -25945511, 7480958, -17681669, -8354183, -22545972, 14150565, 15970762, 4099461}, + FieldElement{29262576, 16756590, 26350592, -8793563, 8529671, -11208050, 13617293, -9937143, 11465739, 8317062}, + }, + { + FieldElement{-25493081, -6962928, 32500200, -9419051, -23038724, -2302222, 14898637, 3848455, 20969334, -5157516}, + FieldElement{-20384450, -14347713, -18336405, 13884722, -33039454, 2842114, -21610826, -3649888, 11177095, 14989547}, + FieldElement{-24496721, -11716016, 16959896, 2278463, 12066309, 10137771, 13515641, 2581286, -28487508, 9930240}, + }, + { + FieldElement{-17751622, -2097826, 16544300, -13009300, -15914807, -14949081, 18345767, -13403753, 16291481, -5314038}, + FieldElement{-33229194, 2553288, 32678213, 9875984, 8534129, 6889387, -9676774, 6957617, 4368891, 9788741}, + FieldElement{16660756, 7281060, -10830758, 12911820, 20108584, -8101676, -21722536, -8613148, 16250552, -11111103}, + }, + { + FieldElement{-19765507, 2390526, -16551031, 14161980, 1905286, 6414907, 4689584, 10604807, -30190403, 4782747}, + FieldElement{-1354539, 14736941, -7367442, -13292886, 7710542, -14155590, -9981571, 4383045, 22546403, 437323}, + FieldElement{31665577, -12180464, -16186830, 1491339, -18368625, 3294682, 27343084, 2786261, -30633590, -14097016}, + }, + { + FieldElement{-14467279, -683715, -33374107, 7448552, 19294360, 14334329, -19690631, 2355319, -19284671, -6114373}, + FieldElement{15121312, -15796162, 6377020, -6031361, -10798111, -12957845, 18952177, 15496498, -29380133, 11754228}, + FieldElement{-2637277, -13483075, 8488727, -14303896, 12728761, -1622493, 7141596, 11724556, 22761615, -10134141}, + }, + { + FieldElement{16918416, 11729663, -18083579, 3022987, -31015732, -13339659, -28741185, -12227393, 32851222, 11717399}, + FieldElement{11166634, 7338049, -6722523, 4531520, -29468672, -7302055, 31474879, 3483633, -1193175, -4030831}, + FieldElement{-185635, 9921305, 31456609, -13536438, -12013818, 13348923, 33142652, 6546660, -19985279, -3948376}, + }, + { + FieldElement{-32460596, 11266712, -11197107, -7899103, 31703694, 3855903, -8537131, -12833048, -30772034, -15486313}, + FieldElement{-18006477, 12709068, 3991746, -6479188, -21491523, -10550425, -31135347, -16049879, 10928917, 3011958}, + FieldElement{-6957757, -15594337, 31696059, 334240, 29576716, 14796075, -30831056, -12805180, 18008031, 10258577}, + }, + { + FieldElement{-22448644, 15655569, 7018479, -4410003, -30314266, -1201591, -1853465, 1367120, 25127874, 6671743}, + FieldElement{29701166, -14373934, -10878120, 9279288, -17568, 13127210, 21382910, 11042292, 25838796, 4642684}, + FieldElement{-20430234, 14955537, -24126347, 8124619, -5369288, -5990470, 30468147, -13900640, 18423289, 4177476}, + }, + }, +} diff --git a/libgo/go/crypto/ed25519/internal/edwards25519/edwards25519.go b/libgo/go/crypto/ed25519/internal/edwards25519/edwards25519.go new file mode 100644 index 00000000000..fd03c252af4 --- /dev/null +++ b/libgo/go/crypto/ed25519/internal/edwards25519/edwards25519.go @@ -0,0 +1,1793 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package edwards25519 + +import "encoding/binary" + +// This code is a port of the public domain, “ref10” implementation of ed25519 +// from SUPERCOP. + +// FieldElement represents an element of the field GF(2^255 - 19). An element +// t, entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77 +// t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on +// context. +type FieldElement [10]int32 + +var zero FieldElement + +func FeZero(fe *FieldElement) { + copy(fe[:], zero[:]) +} + +func FeOne(fe *FieldElement) { + FeZero(fe) + fe[0] = 1 +} + +func FeAdd(dst, a, b *FieldElement) { + dst[0] = a[0] + b[0] + dst[1] = a[1] + b[1] + dst[2] = a[2] + b[2] + dst[3] = a[3] + b[3] + dst[4] = a[4] + b[4] + dst[5] = a[5] + b[5] + dst[6] = a[6] + b[6] + dst[7] = a[7] + b[7] + dst[8] = a[8] + b[8] + dst[9] = a[9] + b[9] +} + +func FeSub(dst, a, b *FieldElement) { + dst[0] = a[0] - b[0] + dst[1] = a[1] - b[1] + dst[2] = a[2] - b[2] + dst[3] = a[3] - b[3] + dst[4] = a[4] - b[4] + dst[5] = a[5] - b[5] + dst[6] = a[6] - b[6] + dst[7] = a[7] - b[7] + dst[8] = a[8] - b[8] + dst[9] = a[9] - b[9] +} + +func FeCopy(dst, src *FieldElement) { + copy(dst[:], src[:]) +} + +// Replace (f,g) with (g,g) if b == 1; +// replace (f,g) with (f,g) if b == 0. +// +// Preconditions: b in {0,1}. +func FeCMove(f, g *FieldElement, b int32) { + b = -b + f[0] ^= b & (f[0] ^ g[0]) + f[1] ^= b & (f[1] ^ g[1]) + f[2] ^= b & (f[2] ^ g[2]) + f[3] ^= b & (f[3] ^ g[3]) + f[4] ^= b & (f[4] ^ g[4]) + f[5] ^= b & (f[5] ^ g[5]) + f[6] ^= b & (f[6] ^ g[6]) + f[7] ^= b & (f[7] ^ g[7]) + f[8] ^= b & (f[8] ^ g[8]) + f[9] ^= b & (f[9] ^ g[9]) +} + +func load3(in []byte) int64 { + var r int64 + r = int64(in[0]) + r |= int64(in[1]) << 8 + r |= int64(in[2]) << 16 + return r +} + +func load4(in []byte) int64 { + var r int64 + r = int64(in[0]) + r |= int64(in[1]) << 8 + r |= int64(in[2]) << 16 + r |= int64(in[3]) << 24 + return r +} + +func FeFromBytes(dst *FieldElement, src *[32]byte) { + h0 := load4(src[:]) + h1 := load3(src[4:]) << 6 + h2 := load3(src[7:]) << 5 + h3 := load3(src[10:]) << 3 + h4 := load3(src[13:]) << 2 + h5 := load4(src[16:]) + h6 := load3(src[20:]) << 7 + h7 := load3(src[23:]) << 5 + h8 := load3(src[26:]) << 4 + h9 := (load3(src[29:]) & 8388607) << 2 + + FeCombine(dst, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9) +} + +// FeToBytes marshals h to s. +// Preconditions: +// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. +// +// Write p=2^255-19; q=floor(h/p). +// Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))). +// +// Proof: +// Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4. +// Also have |h-2^230 h9|<2^230 so |19 2^(-255)(h-2^230 h9)|<1/4. +// +// Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9). +// Then 0> 25 + q = (h[0] + q) >> 26 + q = (h[1] + q) >> 25 + q = (h[2] + q) >> 26 + q = (h[3] + q) >> 25 + q = (h[4] + q) >> 26 + q = (h[5] + q) >> 25 + q = (h[6] + q) >> 26 + q = (h[7] + q) >> 25 + q = (h[8] + q) >> 26 + q = (h[9] + q) >> 25 + + // Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20. + h[0] += 19 * q + // Goal: Output h-2^255 q, which is between 0 and 2^255-20. + + carry[0] = h[0] >> 26 + h[1] += carry[0] + h[0] -= carry[0] << 26 + carry[1] = h[1] >> 25 + h[2] += carry[1] + h[1] -= carry[1] << 25 + carry[2] = h[2] >> 26 + h[3] += carry[2] + h[2] -= carry[2] << 26 + carry[3] = h[3] >> 25 + h[4] += carry[3] + h[3] -= carry[3] << 25 + carry[4] = h[4] >> 26 + h[5] += carry[4] + h[4] -= carry[4] << 26 + carry[5] = h[5] >> 25 + h[6] += carry[5] + h[5] -= carry[5] << 25 + carry[6] = h[6] >> 26 + h[7] += carry[6] + h[6] -= carry[6] << 26 + carry[7] = h[7] >> 25 + h[8] += carry[7] + h[7] -= carry[7] << 25 + carry[8] = h[8] >> 26 + h[9] += carry[8] + h[8] -= carry[8] << 26 + carry[9] = h[9] >> 25 + h[9] -= carry[9] << 25 + // h10 = carry9 + + // Goal: Output h[0]+...+2^255 h10-2^255 q, which is between 0 and 2^255-20. + // Have h[0]+...+2^230 h[9] between 0 and 2^255-1; + // evidently 2^255 h10-2^255 q = 0. + // Goal: Output h[0]+...+2^230 h[9]. + + s[0] = byte(h[0] >> 0) + s[1] = byte(h[0] >> 8) + s[2] = byte(h[0] >> 16) + s[3] = byte((h[0] >> 24) | (h[1] << 2)) + s[4] = byte(h[1] >> 6) + s[5] = byte(h[1] >> 14) + s[6] = byte((h[1] >> 22) | (h[2] << 3)) + s[7] = byte(h[2] >> 5) + s[8] = byte(h[2] >> 13) + s[9] = byte((h[2] >> 21) | (h[3] << 5)) + s[10] = byte(h[3] >> 3) + s[11] = byte(h[3] >> 11) + s[12] = byte((h[3] >> 19) | (h[4] << 6)) + s[13] = byte(h[4] >> 2) + s[14] = byte(h[4] >> 10) + s[15] = byte(h[4] >> 18) + s[16] = byte(h[5] >> 0) + s[17] = byte(h[5] >> 8) + s[18] = byte(h[5] >> 16) + s[19] = byte((h[5] >> 24) | (h[6] << 1)) + s[20] = byte(h[6] >> 7) + s[21] = byte(h[6] >> 15) + s[22] = byte((h[6] >> 23) | (h[7] << 3)) + s[23] = byte(h[7] >> 5) + s[24] = byte(h[7] >> 13) + s[25] = byte((h[7] >> 21) | (h[8] << 4)) + s[26] = byte(h[8] >> 4) + s[27] = byte(h[8] >> 12) + s[28] = byte((h[8] >> 20) | (h[9] << 6)) + s[29] = byte(h[9] >> 2) + s[30] = byte(h[9] >> 10) + s[31] = byte(h[9] >> 18) +} + +func FeIsNegative(f *FieldElement) byte { + var s [32]byte + FeToBytes(&s, f) + return s[0] & 1 +} + +func FeIsNonZero(f *FieldElement) int32 { + var s [32]byte + FeToBytes(&s, f) + var x uint8 + for _, b := range s { + x |= b + } + x |= x >> 4 + x |= x >> 2 + x |= x >> 1 + return int32(x & 1) +} + +// FeNeg sets h = -f +// +// Preconditions: +// |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. +// +// Postconditions: +// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. +func FeNeg(h, f *FieldElement) { + h[0] = -f[0] + h[1] = -f[1] + h[2] = -f[2] + h[3] = -f[3] + h[4] = -f[4] + h[5] = -f[5] + h[6] = -f[6] + h[7] = -f[7] + h[8] = -f[8] + h[9] = -f[9] +} + +func FeCombine(h *FieldElement, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 int64) { + var c0, c1, c2, c3, c4, c5, c6, c7, c8, c9 int64 + + /* + |h0| <= (1.1*1.1*2^52*(1+19+19+19+19)+1.1*1.1*2^50*(38+38+38+38+38)) + i.e. |h0| <= 1.2*2^59; narrower ranges for h2, h4, h6, h8 + |h1| <= (1.1*1.1*2^51*(1+1+19+19+19+19+19+19+19+19)) + i.e. |h1| <= 1.5*2^58; narrower ranges for h3, h5, h7, h9 + */ + + c0 = (h0 + (1 << 25)) >> 26 + h1 += c0 + h0 -= c0 << 26 + c4 = (h4 + (1 << 25)) >> 26 + h5 += c4 + h4 -= c4 << 26 + /* |h0| <= 2^25 */ + /* |h4| <= 2^25 */ + /* |h1| <= 1.51*2^58 */ + /* |h5| <= 1.51*2^58 */ + + c1 = (h1 + (1 << 24)) >> 25 + h2 += c1 + h1 -= c1 << 25 + c5 = (h5 + (1 << 24)) >> 25 + h6 += c5 + h5 -= c5 << 25 + /* |h1| <= 2^24; from now on fits into int32 */ + /* |h5| <= 2^24; from now on fits into int32 */ + /* |h2| <= 1.21*2^59 */ + /* |h6| <= 1.21*2^59 */ + + c2 = (h2 + (1 << 25)) >> 26 + h3 += c2 + h2 -= c2 << 26 + c6 = (h6 + (1 << 25)) >> 26 + h7 += c6 + h6 -= c6 << 26 + /* |h2| <= 2^25; from now on fits into int32 unchanged */ + /* |h6| <= 2^25; from now on fits into int32 unchanged */ + /* |h3| <= 1.51*2^58 */ + /* |h7| <= 1.51*2^58 */ + + c3 = (h3 + (1 << 24)) >> 25 + h4 += c3 + h3 -= c3 << 25 + c7 = (h7 + (1 << 24)) >> 25 + h8 += c7 + h7 -= c7 << 25 + /* |h3| <= 2^24; from now on fits into int32 unchanged */ + /* |h7| <= 2^24; from now on fits into int32 unchanged */ + /* |h4| <= 1.52*2^33 */ + /* |h8| <= 1.52*2^33 */ + + c4 = (h4 + (1 << 25)) >> 26 + h5 += c4 + h4 -= c4 << 26 + c8 = (h8 + (1 << 25)) >> 26 + h9 += c8 + h8 -= c8 << 26 + /* |h4| <= 2^25; from now on fits into int32 unchanged */ + /* |h8| <= 2^25; from now on fits into int32 unchanged */ + /* |h5| <= 1.01*2^24 */ + /* |h9| <= 1.51*2^58 */ + + c9 = (h9 + (1 << 24)) >> 25 + h0 += c9 * 19 + h9 -= c9 << 25 + /* |h9| <= 2^24; from now on fits into int32 unchanged */ + /* |h0| <= 1.8*2^37 */ + + c0 = (h0 + (1 << 25)) >> 26 + h1 += c0 + h0 -= c0 << 26 + /* |h0| <= 2^25; from now on fits into int32 unchanged */ + /* |h1| <= 1.01*2^24 */ + + h[0] = int32(h0) + h[1] = int32(h1) + h[2] = int32(h2) + h[3] = int32(h3) + h[4] = int32(h4) + h[5] = int32(h5) + h[6] = int32(h6) + h[7] = int32(h7) + h[8] = int32(h8) + h[9] = int32(h9) +} + +// FeMul calculates h = f * g +// Can overlap h with f or g. +// +// Preconditions: +// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. +// |g| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. +// +// Postconditions: +// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. +// +// Notes on implementation strategy: +// +// Using schoolbook multiplication. +// Karatsuba would save a little in some cost models. +// +// Most multiplications by 2 and 19 are 32-bit precomputations; +// cheaper than 64-bit postcomputations. +// +// There is one remaining multiplication by 19 in the carry chain; +// one *19 precomputation can be merged into this, +// but the resulting data flow is considerably less clean. +// +// There are 12 carries below. +// 10 of them are 2-way parallelizable and vectorizable. +// Can get away with 11 carries, but then data flow is much deeper. +// +// With tighter constraints on inputs, can squeeze carries into int32. +func FeMul(h, f, g *FieldElement) { + f0 := int64(f[0]) + f1 := int64(f[1]) + f2 := int64(f[2]) + f3 := int64(f[3]) + f4 := int64(f[4]) + f5 := int64(f[5]) + f6 := int64(f[6]) + f7 := int64(f[7]) + f8 := int64(f[8]) + f9 := int64(f[9]) + + f1_2 := int64(2 * f[1]) + f3_2 := int64(2 * f[3]) + f5_2 := int64(2 * f[5]) + f7_2 := int64(2 * f[7]) + f9_2 := int64(2 * f[9]) + + g0 := int64(g[0]) + g1 := int64(g[1]) + g2 := int64(g[2]) + g3 := int64(g[3]) + g4 := int64(g[4]) + g5 := int64(g[5]) + g6 := int64(g[6]) + g7 := int64(g[7]) + g8 := int64(g[8]) + g9 := int64(g[9]) + + g1_19 := int64(19 * g[1]) /* 1.4*2^29 */ + g2_19 := int64(19 * g[2]) /* 1.4*2^30; still ok */ + g3_19 := int64(19 * g[3]) + g4_19 := int64(19 * g[4]) + g5_19 := int64(19 * g[5]) + g6_19 := int64(19 * g[6]) + g7_19 := int64(19 * g[7]) + g8_19 := int64(19 * g[8]) + g9_19 := int64(19 * g[9]) + + h0 := f0*g0 + f1_2*g9_19 + f2*g8_19 + f3_2*g7_19 + f4*g6_19 + f5_2*g5_19 + f6*g4_19 + f7_2*g3_19 + f8*g2_19 + f9_2*g1_19 + h1 := f0*g1 + f1*g0 + f2*g9_19 + f3*g8_19 + f4*g7_19 + f5*g6_19 + f6*g5_19 + f7*g4_19 + f8*g3_19 + f9*g2_19 + h2 := f0*g2 + f1_2*g1 + f2*g0 + f3_2*g9_19 + f4*g8_19 + f5_2*g7_19 + f6*g6_19 + f7_2*g5_19 + f8*g4_19 + f9_2*g3_19 + h3 := f0*g3 + f1*g2 + f2*g1 + f3*g0 + f4*g9_19 + f5*g8_19 + f6*g7_19 + f7*g6_19 + f8*g5_19 + f9*g4_19 + h4 := f0*g4 + f1_2*g3 + f2*g2 + f3_2*g1 + f4*g0 + f5_2*g9_19 + f6*g8_19 + f7_2*g7_19 + f8*g6_19 + f9_2*g5_19 + h5 := f0*g5 + f1*g4 + f2*g3 + f3*g2 + f4*g1 + f5*g0 + f6*g9_19 + f7*g8_19 + f8*g7_19 + f9*g6_19 + h6 := f0*g6 + f1_2*g5 + f2*g4 + f3_2*g3 + f4*g2 + f5_2*g1 + f6*g0 + f7_2*g9_19 + f8*g8_19 + f9_2*g7_19 + h7 := f0*g7 + f1*g6 + f2*g5 + f3*g4 + f4*g3 + f5*g2 + f6*g1 + f7*g0 + f8*g9_19 + f9*g8_19 + h8 := f0*g8 + f1_2*g7 + f2*g6 + f3_2*g5 + f4*g4 + f5_2*g3 + f6*g2 + f7_2*g1 + f8*g0 + f9_2*g9_19 + h9 := f0*g9 + f1*g8 + f2*g7 + f3*g6 + f4*g5 + f5*g4 + f6*g3 + f7*g2 + f8*g1 + f9*g0 + + FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9) +} + +func feSquare(f *FieldElement) (h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 int64) { + f0 := int64(f[0]) + f1 := int64(f[1]) + f2 := int64(f[2]) + f3 := int64(f[3]) + f4 := int64(f[4]) + f5 := int64(f[5]) + f6 := int64(f[6]) + f7 := int64(f[7]) + f8 := int64(f[8]) + f9 := int64(f[9]) + f0_2 := int64(2 * f[0]) + f1_2 := int64(2 * f[1]) + f2_2 := int64(2 * f[2]) + f3_2 := int64(2 * f[3]) + f4_2 := int64(2 * f[4]) + f5_2 := int64(2 * f[5]) + f6_2 := int64(2 * f[6]) + f7_2 := int64(2 * f[7]) + f5_38 := 38 * f5 // 1.31*2^30 + f6_19 := 19 * f6 // 1.31*2^30 + f7_38 := 38 * f7 // 1.31*2^30 + f8_19 := 19 * f8 // 1.31*2^30 + f9_38 := 38 * f9 // 1.31*2^30 + + h0 = f0*f0 + f1_2*f9_38 + f2_2*f8_19 + f3_2*f7_38 + f4_2*f6_19 + f5*f5_38 + h1 = f0_2*f1 + f2*f9_38 + f3_2*f8_19 + f4*f7_38 + f5_2*f6_19 + h2 = f0_2*f2 + f1_2*f1 + f3_2*f9_38 + f4_2*f8_19 + f5_2*f7_38 + f6*f6_19 + h3 = f0_2*f3 + f1_2*f2 + f4*f9_38 + f5_2*f8_19 + f6*f7_38 + h4 = f0_2*f4 + f1_2*f3_2 + f2*f2 + f5_2*f9_38 + f6_2*f8_19 + f7*f7_38 + h5 = f0_2*f5 + f1_2*f4 + f2_2*f3 + f6*f9_38 + f7_2*f8_19 + h6 = f0_2*f6 + f1_2*f5_2 + f2_2*f4 + f3_2*f3 + f7_2*f9_38 + f8*f8_19 + h7 = f0_2*f7 + f1_2*f6 + f2_2*f5 + f3_2*f4 + f8*f9_38 + h8 = f0_2*f8 + f1_2*f7_2 + f2_2*f6 + f3_2*f5_2 + f4*f4 + f9*f9_38 + h9 = f0_2*f9 + f1_2*f8 + f2_2*f7 + f3_2*f6 + f4_2*f5 + + return +} + +// FeSquare calculates h = f*f. Can overlap h with f. +// +// Preconditions: +// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. +// +// Postconditions: +// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. +func FeSquare(h, f *FieldElement) { + h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 := feSquare(f) + FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9) +} + +// FeSquare2 sets h = 2 * f * f +// +// Can overlap h with f. +// +// Preconditions: +// |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. +// +// Postconditions: +// |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. +// See fe_mul.c for discussion of implementation strategy. +func FeSquare2(h, f *FieldElement) { + h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 := feSquare(f) + + h0 += h0 + h1 += h1 + h2 += h2 + h3 += h3 + h4 += h4 + h5 += h5 + h6 += h6 + h7 += h7 + h8 += h8 + h9 += h9 + + FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9) +} + +func FeInvert(out, z *FieldElement) { + var t0, t1, t2, t3 FieldElement + var i int + + FeSquare(&t0, z) // 2^1 + FeSquare(&t1, &t0) // 2^2 + for i = 1; i < 2; i++ { // 2^3 + FeSquare(&t1, &t1) + } + FeMul(&t1, z, &t1) // 2^3 + 2^0 + FeMul(&t0, &t0, &t1) // 2^3 + 2^1 + 2^0 + FeSquare(&t2, &t0) // 2^4 + 2^2 + 2^1 + FeMul(&t1, &t1, &t2) // 2^4 + 2^3 + 2^2 + 2^1 + 2^0 + FeSquare(&t2, &t1) // 5,4,3,2,1 + for i = 1; i < 5; i++ { // 9,8,7,6,5 + FeSquare(&t2, &t2) + } + FeMul(&t1, &t2, &t1) // 9,8,7,6,5,4,3,2,1,0 + FeSquare(&t2, &t1) // 10..1 + for i = 1; i < 10; i++ { // 19..10 + FeSquare(&t2, &t2) + } + FeMul(&t2, &t2, &t1) // 19..0 + FeSquare(&t3, &t2) // 20..1 + for i = 1; i < 20; i++ { // 39..20 + FeSquare(&t3, &t3) + } + FeMul(&t2, &t3, &t2) // 39..0 + FeSquare(&t2, &t2) // 40..1 + for i = 1; i < 10; i++ { // 49..10 + FeSquare(&t2, &t2) + } + FeMul(&t1, &t2, &t1) // 49..0 + FeSquare(&t2, &t1) // 50..1 + for i = 1; i < 50; i++ { // 99..50 + FeSquare(&t2, &t2) + } + FeMul(&t2, &t2, &t1) // 99..0 + FeSquare(&t3, &t2) // 100..1 + for i = 1; i < 100; i++ { // 199..100 + FeSquare(&t3, &t3) + } + FeMul(&t2, &t3, &t2) // 199..0 + FeSquare(&t2, &t2) // 200..1 + for i = 1; i < 50; i++ { // 249..50 + FeSquare(&t2, &t2) + } + FeMul(&t1, &t2, &t1) // 249..0 + FeSquare(&t1, &t1) // 250..1 + for i = 1; i < 5; i++ { // 254..5 + FeSquare(&t1, &t1) + } + FeMul(out, &t1, &t0) // 254..5,3,1,0 +} + +func fePow22523(out, z *FieldElement) { + var t0, t1, t2 FieldElement + var i int + + FeSquare(&t0, z) + for i = 1; i < 1; i++ { + FeSquare(&t0, &t0) + } + FeSquare(&t1, &t0) + for i = 1; i < 2; i++ { + FeSquare(&t1, &t1) + } + FeMul(&t1, z, &t1) + FeMul(&t0, &t0, &t1) + FeSquare(&t0, &t0) + for i = 1; i < 1; i++ { + FeSquare(&t0, &t0) + } + FeMul(&t0, &t1, &t0) + FeSquare(&t1, &t0) + for i = 1; i < 5; i++ { + FeSquare(&t1, &t1) + } + FeMul(&t0, &t1, &t0) + FeSquare(&t1, &t0) + for i = 1; i < 10; i++ { + FeSquare(&t1, &t1) + } + FeMul(&t1, &t1, &t0) + FeSquare(&t2, &t1) + for i = 1; i < 20; i++ { + FeSquare(&t2, &t2) + } + FeMul(&t1, &t2, &t1) + FeSquare(&t1, &t1) + for i = 1; i < 10; i++ { + FeSquare(&t1, &t1) + } + FeMul(&t0, &t1, &t0) + FeSquare(&t1, &t0) + for i = 1; i < 50; i++ { + FeSquare(&t1, &t1) + } + FeMul(&t1, &t1, &t0) + FeSquare(&t2, &t1) + for i = 1; i < 100; i++ { + FeSquare(&t2, &t2) + } + FeMul(&t1, &t2, &t1) + FeSquare(&t1, &t1) + for i = 1; i < 50; i++ { + FeSquare(&t1, &t1) + } + FeMul(&t0, &t1, &t0) + FeSquare(&t0, &t0) + for i = 1; i < 2; i++ { + FeSquare(&t0, &t0) + } + FeMul(out, &t0, z) +} + +// Group elements are members of the elliptic curve -x^2 + y^2 = 1 + d * x^2 * +// y^2 where d = -121665/121666. +// +// Several representations are used: +// ProjectiveGroupElement: (X:Y:Z) satisfying x=X/Z, y=Y/Z +// ExtendedGroupElement: (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT +// CompletedGroupElement: ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T +// PreComputedGroupElement: (y+x,y-x,2dxy) + +type ProjectiveGroupElement struct { + X, Y, Z FieldElement +} + +type ExtendedGroupElement struct { + X, Y, Z, T FieldElement +} + +type CompletedGroupElement struct { + X, Y, Z, T FieldElement +} + +type PreComputedGroupElement struct { + yPlusX, yMinusX, xy2d FieldElement +} + +type CachedGroupElement struct { + yPlusX, yMinusX, Z, T2d FieldElement +} + +func (p *ProjectiveGroupElement) Zero() { + FeZero(&p.X) + FeOne(&p.Y) + FeOne(&p.Z) +} + +func (p *ProjectiveGroupElement) Double(r *CompletedGroupElement) { + var t0 FieldElement + + FeSquare(&r.X, &p.X) + FeSquare(&r.Z, &p.Y) + FeSquare2(&r.T, &p.Z) + FeAdd(&r.Y, &p.X, &p.Y) + FeSquare(&t0, &r.Y) + FeAdd(&r.Y, &r.Z, &r.X) + FeSub(&r.Z, &r.Z, &r.X) + FeSub(&r.X, &t0, &r.Y) + FeSub(&r.T, &r.T, &r.Z) +} + +func (p *ProjectiveGroupElement) ToBytes(s *[32]byte) { + var recip, x, y FieldElement + + FeInvert(&recip, &p.Z) + FeMul(&x, &p.X, &recip) + FeMul(&y, &p.Y, &recip) + FeToBytes(s, &y) + s[31] ^= FeIsNegative(&x) << 7 +} + +func (p *ExtendedGroupElement) Zero() { + FeZero(&p.X) + FeOne(&p.Y) + FeOne(&p.Z) + FeZero(&p.T) +} + +func (p *ExtendedGroupElement) Double(r *CompletedGroupElement) { + var q ProjectiveGroupElement + p.ToProjective(&q) + q.Double(r) +} + +func (p *ExtendedGroupElement) ToCached(r *CachedGroupElement) { + FeAdd(&r.yPlusX, &p.Y, &p.X) + FeSub(&r.yMinusX, &p.Y, &p.X) + FeCopy(&r.Z, &p.Z) + FeMul(&r.T2d, &p.T, &d2) +} + +func (p *ExtendedGroupElement) ToProjective(r *ProjectiveGroupElement) { + FeCopy(&r.X, &p.X) + FeCopy(&r.Y, &p.Y) + FeCopy(&r.Z, &p.Z) +} + +func (p *ExtendedGroupElement) ToBytes(s *[32]byte) { + var recip, x, y FieldElement + + FeInvert(&recip, &p.Z) + FeMul(&x, &p.X, &recip) + FeMul(&y, &p.Y, &recip) + FeToBytes(s, &y) + s[31] ^= FeIsNegative(&x) << 7 +} + +func (p *ExtendedGroupElement) FromBytes(s *[32]byte) bool { + var u, v, v3, vxx, check FieldElement + + FeFromBytes(&p.Y, s) + FeOne(&p.Z) + FeSquare(&u, &p.Y) + FeMul(&v, &u, &d) + FeSub(&u, &u, &p.Z) // y = y^2-1 + FeAdd(&v, &v, &p.Z) // v = dy^2+1 + + FeSquare(&v3, &v) + FeMul(&v3, &v3, &v) // v3 = v^3 + FeSquare(&p.X, &v3) + FeMul(&p.X, &p.X, &v) + FeMul(&p.X, &p.X, &u) // x = uv^7 + + fePow22523(&p.X, &p.X) // x = (uv^7)^((q-5)/8) + FeMul(&p.X, &p.X, &v3) + FeMul(&p.X, &p.X, &u) // x = uv^3(uv^7)^((q-5)/8) + + var tmpX, tmp2 [32]byte + + FeSquare(&vxx, &p.X) + FeMul(&vxx, &vxx, &v) + FeSub(&check, &vxx, &u) // vx^2-u + if FeIsNonZero(&check) == 1 { + FeAdd(&check, &vxx, &u) // vx^2+u + if FeIsNonZero(&check) == 1 { + return false + } + FeMul(&p.X, &p.X, &SqrtM1) + + FeToBytes(&tmpX, &p.X) + for i, v := range tmpX { + tmp2[31-i] = v + } + } + + if FeIsNegative(&p.X) != (s[31] >> 7) { + FeNeg(&p.X, &p.X) + } + + FeMul(&p.T, &p.X, &p.Y) + return true +} + +func (p *CompletedGroupElement) ToProjective(r *ProjectiveGroupElement) { + FeMul(&r.X, &p.X, &p.T) + FeMul(&r.Y, &p.Y, &p.Z) + FeMul(&r.Z, &p.Z, &p.T) +} + +func (p *CompletedGroupElement) ToExtended(r *ExtendedGroupElement) { + FeMul(&r.X, &p.X, &p.T) + FeMul(&r.Y, &p.Y, &p.Z) + FeMul(&r.Z, &p.Z, &p.T) + FeMul(&r.T, &p.X, &p.Y) +} + +func (p *PreComputedGroupElement) Zero() { + FeOne(&p.yPlusX) + FeOne(&p.yMinusX) + FeZero(&p.xy2d) +} + +func geAdd(r *CompletedGroupElement, p *ExtendedGroupElement, q *CachedGroupElement) { + var t0 FieldElement + + FeAdd(&r.X, &p.Y, &p.X) + FeSub(&r.Y, &p.Y, &p.X) + FeMul(&r.Z, &r.X, &q.yPlusX) + FeMul(&r.Y, &r.Y, &q.yMinusX) + FeMul(&r.T, &q.T2d, &p.T) + FeMul(&r.X, &p.Z, &q.Z) + FeAdd(&t0, &r.X, &r.X) + FeSub(&r.X, &r.Z, &r.Y) + FeAdd(&r.Y, &r.Z, &r.Y) + FeAdd(&r.Z, &t0, &r.T) + FeSub(&r.T, &t0, &r.T) +} + +func geSub(r *CompletedGroupElement, p *ExtendedGroupElement, q *CachedGroupElement) { + var t0 FieldElement + + FeAdd(&r.X, &p.Y, &p.X) + FeSub(&r.Y, &p.Y, &p.X) + FeMul(&r.Z, &r.X, &q.yMinusX) + FeMul(&r.Y, &r.Y, &q.yPlusX) + FeMul(&r.T, &q.T2d, &p.T) + FeMul(&r.X, &p.Z, &q.Z) + FeAdd(&t0, &r.X, &r.X) + FeSub(&r.X, &r.Z, &r.Y) + FeAdd(&r.Y, &r.Z, &r.Y) + FeSub(&r.Z, &t0, &r.T) + FeAdd(&r.T, &t0, &r.T) +} + +func geMixedAdd(r *CompletedGroupElement, p *ExtendedGroupElement, q *PreComputedGroupElement) { + var t0 FieldElement + + FeAdd(&r.X, &p.Y, &p.X) + FeSub(&r.Y, &p.Y, &p.X) + FeMul(&r.Z, &r.X, &q.yPlusX) + FeMul(&r.Y, &r.Y, &q.yMinusX) + FeMul(&r.T, &q.xy2d, &p.T) + FeAdd(&t0, &p.Z, &p.Z) + FeSub(&r.X, &r.Z, &r.Y) + FeAdd(&r.Y, &r.Z, &r.Y) + FeAdd(&r.Z, &t0, &r.T) + FeSub(&r.T, &t0, &r.T) +} + +func geMixedSub(r *CompletedGroupElement, p *ExtendedGroupElement, q *PreComputedGroupElement) { + var t0 FieldElement + + FeAdd(&r.X, &p.Y, &p.X) + FeSub(&r.Y, &p.Y, &p.X) + FeMul(&r.Z, &r.X, &q.yMinusX) + FeMul(&r.Y, &r.Y, &q.yPlusX) + FeMul(&r.T, &q.xy2d, &p.T) + FeAdd(&t0, &p.Z, &p.Z) + FeSub(&r.X, &r.Z, &r.Y) + FeAdd(&r.Y, &r.Z, &r.Y) + FeSub(&r.Z, &t0, &r.T) + FeAdd(&r.T, &t0, &r.T) +} + +func slide(r *[256]int8, a *[32]byte) { + for i := range r { + r[i] = int8(1 & (a[i>>3] >> uint(i&7))) + } + + for i := range r { + if r[i] != 0 { + for b := 1; b <= 6 && i+b < 256; b++ { + if r[i+b] != 0 { + if r[i]+(r[i+b]<= -15 { + r[i] -= r[i+b] << uint(b) + for k := i + b; k < 256; k++ { + if r[k] == 0 { + r[k] = 1 + break + } + r[k] = 0 + } + } else { + break + } + } + } + } + } +} + +// GeDoubleScalarMultVartime sets r = a*A + b*B +// where a = a[0]+256*a[1]+...+256^31 a[31]. +// and b = b[0]+256*b[1]+...+256^31 b[31]. +// B is the Ed25519 base point (x,4/5) with x positive. +func GeDoubleScalarMultVartime(r *ProjectiveGroupElement, a *[32]byte, A *ExtendedGroupElement, b *[32]byte) { + var aSlide, bSlide [256]int8 + var Ai [8]CachedGroupElement // A,3A,5A,7A,9A,11A,13A,15A + var t CompletedGroupElement + var u, A2 ExtendedGroupElement + var i int + + slide(&aSlide, a) + slide(&bSlide, b) + + A.ToCached(&Ai[0]) + A.Double(&t) + t.ToExtended(&A2) + + for i := 0; i < 7; i++ { + geAdd(&t, &A2, &Ai[i]) + t.ToExtended(&u) + u.ToCached(&Ai[i+1]) + } + + r.Zero() + + for i = 255; i >= 0; i-- { + if aSlide[i] != 0 || bSlide[i] != 0 { + break + } + } + + for ; i >= 0; i-- { + r.Double(&t) + + if aSlide[i] > 0 { + t.ToExtended(&u) + geAdd(&t, &u, &Ai[aSlide[i]/2]) + } else if aSlide[i] < 0 { + t.ToExtended(&u) + geSub(&t, &u, &Ai[(-aSlide[i])/2]) + } + + if bSlide[i] > 0 { + t.ToExtended(&u) + geMixedAdd(&t, &u, &bi[bSlide[i]/2]) + } else if bSlide[i] < 0 { + t.ToExtended(&u) + geMixedSub(&t, &u, &bi[(-bSlide[i])/2]) + } + + t.ToProjective(r) + } +} + +// equal returns 1 if b == c and 0 otherwise, assuming that b and c are +// non-negative. +func equal(b, c int32) int32 { + x := uint32(b ^ c) + x-- + return int32(x >> 31) +} + +// negative returns 1 if b < 0 and 0 otherwise. +func negative(b int32) int32 { + return (b >> 31) & 1 +} + +func PreComputedGroupElementCMove(t, u *PreComputedGroupElement, b int32) { + FeCMove(&t.yPlusX, &u.yPlusX, b) + FeCMove(&t.yMinusX, &u.yMinusX, b) + FeCMove(&t.xy2d, &u.xy2d, b) +} + +func selectPoint(t *PreComputedGroupElement, pos int32, b int32) { + var minusT PreComputedGroupElement + bNegative := negative(b) + bAbs := b - (((-bNegative) & b) << 1) + + t.Zero() + for i := int32(0); i < 8; i++ { + PreComputedGroupElementCMove(t, &base[pos][i], equal(bAbs, i+1)) + } + FeCopy(&minusT.yPlusX, &t.yMinusX) + FeCopy(&minusT.yMinusX, &t.yPlusX) + FeNeg(&minusT.xy2d, &t.xy2d) + PreComputedGroupElementCMove(t, &minusT, bNegative) +} + +// GeScalarMultBase computes h = a*B, where +// a = a[0]+256*a[1]+...+256^31 a[31] +// B is the Ed25519 base point (x,4/5) with x positive. +// +// Preconditions: +// a[31] <= 127 +func GeScalarMultBase(h *ExtendedGroupElement, a *[32]byte) { + var e [64]int8 + + for i, v := range a { + e[2*i] = int8(v & 15) + e[2*i+1] = int8((v >> 4) & 15) + } + + // each e[i] is between 0 and 15 and e[63] is between 0 and 7. + + carry := int8(0) + for i := 0; i < 63; i++ { + e[i] += carry + carry = (e[i] + 8) >> 4 + e[i] -= carry << 4 + } + e[63] += carry + // each e[i] is between -8 and 8. + + h.Zero() + var t PreComputedGroupElement + var r CompletedGroupElement + for i := int32(1); i < 64; i += 2 { + selectPoint(&t, i/2, int32(e[i])) + geMixedAdd(&r, h, &t) + r.ToExtended(h) + } + + var s ProjectiveGroupElement + + h.Double(&r) + r.ToProjective(&s) + s.Double(&r) + r.ToProjective(&s) + s.Double(&r) + r.ToProjective(&s) + s.Double(&r) + r.ToExtended(h) + + for i := int32(0); i < 64; i += 2 { + selectPoint(&t, i/2, int32(e[i])) + geMixedAdd(&r, h, &t) + r.ToExtended(h) + } +} + +// The scalars are GF(2^252 + 27742317777372353535851937790883648493). + +// Input: +// a[0]+256*a[1]+...+256^31*a[31] = a +// b[0]+256*b[1]+...+256^31*b[31] = b +// c[0]+256*c[1]+...+256^31*c[31] = c +// +// Output: +// s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l +// where l = 2^252 + 27742317777372353535851937790883648493. +func ScMulAdd(s, a, b, c *[32]byte) { + a0 := 2097151 & load3(a[:]) + a1 := 2097151 & (load4(a[2:]) >> 5) + a2 := 2097151 & (load3(a[5:]) >> 2) + a3 := 2097151 & (load4(a[7:]) >> 7) + a4 := 2097151 & (load4(a[10:]) >> 4) + a5 := 2097151 & (load3(a[13:]) >> 1) + a6 := 2097151 & (load4(a[15:]) >> 6) + a7 := 2097151 & (load3(a[18:]) >> 3) + a8 := 2097151 & load3(a[21:]) + a9 := 2097151 & (load4(a[23:]) >> 5) + a10 := 2097151 & (load3(a[26:]) >> 2) + a11 := (load4(a[28:]) >> 7) + b0 := 2097151 & load3(b[:]) + b1 := 2097151 & (load4(b[2:]) >> 5) + b2 := 2097151 & (load3(b[5:]) >> 2) + b3 := 2097151 & (load4(b[7:]) >> 7) + b4 := 2097151 & (load4(b[10:]) >> 4) + b5 := 2097151 & (load3(b[13:]) >> 1) + b6 := 2097151 & (load4(b[15:]) >> 6) + b7 := 2097151 & (load3(b[18:]) >> 3) + b8 := 2097151 & load3(b[21:]) + b9 := 2097151 & (load4(b[23:]) >> 5) + b10 := 2097151 & (load3(b[26:]) >> 2) + b11 := (load4(b[28:]) >> 7) + c0 := 2097151 & load3(c[:]) + c1 := 2097151 & (load4(c[2:]) >> 5) + c2 := 2097151 & (load3(c[5:]) >> 2) + c3 := 2097151 & (load4(c[7:]) >> 7) + c4 := 2097151 & (load4(c[10:]) >> 4) + c5 := 2097151 & (load3(c[13:]) >> 1) + c6 := 2097151 & (load4(c[15:]) >> 6) + c7 := 2097151 & (load3(c[18:]) >> 3) + c8 := 2097151 & load3(c[21:]) + c9 := 2097151 & (load4(c[23:]) >> 5) + c10 := 2097151 & (load3(c[26:]) >> 2) + c11 := (load4(c[28:]) >> 7) + var carry [23]int64 + + s0 := c0 + a0*b0 + s1 := c1 + a0*b1 + a1*b0 + s2 := c2 + a0*b2 + a1*b1 + a2*b0 + s3 := c3 + a0*b3 + a1*b2 + a2*b1 + a3*b0 + s4 := c4 + a0*b4 + a1*b3 + a2*b2 + a3*b1 + a4*b0 + s5 := c5 + a0*b5 + a1*b4 + a2*b3 + a3*b2 + a4*b1 + a5*b0 + s6 := c6 + a0*b6 + a1*b5 + a2*b4 + a3*b3 + a4*b2 + a5*b1 + a6*b0 + s7 := c7 + a0*b7 + a1*b6 + a2*b5 + a3*b4 + a4*b3 + a5*b2 + a6*b1 + a7*b0 + s8 := c8 + a0*b8 + a1*b7 + a2*b6 + a3*b5 + a4*b4 + a5*b3 + a6*b2 + a7*b1 + a8*b0 + s9 := c9 + a0*b9 + a1*b8 + a2*b7 + a3*b6 + a4*b5 + a5*b4 + a6*b3 + a7*b2 + a8*b1 + a9*b0 + s10 := c10 + a0*b10 + a1*b9 + a2*b8 + a3*b7 + a4*b6 + a5*b5 + a6*b4 + a7*b3 + a8*b2 + a9*b1 + a10*b0 + s11 := c11 + a0*b11 + a1*b10 + a2*b9 + a3*b8 + a4*b7 + a5*b6 + a6*b5 + a7*b4 + a8*b3 + a9*b2 + a10*b1 + a11*b0 + s12 := a1*b11 + a2*b10 + a3*b9 + a4*b8 + a5*b7 + a6*b6 + a7*b5 + a8*b4 + a9*b3 + a10*b2 + a11*b1 + s13 := a2*b11 + a3*b10 + a4*b9 + a5*b8 + a6*b7 + a7*b6 + a8*b5 + a9*b4 + a10*b3 + a11*b2 + s14 := a3*b11 + a4*b10 + a5*b9 + a6*b8 + a7*b7 + a8*b6 + a9*b5 + a10*b4 + a11*b3 + s15 := a4*b11 + a5*b10 + a6*b9 + a7*b8 + a8*b7 + a9*b6 + a10*b5 + a11*b4 + s16 := a5*b11 + a6*b10 + a7*b9 + a8*b8 + a9*b7 + a10*b6 + a11*b5 + s17 := a6*b11 + a7*b10 + a8*b9 + a9*b8 + a10*b7 + a11*b6 + s18 := a7*b11 + a8*b10 + a9*b9 + a10*b8 + a11*b7 + s19 := a8*b11 + a9*b10 + a10*b9 + a11*b8 + s20 := a9*b11 + a10*b10 + a11*b9 + s21 := a10*b11 + a11*b10 + s22 := a11 * b11 + s23 := int64(0) + + carry[0] = (s0 + (1 << 20)) >> 21 + s1 += carry[0] + s0 -= carry[0] << 21 + carry[2] = (s2 + (1 << 20)) >> 21 + s3 += carry[2] + s2 -= carry[2] << 21 + carry[4] = (s4 + (1 << 20)) >> 21 + s5 += carry[4] + s4 -= carry[4] << 21 + carry[6] = (s6 + (1 << 20)) >> 21 + s7 += carry[6] + s6 -= carry[6] << 21 + carry[8] = (s8 + (1 << 20)) >> 21 + s9 += carry[8] + s8 -= carry[8] << 21 + carry[10] = (s10 + (1 << 20)) >> 21 + s11 += carry[10] + s10 -= carry[10] << 21 + carry[12] = (s12 + (1 << 20)) >> 21 + s13 += carry[12] + s12 -= carry[12] << 21 + carry[14] = (s14 + (1 << 20)) >> 21 + s15 += carry[14] + s14 -= carry[14] << 21 + carry[16] = (s16 + (1 << 20)) >> 21 + s17 += carry[16] + s16 -= carry[16] << 21 + carry[18] = (s18 + (1 << 20)) >> 21 + s19 += carry[18] + s18 -= carry[18] << 21 + carry[20] = (s20 + (1 << 20)) >> 21 + s21 += carry[20] + s20 -= carry[20] << 21 + carry[22] = (s22 + (1 << 20)) >> 21 + s23 += carry[22] + s22 -= carry[22] << 21 + + carry[1] = (s1 + (1 << 20)) >> 21 + s2 += carry[1] + s1 -= carry[1] << 21 + carry[3] = (s3 + (1 << 20)) >> 21 + s4 += carry[3] + s3 -= carry[3] << 21 + carry[5] = (s5 + (1 << 20)) >> 21 + s6 += carry[5] + s5 -= carry[5] << 21 + carry[7] = (s7 + (1 << 20)) >> 21 + s8 += carry[7] + s7 -= carry[7] << 21 + carry[9] = (s9 + (1 << 20)) >> 21 + s10 += carry[9] + s9 -= carry[9] << 21 + carry[11] = (s11 + (1 << 20)) >> 21 + s12 += carry[11] + s11 -= carry[11] << 21 + carry[13] = (s13 + (1 << 20)) >> 21 + s14 += carry[13] + s13 -= carry[13] << 21 + carry[15] = (s15 + (1 << 20)) >> 21 + s16 += carry[15] + s15 -= carry[15] << 21 + carry[17] = (s17 + (1 << 20)) >> 21 + s18 += carry[17] + s17 -= carry[17] << 21 + carry[19] = (s19 + (1 << 20)) >> 21 + s20 += carry[19] + s19 -= carry[19] << 21 + carry[21] = (s21 + (1 << 20)) >> 21 + s22 += carry[21] + s21 -= carry[21] << 21 + + s11 += s23 * 666643 + s12 += s23 * 470296 + s13 += s23 * 654183 + s14 -= s23 * 997805 + s15 += s23 * 136657 + s16 -= s23 * 683901 + s23 = 0 + + s10 += s22 * 666643 + s11 += s22 * 470296 + s12 += s22 * 654183 + s13 -= s22 * 997805 + s14 += s22 * 136657 + s15 -= s22 * 683901 + s22 = 0 + + s9 += s21 * 666643 + s10 += s21 * 470296 + s11 += s21 * 654183 + s12 -= s21 * 997805 + s13 += s21 * 136657 + s14 -= s21 * 683901 + s21 = 0 + + s8 += s20 * 666643 + s9 += s20 * 470296 + s10 += s20 * 654183 + s11 -= s20 * 997805 + s12 += s20 * 136657 + s13 -= s20 * 683901 + s20 = 0 + + s7 += s19 * 666643 + s8 += s19 * 470296 + s9 += s19 * 654183 + s10 -= s19 * 997805 + s11 += s19 * 136657 + s12 -= s19 * 683901 + s19 = 0 + + s6 += s18 * 666643 + s7 += s18 * 470296 + s8 += s18 * 654183 + s9 -= s18 * 997805 + s10 += s18 * 136657 + s11 -= s18 * 683901 + s18 = 0 + + carry[6] = (s6 + (1 << 20)) >> 21 + s7 += carry[6] + s6 -= carry[6] << 21 + carry[8] = (s8 + (1 << 20)) >> 21 + s9 += carry[8] + s8 -= carry[8] << 21 + carry[10] = (s10 + (1 << 20)) >> 21 + s11 += carry[10] + s10 -= carry[10] << 21 + carry[12] = (s12 + (1 << 20)) >> 21 + s13 += carry[12] + s12 -= carry[12] << 21 + carry[14] = (s14 + (1 << 20)) >> 21 + s15 += carry[14] + s14 -= carry[14] << 21 + carry[16] = (s16 + (1 << 20)) >> 21 + s17 += carry[16] + s16 -= carry[16] << 21 + + carry[7] = (s7 + (1 << 20)) >> 21 + s8 += carry[7] + s7 -= carry[7] << 21 + carry[9] = (s9 + (1 << 20)) >> 21 + s10 += carry[9] + s9 -= carry[9] << 21 + carry[11] = (s11 + (1 << 20)) >> 21 + s12 += carry[11] + s11 -= carry[11] << 21 + carry[13] = (s13 + (1 << 20)) >> 21 + s14 += carry[13] + s13 -= carry[13] << 21 + carry[15] = (s15 + (1 << 20)) >> 21 + s16 += carry[15] + s15 -= carry[15] << 21 + + s5 += s17 * 666643 + s6 += s17 * 470296 + s7 += s17 * 654183 + s8 -= s17 * 997805 + s9 += s17 * 136657 + s10 -= s17 * 683901 + s17 = 0 + + s4 += s16 * 666643 + s5 += s16 * 470296 + s6 += s16 * 654183 + s7 -= s16 * 997805 + s8 += s16 * 136657 + s9 -= s16 * 683901 + s16 = 0 + + s3 += s15 * 666643 + s4 += s15 * 470296 + s5 += s15 * 654183 + s6 -= s15 * 997805 + s7 += s15 * 136657 + s8 -= s15 * 683901 + s15 = 0 + + s2 += s14 * 666643 + s3 += s14 * 470296 + s4 += s14 * 654183 + s5 -= s14 * 997805 + s6 += s14 * 136657 + s7 -= s14 * 683901 + s14 = 0 + + s1 += s13 * 666643 + s2 += s13 * 470296 + s3 += s13 * 654183 + s4 -= s13 * 997805 + s5 += s13 * 136657 + s6 -= s13 * 683901 + s13 = 0 + + s0 += s12 * 666643 + s1 += s12 * 470296 + s2 += s12 * 654183 + s3 -= s12 * 997805 + s4 += s12 * 136657 + s5 -= s12 * 683901 + s12 = 0 + + carry[0] = (s0 + (1 << 20)) >> 21 + s1 += carry[0] + s0 -= carry[0] << 21 + carry[2] = (s2 + (1 << 20)) >> 21 + s3 += carry[2] + s2 -= carry[2] << 21 + carry[4] = (s4 + (1 << 20)) >> 21 + s5 += carry[4] + s4 -= carry[4] << 21 + carry[6] = (s6 + (1 << 20)) >> 21 + s7 += carry[6] + s6 -= carry[6] << 21 + carry[8] = (s8 + (1 << 20)) >> 21 + s9 += carry[8] + s8 -= carry[8] << 21 + carry[10] = (s10 + (1 << 20)) >> 21 + s11 += carry[10] + s10 -= carry[10] << 21 + + carry[1] = (s1 + (1 << 20)) >> 21 + s2 += carry[1] + s1 -= carry[1] << 21 + carry[3] = (s3 + (1 << 20)) >> 21 + s4 += carry[3] + s3 -= carry[3] << 21 + carry[5] = (s5 + (1 << 20)) >> 21 + s6 += carry[5] + s5 -= carry[5] << 21 + carry[7] = (s7 + (1 << 20)) >> 21 + s8 += carry[7] + s7 -= carry[7] << 21 + carry[9] = (s9 + (1 << 20)) >> 21 + s10 += carry[9] + s9 -= carry[9] << 21 + carry[11] = (s11 + (1 << 20)) >> 21 + s12 += carry[11] + s11 -= carry[11] << 21 + + s0 += s12 * 666643 + s1 += s12 * 470296 + s2 += s12 * 654183 + s3 -= s12 * 997805 + s4 += s12 * 136657 + s5 -= s12 * 683901 + s12 = 0 + + carry[0] = s0 >> 21 + s1 += carry[0] + s0 -= carry[0] << 21 + carry[1] = s1 >> 21 + s2 += carry[1] + s1 -= carry[1] << 21 + carry[2] = s2 >> 21 + s3 += carry[2] + s2 -= carry[2] << 21 + carry[3] = s3 >> 21 + s4 += carry[3] + s3 -= carry[3] << 21 + carry[4] = s4 >> 21 + s5 += carry[4] + s4 -= carry[4] << 21 + carry[5] = s5 >> 21 + s6 += carry[5] + s5 -= carry[5] << 21 + carry[6] = s6 >> 21 + s7 += carry[6] + s6 -= carry[6] << 21 + carry[7] = s7 >> 21 + s8 += carry[7] + s7 -= carry[7] << 21 + carry[8] = s8 >> 21 + s9 += carry[8] + s8 -= carry[8] << 21 + carry[9] = s9 >> 21 + s10 += carry[9] + s9 -= carry[9] << 21 + carry[10] = s10 >> 21 + s11 += carry[10] + s10 -= carry[10] << 21 + carry[11] = s11 >> 21 + s12 += carry[11] + s11 -= carry[11] << 21 + + s0 += s12 * 666643 + s1 += s12 * 470296 + s2 += s12 * 654183 + s3 -= s12 * 997805 + s4 += s12 * 136657 + s5 -= s12 * 683901 + s12 = 0 + + carry[0] = s0 >> 21 + s1 += carry[0] + s0 -= carry[0] << 21 + carry[1] = s1 >> 21 + s2 += carry[1] + s1 -= carry[1] << 21 + carry[2] = s2 >> 21 + s3 += carry[2] + s2 -= carry[2] << 21 + carry[3] = s3 >> 21 + s4 += carry[3] + s3 -= carry[3] << 21 + carry[4] = s4 >> 21 + s5 += carry[4] + s4 -= carry[4] << 21 + carry[5] = s5 >> 21 + s6 += carry[5] + s5 -= carry[5] << 21 + carry[6] = s6 >> 21 + s7 += carry[6] + s6 -= carry[6] << 21 + carry[7] = s7 >> 21 + s8 += carry[7] + s7 -= carry[7] << 21 + carry[8] = s8 >> 21 + s9 += carry[8] + s8 -= carry[8] << 21 + carry[9] = s9 >> 21 + s10 += carry[9] + s9 -= carry[9] << 21 + carry[10] = s10 >> 21 + s11 += carry[10] + s10 -= carry[10] << 21 + + s[0] = byte(s0 >> 0) + s[1] = byte(s0 >> 8) + s[2] = byte((s0 >> 16) | (s1 << 5)) + s[3] = byte(s1 >> 3) + s[4] = byte(s1 >> 11) + s[5] = byte((s1 >> 19) | (s2 << 2)) + s[6] = byte(s2 >> 6) + s[7] = byte((s2 >> 14) | (s3 << 7)) + s[8] = byte(s3 >> 1) + s[9] = byte(s3 >> 9) + s[10] = byte((s3 >> 17) | (s4 << 4)) + s[11] = byte(s4 >> 4) + s[12] = byte(s4 >> 12) + s[13] = byte((s4 >> 20) | (s5 << 1)) + s[14] = byte(s5 >> 7) + s[15] = byte((s5 >> 15) | (s6 << 6)) + s[16] = byte(s6 >> 2) + s[17] = byte(s6 >> 10) + s[18] = byte((s6 >> 18) | (s7 << 3)) + s[19] = byte(s7 >> 5) + s[20] = byte(s7 >> 13) + s[21] = byte(s8 >> 0) + s[22] = byte(s8 >> 8) + s[23] = byte((s8 >> 16) | (s9 << 5)) + s[24] = byte(s9 >> 3) + s[25] = byte(s9 >> 11) + s[26] = byte((s9 >> 19) | (s10 << 2)) + s[27] = byte(s10 >> 6) + s[28] = byte((s10 >> 14) | (s11 << 7)) + s[29] = byte(s11 >> 1) + s[30] = byte(s11 >> 9) + s[31] = byte(s11 >> 17) +} + +// Input: +// s[0]+256*s[1]+...+256^63*s[63] = s +// +// Output: +// s[0]+256*s[1]+...+256^31*s[31] = s mod l +// where l = 2^252 + 27742317777372353535851937790883648493. +func ScReduce(out *[32]byte, s *[64]byte) { + s0 := 2097151 & load3(s[:]) + s1 := 2097151 & (load4(s[2:]) >> 5) + s2 := 2097151 & (load3(s[5:]) >> 2) + s3 := 2097151 & (load4(s[7:]) >> 7) + s4 := 2097151 & (load4(s[10:]) >> 4) + s5 := 2097151 & (load3(s[13:]) >> 1) + s6 := 2097151 & (load4(s[15:]) >> 6) + s7 := 2097151 & (load3(s[18:]) >> 3) + s8 := 2097151 & load3(s[21:]) + s9 := 2097151 & (load4(s[23:]) >> 5) + s10 := 2097151 & (load3(s[26:]) >> 2) + s11 := 2097151 & (load4(s[28:]) >> 7) + s12 := 2097151 & (load4(s[31:]) >> 4) + s13 := 2097151 & (load3(s[34:]) >> 1) + s14 := 2097151 & (load4(s[36:]) >> 6) + s15 := 2097151 & (load3(s[39:]) >> 3) + s16 := 2097151 & load3(s[42:]) + s17 := 2097151 & (load4(s[44:]) >> 5) + s18 := 2097151 & (load3(s[47:]) >> 2) + s19 := 2097151 & (load4(s[49:]) >> 7) + s20 := 2097151 & (load4(s[52:]) >> 4) + s21 := 2097151 & (load3(s[55:]) >> 1) + s22 := 2097151 & (load4(s[57:]) >> 6) + s23 := (load4(s[60:]) >> 3) + + s11 += s23 * 666643 + s12 += s23 * 470296 + s13 += s23 * 654183 + s14 -= s23 * 997805 + s15 += s23 * 136657 + s16 -= s23 * 683901 + s23 = 0 + + s10 += s22 * 666643 + s11 += s22 * 470296 + s12 += s22 * 654183 + s13 -= s22 * 997805 + s14 += s22 * 136657 + s15 -= s22 * 683901 + s22 = 0 + + s9 += s21 * 666643 + s10 += s21 * 470296 + s11 += s21 * 654183 + s12 -= s21 * 997805 + s13 += s21 * 136657 + s14 -= s21 * 683901 + s21 = 0 + + s8 += s20 * 666643 + s9 += s20 * 470296 + s10 += s20 * 654183 + s11 -= s20 * 997805 + s12 += s20 * 136657 + s13 -= s20 * 683901 + s20 = 0 + + s7 += s19 * 666643 + s8 += s19 * 470296 + s9 += s19 * 654183 + s10 -= s19 * 997805 + s11 += s19 * 136657 + s12 -= s19 * 683901 + s19 = 0 + + s6 += s18 * 666643 + s7 += s18 * 470296 + s8 += s18 * 654183 + s9 -= s18 * 997805 + s10 += s18 * 136657 + s11 -= s18 * 683901 + s18 = 0 + + var carry [17]int64 + + carry[6] = (s6 + (1 << 20)) >> 21 + s7 += carry[6] + s6 -= carry[6] << 21 + carry[8] = (s8 + (1 << 20)) >> 21 + s9 += carry[8] + s8 -= carry[8] << 21 + carry[10] = (s10 + (1 << 20)) >> 21 + s11 += carry[10] + s10 -= carry[10] << 21 + carry[12] = (s12 + (1 << 20)) >> 21 + s13 += carry[12] + s12 -= carry[12] << 21 + carry[14] = (s14 + (1 << 20)) >> 21 + s15 += carry[14] + s14 -= carry[14] << 21 + carry[16] = (s16 + (1 << 20)) >> 21 + s17 += carry[16] + s16 -= carry[16] << 21 + + carry[7] = (s7 + (1 << 20)) >> 21 + s8 += carry[7] + s7 -= carry[7] << 21 + carry[9] = (s9 + (1 << 20)) >> 21 + s10 += carry[9] + s9 -= carry[9] << 21 + carry[11] = (s11 + (1 << 20)) >> 21 + s12 += carry[11] + s11 -= carry[11] << 21 + carry[13] = (s13 + (1 << 20)) >> 21 + s14 += carry[13] + s13 -= carry[13] << 21 + carry[15] = (s15 + (1 << 20)) >> 21 + s16 += carry[15] + s15 -= carry[15] << 21 + + s5 += s17 * 666643 + s6 += s17 * 470296 + s7 += s17 * 654183 + s8 -= s17 * 997805 + s9 += s17 * 136657 + s10 -= s17 * 683901 + s17 = 0 + + s4 += s16 * 666643 + s5 += s16 * 470296 + s6 += s16 * 654183 + s7 -= s16 * 997805 + s8 += s16 * 136657 + s9 -= s16 * 683901 + s16 = 0 + + s3 += s15 * 666643 + s4 += s15 * 470296 + s5 += s15 * 654183 + s6 -= s15 * 997805 + s7 += s15 * 136657 + s8 -= s15 * 683901 + s15 = 0 + + s2 += s14 * 666643 + s3 += s14 * 470296 + s4 += s14 * 654183 + s5 -= s14 * 997805 + s6 += s14 * 136657 + s7 -= s14 * 683901 + s14 = 0 + + s1 += s13 * 666643 + s2 += s13 * 470296 + s3 += s13 * 654183 + s4 -= s13 * 997805 + s5 += s13 * 136657 + s6 -= s13 * 683901 + s13 = 0 + + s0 += s12 * 666643 + s1 += s12 * 470296 + s2 += s12 * 654183 + s3 -= s12 * 997805 + s4 += s12 * 136657 + s5 -= s12 * 683901 + s12 = 0 + + carry[0] = (s0 + (1 << 20)) >> 21 + s1 += carry[0] + s0 -= carry[0] << 21 + carry[2] = (s2 + (1 << 20)) >> 21 + s3 += carry[2] + s2 -= carry[2] << 21 + carry[4] = (s4 + (1 << 20)) >> 21 + s5 += carry[4] + s4 -= carry[4] << 21 + carry[6] = (s6 + (1 << 20)) >> 21 + s7 += carry[6] + s6 -= carry[6] << 21 + carry[8] = (s8 + (1 << 20)) >> 21 + s9 += carry[8] + s8 -= carry[8] << 21 + carry[10] = (s10 + (1 << 20)) >> 21 + s11 += carry[10] + s10 -= carry[10] << 21 + + carry[1] = (s1 + (1 << 20)) >> 21 + s2 += carry[1] + s1 -= carry[1] << 21 + carry[3] = (s3 + (1 << 20)) >> 21 + s4 += carry[3] + s3 -= carry[3] << 21 + carry[5] = (s5 + (1 << 20)) >> 21 + s6 += carry[5] + s5 -= carry[5] << 21 + carry[7] = (s7 + (1 << 20)) >> 21 + s8 += carry[7] + s7 -= carry[7] << 21 + carry[9] = (s9 + (1 << 20)) >> 21 + s10 += carry[9] + s9 -= carry[9] << 21 + carry[11] = (s11 + (1 << 20)) >> 21 + s12 += carry[11] + s11 -= carry[11] << 21 + + s0 += s12 * 666643 + s1 += s12 * 470296 + s2 += s12 * 654183 + s3 -= s12 * 997805 + s4 += s12 * 136657 + s5 -= s12 * 683901 + s12 = 0 + + carry[0] = s0 >> 21 + s1 += carry[0] + s0 -= carry[0] << 21 + carry[1] = s1 >> 21 + s2 += carry[1] + s1 -= carry[1] << 21 + carry[2] = s2 >> 21 + s3 += carry[2] + s2 -= carry[2] << 21 + carry[3] = s3 >> 21 + s4 += carry[3] + s3 -= carry[3] << 21 + carry[4] = s4 >> 21 + s5 += carry[4] + s4 -= carry[4] << 21 + carry[5] = s5 >> 21 + s6 += carry[5] + s5 -= carry[5] << 21 + carry[6] = s6 >> 21 + s7 += carry[6] + s6 -= carry[6] << 21 + carry[7] = s7 >> 21 + s8 += carry[7] + s7 -= carry[7] << 21 + carry[8] = s8 >> 21 + s9 += carry[8] + s8 -= carry[8] << 21 + carry[9] = s9 >> 21 + s10 += carry[9] + s9 -= carry[9] << 21 + carry[10] = s10 >> 21 + s11 += carry[10] + s10 -= carry[10] << 21 + carry[11] = s11 >> 21 + s12 += carry[11] + s11 -= carry[11] << 21 + + s0 += s12 * 666643 + s1 += s12 * 470296 + s2 += s12 * 654183 + s3 -= s12 * 997805 + s4 += s12 * 136657 + s5 -= s12 * 683901 + s12 = 0 + + carry[0] = s0 >> 21 + s1 += carry[0] + s0 -= carry[0] << 21 + carry[1] = s1 >> 21 + s2 += carry[1] + s1 -= carry[1] << 21 + carry[2] = s2 >> 21 + s3 += carry[2] + s2 -= carry[2] << 21 + carry[3] = s3 >> 21 + s4 += carry[3] + s3 -= carry[3] << 21 + carry[4] = s4 >> 21 + s5 += carry[4] + s4 -= carry[4] << 21 + carry[5] = s5 >> 21 + s6 += carry[5] + s5 -= carry[5] << 21 + carry[6] = s6 >> 21 + s7 += carry[6] + s6 -= carry[6] << 21 + carry[7] = s7 >> 21 + s8 += carry[7] + s7 -= carry[7] << 21 + carry[8] = s8 >> 21 + s9 += carry[8] + s8 -= carry[8] << 21 + carry[9] = s9 >> 21 + s10 += carry[9] + s9 -= carry[9] << 21 + carry[10] = s10 >> 21 + s11 += carry[10] + s10 -= carry[10] << 21 + + out[0] = byte(s0 >> 0) + out[1] = byte(s0 >> 8) + out[2] = byte((s0 >> 16) | (s1 << 5)) + out[3] = byte(s1 >> 3) + out[4] = byte(s1 >> 11) + out[5] = byte((s1 >> 19) | (s2 << 2)) + out[6] = byte(s2 >> 6) + out[7] = byte((s2 >> 14) | (s3 << 7)) + out[8] = byte(s3 >> 1) + out[9] = byte(s3 >> 9) + out[10] = byte((s3 >> 17) | (s4 << 4)) + out[11] = byte(s4 >> 4) + out[12] = byte(s4 >> 12) + out[13] = byte((s4 >> 20) | (s5 << 1)) + out[14] = byte(s5 >> 7) + out[15] = byte((s5 >> 15) | (s6 << 6)) + out[16] = byte(s6 >> 2) + out[17] = byte(s6 >> 10) + out[18] = byte((s6 >> 18) | (s7 << 3)) + out[19] = byte(s7 >> 5) + out[20] = byte(s7 >> 13) + out[21] = byte(s8 >> 0) + out[22] = byte(s8 >> 8) + out[23] = byte((s8 >> 16) | (s9 << 5)) + out[24] = byte(s9 >> 3) + out[25] = byte(s9 >> 11) + out[26] = byte((s9 >> 19) | (s10 << 2)) + out[27] = byte(s10 >> 6) + out[28] = byte((s10 >> 14) | (s11 << 7)) + out[29] = byte(s11 >> 1) + out[30] = byte(s11 >> 9) + out[31] = byte(s11 >> 17) +} + +// order is the order of Curve25519 in little-endian form. +var order = [4]uint64{0x5812631a5cf5d3ed, 0x14def9dea2f79cd6, 0, 0x1000000000000000} + +// ScMinimal returns true if the given scalar is less than the order of the +// curve. +func ScMinimal(scalar *[32]byte) bool { + for i := 3; ; i-- { + v := binary.LittleEndian.Uint64(scalar[i*8:]) + if v > order[i] { + return false + } else if v < order[i] { + break + } else if i == 0 { + return false + } + } + + return true +} diff --git a/libgo/go/crypto/ed25519/testdata/sign.input.gz b/libgo/go/crypto/ed25519/testdata/sign.input.gz new file mode 100644 index 0000000000000000000000000000000000000000..e6dc7280569666c82a6edbc25bda02a73dcd0c52 GIT binary patch literal 50330 zcmV*6Ky$wziwFn+0000019NF-ZZ2tVaCLM5?EPz!AU%?02mX)M0EV~k28PG}moVqp z*D^9gA!nNH)m2%^C^oAyBf`zi0DW8qRPPrlJ!@tDXRK03 zd(%@#94(}Gu8`uIr`;NMD|7S^`}4*y-?mGB@7ZaMnnO!7oDj z{=_oEOn%&|@gzPpt~=gb-~E*LmK(|_?|YtHONlw=)K8l+g!ku9UTcRw-lyL?>Yii2 zb){U-iZP#X%iCv)rTC-5?Z}sL=BXEA5vhDdjGp(ZW#rjbEN3)d z=IMI{cIK>eW@LlecwgcV`#3{+aia3fl2bjghg7gnA9(HzDVNKly|J{Xw9?vhdI;s< zCH;(3)eNZoOLxeVYHgo8M*BAKK$=ivGKig4)4NCp1tCnrG?Ude*J*;uGZe4 zJ$miCJnMO}zD6s(JQ!;s ztfctj_WbP3u3=JU>(G`=U) z`QTXie#*qB)AAa3g?#X(_g!JLx8Yg2q!bNOWv`r~cJQQ<&YbvCZ=DUnLx@))#5s|E?n-JDB3pP%R?=C6SN{H;ZVaLz*t%U!5_Qf~}514x* z1e~X0_Z@GXGt?Byb{otSEX@1h#R*@ZQrhggRb6o=A;%)PfJ? z-s{T-y`8rtj)%=|-af{A*}o8fe*FMGxbm`Lw4e96E7!SmGqC2|`if(m$cLR+$Bpl) z>1q7@zzO+{BVl-R5O6PFS8>?*K1Aiq29gbTA(}@QoRB*YzCz;Qp}ZUE_hsQG$ugHZ zC*ePg|BqMs)B41R?>&SN7IZvB4S#*e_*=!1YU5Kj`yFrr0t|oh5O4S!B2p$Tt^3}Y zLt%H@#rMDhguRVRuT?T11a>G-4g4pZ_rX30@jc;Ljw~1W7xfvL2e+@5mxVt zd+_;(Pw0&lc5A8tmvjkxWcM}Vyn7_V%zkoY%WflJU@0A3(eHydSEBMu=)uIc5q6WK z2j)a9$XIH~n}9;g}~9 z(n897QNWAsVTpTy+aFs+F%5KqWyX`eXvsOhvuPET*bcUi^Pz};V7f_<&& z=hqK-^CUm_cv=9*u)Ja3=Ypl?Nv+NLw%H!iz`k!L4DR$qK+_KUmh*rDNmjkb=d?q5 z89fGKaw!ktf@DdiDhrbYy#=x}TSV^1u8BJM4Z)NEuvz-`2EZFX-2M-*^M~9}OZ>3W z>ixX2$9LcW>5?YM1^lo2vfBJzewW@x!nivS`_3Wd-5zmI9{QBKNN5GTK?uD37y%Px z2^71pE{30xMf!MvH6+QK3Q<(A0Q4tR=}kzHbPA!h=Qb_ z-VF+yKbb7di7^zs_9mXdU+nYnOJ`XLe_&6Ri zHPu1I1|#oyunhhS;RB3P32C_c0eP^Dx+~%BIe5HLW&pd--9Nv603Y%ai)-1$Zayv7 zpJ%l?12xQ(MqH6R+@F(h$hpWV1wYhf398sMp&f(^B+xIg`Gv({!DFqFLtZ&2!L5*_~&fDX_ITyGdSLbVt z4|(7F^ZN&+O+e_F@Bz!mmnk_uu;H95W2J2FEN#85t0g_Vn0B9pu}kd zFQ$MRE-;J8dQR3EY~3l4(y*qWjsXHtl9fSR2CG?<%--^7ymB3tK#vt1e&qk`rT$n> zvVsrrjVf|Xsv?l`VMj>Mctwtf96?1xngE_9?EdcO*`35lg-6;ZoRfoi`l~U@tYtQ@~@C%vd;E zRtW(jGRl{V*-`5O%}-&AL-@aVtv{foSt)P9C7@_xJ)o?D_MQ);fZxOvn|hcx!nq!@ zH%qd~qzUvw#e7d^%c&G86eItW;>s8ipbPXsHO)5HmmD0~KYj*)o(7ebc8ry@pI<)! zWV+oY%2{@~toywrYWg6zZjzkIPj_zwsg@aL9p za>@qMd|(E+jUPmcropq=xMi&h1ejE!{8JJNRUTFIOJFa7vMFGeqLuvMs2l7J^iJ;e zOHq?Z?)=NrsGbJ3I$)I|ZU6lG0Te3Ob4=ia%Sw?@$ltH1>&M^&7$ykez^nz1NxhfI zpTyfMmJE#~*IUe&1j6^`FsesUQ#x=3=uIrL*aeQ$3 zA{jq{dbE4;HNnIG*RS?x%!Nsm;ZHsh529>jwF$2WYYvMzL->3WEAVc@%lm`}pWN(8 zovg|tWfPuyCY|7j)JU5+Mph-uHXMia)c3^42fuvr*eA9#_{)SBKLog6KY#+2NJ@!H zzGa2ktcS-O0Z9S~ng}p$z5rzYf;%2QA>cox5WoQGB0LdCcmP?1nVb($5DVP3&X**K zMYHH}fDsCiyYv}1;lQ&d&*nl&mdFi238D@IgYS3G9kV^FUh>SzX zCkX%@*qPqWd!A8a#VtuYfY9rqz~V1~54Z~ffc?fH3-Bj`kf|pMDPkYq==4hhW{2hr z9*NlikhiTYbVSAoj*L3a-;-{Rcxx5sq3Qyt_uAQO&-uo4*iOv47uK?RkVfv?88;-V zluQBui$o7V`b)C-|NVM@!sI8Y#64f2T%g!2o|G+<_5&ten4F-Fa1UO_i7TE|fT$p8 z{sn*h9RmbXQ_HF0xqb@^mS3_sZ$tr1QOgQ!vkpd)TV3Qb7qpc3=hqJ~2w!$-Rcw0_ zpl&5CP-S4-;O+7A%(S0o_}#|Vrww8Pp!Z_DZ(@0 z>iRaoXWxL<2lT#h?C}0iyyBnME+qtIMn3m?6z)&uLCpcm!8i(d^HSY{xUxYwf@%|W z^0V1jcB^HNz#ohWpbL)emD&Y(kSJ{l!}upFK(RwKTl^o)II_zN`1N?6`u_a-0WXU{ z4yQiCBtdEGz1gGWmrno+S~|ra0vq46J**CiKs*4Otz-?E4?Waqlso_r;3e)q7ulb6 z!yMV3LKa>Rp8tY``N_lr)@9A0AqH|VVB~3M0a|gI#=-+MGbkpV!*Y{@=l|48{vqyC z+MGl6=iLFn`<+znR6cV9Lk4mRmRp-Mtte;;$pho}=9_leoqf(?yYi)Se`kflQ1U+&- z&hxT^6j&P+?I{c?`B>1cGs(C337(G+UM#n<2mE#*CGc+&XH&EP5H|Kw}_={qKpPFq%1FY%FljklJ~U-$b^kVL?; zn6QRR60?@3-s~P`t@LcyrR$g;FafI)AdugDQt3J1QoSA#-69zSE%=vLNX>?>5O~M? z^XmuncUJ0C03Ov0HaW257kesvb6|yVqTJs+er5!(6FEHpr~D*u*47R%=z4obDk93v z5^e$MtU16TH(ByMEMs~+EMqZ%aR3FZd05Ik18d2;640f_dHtDUr9-?6`KeaR`yB?D z@<08ee=vz!wwHS?P)sCDF;3t)HGB5~nfOf2Mp~ty3zU}@eD4F=G-#0hFZBflc$k3# z&WBrjzM9qq@A07lKcAk9<^rltw>}_2Ahmd4_McxrAQIf`cNzR0%d;H2dvyPbM8G-6 zQ>ws!s6SK@(XwP8@&%zA^JSTczbqI@f_SeN64cmiB00wFRWMZ^<-)DNCE#AbsGmyN zy^8?s#ljcG4EFAg@y(GWw;u9FOWw_RCEPshINdDsKmDqIHrRsbR5u}fVf4Q-(4#BPI(NW>SvER?1%i}r#Lnt1ei&J?u-%mE(@ zC9}5go`hfQzWn_90g(XWktk7P4q`1?wLNR^#oK0AAQH9Sb-*V1=Ot89s^OQLI-StS z<0mP+6Fkk`Rg<-hA&q#J|AKWl$d@{>ndtylnJ1H!ylY)%A2t9JCH8^&iM~9J@)1)5 zygiqqWLU%XIe2mi|F>TD52ZHX@r2tNCG_yVD>Ta9q}PXaB2a|)73v+2n8L0&5l%*8 zrpPA{you5%WtNIH#E>XkSjtp@1-Sv#FG(7gBvuoH`Jg9N?ZJ~NVB^oPA5gG;DlE)9 zSi(?ElSN6i58ojAsb6rRvgG|^{b}cdsVQpMYob!m-(4a(Cu6`se+-i9Ty$9`)d6vy zs-tZa(Cj!kr9Xg;RRp1oalNgrwPaGWhq4d<9SDhY5W`HB7KaO*O8VEe@VWnculpw- zLhj=o>=S_z+1oGTFTU90HI@^S53s%L_wj}=QzA4%!yz|?yel~@eQhXu8ju$IUNt9{ zwBR~Ac>@sX72n$ zP&5JR-15UVPZqYaz$^DjXl_(zsrQ$KK6dPQoJ}wtwRr+JSsw2v+unB%vIOzekiy@O z4n!gG4@v`&H2L_o;o&JIe^+0)MFHkM36vQl2o6J=|F>WG4>rN>?P;?FAe$sqUKR~M z1FloT9)QKDVo37WEkqb#J4ut*5F2jK%&2vS*sT|`rp-acCY~+SVxe&ik~*)uFifCv z^+JVw_n1TK )CvQ&_F|D&(|~Wcevas@-~58&na0Fp6blgcBX0v2FFU%r%5 zcJF$5clNs!DmN^b+VTxQX)aO8z$xz z0p1%JQz(ry-qA^gwwqw^2W-{1y_xs=afC5q7}ZIhi`dgLl|KbdI^^+Kz*3;`eTZ@7 zHImqF;L!+HdrcKd36Hoq_0 z+ci_5y0xiw+EXz3pB~6WnF@2IPPlnaz1OA)q9@2cQN(28+vC*-u{pe84Qf9MhI4ox zf8ogt=njkwh9j`^OJgKZ)Zjfec@U)izy9if_#vums#zOIv1MwvmzTi#1j%zh3-C%M zES43QZVH0PX214@@vcvLzeA%^A8=DMju9#-5DK+Op2TsAQ&MSZX+PKNz~mLic(WbV z<^B2f1KyYVl+Q1?1r=eyGd2rAiHXVKs81^7am*OBKr*MeCs(nm;I8>YR=IO~B?4%} zDe}et!kMd;g&UG6>eqG(Iu8cX^+dvE=cTF0USWR(9NYYChwYs&al3g!Gv2TL?(MvX zE1A;-4)p6`eBn1!rGP%4U%mXFXwwE>ne25lm|`KBjrSNO5h=F*xDNh&E{O9!qY%#u zackJ)#h*}z5pm*&lvkjtzV;YD6rcDE1vt+6^}B}R&8c0@WXuWR&+ubd%d9-{5;s1|v^A@d~1ez zHUoTJj9#?AlQPN%%<1tvJB16q1eYJr>Z;eTuca?}-+PM8?_fj7c*MR%_90fYj)bLA z2(&X=FcLFUcUnIQ_WL0#ameC_M``SkQ@QMl4Sk0JkYo7mklM(nog{s6;$X|cLp8_r>9a3BX zdS5=`vY!NQo@N_uOz~-n5AjK$DnLxF*~VC~4*_IPJ33-66ocD-i%fRL06}M4lggwf!OKcHdGZ9}X zUaiexWD&_g+a5i6S!fFZFtG1g&WHeBA}hGEgfF@huRu8zXvdv+ zSpPLxTRawo3TQd@zHas;*{XV}4eyELY2J!b{PQKA0aN1tM|^}ux;K@L%-a`flS0PJ zpi!xH8U+rC_ujlro)i$1lD)>XKvaROz@J=iK!O)*GroY`V8a|~c=20Vad7@q)>UAxW4b@Tet=CItk-QUEw*3}Vz8h(tbBO7t)^gzLg4Nc2bIX@I%Dr3 zs`(u|cFgmK#8OCt>jy^((22CfG8)VOaXMi5a3Anh5{chuku=gE^2Bw-bRTYhR{ z9s@wy7K!m0k3*@=4d5S5s;W6D4j(5*_SXjgANVPM#`KD#;kw_g%lWQgU-vaE%jCr- zc88d--uv<@7!Qe@QYj!jiiYTW5go)SmoFKMl-`8-S6c2Oqjslwi+IWAUDq&lD?amC9?(M}$ySF`m z9t-ATGbQE6D%l1kF9vCKI0mBE>05Ax!z1xFkSN);Z#?CR&OA-4l>xOcNxip<0 zn|I>QKx;~;cL0gpvw6ZMiSotITfL0~+&&<2Y~5*~YYKG2faN0&d(ilJzXV>|&V=of z+_@+8XWaol*3YZsC*-EY=1yup> z@9Bid(+U-28+^Z4S~+T4K=PNE@p#7yIL5{RJD4@~z`~S0n4kb4>XIIbbhCLl#lNii z?LWVM06tAxA}0poSlo{X#P7yZDj2M{nwy77k1f%cN|*l-NQ1TSW@j7OB@gG4pE3O5 zc76a(*f_C~fHv%fraZKxiQS_jDA-?P6YjMnAYi8ox+$GddJ4r*0qEe-U{33QN|#F| zg0Vc+_R@IL6IQsEnB_ZWYpt7^S?!&U=i>c8{Db~n(s(66KLed{ zIg1$sz>xYfuqE#ky#b`KbZT&%*B?mi)^^U_qxGd}z;K|^ z+^Bqie*J*uaQ1CyrDkjanWfv|Yc0u)Odz{8HYo`;D1x}{UqRtG<( zhtd33hqM45e3dsDBz;?hN3H;fPSBZr)5`{Ahm}CO)MS)e)ZbL}V2M0mq5)Z?VCQBf zJa(DCY_p&a|M~R;?8_w=Zc)YYEF)6xV(?f)?|bzW^I?BBK6WUbgH#k0aacP*Gp%m7 z9_g#$m##rO)Db_?&NkxLs%FBcPKp|Sx~%MQyv6PS31f?1V&&-lw==qdGzM6Bo|6~< zux*FN2(g7NIi#ILO1!KnId%_n55<)YK_D+S&zTC~M|lXy|64xl4+d-@V1EM<09ye? z=kr`bv}rMB+r4h6@A%I3HtCVx*4>9%_k48`uUK=X93hq5uU&0ZuM+U5 z=b^Z?wIq(VJs&Fhb<8gCtHF*drApm{%geZtoStE;yxw+v@3B-1<$u#>{SgmP3fdI! zF*DU!wUZk&Yu$?>TR652&Qm@B(DKc|ISBK{>-|8P+7f1pYvfB|&9bBA$r1 z1~1#>RM;)>g9&>gI}o8`BwSr_?_NLr;@%5Uc)Dw%1GTcO3@{{Isou zuj6~m(Q8-BWpS3&^O$M>hDBtvoAK8VaB*!L2+!R7)J@;b_I}T6$Lq#h@q>y9C8>K@ z&RH@4*HOAdU2e}X@!BRBNpy&%&#ulb#OKEz{1rwnL~8rsp06_ibagQHKvu&c!Ai+` zVTWNoPyTDy9%$R)L0)VEk+SXa?8rCl8$o-RFL*8j2*xIHvJoHxwv06VdXC|Hlf%>h z#!vgxWgr4!49W#k$n;h(cjpUb(CEi|Ko&- z*5M_|7Gg=K$F?ER4q(2HNSUf9p6Ci7cQ76`EHr zWR?a*j7}&osyCaem*drj2x(U2_9{z@ji5syMjTF*5;1>%{eZlvLHP8;Uo~HqbVP0A z=-IZ3=h?P8H>tHqy!;#fADfuI5w7+;Yh!I~Q`S@5*hn{>EeO`2Ut|jYRv>`un~()P?QLWI7w)(- zDGB)5FdoOoXR{NpdacbC{crxfKZ|m1cCR5p#hxaF?%{Te9tLGushqA_9`B{{&4DEn zaf-vM@7IgJ{Tz&OTGyZYVkQP;>X4rHyQt~xyuwYT&j`oqoCG@R(orq2@XxOw(0T$P zS4tCN`6YLlNzW@J_Gp1LUr8&BAj@ioSqJRg*w_~)sCd|?sZQ;NFH_W!#-@Xu=f+v~{h_#dI+k5ZY5> zaj10J!mkw$zA+tY{d?`QAsShU$#j9uUpt$DVs2=)35|Njm_FrB0^br1@9`XstUCA4 zuOHyFT%(Ex0cf&24XWtsS&sxMn)%0k zBn#7;F6Nbu|c{pDrJ$y;2FFCzR9dYjU1p7Lq zJ^0u}-MKt?1BUl%Ok`!B^i%CQ%$ZsoxKFtZ4(OGa%;avppFbf5mrk?@gv?APU4492 zm=tcjkB7?X#j8owx5Pwk)?$$f#LLD*oPMbh4u8T=Tc?H zyr}s>FdIaOArp|ia$g=4UCiOlM3Im%O8e-5y1I$uqFCi5sU&F`N3Sm>CN4yQXfxm| zca6nO2iaVkL_K%rO`ENqx!j*$KOo8gM^FT-*ppMKf8)yY>6KiL73JNZ$Eh$%b(fJ0 z+Ptfbb0sP`$;?3J$E!Qa`{g*EmxRF8C^;01@KR3yEIW>)cF-2?MzGF+>PwvZsymAl zXD~0p7x&}m!OqUO#n;JD{58t?+DP+_dwO2ggUMj*bpkUntVa?FO9v!QEf7?w+9eu2qe|FGD)h{k ztvQ)0O%f`KHo|l~_G`@KJZs#;e$a3QbT4^R=X1#TKkrljytW8V>Y;SC6w(_e_TFqHDqyz z?BYj9B6}-YLGog0t>hK~FcxR?K@&eAnytCL5JSBJkc30$Hv5h*YilKja;bh*t2l2qZDUXd_+&)|EVAQ=cV?M z&M(M)^mv_I7N!tt)@a+tJ1Avq#-s=?UI#nC4^SaM+IiIM=fp^xa~E-aJvCyNk0Xj_ z#Za4ryQ}B%7~P83jRpIv~l_}d3i&F$IdSj1Wa;G~v2hrO%YzUC1L)iOJi^}#1> zNAcYH#dU)R1cx|I+LfxB&rEVJO)n%T|7;}j-HFToAV;mjdVX;7XAGSDK9$O`4wkHW ze$Qi*YWL89lEjI+M-x@F^9H?Y{U!m;@*bHvSCGTdIexTk&ySK>J-G7e0YEL)ZmQFDZC%wu=c(-mQlPsQng{we8%v&n`+!)&Lu&gA5T3wK}Z{{@!JP@H*e__DWgMw zy|g3bIsbG$q;tfYn)=EpT;<0|9uy{d#sCYU00bx5ii9ph@9rbu^iPOh5rlQD(`H&S zj#w`8`9IEFEt~p1zp=5W00@Dby*z-g;dq;z;N)rgyUde(e^E?{H6(g{zhE zojwQI=j;^S9@9`MzK0^h<{mt_v^0JILF*f6^E$W6fIF+SWp69e1K05m_S@skDhCG} zEg>s~Bry>e5Wik|2_Dw+KEqj~>*!C#B62&@@;BmgUA{7?R4 z*&v}sz>OO~u|3UF`4Vla7t&$Y8qie~4Uauh|qI)uYFC|I2*M^qdxJhC(K-;qf4!WFAi}V1SuVl zmzw1g^=*Q5-e|7ylb#Jo33-3>P+l=QLla-Bo9F4W?URv)WVmV8`m(>%@?2?@0T@W2 zFH&y0vR`&5c)*@<*wcEWQ{d}j4CyU$`VTN0m8y*t!MTxm!uT)x>_2&ck*Sk6(01BJ z17OV(;qIxs+i?U)+0s3wT28(`pM2LtA`vJs;5c^X%~?7SKG8T5@q$$HO0ho6x;~xs&kf_p05V*thI=3Fkt?yQo_24wx&&!zH^r%rYfJc#|e)WnX; zVo8*0M^?Lr7BQ-j@`)Z~%?1H7d;AF`5dO0E}k zo?`FIaxjUv>x~Unvc{1L{d; z+w6&4cc|YM2g+YcW=bN;3x0xFyYI67wm)T#s^G$Z*{A=ZP<{v4V9L4hM3&;(MnF2; zo*7reX$!M?!vH*c-?aIUGVe!6c_?Bdn+swF=gZ3F(V@40gB4kJBC5XOlzhY}hAYtR5J%Pj+WU!>W3lEmB*ERx(h*G-8b3YT7JAC*p?g^O_L8vc0f6!DDuDsHcNSe zK@lx5yw8=>@=O&4*hxEA9Vnur@pNGJcS_3hq^6`#B+pd&MFyo5at~k1bb*A95#!-t+VO2Pk2)6gg=xb*4Hg-?$Nhy=B=* z`EiOHBWfUdJNW$+Z?e3rqyC*9UQVy-gNM{b?%sZF)UmT_Ti#3L71kqs?Z+eeQThmbhYDk5%sBx%9-+5)A2Og}zFL$gU+(}T-z7)x!__#BTE2~>H0L2Qz zi~X?)Le}-C@OI?qb0smtl_{BJxSpN8ztgTgme9|5PW*0(ql~ICdm$K~`rVaPCo1Jk zir4#PrM0X-)2{iuNzL!t{1c3`ZeBrl>xaFDJ#Bw6Q}}P;9|1l3<3^LD+fnhaKceot%GwDiZG2yC;!e zB{}DZJxH+x=Am+AD--eBJPi=G*SD;xLLFu+S1l&DKF<68HP2(4R94~)8O5gzPI*fc zB8BUk@>!EnfGw;9h~%&N|26;rI`jWi%RZtC&u32O#i_6e-=UEFo~&kFP-TGfuiWem zK;`?v10Jt{a-NsWM-erikAiF3B`YE1M~FhwA``{pwbyj=TfsD-=gP}rvLHdh¤ zlQ$!hi%}8rZ%fs@d9}ko$K;!oye<#8l1~b5#gV<6%-bfWU0C^I+sD{n|7)k@@~BAd zA+KG&Bg#8uUzV_n+{Lc0ZXY$EDL3%jw516L0ZQ%H|%IWi3GF*jD z^EkW-kF4)U`J^xk?+rpE;fHF?uxgpT+6DH0BfKEQ;=R{x-qQTjp--9hHamYXX<44y zRLe~=OKhju*Ye;Pz>NHnc41}!1%73gG-j?x85O43VGXOsF7v#dm7bipmbB{ zD^c%vM`l2lH5HE%ha&=VGg7))`8^*&$!fBRwZ+GJ^k$KVv4pKeB)ItfSo&n(=_>J2 zK7Z>k9eq!RWW0!K9oTLe+HB`@4_{)1#27KW%0hlDt+H%8W&J7WdgT3%@eDFf9cZV@P=8f=sezjr z-1uYu^EAY-5VG@%c18pna>gf3_wvWz070-lfS)0S{B?l84)9;;0Dpp`iY@U!&c4bg z*&G^uZgu1_J2f}>_ig1VqsW#thJ>4CJ?{G(C4N%wYkoXfvaz2Q`SbW(`6EX>{SEu0 z9VZXvV=nw|3A~S>9Qyh7160pb-pAfpmH#OAC}TYDbSipK!SEjrNNn2dV_D`GfwyM3 ztO#zzj+W)s;tc!q>4`;wE*uJzqMzSQ&iz`5Py6`6z(ka2)O93&R#;A0N-`eprMv|# zap2%sYrcS*<%;mxWieV+3;O0kl*!V%#J;sCuNL&bFUF{_B6`<|JNG310m-bll z-uK{Tm)r}Il&dx?M&aRqIZ7^lG%(WcOyJR~&9OWOeh(lqS`6Q4DLTc>pp(gZx`ciH8WMGpI2jAFV zvkJzFecBMly7%r8-|V;=NH|mKO9QhEZv-1KX{)lzHb>fm3|2+ulsTL9c8=&uz4L;p z5=)%>mV;&%4+s%<$sO@r2bJ z1)Ke!QNL8$QnSpv`d4C(T9hPk6kqkRPngJdy!=j;o1|lHATK$x)C-RG+OP(}TG}CA zz)@@t25oIWfXc3RgPK!+ zUEr?^{Fl1GAD56SOm+hs<2pYfA0yQP1~NzJmEE7`b-=dQVKv}wf0SY^|6)BT0B_xlJUX41R3QXS>3uLxh>V zHOQBZ>sG7t7lcvYU8b}!HPunTb+zY|q{g8BCGW8fYh#)JFo37wH+xy?OVRuuel@f`O{``IPg(#E(?R&`iJX$cj8HqYV9ei4!``k z)1fR7MvQ;HA7ig}j`aZK-&yij$RQ2DUoVOy$tiiZjG=4!jfC5`Q-0K+y{P&(k(Y&yT@Yz1wJqm)zV~2DZaDDtG?;00Q->YxAFQ4FUt<~ zT?6kUtps_=CKG-;G3&1r{B?r=awqsh@n%!OyQ>2-m}xq4Cs2{rOb8D$!R8Ze_DaVa z6{Vr%EpmZ?2w9lx@xD9*07I>5yHBLRqec$7t6G>|Dl$2_=3#%!{`vI- zB9+kR8g zEn<_&+8ZmD14yaD53bO%ENF}D`bfnvqKw~Nu2>8J&$FM3ZLmMk>3D!0&wD&y1sut{ zcpcXPaBNAhK{Ql^*n=G(gcM$Y1g^etb*PH8irFqfo{hju%$mw6;y^NLSKw^kDZMKZ zqkbG_ReF_9fY?%109RkFaFYX3(GIWaYR7L_LQ2O=u`G2)V|%Y!Qk2Hd>TVSf zF4e7VaUSXO+^AR^unI&ACeOohqT(#z!70Fe=d1S*pYTzJv~dVql+1RdE^tWdPXXE$ z>HLnJARxhwcgmu6zp+4q0%)ZsZ=Lb^rG!19(t*XP%x)*3>|KST4__nN{s)YO%ZF%I zdxZ+H{#XU6B8dF;2awrp89Yi6J8YuJb?nI#8a%4z^xAlF3why__Oj`F+bc=1Q#!R0 z0JA5^V8R{j?_{wrhUC;4mB0oVNBfxhN-#DtIoLc%B;U3a{dI%CZtySQ27fRzX@%_( zZzaAHj3aA|GvG3P)}f&1pnOo!oTz@WQBoBp3+A%2)DNmcFKKoZ&F+T}tk1MJdr5jE zY25o@s;}aQ)?x|EQtVTH!0_|y2Y7o&Eor+|h_YMb9esX`qD4W;q-93Ly;`yoHiPV^Fm^%|Q3@C&Mbu%|@h z4KQcZ@@q-1Qk+CLr>Zp@4m-RXIC6QNx9rBm#zv@$OA^>ZluPVL5!#$)FESQLBI;rA z1BhZhr@C2jdRUPhQNLh1kK(~>`i(D-&-1(3UU2qv>TEv;V7K0yE~qZs>pgO%ekL&D zMZh@f1X*V*#uDX@7JV<9pgOCzy+L^>Y~&0`-eeM#Q|YqX#QPnY9qDMnloB#NTgh~_ zU531dQ%SbJj_}tJ{v{mYPq1|X!>*y6oE?1shhgHyKZayJ!`3Z(r{CT*+WAslJ<4?} z8KIseNQ76x9L%Os##b8_9>=w*;|8T$8hH+C$3#6+91-Ic&EqH6pI<+KLY!j7JHP#L zt;#S!My^}op_#YNc0&M0H^23LYknLIq4qr#!OrXDD#!xgUkPm4nltovOYi|NXtvACqTp_Q0h`{fjUyp0 zHMjS0?2*KLL?N}F0cH&lrp}uenCn%ciFH4`dTI_wM*p?k|5XN>$GgKv9{%#RMn?&M zY|~(!`jRG7VRt3-Vv>|x-QwaS%PSwbC$UeqadCPl9Hl8bcY+Zy>MF_Jk_?GWf0YUc z_#VD|7tHmsJINN=*GpsD2D?P<@kmdG56c|}a0q@z^}j)`A#f;`8nhXJ zaROUYSpzXo_|TGSN#SXPPkcNngxl@$Rhb32ri3tMy^3>*7yATk`3?O#f%qyGp$HAJ zZU|=OW3!R`2XqKfzgzj|rqs&dMG2uG(vNi^--~O;B4Kvop#(cG5<*m@a8Q*K!Boi2 zcc@WFEOt~<%`jqN2OP5BL9QLg6Zy3)9dRPB_nfO<0#>k9uOuJ9)*aLfxS(}6V? zAQP3|Nsk@FB%4NQ3AkG4k>;j9PgVL2&zUy8?~}^clclJseU8qcb`?Gz$4JSG%I!SO zAxMcas!5H%8INk3CxrU*>j&7mVIQHYKaxjbKLl?U2-&`^`o77_V*vh-{KXh4_0 zwv~)P!3B(>hGaYNBE`$Ey(bi{joKJ1j-~VklOp)f3pvSJKirw zIrM=9z%Azl@l|Ecg7bUH&c~*Zt38inw#JShtgp+t$<}VZXMpKy>mz|D*y|`cytOQz zGE#I-*(O@)VF^JmnDKcCB+9jT0)7cp1k8tB=bt~1wxtkBE&G$!OQ9E)67TBZB>XT= zxg#q0Y~|vR7U;Nx&6{!-4)X>-pMaM;(XB=B_UFBiDkOt{@B>C#(iQK$6vf7-S9j)v zkhIm+JYNY;*pMXod_{`FeqGH}PeYbelKH!gS0P2Mc#9xqkz4c+h9af-!L@CLXlq&` zSMdRDpHTif!(V6kmvM$a@^iBgWV~DYClM!4yqt8064rUwC9$|FC1exD`v6_d-VZeb zDf*vwMsO|5c?Q+DL&wLidrGdgiv@bMhJF*N-nl3Ts+A(K&+Lq!Uq1jOMh3dd^12^k zV9Lj~wx-}kvGmQNDC~Q(9ra3|VsFAuRDG%kHn2)aRLyLAS9HR5h*EYB>29jE!qQsvDUj{b4KyfRi!Ti-y7{k%NfG3udW(;m`Dcf}KIjSun?`R#Fl zb#P=*CSeb7Br`qeZ^Z6|A-2^OSvt}q<1@TdqS^*(Z+qYgTNM6N<+gL8@*LmX#ORqi z8&v2>wRZuTha9<5aY|{l?N2`*=41I_IyFxzh#l>1Pf}|#^M*Gbi&EAiN@b=Rr-&J7 zQ^in(xI|+WYp0>II%@buaUZhUQy@#bc{z}Z#9;%||qU6*{vuLq$d&^a=h~D$` znD_Hdvr5%xtJC#DVmf(?hey2nM%lftMMtQD;qaXhTyUIU|I`HHYS^M9pv0!*lv%(; zumKivzCV3+<%hj#ZOuMQX>>9LK?Vb^p!&i5#yY>2u;r~c$h9;TjH2LKirJ0Jea9>D zIkRsfYyr)&TwgECmCMQYSLwd4i41c%3iHX$`qv%)y2HPYJN#j3vn=_nM(xxr!^^ny zvh&pNZ0nWYSV^6x4(tVT>?bNIZcPPlkO7TcTZ5exuNyWLi&W=+l7UEX_K#=&Gl_cM z)ksiUCq)TAbIQ-JAK-!E+YSI}?C{a>@@1eKAOQuAeAwm9)cE+YdxFjRZ^`2Q#;h_c zt4{SvLN4AZN<1l$2Ij{Oau&3eQd5+$$tvJ{6s4T(Em3V#grd8;D?Ak)|0 z8TKkKr5O2DAOODUrY0}cp@x-=-qF<1HO66!AhzArcz?fd?Oi@+{*#?}t9!-{;KD6M zb2jO{vO-Nqy9Bz)&dll-)$0Vd=f;h126F)o+o(j_;A0yeL1Da_ zT0#|M5u{$W3ACw6LzO#7`(t{Omu#oRdgpN_$g`akz}GETFF@^FQt<5Ap{jpwf4Y*J zz)ZU-?N0$|37bI_r^-))*YcvoTs&QUtVpyP8;CusW90XhG>NKw6GtQH!ZyxGh+-=i zub+lj%2@Ut^DT7%d;#5gw(S)j5pp^&L7aTlZUrM_Iuh>y$#W*8%PjFuhl#<7LfaHx zwG@WRO}NHOWS3~`6Ur0_6Q*DAcuW1B8AFL`drPUGam2<~uAkSt3IJXNCzt9SCf>XY z&ZmC$BI6KA`LD7)ow+5kUHp~z)EZ1w3InH{%GAgNX&oTH4*1)9)zxin4T(rbk>O=4 zvGd5b)>W4e;jcsdb%=i{hxn5m1@TPIL8{ZT%`N4Tv<7rywGvfae9l`aBIJaSZ;0K_ zEp&>0;DvH-t6Uk*k zly%>2R0NaNG9d2FZvmH<88W^dusDKzEMczH+aJ_*C0dex{+o**0mlLDbj zou1&?1h1(IFYex{$Zzekk^)y>$F$h)DrW=>d~M7LKvGOCZrLJ8?5~4yb|T)-v)=`N znXId9HjY;~6MZiGUNs*{3%b5}FY_;zBH7dX;Nbxq6H#KZ!=z+^(>Bj@)oxT7A zs{F@%ce^mVbg6YZ!!NnXj@=l0_KRn;OXgrGzrz%WXl)V&2*mk9kx z>z4ho9$&$Yb zJF|ajNE^zhWwi<^P$us|5koi}>Ynu8#sDI!D6zh2I54F>V}D)ZuS@)kxx}AFlqXxb z%NUSczx6A1g|pX@rTVj8P3?Cac_+5>C!6|I{YfW?sCec~ zpUBW7nNv?M3k(1l>*Hk|L-NvJK7jv>CpOg#9yzYkT~(^1W(Ocue@nKyNF#Aqlvorf zAXojE12@N`+SBANPQ{wHfHqphQ?WJW%2;V3)a%$RMo`zs1FOo-o!h1eoHy{-(mUco z8$YWXgHtUSWTrl`;p3b~){T|bwZqymh=ltF0tzO6ZXd^sTFmgd9=H=<2uBoe;7!v! z4*{DEs^&3qFY1~u%BC1d^ba9+amUU`=DcOQVVb18W>Dv)F;Bm*1fM$u( zo_Oal7`DM;^Dp@LS2jhS)t%Dy1|f!}AgnDlpcFe!z7bvrX^ET^)Z4@NAXynpwaG(9Gh^rmGSW>?IIvyCFF!4||`Qpcz<`6n1 z`{Yd&3XBpgsDg;8@`8GwH~0~C zRpjy@ip#V}P<>v@3u29dgNi=b3F_y|DG!v)TLMV_B&pI($wExd>uD{{AKvkj1s>a^ z>Zc)@yQ&+`3fdMnr(u5iTb+YG4mNmC;;l+tT|VlBy@0?jV3r~y_mU*DYykJ+-6$?G z2}03!RV)`@Ck#&M+7_YzuT%VWihnt$_)`Hk)PO-61c1chlSiFReoBReol*K|7pSJ> zX`j@Yk9S$~QZBP@m@;ppCS{HwtdIX?u{FyPtY|Y|DoPPbl?TjWZEPy3ttxoQpZ)y) z0k+xorBFIZZb?ZWqP=zxAn$Bd>O7B)2h{L-5m!G;SV=W0RTpeH*;L^@f~>kTN7S_7 zkt^L* zIG5+GA$o)_Rq}P#o45hwy(}p}HrM;~K_y+^pvK(mEUj|vmXj3RNAl1#9kN!DGCC#J z*lKmhR}9h-o{?T<-|zHy?GKf*W~GnsLJ!Mqk34$`b0!Y0r%I-OMbF8OMO%Disnbb; zeAC8%EKnY#Lx_xCE89fHdjZMbH)zx9<2fCClI@04Zw&dL30PH0f|5sZc&=me!y8E3 zpZuIH2S=+iq=xkn167((m4GGO5%dI3+kiO_qeqwcL^<#<(<@KjSW)isKk*2fv=pggsE*J#?)5+?q!ZuY-JXea+{ywV7PwCtp9{=kWf8F9= z&n^Dg>Acc|oyll(Y$Gip-V^48<3dVDMW_3S40?=~!d zT|>4eKDi|+YFeA|Yw45eho5nN?RssPEWGQKM~Md?p-NVcM|Slac};99B@aH*>$$gr z)@Ky3iPH5q9-J)fR7+GrY85B3q|$aS*#n6*09K&gXM3Y4!7O<^KS}Biel>9dZ0NK! z8%byaqP>b6ncrW#NMix=-GgyqAri$ZtnAd9JR{_IEcJ2pi#U`N|4LxTNVHLUcKfFo zlD(PXj$|uk9ujYS(x+XDCe;uril?LGiQUKsF3Bkrs{(j}A>PMUD6khFTJ8{izD*KR zHM)xm%6;`6t~&)JlBc(b(4MAdC6$0=ze!2n2;_S_^ij=yedHo+E^dOw5Xg42++WY5 zuwvfw)l;(XN>rLl5eWj1L(OgQ|1gLr$mETawWW}KUiqULTvXoi>pW^Y6=A8V`!nkx zI{h@oz`M+jU{vC2akgI4;o;q{*P;oBUyc-e{-Hhy@O*;2mq#1m>YG8+Wlag0_sN?tbU_Pq~~5QDa%e~{#$K} z{Tnt-V^h?FZ#keL{&zYg*?%NWsJE29R{m)!S5@tw8;TrA>?Y|^uTd^G?Aw7}t91}W zNu*9z4jcXX^#hudRU1^c`9ChZB_`h%szbHhpib=u$s{>tDQn|VQ%kaJ7ExN z0*kV%SGxNihx4vO9U-7=UMuE&Fa|z!k=i54-jmJbG%%2MkHN-D`Gm9MI^%fiLGGRE z*;o1C9TTlwu#Cqeko-?_FP%T2 z-em^ov4~)J{)2oL*_dVnkrn&%9wJchyMS#k z@h-~Q(KYX#)pnQDM7fxIq|nNb2SG|AAHKrt_p@+5uTKv2#$EBtL!SXZ4lQ6Ap z4}oeYuNpIdUE{B7{ENEApQYU0r~5>zSMu{%zZQ(RNs*jL>-KS`U}HafyK~Dt>b+lH z#TJLM6@0a#tJEVUb4Ll>4pI<*<<(j;xYG9pU z$LaODkd?cjm5@88*?V+)H@uEZUut%b)QJa*?cBEjGSz3kT@yXIxFCnj#sUH%@U6#x zf&H__Z@5?zk+)|y?BQ(O>1LM?s5JVC9Jl)S?u63mfUvH>hh_JsEJ96%~Q zWd|U2HsFs?g6RzB=sd;+wy_KZ7Q2?b_q+NC*2t$(1QQ*?u!}UM`h9m{mzoHvJYJ&a zFe|nN+`W<7jB;8TM))snU4C1w%7iYN0Na*FuOAs+X7Uz%zO1(0 zvw`n?JZ9K(L+0abbpZ=ss*j&yqZHnRKfWPQ``Ak*$sm3-F8@sVKg`-UE0|v1yjLbY z$V!=HRUYF?@mp~0OsHu!_QGo3BT1CvD-td_p8=ld@e*Se(5sC;Q%bGB&hghd{zaYR zj}Qu^;gwV_GNU^9Q$14aSG_#jNcN{C@k$nF8w}58Wxh6b>dJRCucNS6>`0CtwH}KU z+Ls;Q_B>w)5kO`e&xwUM&9=kWvDvDhUq68D2>t2g{t<^faZaMz=RY#5vtw}t={`#m zq$Kwr#eX6Bf}_;8&X0Pa`E?GK-|QGek{L>VxQSEOiodK2l3k76z)PF}d`hBM+02N8VT;v~X~K~LT={nSD!}U}%e2Ra zof5qvhKNi|+&Y&qD+^w&N9y2rn+d;D1+fznnj-h=5_?ORu6 zNIHip1@mj6eB5!Y_^LE5`vA#^BJ?p)rPoa}*-ty?Y!Cpn?NXM5PI7}w*gbRe=+19z zA4N3v8^zquuOA>0=T`A2t_yB?x@(9%YR&)3)yrsSS@71(B|@hCfOQsl;y?Dcg=$aj_4Y!!?SsMZcv zB`|sbO2{BiWX6M}jFnMw=P>4czfe%CA0R7D#YPJO@j_+Ffe#`Zx}Gr!T<>oy;iH_CP- zSs_D$TPFSh#_?1Ttg6#f6Y-Q~PKTAF%(^0atcUvlnQC4HyCuQUm0%|2IcTqh4?Q|w zS6Rc*r~RV1zFoNhH~Gt(N=F|+leU&+1l5gMd!b|iSZ7;mcczGV`9}n;=%u~-jghAu ziLCt2rc@SQmak>A)5Jvb$19I2@rGi0*e@|`-|s}L-7p^+RftM6Dq94WXU%}x)w>jM zkn7Lyk}zB;^qnO%kH`CY*`)TwM<{66x#w%c@eqdE0eexnj}Wncs9Vk*((8gyfm$pe zx#g;)OsNu{gO|=v;SkfU9b*qe&655^=Q{&M{~XP0X*-=gSz^npRFw*3cwfBa46)UA zEzComO&ml;FQC2J9)BI=uY>#xJIJ4B@BLO@W(U@7klno*3eHHyPTdZCTf!FgDlF0> zwc^~$(WPu%+(Q|PJ2$&au(EMT$A?YBbol2$Bhb`k!TD4>CLf`iYSlJy+Ar|y2S`+) z9#K%afxj*uklP#gP>CkcpENxSb7t}FB~*p_fI^2=mG}&d$;xM`T3Kn2QRi*m=)bt58ROyO>WUstYj#T-bC=)Qr zz1pUrr;xwWycXO-Bd5j#ih*;FtRa_*ccmD3nK$W7!Ycb+k^^!0oMcG~Tq#pw1L!<5 zMcJdt|HA3Q_3GL~?OAG*bytbi5H=W;Bu}tw(JmS14znBOe@4Nn*p3v70`vT-U@dt$Sw>wBHo3A=|lhigWBmXE1L zmX>LI)75EZrVk!vL{`V^hU{g76-A#QMAo{?cHZX!yb+U#-)*c>CMa+#YMzL^lpkHf zrA1n(#96~2hLJ&XUX6<231D6;00+Zm!3IC{vvB)^ixUwKfz(^hA>}XuAjo459tY=9 zECmpM5xWv$LQzjj5drBH!S!q4AL7i~Z256@qG*;1fcJODAMZ+SvNm$^r;n{@?DAh1 z`RgM8;x6*XMhnW>fTe=a_%Z3mW!njb9Dq$pOQ50#Xb6Oa9b>?kyrd*6AVety{4#BM-Fu&eQHqeBDNC9B!^rdv?o%l75 zCEO9DE>;rkY?h?gXY(pkASBvmJJ}^b;8WYVVsyKg9QjbSW8f;OsbfRu@9$WmL+H8s?=Ap5NJavrQ7U8D4 z7w@(_avAD`Juf)35lIN%^W$f%av|3BA=uuNv?fv-uXdgpZ10s{%kZ$5oyj1eyTOrU z23|k;1FN>GPK=_uRmDaA^BzxoKRHJ=VX}Ry;Jj0wFEC)TDG1*kWc z2+o>br$e*J(*Y3?|c+;-NP?rLL2qr^jTk>-!D9P&8q%hOJE?IS-?UsgyuMjjJw zWI0{=*~y;mn0rwm79?n&BoL%WieGXwE3W1OctwpZ0GUjPC1>SzRp4ODJdcUvgHhDV z5BYmuXQH=yfQ5Cn&E&lv9F$iUSL|xKvDB&(RXNi@5qdmlk!g@pvDv68d*P$r*1Rm# zRf8gvvhfVHTeG}MtVUXne)G1sTAJgs_`qCSRbfiaC&tQRU3nRS6_-#o%AP!RV9x6s zRPWb5QXCif4#t$EBQ1x|)r7<>Q@Q84UtiOGKMMJG#g{cIk8Hi)+&tg+>?ah;Y6-2% z%DknNkoy&E@(Zs6nEO%Y(9yym<)T+9H9m@^8+L()kAu%)s>?wjcjQHFl>;80?E9AX ztIFqCJAFVxdVbofbKWGYmv-c!}Q_sRb z9CHBahzcy3RxnF93#c$;5%Tar^;&5K-{+&&tt!C+W!^_#4vNlIw=F2GZ(f}bTUJTG zeZZF=H?JuXcyI{(P8Jhvl)Y(lSgemQ`6SA`Ap3`N8#d3MD8nP=`$I(t z%1r!z`&kv)lS!&xwL`)PYk*y&{NO8(4X(qe3Puu7S7RzkbN=i+2`@Q0&Nb7wi#Vl4 zo+I%5ATkJ$qN75kas^xlL>%Q5&YIc2n+-0`|`uYm4E|))NN>0psSAoPX0)XpV+;fZ=eY^ zm&aVI=cvMxbAqzT)TpC;SGoMA0){`bNP2m}233}MfDbQNdPOw_l-cx%q5x@q42yY- zS0EU@oo8d-jXBi}aIcDNvV2ow#3|9{cnRDAe14TzcW%%N)sZJ3RjJj3Evp{dlsMQm z;$rO$q@=TC8er_RbR;wn@t=cfRzymNi`^`hMPK;*z! zgt%4il^0WP%aa^z_9&HkqW#;kOSXjxc6*)Q+NHVNQx!Gr(W~9BYk*CZStau`ug6PL z`Q%rA97U4DUsw6-D*sJfQ!#A#b?kw^zYHO4O)o2;~_6 zf+U&9_{(Xrt@xlcz)#*-7+a1ri6$C9KOW_{6p7_4=D9D0_qa-LE12;_6<)!BYK;Jl z@grbkd6j=E`%`cs08sJQ$DV`*7f3JD4wt*~y>GE!Btgjl%C)sI9%`h+z;fhq2HB zn9?rb)Ny)HV6jI?-A-I3@1mUj6_YLy=#`VR*=3VJ)!u?!d#%+6I7&qYFz{9iC5h$g zj?Rb+k?MFKk8_AvD&ssJdPHR(qiUd*1H0xQwx%h(11imux8qj)NY%kqSd@s7D0kcG zhn<${T{H-2_Y&S)*Pa|c+WaLrx5<)e7q4uT+le5Bf4yd|ZG23c_XZb@BGT*jr_dYGeNKF=R!4C0?_KCprM>goq@M+;$iOnZ&?=d4EM+Wyw3)eWd zLEsmP*mZV*(p_SNe|9M=$CRGb-}rS?z7yD#<07~G_5s_jd%zx_J{1Uw9y-2Q9WdqA z$eKql1RdSwQMj@DmyU`VlweqY$#>r4Xm^%bBeBc?B`FxGKx2C)KU|(lyz-(4FcS;b z4tOlQtgmXlcqk<}+XLvrRH;LGg^Zoc^Hgz|ZrAIa-ir-vXgR)dRf6qet-;oGtflUy za4zxZsmj2_WwERH6GbEVAYpd>coM{at#M*s8^0Mdl=OJxi9cb0k2>cysS5a3Yyppv z>uZ-(KxG$?W0!}HLC^q_rTwa_iMzF2)jxA)E!c*v1XGjxpFNF7NME>cj8gjfpz%^V<4F*s<}9THT3xnSQ}~ zUMBM$S$?Omx`W;=d$REq04x470eBAiElI_Q<8oA;hbKBMPDE5YXFkgV9YP+D+o}@C z)`qP&*6z7BT?0bfE0toDXmh&)v&%H>flLFHvse7{>%F#pupdDd2I>{KGV=MZqa3M% zCV)FR@(pHQ-6j=NLLHv&n3d}7^T$EMWkGTIt?n`JfSa)^v)C<+{q1tpNhlUin?xY<-d)) z{ITnt)I;t2o&15qz-0UN5G_(oQ8M>XJ%#A2Nyp>FIK|n?-({v9K@TR`*8#P)xJI-l zETu;&q4w9glRYYS9@!KlzQXmS5npOc{QUX>!>W*d)>iWan8fO~>aJS~VdcAIRb&tD zDcJ`lELc)+Nui3R>A6Z{fJj*k4Bc_xqJoOJ<{dtl$2*dMA9h8B0S_J$8wctgSt|Ia zInO1Nen0$^L&^O~c4)e+etX#>YVUP$vZ%Zm(4%%KmM0IS+%_x$hcc!5+*3sN&gdv| zR!`X!4sukhD=C*aB#Z|gILG*aW=6(sNa=vQHn183iFECtv|-K{9&j(9g?@*T8@JsEZS|?IX_$ zrqlVYHr(26WlJ;m@2O4XNu?>Me6TXPikH&|A1&67rG2c8vJ-nu(>;)wCo3nF?}xUl zYKW?XHgN7Vv?&5TU4Z@$X>v2s0Xz?~RK@!Ft|VA5bz&kVO8AE~vrt*EjNU*Hpz`d6 z3S_i^Jpp?=2BJ!EJcqjGc>ixV94~o4rpNx#ys<%mKFl$JU|$Igj$WF`KOk*~>Q&ov zPQ^|kEREf<6K~F+!?GlzWVl|1OX2gp{2)MlvUyTOwg|>2cJCx+36+S7a9e zB7J;Bcc8Jn9#y1d7kMb?U#h5IKcL&jM?tC>$o9zdyBwZ)B}=fS_~514A&Y;OZX|17 zmFZSJIGn|jotWEqUg7vi-fUIC0bBfL!oxqV)uZ;#l7*-gZ>^y?0)1+g@1=VQVV@5G_DRXfZ`r0C zj926idiP0HF~EJ`OR^Adb+gH_;bsCK@;AIzfgk5g#4)NOHr-!pO?Bj|743 zr;zrtg}>z=DGq#vk9hi0{YEb78*Ls7$^gqZ1Mmde_Gc^Jb@8k-%XbJ?pM?E^0)q|1 zETLol9vLm$i(lN1LS5bINAgPT3q$r$yyabFwD{L${<_S6Gne^8HavEstn+-# zBF&anUO!sSQ+3(gYP-TI_W|PAz&)g4RVJ1{aEeP_$U9GIMd7}3_a4=rc<_W%;rt** zLoFXC=C>)y6Yj%?rxnxq`Sk+?Q}6W(@N)ycB+Lq$lb(=WkTxvm@=#>k_}M*$RoeV( zlS!RTqEalSGzmS33!^CMA|J-Xj{@xEGqMSj{28)T;~gM*X8?%?49{|t+P48bftsF^ z-cx62n3?Nkd+#GNrBdW)%5})s0aFg(Rpv(3cVCapolO`QnM4a7R|v}ZTl**szyK-nR*WYHT` z)&kqeXtHGimcKcw4)EBRRVJRb7C0Mok|UrUwv@fJ5&(eZ=CDu48>lZ*y-EuJjAeFw zq~uf?2b3G-=G?3f1qc5Ot9_{bWs;Vb1*rTD;M5cx&bgN;fWJs&#ka*v=(rBbgE`Ab z=lD>~7eFz#LgeJ-FRoib?LvM<=_o$Lv~S2M#_$rZbLN*~1cbx60dUF`@vEg+1N0S7 zmfiz2Cu&P*0A8-E{S-x~6(#60H{f-vRH6Z|@)9DCqe>oFc|F48Dl0C#kVM`@oAZ#O zo?en?JOI> z!})|FYl~E|1R{r_*1Ikz|z?fH%Lyc>7yQIXm#T6_gm%Qni;$Ix7fTR3a z#~J$606~2HC#X*DmvaQKwP&b&T|?w>%69%c*!Fsx?O~+KOF6J=p2oZs&Iu2+$v1AL zL%b`P-t<)m=e>=6o+&?}a%Od6PW3}^%5mBxlD={F@J^s;im9nVKfylhf{wv9&ScnF zKZ#pUluuxIDok~cYmFnZBmu(jBBz<3 zMN|Xdo#+|1vnEgWGC_V3gP$tVll4feHiyBld{+txq4~on z51$BgN_xH0`>&?Hqc;+r%__?5thvP0-?%0?2vb*@x|TBcBl~aw$^);O;yyc5Dd=nc zM!@%XE-rU;=|k>Nz$LK&EMFuP=pUQ0ECT?_x6epWNOnB$uYdLH%LSK`AY?Yh-+OC> z`FnOy@kHUdVo#~v(}^IJq{n)x1z2tN2)K3~6C42$OC)<%BPuk<7We$p5t2?2g-fu?j(xZ+WrMNaW1Q zYJ(xuOVz>ew;_Y?iEXOOR_5@u%EJftA~@>4Ws}Iqa8~}h&0n|qZ|F9ERJ@leC1=y# zhyt0;_OAkN`Kr@uN4x#BUjx-dfopWKo9ti*V3oUmdT)K@M5HcfP4kR)>EPM?^93rj zX~>&DC@{1prtTBT8y3!utGhjsQ ztCz*@I#UjU>f~_#>qv?669b znMT00++sh8K=I9m08CS3C$`h2fK#%~2D=WM0qih;TC6XDsB4DLm_vC2+1W6frPSRk zCuZsP07&WTIo~17VJg=~bwir;0&RD@EL6C&C-|@9{B@lFmX7m>kLo6)HEv+Vj*?yH zu+-q6CCMu2Pgy02hh5M^A@+D}Yahz<=s%GKQ#-c|2eI+HptMuZ9&le0eV~3#b)E5v z!`NH-5eKs7tlrPBA7Bc$Pk+thNxoOP_fdM-X4Ji2n;kv%m8NkFycN@2*;$Vm)9v!h zVx#1I0L#RLfPN|ZoA>@k1bBL|qvO~T>8wMO#YE|544VShVSo0In6fJGSx)k3n+=nP ztL>XESwC-nbCtI9k*qgjO-{T-voNq>@N27Dn;@~JeJPV*Rs1TVga6$}@f($|S$dV> zlB}4AAf&+ia!2oxc!rk(J{Db8rsBBfR!iDRG^*Jw{z;#9q@bN>9VfjD52fij=f&R+uQcYy!NnW zLo&8glUw{c-XF6(Yf;umwIy)0eV!8}Pzx&3EhVh)(!~`H*zC8G)-r&5GDSSa(G0m`EM8}|3`Vz#`Y70m#lZ0%3(GFUj!Y0O$8_1>hMy!uQd;Nui!kqN)IaE z@H^J-zLI)Mgux+2OY`z3s5wi3%c;ba`J2D4^VfC$o4U@Q<`6}qkh%))<`F`1zW0$g ziQiqRD3xs*hr(U~OzO%9h=nfC$rrB~vg9k*bqHMQaa{poso~};0d=+|_}G?2d3_}7oKKVw z#U^0hrr9Kwyfz#~`eFM{ciR$=Vm#|v4#8YeSi!uVImr)Bu>*0!0QKMje0sEnD6+h- zigcbV$@s&!s9@IHOF^$L9e6Z=Lp#1bu`2*gBo)!5UrI+eY?#1 z82Q={h^IatL}W_$T^)R|@%E19Tx*i#`4H8*JgPV(Vct=BvvJOmi=yNJ(ueYaGV3%smGr5$C<&1q4xIh zyX+84Eu`}^v-9_(-^E8yPh&32%0HBAGkqfCt&Hvf@Jp$YmZE#lvjx2KZAO>)5eg7} zx<`5zYDa49z!$43DzPQOBHN26R$kM-ULw{cF!sOB^VfO)+d9u5&s7`N%p<9#J8SAh zoSYord_`0=Dh-b-sl~x|Z3c0$lw$S zMeuko$n$+C=quM&rk5PMQ|-?ym2qT~|6v!vP>ZJ(RLjxxinlstN0?H{%(GudGt^nA zF*}f4j3lPJx!xIeRd>{avhP54t=_A$X_;OV9+s6N?3#(q+c23fO*otP|_J zxyea-jvCM^Ue8PEo&frU?MzfuS3p`A^*MpV9}l*}P5hA4v7$kHfuEsXdHJ}Str2Wb zkfJ7EMSOOa3WgxxJAu?LX9B?{xUm=ZdtX^MJG;Xwt;iFpRHVCej)q^iY#R8E!P&4N zFC2jt)2Ygf?w|OHQTOmPm7N^$C*H}rWLwT9L%Pel~V_T)aQOe!$voDrD8}GV4z)f)wp2J#Z&9mQb-z=|8fE;kPPR87Y<@ zu+yL{25MqZ;0(*oF8lP9#0AU_d7&W~CL?1oBVp{bC@ zf6U@g)mWC}1MEK7xmG+9Pz8u!UA+Nt80E=*Hi_Sy-}7R%+5F_5Ch2b5szVH{chK!_QO>$|`JD)(Iu|0`ZOJgH0f<4uUP+qEm~tzPx>ELJCiMz;vmS;+P=(X5_uxlPCcsnsCownr)+ z!Mx+FOnmISokcYc{F?mNE5Cl@rSt)HUq*lC`R8`Xt7oTV6sw4{+hfd+3~~s8>?5#q zG;vUHfJW5~a;W~5kwH#8%)S#-WP$6Z4=(~hRcdNJ)BfV+VASlYvGLa!vSdX`ueCK{ zw%hY33q5;pmkBzPDL;*HE!LC-22vs8>LfQLGHmze& zKBo(mkUScb;lt!?!?f7DQ#_=8UtWdUae1iD|LTvT50Z+2z$hxED#Z~9QC~-sm#UvCR6uZxe?+ zX};KMt~0%HNlQ6w_XIpQ-b*fQ7Qj6?6AX0v^$kfRT2d}+dzTwfSP$2 z%fxC^_BTN7^)gBg(xfEmn+phd@+Eoi`AjEPmc6c2UB zdF3o6#Vlnk`s%i#^D!gfMy&SQ@dx+ouZEWa(=V$%2;G>5*VV6*RMpgh$(>Sy4REyp zMV*CF6lq(9N$Y8k*&2_954!;Zd}PKufxO||7d74p^57*fJ}b*kfR=}+F@Ig?uM7S6 zcA-C1T;!&{T2+5iUipwnmnu}A_3;swdU)Qw-?WHa(VM-SX_8*meRKM7kUQ&+xAgo0 zg>2R6DY48TgF;a4;RfdF*6Lu!lm(yu&J3m9eBm*yu4C zYO*?Ss-MA}8bc*If!j`+VaU$&4xZ3U zeuZ&aQZwMtEHgz1(1)@$PRwMFcvA`N9baP?(Z{wwMz={Q0pR%F-o1eU>&S-vI{zam zQj<(-uhy+_FIQU~b)Nt+9SZ{q~$_7?H@jJdxeG93< zVwFchTGjDQ-zbKcva~n~S=)3QoEJ($BI<0yc6|r$Q9z_Or%{ZjGH)#Q!Z z;1eETb$84U`wRdh7Cd6pkY-c5r^tYZ)f6WaS1oV3jhDw16t*QYgI6gZw&LGA5zufp zqPQ>3x~=pb0}Y7{l-C%f|9C%3&aQPnWPfSSF3`-2=ElO+pnT7KzUq9+3y|$U zSql__h zF{14Sfpdr0#LXLQSn~j2jU+j8Q2~>81^Av=7x794mY~qVlNOelU-?Qu*_zWNUpX;( zox&2_0DC}$zxBSk*}*nX!pI{Cb!gbBIs7WLR29LKi5bL^6R4{4put&vq?iF^CCT+2 zIuR1nb^J+%&`D5|6dXGYd3v9HWH{$9<-y57H+4xZ6$m~Xe`gOtuvaTj&V1l1c-uoU zzsEO;A0=ab_jzr?%6WY)!8m9ba!pe&u;Tt-{-U4xC^2mhT-|_74wocaxHs<&g+^UfYh2=k(M_ zl!qPw+r?vlYd%dpaAkOAY2Q_^bSU^xahPQS)WRll53m?Xv9C8BSv%Ca^pqjapI<)! zucG$k#k_q4##QK6D zrsAE{-_*}dQkdS9lgJ@SnBx>XhROe}0Md)e32Sw&?ES6tB3TX3P;DtA@<{yEyW-Wm zT>EhNoftKc6~OmCACEo-^~bS%Z=GHKA7?-x{%(WOhAd)px#N;Q)Ln>4?_iDjEP=&X zGDb^-;=H>n(}$FFYe`q&`ALqvf)q0q9IK-2m1hqG%4-zjR8_d>`6i42Dd~+w%M2#X z8>~`0yB5Juqf{#IA_v`j6k5X19uS1Np@Jd&-9C?Yo%$ ztunp>UZr3-1bB*xCR>KGKyp;GfT4EYq{ zK7_NDqfA8qgf%frdCe4v@RIu0mq)~pOssw9xwU@OF-d7_o(~AMZ)>O26VB1U>4(QN z>{^^G^7uiX9?YM8I@j4(DYGAkHnzP!A=DQu-Ta@{3IU~znD=)IeMXrfY@8@v;Gm~j z%K;9R@46kxIr9lXcYD4Sh{K4A=Szzqv0uqPZ4@r*S_hsr9=YJgb7!;P+ve<&%T$)& zCXA3B>cJa_+9qEIGR(L`xei*!;2>@L_yE0~SEp5xy8^_Xr8Ae%SApuA@M)0oX2jsNe!hu2bF+Pl3J_wqF4{B!!p`#7^}o}{Fve#n2jxF zQec2-?K~VV%Ix)r-J!N=TK>h<3F1=ruqm=J-CK&2RpqP8B3ni%By_~)1rqQsNHf*n zEfvQ+JF@e{lTQL;A60DkQse}mIj+)R9bW(NqdzBBg!0#w{<_k?i7WkyoEdyKg zk{PfN9Jt9R@HVM}D>DY2B}8V;6_1nRS=tr#vS*U37~5mRR+CY=znF~oDC`wT^6mgW zU++qQxp1TvA0Gh_-!@uu{$vHb5`am(@zPV)uWlyeWaBeC4E#NZtvh&t~wDx+M~XMXHS6e#xjmoo!MxP zr>y+VJPDj7D%yLs7eDvt=3WsRD_pK!+3NOscHyYaR-?POPohJmZ>0f0ty4hUczCi@ z+pmn&z&)0{sPCiDk3Pf7cK|MF;Z*|t8LZ%VUe?6+^OsepjEI|h|KO}|U?VP3(nBZ0 zTTbKx3@xcq|4;+)gh(|c2gE~qC{mej3}8Qt)wiuemOKR$h%aLAR&3%RIe720R8f*p zU0%KEp}v|YK-8)(*Vmo#5fu%^fA5dO$Z3LK*@`uJ^#way_9iSq{R}Y77?;&Ga)uSa#8>eWS`XV{L(grnkT>m=LUuXJv zai%{vv?06kd3O3(@1vUFPVTX2uiPvOEvvE(+5?fuChy4d*<);sNLCcjmL0tY2FSbi zemBOdwLBo9#rLzccuiU)sW{m|vL=5wGyn4E*AHlNXW8#U9oj<~rsk?X*;YL?eN&59 z7USv>?*{P9@NA%u-9p&TeNQ{>o&3W6D!ttK9VI599^f)$IoN#q@`s*+i>e;= z*FFCCYCfMu!Ucw8RdgJskRR@mw9`Wp%wH=TGI3+cRPWvfyr55;U6&*MUbzBR`VIZ5 zFQBJ8`Dr^cZUQQ@(JU4$zb84o`v*DW@_0Qv%i3_~Y9Cv=9S9&@8D<4wxnQ{oN&;5P z?3R+g1X4Uv%juX%0wLP@TJh!Em_#$g&z9&;kN6Gf^x0jd)K$N}i_{G{}w(wo+wkKSZW&_qTj5>fb%D$42{2ywutv+Z7cieVY6V?|S1W zh+so?STBIgIVUL~(pHusy)P)aDilu$3Lh6tJcP|o*!tw=fnU;=|IjnJgaI9s)$f(kY2-h{96z$k4qwt16X$hmi3+#Y-2U zDlbJIqI#lwIm!=HUi7;@5dSztOq`T}a2{0zdHXP(Xe9)_b`4S%#IcHW^AuY!CPw+YAPEgzRBMS5#wGU6uHFSj}FROg0@$;^-YMRwc1{ zXOeE^O-|QiC&~yea9S(8xjsa39-2C@or)iu;H5_L)&K~+?)N#CRm6}qp3Xp zc)a~6=emS$P3@$&)u;>zC?#jb7hPLRr z07)|g)kIMLrzp711Ne8tA^;GEX{{~$pF@u_|1@?)ns&DOj{QwU@(d&LLjm!T8@2Y` zr!U<0I`lFgIig+p!^5kCwr%&UrYZiz;w6cVu2O{rYJSQ27}=y>0%^0zgxrb8K6^^v zR#Zp|>dcNV!M6l|2_*Gy+wut08&pd$>K^ZSw-dtGaNfx*PpXk$k(;VTkL2Nb5`-Q} z2yDBjWWX;dasA229(sNb zR!s&TSI1N?YuvHURjAf$W{X2f?;0_WqpG^8&e(7zDlCC7)PA10MXO$cJv@6fJjNk2jd2vu2 zz~BZORCflwsmb@)HPnIQBd~){|C*cL0xXi#{QU-S25>m2?&_$GO?Gph1nC^snjjKuOd&vQhvL*)Tt-6w=+HpoaeRLW52KRKkI<= zZ%~*OB*l(*oS+e`Fo^==KjCZeZoQhPt1oLx0jU#Y_9 z0vDAC+%830BU{mNEG(9-TVg2uHs|gw36Om8=W;!*=fQ!2OUpjGXC!+Y%2Nh7`$q8| zt3Y^?cap-Dua>lSJaG<&(A9#ko|rudT&NZ*^+N4JY23Iod9>GiG5;eHrU&@mN0NX zO-}vCTkB7d>=O);t*<6ZvqKIN-`7~D{blMTv8z%Z90>wreWjKC>r#JR>fg+z{*b>_ zRBK!MePz+ULv4zu?(n^06W4U^h+=!mv{f;J%dYU-EJ+<%OuXV&+YYdT$yG|h{Ji!` zS>6|WL_*Z_x_BVxMFnkhC@Hr6{Q3cEfESbW#jK^v13G~srY&fjoG#b26lO6@d!e!# zbJD?J7bJG97ho3Or@ywKbxd12fJcVXEK!j~C4ZSQl)O|HU%8Z}+P1gQBOmH*IdXs$ z$J1JG0;IY*rw43k>m;dwyEZlF0K_#iJ`cLY;sGDjHlV zDcJkQZ;_ALkRMt571DtdciTiT24aBa0+UNUyxshzyl@GwEi z{J_#t7Z`m3hxI!V@?_^L2#9?ab68lyY+w73akHlpXDR&ndE9N==RiS|@{wX_DORiU zap-@Y>aSD%+d0)ArEcu~-$zjxR_DbEZ_~c0lbf#Yw#?E4t z*S^Pxop;!)KYj`c-#WqE|}PxbOb&00p4jg zy{X3IwC9%3MwtfrU*35t7**tOQ{scV6tohcQZz4KAVmsN&je(7&^D+{6`P>azWI|k zI@sQ}uXw&{+sYQ$OYpkCeOzhrVWZ9sD$iDBb-te6TBME`U9L}XdSoM)lwCTthrxq?8Gz@i^$8O3lNt$F?cTH!R^WO?r7f=4uR)Tbp~yGRQXPDKhHcHN z^G2eR115l8`;(--!@RtTcnSptrTLIiAS&HgyaT3ymlg;otbvccd3pqH^A&*y4_=bI z+CVI4T8s&6ZUK+7|84-lPY)%oM%3ojd76hKJG>sF2}mValoN^=dp?<=m*Qg-btqQB z?g4{eKk+V}&V8&)9^6ey_-e6~m~yU5n7~V=7i+VHPiU#!-z$i;W!m{5(E7$pWLAF^ zcOekAZ$j6Ts$!M$rH{tL$O9g$RAN6h0EGvSa|bHERuWcK2R1V&zc^(c7JqQWrtoE4 zyS~KmWLR}}1_ZsyRwMKIeC1VGT46`LArmRNzRZdk@MQt=nb)#6mMzRN%E6wjPhfa1%ESiQn3{L~jbo&YoDstKJd+ z9Ry|%_M^U1&3p;2;ABpjPO?1PU=bqDDvc;+-X%}KX|P@_t18G{8+fLGr)?nO7ZEYe zxUKU&Mva@Wq@u=Qzdf^~TdD!4E}!-0!Ya0)m@)D0TuJM|EoFk5K9+UdEnn-2B@cDy z_YPv|DJmf5Vjp+`c(3I+@OKP#tBf|DSd1ynQL&r-!&h>c%3~*wyF~1_^P~7gsJ39M zXhc*2N)G2<9D3|d0~g?aminSdLjedJ>Kt~UY;5Y>OL-femYrqV9u<%B>&HWuqaJXt zo8Op<^R9Su4fB1D#O?gFGPSaF%n>)fd|Mk?{sT7j^r7-rkjd6wz1K^iI6dW;oSwY_ zdXK}qmTrwxCZUVpyd99m0Z(S3r%Sb+lv)-EO(OG#4b?iObHc|C0gG4`Wk%wK=LKL6 z<>adZjb6JDfBC0Btd@gG8WMqL2LevwUxJ4()!cD-Oopbi`|~t@N9+o1mf#iMQl&aQ zSE6zTSvU*RlRO*1x4={b|pq2J1~V zfXpLZignpD-$Sms{+deScD|qF+YhBxvr)+Prr;w9hIdp~@nS>miN|`M0&%PTJsT;? zHXe|W>S-*{1ugD|tL%ockDp&Zfc-k1{Ac$Hd7f*`zYPoQ2ql$ z!~I-EJfn3DOm*QCN*gwbgPI9A9lNd(Fom<>8ISIOLlK`IP#Rx`=?aZv#ew^4KQ-`B zjo-p2Z?7GI(-9x9VJsqtlr`&S7EY$Z_F*^-Ch*k>#0O-@e)vi3b)TwQL<|{Z0l-sI zY4e`Ms3k`MAnL^*@%vE1b8xr|Ou~&+xf&D#cVCd$KFI@{(8FuNzii)@>tWWfld8Qd zY~HfYI_207OKSLZ(vna@l6K;Xd`s+jYy>8+Zvu#!|C5hOQZgOj&8>wC{1U*)3>f&I z3FfZ+GTYz5WRKBo@M>Qmx-!0Rg5C{_l7YHFqC#GQ&ycz?f7b?b3=xR-#6j1mynm5W-EoVMxvg_?N~{?sBJ_!f+Z0P)69*?TX=R z*+M~4?%Nab8sdp z*1ea(Z{P@y-P+@JOO`}!77v$fMcd^PmbziD5YEn)qzNM!7!oh%m{N%!Y2gTJA5t2u zOc<5h{$vF-__P_j9SHfTJFo05fi$oryw|IG;NaK3IgX`V?gCBKkB9+Bw{BO_ebo3dAwLumk{4gVb_UVy?^wxibJZr86-?k4jbJ#GKGQH4TEK0KsRW2vv_H%jcL>`}Ku6z^2!$upU4m#ibh63Oonr-D^p!U98W-{QYLZz-V;uWu%1 zYy0}Mc^SUz1@_={%VAx>*xhm~luOa?5fIprNYDmmYy-BVs!G9QgCLBC^TpGvjStcd zcy{59MLyXPqRbaAr-A2FZKjeb5f~D|mkS62_675^#6w+ZkIRqreOD&c?l%#>l&S=b zy`GbKiT{Yb9bd+8u(bjLR_AG{3OUC|v7VaRXBpTkZFp6#H{)K);|-2($zz`%UO-aZ zgVnIn`*So(iT<%FY|r(&QXdY2vWD0yk-kf`73?Sp&SF_F99-A1Ok{O{$ENDjDoaEv zJNDrxTx#2|65fxjzS<^nqhq+M8mWGIW`lRB26P9aYGeIh+>q}AUK5t&gedmP;holU zANEcDp=!TJ>LYfUP)2Ex>mcTh|DiNyhXGL}JD^q4ch^Vi8a4HU;XD|8h=1MduY3I) zyVoBK>Z!xFEqRJ=Zq;wcZvX}fBaylLN=~;iGwWb1K?-g#q_d7#9wt&r&-sp1K9$y) zKe_>@Htf71>!xT~yUSQ_iygDP;Q(p|w)^wz2TbquD~~9D6>KM%M6PQ-${~+e zC0J@~N=(V>9vgmHfF0R4RTFP3?VD`mSF>n8Z&nCM zlEeB30KNh8i&EgSJ{eDoIY~~>=gnEJeX!$1f(*Dd7eWqy2#(J#S!MR?3O3zr5S|y3*^X|KUu_3`ae$B)GRhVZPo} z;M{6S1&<{NMv}U}t5az3-(Be>em>s(bPp%H%DLxlBefE^)N0yPyU z$&XEH5?fK4NfS(%8eMg)iY-L-Bfp!LXMSVB7}E&qJrj*XcDRZdL-=FIehx3+uBVX{ zW%0=0`>{0uxMkXN2jnnJR!@%E%ZpZ<6NytG_}B7`8ZoU= z1NEXJk#Vc>Y{i17*PO%q*TMce*uS-d{c-k&ay#(Tj^wll04K4x!t$T|YLIX}-qE@m ze!xdn?Wt!&dY!Xz8U*NN%8%0n{S5Yq@-`$7SSCMukE1TsZd&tq z0JtbN!zcuaA4?9aj|PPxE>LZHVl0b*ooCrGNZIMgw*pv)XMu+6c}5XulIZ6YIC|B; zSmFm$c<{&O>8rQ31M}t;s%#Gm7v~W%vc^g{c?pO*M}{PYT>*TSIWDDSKW7>UrBKfX6I@g}NcRsH%va$}9Nb_>~8R2GS<9JzfM!Aq6l? z8^k@I=1i-DnsfKf4)UN+a~@=;w5I5#mMEwVk6=95H~4&m%}<|U5fp%?;8^D(@l3*l zO39~V2KxzeRscwWmz#i;PgnUPtXIJ)2X%mXe4y}h4sYX$N$k^WKcZI*#M@`hTC&nv zwqa2t;4zU>I?%`z4>O(Juw8gkB7IE3;8Ln z-UR@}t*S&0MFy#t$XWx2(B~q$uk`I+Y5k)sZ?>+n^v6-V^<)a2X#>dGstyxf>ac&C zUyKD+S*1RWh>?@FLzIo-7sc?u^N2=x-9cX{$ zptm1Cee&Vm2K#5_^?qYhatF7#u&YemqdthdMA=_g=cl6l1i}=`+WtLcYY1rOPw+a@WfU`u&4m!?RLXc5dt~m2)k~u^h zv|I?Mf`|%xpTbH%cij?G5LgWVeMrG~AW+A3LTJvk<1Dj&DkGK18k^Bq1STQ;vYnBcY zM0aF_TJkIz0VxT#%A^gurpN(!dt_!G_QT2_$puMf7F<)(W@7ty_}R~o;sPcuz%}JU zt#Zr%GfGfw1rID-v8$VCGo{A|-7D#1KV5Fg@hm);5-~Up{@SKT3SUnl$PWdH6?_U9WF7ea`-p2*ie#fH(PP6=@9p79ptexnvx z6?|}V1s?;FU}1gn-3~-hAy4UOx@x*!lHy&TK46&B>G<72iXDhK`ex0_IK4kN{`~#{ z-k4gumMSO3RZuD8Z;$Y_NZu5anLgb&KYarqWaz_{voo_xmc#8)64>zO?s}zu!5-1k z8R~oqe{5H+wgM;L=l~XpJd%t%(UP&M8P+RztLM2 z(nMtsYP97bO6=bW0sH+qb@DdSeL3s|*bY=c)CyF2Q*eFOJDhW_A9R1@gIIiwqUHQG z#=*{kf$y^%A#$dCyeCpP#RN__HWp=Ic2a}I4eCk0rcPv@3cCJvv%hZk{{T1pV?8@B z_3I8R;TBk?t44C9IE+h~SBmN)dr&xX0+bBu<3B3h^>MWHCdU!@G)mLsP+u}tA65Qj z)CD-m$MY=eev5x_VZ4tQewoVf=hqK-Wg@z4Tzy`!%5p5SZmE$Xz^C7X&Br>5>R#X> ztMF#!E=#KFvRly+M`4eHhpbCJlEXE72BOrcpP(?t?B(Q#rkv=JWCtKyKIKMS4=6FN z><{en3|P^Xb^^HJ-%Db#Ro1|&abFLVo^uF4@AXSD_8o=kpRA)BWMh>SSGeK(;Q6-{ zF!tW|+ez&cH|{Fh;}wL$schmBFMHVL1_B!|@colziTxjq&t}inQKAH&%F)hWA0`}= zyaTV6k+mLKqC{ALqN8%xaIhH|)tcx2a@}1_`q=8!7OQ2Fn?Qj)~}?E^^W`G2?5>rzkv z$Wj8-my$8>;-!w1e0A`V1*h{iqe#Qdr`JynRA1d&4a||i{e86P`5jR!B#Mt`rA6Ga zY&uU>N5CV-89zm6RgPb8=O=Z{*TP%~1q)<&9YyEw<6u1((Znl=mOh&zFR*&mMz|u? zA)BTWwD(7|IXkYqy?XRQ#Kf=-e%ovjQ$L*mAr!qTE(nq_Xr(%q}LT;YBU>$0}f09>? z)v@|*D@tEVLH=sZ6q#*GDVng8{Rs`PApRQ3;hElIQA}{#tR!E$ciZ{r*AKuDz;?qa zDm=abtm65^RRoQ|8A027idu|IR_-{0Bf^g?PJ9$b2WE5dr^(7tHl|QrE)evS5_p)u z4cGgOg)=MLnJ`OPeo|ylpHW{$>z7l%b{@z$@YpXfBqF>(5q6}=vXnL5QeVenfz=)g z@!4b9xa427;j03bm0<$Ww(D*E$WAO{eByiFXNQle{*gFjO}ns0AjCO^14iuXAXj45 z*d92j7t>w}{h`oRcfM%6QEG`o%y27-v`wBlxd$FV2o_TfCX%Z+07#c`ZhU80gjqsq zWW%;p%APLtPZj&Q{O)vBRvrP2J;GQ8_oh@yAi<0SCwcbo?R;6?887^!kR~B2j7SNpTGlkr}^ zt8?)xZspJ(FpwPDK~DVJ{HpXoHq9W#2rPN95Gme!m#CGG=!#;_XWiq(zwjha)g|P1 zPvlyXJlGKbitp=@4Ey6%cE0`R*AM6*l#k6@d8chd*SX=lpq!2_^%TxGdFv^>ua6_k zNx@U)Ugy8yXjT3nTn0Gi+5NN`s@g6csnxZ!ZY$N1M(A4W%W=N+x~|`{@Jot;F~2VH zopy+y~sS6(F^On>PuE`=SDxvby?Zufek7iVV(d9j^KlmP8sz7gQ9hDnu^fo-fkerL~z4@pGV&BwpN9=%<2 zodYKa;pe<2kb?&i24&T!6455U77eY52-cimYr;1$kr)hrj0%2U;*FQrEnf-v7ypEp zCmwiSR)MIR5oLanr6i^shjC+EuYY(+B4d^X_oN%VzPG4&)otXr8lWk7ip|d0!wsN2 zg&Ui&{{Y!{{p8Vn<6ayTw<)oWAxqRp;)_29o@iZ=i?FKN%u&+F3X3j6!d43u4+Qcb z+s7-odDx!{v*o*jOiwUsFUqf%A;%xZ&Y`biPVh`xH^3IhE`6Gv=vGdBnPWj;N1yH z3U*)nIAXGif}Q#6Y=52Y|1r+?=Pr*>S2+&G;$WU^KW`Ezu5(>!!NKoY zY*5DwW{Sd`AQRC13T>N*dGZDxo+4RA7or`NqP$UG!l1qHeB-$Vcye( z;G_FA9=luriv+*|0aQf-;X0BqgpOA^_rlkAR60uzRJi;N-E&EaDS97YD zR}+iGa>Lg}j@f{%5?=mzt^FtjBf-`shiKsQZ*sYR3=j8_epczux3f6PNA{7#Hn-;; z*FH9(0Wn$G`r>PVz8xDGKe3doW3heG(a*#$Y%lF<#ET2Ye)lV@0&eiN^3CeaTvD?K z{OU+9p2-Hffzz26c#FB)%plNzWwu;C!oX=#ghBWocU;D9;! zxsT*@vW4Xn$Bf=wDJ~n|TO1lxb%Ee(?^;v?@0b|bX4#dzkw(Q^l;RZ~ps*Mb@XhTo z`46c=V-TuhHL+T#A+FeVApX$`k^pGc? zFQjtuV3}+Rm~%;6XFnWg`03>Mph>k=Bn^6{RsFP3NZ;R!ZLN{=M~LV!>_}=7%2n?k zhf$N1JMYh5KY+cKdSPb?&VgJ*;U_lh<0k+Llx+*S%(?s7IbubZOMkdv>874hjs4x{1a2srwY%3XRZyV?QtFK({bvFIF!zpR%t zMWt^u1CW(#B7v4oWFSh(@QF(5Nyf0r3b1N5=oU34g0&Iynlh~jrD8G@|?t#{k% zX2p=c63%kc;!z|i-6rBEM1D7*uZ^M3G&BraO>Yc-r7d<_jh0#{- zR|)dyn6WBv+GA;^Uh~SM|22RttArdDWFo8}$JQ9tL95;yXI z`|EJO4);$v+@IQAo~Z;g=jCO^rn0gWaSiTI^7Ni=CkkqZB3UA5aXKvA3!& z3NP8_&X`4L*IufSB$;bMOb)bh2H4^}snskIZX(0RK6n55>jy{?@dU|}6zl+YzRxCL zG+bduJ&w@8iUN?pg1kZI?Ld^%3wm34r62&rSpUot$AKvNr&f)}7Ij56Lp_w3Fy>kE zghZ!Kz2SY-bPQlW#j9HKjwR*ih~I$9#FqN8*Rsgu;N?vFuy{14aH2!5YuH5oS}4!u z#83C_d^}KD#$*7ToUTCyu%3B@@>!eL0!KT8^;$A|S6V8AVtr%hTKOIeE0#tOh({>7 z8*J?jz&%#5TUZVZVWuxz-rek4?b`A>sp3oL!GmotT<*og>X5=~xuMFTx;{%iyMCE%zHNR)=l9>(0k-848fd(6R#vk4Z+ELa^eWF&y?lNu@NWD z1r2cZ4cPJa`t}nZ1R&72NHi>?$_o1DVO^*R8Nu|?u78a~-aCk1l1|EZt)XxKAT5~TliI0WTc4@V6NIJSb)&%xf-bW?+UJ{LQZE}}PjE#S{ zEKzT9a!M-5I7tRDAHwrv3G6LIgBI|D?eIC!7=*X$+!kT@{nTc{A(ZBctyl8}2Z3?; zTpvxOO)L4;^@-9*5}afzHd!Jr+FN5K`Jn1_wql}quGf-$q?cKs?dQlA zQaziTseVL*N1}eb@9ll2Oj?nr{AT;zuaO>GC6fb;HsCyHTm^WR_E>)^4j$Avf3EPH z<>g!hzi+8mdb^(@xg;Z*5M=9Rw*_XbT;B6P>9Lx1wkPINz|cue zz)Z%9)tnhtPA91gm8D`XgSRC@=3l4#b-I7f>HdH+hb?hW*kr*Iquhg3eUDGOqXpjNTsxVIIDbUM}!%zY<$r$e$zZNAGjFAY=mQV09Wm$bfNaU_go zWWK>)KcGl&r;?h)8PaT&F-g|DEDT_ybb+1WaQ5T*_$k@*Y4wRLMapZgu&!9z0>c7g zqVF3{OCVpJt8n)vEY)=mnZRZiHUac`=6=5_FmgKNtAEcgY_XE5(%2@?lFuDF97WD=Vk)xfH= zc<~mX-x17jS?k#~cj{|8+po7<_PxJps>8OdM_li%La5CtaCYFe##a;}c$Eg^Jw|ez z`)+kX!?h2zZnlRYtG3PH#89SX$dXmhwk|>(;xC-A7{2@+Bz`!RIi7sU{P9YjkyT^M zU&9|?S=DcRGQZibQvm4*(>{ltp6vX!#X~|yoS#rZpFhg`@P*m5i{-91mHj?PMO5;| zTO52=#epLrDH^*ZNhXWSQv%V6&DzuByuJ;O!7fhQTuCjv$p9a z!zR6Yp7rZ?zi#&ry4@cz*pY+dxja`jXBOt`j9TBtM|_>fR43(1N_D_LWXB&9N8#iu z!y!t^oO1Ilml4S}awRaQO>nF=p7SNX@AZEHj^x5u76^rj$Io9spvqOnuQcg?l8Vvk zErVSA(Y}h(rPG>@Hy{#7*lSg@!=!hg3gD88Z#hK+R`=p+V2lQrbL;+K?MgV+J1U8L zb8xw-RSs_8n*l4A4TV<)gYrDS#|3kRJ$Uq2(n*&6gDL$2;Z<3m#i})WlgyGUeQFEA zTqgpbq{PFuXL_66b-)C^fZh4l9)N9uPaz;o47(^Dw{_ z+4VtkyhuOWnH)!1OLul00DkPLo_9Im)m57XwXsMM-xFzrRoV32h&e&}kwILEtb1@i zZ^Ua8cba4%-u8U__7nU^ls;3=CN*(@RRYwl9(W+GJEk>RIs&ilB7}N_Sde$*VH;w( za!v-dV~jJA&x(b=c=!U@J~6c*Y61P*KSm6wOS0xe$bXH7b@EQ;XCx-X8j$z31)!d< ztJ7P`v?aGGl|$jRw0>(yfZB)ky?}20d@A|5TT&`c-BS{e_!PC+AK8qt+2B|QNV&_S zg25H%`Q!*__RW~X<;0ORpt*h259k(Pr&#&YCI^I9&cz=p) zQI7;VUymBF2uLCKd5T@RkS2?-hwLNQsVn;x4_L4wR|n^M^gLfS);d@tmUsq^TlPmc zfcxAi|KHeZYq3^?FnckW~2|NkpIi5RBTY-(}3h^h%0`>KV|vRr7(z1$r|aFzC669rC{9q zcIh5FzqLm>VLN9%B|m7AL}ZC8i>Bys!}YfW0#!Gf;i27xlpNYP=J1 zZD2B`+LRBdU!Pz3{!&GIfo-ARerYv%0F3jKT{)Sz#4OWeTUV5anD|!`UJkOd#BJCZ zO53a^?P9Q8;XEAwqKFJ=^3C)8yo?tZnd-}X({2*q8DOh0`DbE+Azjp z5*=fH0})Olkb6yg#`F0+xH#WO$~3zizSe@7-52K+qJ%e<4CLawgn=(x;m3}|z>#-X zD5;)2$#H6Fd=FW{rhV%jNK1^nWG9X>Hg#2JmJKsLVC+MJ2*l?oc$^B0Bp&z)2jzKw z_I^0!h?t?N$z+)+mrjUn4pht9>8n?w5r4v9O{;ckK_y%%o3n}tWG&dBMWw;}Ra@%T z4#_D!jFE32Sa+{)>#$q>N(H*slxg7C^?qINA9cMyqh=jIht)f#3niY85^7;!NwZcKNfegfzD;$`$)qH6eb_M5sH`~vVAW5AR zl4_}pSrK3cV7E$HHP!C5sm}+vo?vp!#bNHIq#4*)^!`l3fT7S{wo*RU4xhC|xzSs9 znKaieSiYXey4a?83T8d-)+8+gc_9~Uro*-32X$^^VfDTHg`s_ktrCx5srC#sXO$yB zv@asjRV?0VKvrT}(!yA$OvLlCXFiW3S5#C6DcC|6EPd1?l;k+Lp~%sq!{xJPP99ahwk$m-%Y=~=TUqcI4^}*; zk__Mii=^uPS~qbmCkonEDH@<|dLc6-@V@F*%S1^8JZT{bGKiWC9E38u+fEtVd?B ztSTUm3^?E4oc1Ar-9DA;ScFO&B`PcYsVd0jMoK}T<-p}Q=DXVq8dNua#L=W2sg0{F z(3s8#s4V>Je80~3&pO|qTtS@Ip-cP^e6j3K9|urn?|D%5j0{()x8y}b98n<~ULAnd zA4#>Q>MAy4joKxtR~a=VTq5W7&2i$Le85{d4R>%PWt3bm;18e{e*XFa0T%$EscRO6 z53)QKtGcJ2>mb^;Bpe5+&aMsc%6JFn0>(YE$b$k^jlJn0B{UkRaK2mJ8XW%$jBr1lotwU>3drJCk=mz zUxN*MA4xxnJ_$UTb0;F^A#ckJwsfCJL?O}Vg{z1V&3ZxS#|vR$8#GGzi>PwG8~X~%zkL4)&zfsqmZF<79o#G$9FW7ws&CiANG z6ES||AjddYR_cjRa;0+VU*(A(c!*XU6RiCFIJOJ^qN;DLiGxn4i!m<;Hb!*RaggbG zMN`&!i@hX7L#dsYxu0q3;+*5v+4S|sX`9LPzK@KD-05Mlq;-|A>z+rtRx-m}In;!2xtyod`(i$3D97s^CVTCFOP8;-%Gw#ax`qI;qUnbRFa?!PUSbKJQm=j{_ zMd8a3BnGU6f|Wj|y5nsqA%vqQ{wTSWtUns7^GEgVjU)k(vnB?whE-9*nBMD!z5*iQ z8%+fvO$T|-?N$k2&ZF5PK|v6KX#|I42*#wiX{g$Q>&&lAhWqj}#e_BdhTq@t`x}0L T!|y*De*gRjX1oxufGGk1+|U8w literal 0 HcmV?d00001 diff --git a/libgo/go/crypto/elliptic/fuzz_test.go b/libgo/go/crypto/elliptic/fuzz_test.go index 10196cf0bc9..eaeed0dacce 100644 --- a/libgo/go/crypto/elliptic/fuzz_test.go +++ b/libgo/go/crypto/elliptic/fuzz_test.go @@ -22,7 +22,7 @@ func TestFuzz(t *testing.T) { var timeout *time.Timer if testing.Short() { - timeout = time.NewTimer(500 * time.Millisecond) + timeout = time.NewTimer(10 * time.Millisecond) } else { timeout = time.NewTimer(2 * time.Second) } diff --git a/libgo/go/crypto/elliptic/p256_s390x.go b/libgo/go/crypto/elliptic/p256_s390x.go index 40c0929cd0e..fb38e0a272d 100644 --- a/libgo/go/crypto/elliptic/p256_s390x.go +++ b/libgo/go/crypto/elliptic/p256_s390x.go @@ -16,7 +16,7 @@ import ( const ( offsetS390xHasVX = unsafe.Offsetof(cpu.S390X.HasVX) - offsetS390xHasVE1 = unsafe.Offsetof(cpu.S390X.HasVE1) + offsetS390xHasVE1 = unsafe.Offsetof(cpu.S390X.HasVXE) ) type p256CurveFast struct { diff --git a/libgo/go/crypto/md5/md5_test.go b/libgo/go/crypto/md5/md5_test.go index 34c7f541c57..282ba1b8592 100644 --- a/libgo/go/crypto/md5/md5_test.go +++ b/libgo/go/crypto/md5/md5_test.go @@ -169,12 +169,12 @@ type unmarshalTest struct { var largeUnmarshalTests = []unmarshalTest{ // Data length: 7_102_415_735 - unmarshalTest{ + { state: "md5\x01\xa5\xf7\xf0=\xd6S\x85\xd9M\n}\xc3\u0601\x89\xe7@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa7VCw", sum: "cddefcf74ffec709a0b45a6a987564d5", }, // Data length: 6_565_544_823 - unmarshalTest{ + { state: "md5\x01{\xda\x1a\xc7\xc9'?\x83EX\xe0\x88q\xfeG\x18@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87VCw", sum: "fd9f41874ab240698e7bc9c3ae70c8e4", }, diff --git a/libgo/go/crypto/rand/rand_js.go b/libgo/go/crypto/rand/rand_js.go index bb213963fd4..7e939742ac6 100644 --- a/libgo/go/crypto/rand/rand_js.go +++ b/libgo/go/crypto/rand/rand_js.go @@ -13,6 +13,7 @@ func init() { } var jsCrypto = js.Global().Get("crypto") +var uint8Array = js.Global().Get("Uint8Array") // reader implements a pseudorandom generator // using JavaScript crypto.getRandomValues method. @@ -20,8 +21,8 @@ var jsCrypto = js.Global().Get("crypto") type reader struct{} func (r *reader) Read(b []byte) (int, error) { - a := js.TypedArrayOf(b) + a := uint8Array.New(len(b)) jsCrypto.Call("getRandomValues", a) - a.Release() + js.CopyBytesToGo(b, a) return len(b), nil } diff --git a/libgo/go/crypto/rand/util_test.go b/libgo/go/crypto/rand/util_test.go index 685624e1b3d..e76ce2018af 100644 --- a/libgo/go/crypto/rand/util_test.go +++ b/libgo/go/crypto/rand/util_test.go @@ -84,6 +84,9 @@ func TestIntMask(t *testing.T) { for max := 1; max <= 256; max++ { t.Run(fmt.Sprintf("max=%d", max), func(t *testing.T) { for i := 0; i < max; i++ { + if testing.Short() && i == 0 { + i = max - 1 + } var b bytes.Buffer b.WriteByte(byte(i)) n, err := rand.Int(&b, big.NewInt(int64(max))) diff --git a/libgo/go/crypto/rsa/pkcs1v15_test.go b/libgo/go/crypto/rsa/pkcs1v15_test.go index 47444f311c3..7e62560a04f 100644 --- a/libgo/go/crypto/rsa/pkcs1v15_test.go +++ b/libgo/go/crypto/rsa/pkcs1v15_test.go @@ -274,8 +274,8 @@ func TestShortSessionKey(t *testing.T) { } } -// In order to generate new test vectors you'll need the PEM form of this key: -// -----BEGIN RSA PRIVATE KEY----- +// In order to generate new test vectors you'll need the PEM form of this key (and s/TESTING/PRIVATE/): +// -----BEGIN RSA TESTING KEY----- // MIIBOgIBAAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0 // fd7Ai2KW5ToIwzFofvJcS/STa6HA5gQenRUCAwEAAQJBAIq9amn00aS0h/CrjXqu // /ThglAXJmZhOMPVn4eiu7/ROixi9sex436MaVeMqSNf7Ex9a8fRNfWss7Sqd9eWu @@ -283,7 +283,7 @@ func TestShortSessionKey(t *testing.T) { // EO+ZJ79TJKN5yiGBRsv5yvx5UiHxajEXAiAhAol5N4EUyq6I9w1rYdhPMGpLfk7A // IU2snfRJ6Nq2CQIgFrPsWRCkV+gOYcajD17rEqmuLrdIRexpg8N1DOSXoJ8CIGlS // tAboUGBxTDq3ZroNism3DaMIbKPyYrAqhKov1h5V -// -----END RSA PRIVATE KEY----- +// -----END RSA TESTING KEY----- var rsaPrivateKey = &PrivateKey{ PublicKey: PublicKey{ diff --git a/libgo/go/crypto/sha1/sha1.go b/libgo/go/crypto/sha1/sha1.go index 8c48042b1ce..286a59d33d6 100644 --- a/libgo/go/crypto/sha1/sha1.go +++ b/libgo/go/crypto/sha1/sha1.go @@ -10,6 +10,7 @@ package sha1 import ( "crypto" + "encoding/binary" "errors" "hash" ) @@ -81,13 +82,13 @@ func (d *digest) UnmarshalBinary(b []byte) error { func appendUint64(b []byte, x uint64) []byte { var a [8]byte - putUint64(a[:], x) + binary.BigEndian.PutUint64(a[:], x) return append(b, a[:]...) } func appendUint32(b []byte, x uint32) []byte { var a [4]byte - putUint32(a[:], x) + binary.BigEndian.PutUint32(a[:], x) return append(b, a[:]...) } @@ -170,7 +171,7 @@ func (d *digest) checkSum() [Size]byte { // Length in bits. len <<= 3 - putUint64(tmp[:], len) + binary.BigEndian.PutUint64(tmp[:], len) d.Write(tmp[0:8]) if d.nx != 0 { @@ -179,11 +180,11 @@ func (d *digest) checkSum() [Size]byte { var digest [Size]byte - putUint32(digest[0:], d.h[0]) - putUint32(digest[4:], d.h[1]) - putUint32(digest[8:], d.h[2]) - putUint32(digest[12:], d.h[3]) - putUint32(digest[16:], d.h[4]) + binary.BigEndian.PutUint32(digest[0:], d.h[0]) + binary.BigEndian.PutUint32(digest[4:], d.h[1]) + binary.BigEndian.PutUint32(digest[8:], d.h[2]) + binary.BigEndian.PutUint32(digest[12:], d.h[3]) + binary.BigEndian.PutUint32(digest[16:], d.h[4]) return digest } @@ -263,23 +264,3 @@ func Sum(data []byte) [Size]byte { d.Write(data) return d.checkSum() } - -func putUint64(x []byte, s uint64) { - _ = x[7] - x[0] = byte(s >> 56) - x[1] = byte(s >> 48) - x[2] = byte(s >> 40) - x[3] = byte(s >> 32) - x[4] = byte(s >> 24) - x[5] = byte(s >> 16) - x[6] = byte(s >> 8) - x[7] = byte(s) -} - -func putUint32(x []byte, s uint32) { - _ = x[3] - x[0] = byte(s >> 24) - x[1] = byte(s >> 16) - x[2] = byte(s >> 8) - x[3] = byte(s) -} diff --git a/libgo/go/crypto/sha1/sha1_test.go b/libgo/go/crypto/sha1/sha1_test.go index c047204bf31..681e928de25 100644 --- a/libgo/go/crypto/sha1/sha1_test.go +++ b/libgo/go/crypto/sha1/sha1_test.go @@ -168,12 +168,12 @@ type unmarshalTest struct { var largeUnmarshalTests = []unmarshalTest{ // Data length: 7_102_415_735 - unmarshalTest{ + { state: "sha\x01\x13\xbc\xfe\x83\x8c\xbd\xdfP\x1f\xd8Ú¿<\x9eji8t\xe1\xa5@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa7VCw", sum: "bc6245c9959cc33e1c2592e5c9ea9b5d0431246c", }, // Data length: 6_565_544_823 - unmarshalTest{ + { state: "sha\x01m;\x16\xa6R\xbe@\xa9nĈ\xf9S\x03\x00B\xc2\xdcv\xcf@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87VCw", sum: "8f2d1c0e4271768f35feb918bfe21ea1387a2072", }, diff --git a/libgo/go/crypto/sha1/sha1block.go b/libgo/go/crypto/sha1/sha1block.go index 1d37544940f..321d34351c1 100644 --- a/libgo/go/crypto/sha1/sha1block.go +++ b/libgo/go/crypto/sha1/sha1block.go @@ -4,6 +4,10 @@ package sha1 +import ( + "math/bits" +) + const ( _K0 = 0x5A827999 _K1 = 0x6ED9EBA1 @@ -33,48 +37,37 @@ func blockGeneric(dig *digest, p []byte) { i := 0 for ; i < 16; i++ { f := b&c | (^b)&d - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K0 - a, b, c, d, e = t, a, b30, c, d + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K0 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d } for ; i < 20; i++ { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] w[i&0xf] = tmp<<1 | tmp>>(32-1) f := b&c | (^b)&d - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K0 - a, b, c, d, e = t, a, b30, c, d + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K0 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d } for ; i < 40; i++ { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] w[i&0xf] = tmp<<1 | tmp>>(32-1) f := b ^ c ^ d - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K1 - a, b, c, d, e = t, a, b30, c, d + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K1 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d } for ; i < 60; i++ { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] w[i&0xf] = tmp<<1 | tmp>>(32-1) f := ((b | c) & d) | (b & c) - - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K2 - a, b, c, d, e = t, a, b30, c, d + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K2 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d } for ; i < 80; i++ { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] w[i&0xf] = tmp<<1 | tmp>>(32-1) f := b ^ c ^ d - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K3 - a, b, c, d, e = t, a, b30, c, d + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K3 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d } h0 += a diff --git a/libgo/go/crypto/sha256/sha256.go b/libgo/go/crypto/sha256/sha256.go index 3fd446f94b6..e1cccf65a60 100644 --- a/libgo/go/crypto/sha256/sha256.go +++ b/libgo/go/crypto/sha256/sha256.go @@ -8,6 +8,7 @@ package sha256 import ( "crypto" + "encoding/binary" "errors" "hash" ) @@ -104,35 +105,15 @@ func (d *digest) UnmarshalBinary(b []byte) error { return nil } -func putUint32(x []byte, s uint32) { - _ = x[3] - x[0] = byte(s >> 24) - x[1] = byte(s >> 16) - x[2] = byte(s >> 8) - x[3] = byte(s) -} - -func putUint64(x []byte, s uint64) { - _ = x[7] - x[0] = byte(s >> 56) - x[1] = byte(s >> 48) - x[2] = byte(s >> 40) - x[3] = byte(s >> 32) - x[4] = byte(s >> 24) - x[5] = byte(s >> 16) - x[6] = byte(s >> 8) - x[7] = byte(s) -} - func appendUint64(b []byte, x uint64) []byte { var a [8]byte - putUint64(a[:], x) + binary.BigEndian.PutUint64(a[:], x) return append(b, a[:]...) } func appendUint32(b []byte, x uint32) []byte { var a [4]byte - putUint32(a[:], x) + binary.BigEndian.PutUint32(a[:], x) return append(b, a[:]...) } @@ -246,7 +227,7 @@ func (d *digest) checkSum() [Size]byte { // Length in bits. len <<= 3 - putUint64(tmp[:], len) + binary.BigEndian.PutUint64(tmp[:], len) d.Write(tmp[0:8]) if d.nx != 0 { @@ -255,15 +236,15 @@ func (d *digest) checkSum() [Size]byte { var digest [Size]byte - putUint32(digest[0:], d.h[0]) - putUint32(digest[4:], d.h[1]) - putUint32(digest[8:], d.h[2]) - putUint32(digest[12:], d.h[3]) - putUint32(digest[16:], d.h[4]) - putUint32(digest[20:], d.h[5]) - putUint32(digest[24:], d.h[6]) + binary.BigEndian.PutUint32(digest[0:], d.h[0]) + binary.BigEndian.PutUint32(digest[4:], d.h[1]) + binary.BigEndian.PutUint32(digest[8:], d.h[2]) + binary.BigEndian.PutUint32(digest[12:], d.h[3]) + binary.BigEndian.PutUint32(digest[16:], d.h[4]) + binary.BigEndian.PutUint32(digest[20:], d.h[5]) + binary.BigEndian.PutUint32(digest[24:], d.h[6]) if !d.is224 { - putUint32(digest[28:], d.h[7]) + binary.BigEndian.PutUint32(digest[28:], d.h[7]) } return digest diff --git a/libgo/go/crypto/sha256/sha256_test.go b/libgo/go/crypto/sha256/sha256_test.go index a6061907535..433c5a4c5e6 100644 --- a/libgo/go/crypto/sha256/sha256_test.go +++ b/libgo/go/crypto/sha256/sha256_test.go @@ -241,19 +241,19 @@ type unmarshalTest struct { var largeUnmarshalTests = []unmarshalTest{ // Data length: 7_115_087_207 - unmarshalTest{ + { state: "sha\x03yX\xaf\xb7\x04*\x8f\xaa\x9bx\xc5#\x1f\xeb\x94\xfdz1\xaf\xfbk֗\n\xc93\xcf\x02\v.\xa5\xe4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa8\x17\x9dg", sum: "f5e06371f0c115e9968455c8e48a318aba548b9f15676fa41de123f7d1c99c55", }, // Data length: 7_070_038_086 - unmarshalTest{ + { state: "sha\x03$\x933u\nV\v\xe2\xf7:0!ʳ\xa4\x13\xd3 6\xdcBB\xb5\x19\xcd=\xc1h\xee=\xb4\x9c@ABCDE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa5h8F", sum: "a280b08df5eba060fcd0eb3d29320bbc038afb95781661f91bbfd0a6fc9fdd6e", }, // Data length: 6_464_878_887 - unmarshalTest{ + { state: "sha\x03\x9f\x12\x87G\xf2\xdf<\x82\xa0\x11/*W\x02&IKWlh\x03\x95\xb1\xab\f\n\xf6Ze\xf9\x1d\x1b\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x81V9'", sum: "d2fffb762f105ab71e2d70069346c44c38c4fe183aad8cfcf5a76397c0457806", }, diff --git a/libgo/go/crypto/sha256/sha256block.go b/libgo/go/crypto/sha256/sha256block.go index d43bbf02453..bd2f9da93ce 100644 --- a/libgo/go/crypto/sha256/sha256block.go +++ b/libgo/go/crypto/sha256/sha256block.go @@ -8,6 +8,8 @@ package sha256 +import "math/bits" + var _K = []uint32{ 0x428a2f98, 0x71374491, @@ -87,18 +89,18 @@ func blockGeneric(dig *digest, p []byte) { } for i := 16; i < 64; i++ { v1 := w[i-2] - t1 := (v1>>17 | v1<<(32-17)) ^ (v1>>19 | v1<<(32-19)) ^ (v1 >> 10) + t1 := (bits.RotateLeft32(v1, -17)) ^ (bits.RotateLeft32(v1, -19)) ^ (v1 >> 10) v2 := w[i-15] - t2 := (v2>>7 | v2<<(32-7)) ^ (v2>>18 | v2<<(32-18)) ^ (v2 >> 3) + t2 := (bits.RotateLeft32(v2, -7)) ^ (bits.RotateLeft32(v2, -18)) ^ (v2 >> 3) w[i] = t1 + w[i-7] + t2 + w[i-16] } a, b, c, d, e, f, g, h := h0, h1, h2, h3, h4, h5, h6, h7 for i := 0; i < 64; i++ { - t1 := h + ((e>>6 | e<<(32-6)) ^ (e>>11 | e<<(32-11)) ^ (e>>25 | e<<(32-25))) + ((e & f) ^ (^e & g)) + _K[i] + w[i] + t1 := h + ((bits.RotateLeft32(e, -6)) ^ (bits.RotateLeft32(e, -11)) ^ (bits.RotateLeft32(e, -25))) + ((e & f) ^ (^e & g)) + _K[i] + w[i] - t2 := ((a>>2 | a<<(32-2)) ^ (a>>13 | a<<(32-13)) ^ (a>>22 | a<<(32-22))) + ((a & b) ^ (a & c) ^ (b & c)) + t2 := ((bits.RotateLeft32(a, -2)) ^ (bits.RotateLeft32(a, -13)) ^ (bits.RotateLeft32(a, -22))) + ((a & b) ^ (a & c) ^ (b & c)) h = g g = f diff --git a/libgo/go/crypto/sha512/sha512.go b/libgo/go/crypto/sha512/sha512.go index c685319480c..9c143a2a281 100644 --- a/libgo/go/crypto/sha512/sha512.go +++ b/libgo/go/crypto/sha512/sha512.go @@ -12,6 +12,7 @@ package sha512 import ( "crypto" + "encoding/binary" "errors" "hash" ) @@ -195,21 +196,9 @@ func (d *digest) UnmarshalBinary(b []byte) error { return nil } -func putUint64(x []byte, s uint64) { - _ = x[7] - x[0] = byte(s >> 56) - x[1] = byte(s >> 48) - x[2] = byte(s >> 40) - x[3] = byte(s >> 32) - x[4] = byte(s >> 24) - x[5] = byte(s >> 16) - x[6] = byte(s >> 8) - x[7] = byte(s) -} - func appendUint64(b []byte, x uint64) []byte { var a [8]byte - putUint64(a[:], x) + binary.BigEndian.PutUint64(a[:], x) return append(b, a[:]...) } @@ -316,8 +305,8 @@ func (d *digest) checkSum() [Size]byte { // Length in bits. len <<= 3 - putUint64(tmp[0:], 0) // upper 64 bits are always zero, because len variable has type uint64 - putUint64(tmp[8:], len) + binary.BigEndian.PutUint64(tmp[0:], 0) // upper 64 bits are always zero, because len variable has type uint64 + binary.BigEndian.PutUint64(tmp[8:], len) d.Write(tmp[0:16]) if d.nx != 0 { @@ -325,15 +314,15 @@ func (d *digest) checkSum() [Size]byte { } var digest [Size]byte - putUint64(digest[0:], d.h[0]) - putUint64(digest[8:], d.h[1]) - putUint64(digest[16:], d.h[2]) - putUint64(digest[24:], d.h[3]) - putUint64(digest[32:], d.h[4]) - putUint64(digest[40:], d.h[5]) + binary.BigEndian.PutUint64(digest[0:], d.h[0]) + binary.BigEndian.PutUint64(digest[8:], d.h[1]) + binary.BigEndian.PutUint64(digest[16:], d.h[2]) + binary.BigEndian.PutUint64(digest[24:], d.h[3]) + binary.BigEndian.PutUint64(digest[32:], d.h[4]) + binary.BigEndian.PutUint64(digest[40:], d.h[5]) if d.function != crypto.SHA384 { - putUint64(digest[48:], d.h[6]) - putUint64(digest[56:], d.h[7]) + binary.BigEndian.PutUint64(digest[48:], d.h[6]) + binary.BigEndian.PutUint64(digest[56:], d.h[7]) } return digest diff --git a/libgo/go/crypto/sha512/sha512_test.go b/libgo/go/crypto/sha512/sha512_test.go index 96a1aa69a4f..59998b1d38d 100644 --- a/libgo/go/crypto/sha512/sha512_test.go +++ b/libgo/go/crypto/sha512/sha512_test.go @@ -847,11 +847,11 @@ type unmarshalTest struct { var largeUnmarshalTests = []unmarshalTest{ // Data length: 6_565_544_823 - unmarshalTest{ + { state: "sha\aηe\x0f\x0f\xe1r]#\aoJ!.{5B\xe4\x140\x91\xdd\x00a\xe1\xb3E&\xb9\xbb\aJ\x9f^\x9f\x03ͺD\x96H\x80\xb0X\x9d\xdeʸ\f\xf7:\xd5\xe6'\xb9\x93f\xddA\xf0~\xe1\x02\x14\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87VCw", sum: "12d612357a1dbc74a28883dff79b83e7d2b881ae40d7a67fd7305490bc8a641cd1ce9ece598192080d6e9ac7e75d5988567a58a9812991299eb99a04ecb69523", }, - unmarshalTest{ + { state: "sha\a2\xd2\xdc\xf5\xd7\xe2\xf9\x97\xaa\xe7}Fϱ\xbc\x8e\xbf\x12h\x83Z\xa1\xc7\xf5p>bfS T\xea\xee\x1e\xa6Z\x9c\xa4Ú¶\u0086\bn\xe47\x8fsGs3\xe0\xda\\\x9dqZ\xa5\xf6\xd0kM\xa1\xf2\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa7VCw", sum: "94a04b9a901254cd94ca0313557e4be3ab1ca86e920c1f3efdc22d361e9ae12be66bc6d6dc5db79a0a4aa6eca6f293c1e9095bbae127ae405f6c325478343299", }, diff --git a/libgo/go/crypto/sha512/sha512block.go b/libgo/go/crypto/sha512/sha512block.go index 42e8d19fe8c..81569c5f84e 100644 --- a/libgo/go/crypto/sha512/sha512block.go +++ b/libgo/go/crypto/sha512/sha512block.go @@ -8,6 +8,8 @@ package sha512 +import "math/bits" + var _K = []uint64{ 0x428a2f98d728ae22, 0x7137449123ef65cd, @@ -102,9 +104,9 @@ func blockGeneric(dig *digest, p []byte) { } for i := 16; i < 80; i++ { v1 := w[i-2] - t1 := (v1>>19 | v1<<(64-19)) ^ (v1>>61 | v1<<(64-61)) ^ (v1 >> 6) + t1 := bits.RotateLeft64(v1, -19) ^ bits.RotateLeft64(v1, -61) ^ (v1 >> 6) v2 := w[i-15] - t2 := (v2>>1 | v2<<(64-1)) ^ (v2>>8 | v2<<(64-8)) ^ (v2 >> 7) + t2 := bits.RotateLeft64(v2, -1) ^ bits.RotateLeft64(v2, -8) ^ (v2 >> 7) w[i] = t1 + w[i-7] + t2 + w[i-16] } @@ -112,9 +114,9 @@ func blockGeneric(dig *digest, p []byte) { a, b, c, d, e, f, g, h := h0, h1, h2, h3, h4, h5, h6, h7 for i := 0; i < 80; i++ { - t1 := h + ((e>>14 | e<<(64-14)) ^ (e>>18 | e<<(64-18)) ^ (e>>41 | e<<(64-41))) + ((e & f) ^ (^e & g)) + _K[i] + w[i] + t1 := h + (bits.RotateLeft64(e, -14) ^ bits.RotateLeft64(e, -18) ^ bits.RotateLeft64(e, -41)) + ((e & f) ^ (^e & g)) + _K[i] + w[i] - t2 := ((a>>28 | a<<(64-28)) ^ (a>>34 | a<<(64-34)) ^ (a>>39 | a<<(64-39))) + ((a & b) ^ (a & c) ^ (b & c)) + t2 := (bits.RotateLeft64(a, -28) ^ bits.RotateLeft64(a, -34) ^ bits.RotateLeft64(a, -39)) + ((a & b) ^ (a & c) ^ (b & c)) h = g g = f diff --git a/libgo/go/crypto/tls/auth.go b/libgo/go/crypto/tls/auth.go index 6fe97185050..c62c9af76b6 100644 --- a/libgo/go/crypto/tls/auth.go +++ b/libgo/go/crypto/tls/auth.go @@ -5,8 +5,10 @@ package tls import ( + "bytes" "crypto" "crypto/ecdsa" + "crypto/ed25519" "crypto/elliptic" "crypto/rsa" "encoding/asn1" @@ -38,6 +40,15 @@ func pickSignatureAlgorithm(pubkey crypto.PublicKey, peerSigAlgs, ourSigAlgs []S } case *ecdsa.PublicKey: return ECDSAWithSHA1, signatureECDSA, crypto.SHA1, nil + case ed25519.PublicKey: + if tlsVersion < VersionTLS12 { + // RFC 8422 specifies support for Ed25519 in TLS 1.0 and 1.1, + // but it requires holding on to a handshake transcript to do a + // full signature, and not even OpenSSL bothers with the + // complexity, so we can't even test it properly. + return 0, 0, 0, fmt.Errorf("tls: Ed25519 public keys are not supported before TLS 1.2") + } + return Ed25519, signatureEd25519, directSigning, nil default: return 0, 0, 0, fmt.Errorf("tls: unsupported public key: %T", pubkey) } @@ -60,6 +71,10 @@ func pickSignatureAlgorithm(pubkey crypto.PublicKey, peerSigAlgs, ourSigAlgs []S if sigType == signatureECDSA { return sigAlg, sigType, hashAlg, nil } + case ed25519.PublicKey: + if sigType == signatureEd25519 { + return sigAlg, sigType, hashAlg, nil + } default: return 0, 0, 0, fmt.Errorf("tls: unsupported public key: %T", pubkey) } @@ -67,9 +82,9 @@ func pickSignatureAlgorithm(pubkey crypto.PublicKey, peerSigAlgs, ourSigAlgs []S return 0, 0, 0, errors.New("tls: peer doesn't support any common signature algorithms") } -// verifyHandshakeSignature verifies a signature against pre-hashed handshake -// contents. -func verifyHandshakeSignature(sigType uint8, pubkey crypto.PublicKey, hashFunc crypto.Hash, digest, sig []byte) error { +// verifyHandshakeSignature verifies a signature against pre-hashed +// (if required) handshake contents. +func verifyHandshakeSignature(sigType uint8, pubkey crypto.PublicKey, hashFunc crypto.Hash, signed, sig []byte) error { switch sigType { case signatureECDSA: pubKey, ok := pubkey.(*ecdsa.PublicKey) @@ -83,15 +98,23 @@ func verifyHandshakeSignature(sigType uint8, pubkey crypto.PublicKey, hashFunc c if ecdsaSig.R.Sign() <= 0 || ecdsaSig.S.Sign() <= 0 { return errors.New("tls: ECDSA signature contained zero or negative values") } - if !ecdsa.Verify(pubKey, digest, ecdsaSig.R, ecdsaSig.S) { + if !ecdsa.Verify(pubKey, signed, ecdsaSig.R, ecdsaSig.S) { return errors.New("tls: ECDSA verification failure") } + case signatureEd25519: + pubKey, ok := pubkey.(ed25519.PublicKey) + if !ok { + return errors.New("tls: Ed25519 signing requires a Ed25519 public key") + } + if !ed25519.Verify(pubKey, signed, sig) { + return errors.New("tls: Ed25519 verification failure") + } case signaturePKCS1v15: pubKey, ok := pubkey.(*rsa.PublicKey) if !ok { return errors.New("tls: RSA signing requires a RSA public key") } - if err := rsa.VerifyPKCS1v15(pubKey, hashFunc, digest, sig); err != nil { + if err := rsa.VerifyPKCS1v15(pubKey, hashFunc, signed, sig); err != nil { return err } case signatureRSAPSS: @@ -100,7 +123,7 @@ func verifyHandshakeSignature(sigType uint8, pubkey crypto.PublicKey, hashFunc c return errors.New("tls: RSA signing requires a RSA public key") } signOpts := &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash} - if err := rsa.VerifyPSS(pubKey, hashFunc, digest, sig, signOpts); err != nil { + if err := rsa.VerifyPSS(pubKey, hashFunc, signed, sig, signOpts); err != nil { return err } default: @@ -125,18 +148,29 @@ var signaturePadding = []byte{ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, } -// writeSignedMessage writes the content to be signed by certificate keys in TLS -// 1.3 to sigHash. See RFC 8446, Section 4.4.3. -func writeSignedMessage(sigHash io.Writer, context string, transcript hash.Hash) { - sigHash.Write(signaturePadding) - io.WriteString(sigHash, context) - sigHash.Write(transcript.Sum(nil)) +// signedMessage returns the pre-hashed (if necessary) message to be signed by +// certificate keys in TLS 1.3. See RFC 8446, Section 4.4.3. +func signedMessage(sigHash crypto.Hash, context string, transcript hash.Hash) []byte { + if sigHash == directSigning { + b := &bytes.Buffer{} + b.Write(signaturePadding) + io.WriteString(b, context) + b.Write(transcript.Sum(nil)) + return b.Bytes() + } + h := sigHash.New() + h.Write(signaturePadding) + io.WriteString(h, context) + h.Write(transcript.Sum(nil)) + return h.Sum(nil) } // signatureSchemesForCertificate returns the list of supported SignatureSchemes -// for a given certificate, based on the public key and the protocol version. It -// does not support the crypto.Decrypter interface, so shouldn't be used on the -// server side in TLS 1.2 and earlier. +// for a given certificate, based on the public key and the protocol version. +// +// It does not support the crypto.Decrypter interface, so shouldn't be used for +// server certificates in TLS 1.2 and earlier, and it must be kept in sync with +// supportedSignatureAlgorithms. func signatureSchemesForCertificate(version uint16, cert *Certificate) []SignatureScheme { priv, ok := cert.PrivateKey.(crypto.Signer) if !ok { @@ -168,21 +202,19 @@ func signatureSchemesForCertificate(version uint16, cert *Certificate) []Signatu case *rsa.PublicKey: if version != VersionTLS13 { return []SignatureScheme{ - PSSWithSHA256, - PSSWithSHA384, - PSSWithSHA512, PKCS1WithSHA256, PKCS1WithSHA384, PKCS1WithSHA512, PKCS1WithSHA1, } } - // RSA keys with RSA-PSS OID are not supported by crypto/x509. return []SignatureScheme{ PSSWithSHA256, PSSWithSHA384, PSSWithSHA512, } + case ed25519.PublicKey: + return []SignatureScheme{Ed25519} default: return nil } @@ -195,6 +227,8 @@ func unsupportedCertificateError(cert *Certificate) error { case rsa.PrivateKey, ecdsa.PrivateKey: return fmt.Errorf("tls: unsupported certificate: private key is %T, expected *%T", cert.PrivateKey, cert.PrivateKey) + case *ed25519.PrivateKey: + return fmt.Errorf("tls: unsupported certificate: private key is *ed25519.PrivateKey, expected ed25519.PrivateKey") } signer, ok := cert.PrivateKey.(crypto.Signer) @@ -213,6 +247,7 @@ func unsupportedCertificateError(cert *Certificate) error { return fmt.Errorf("tls: unsupported certificate curve (%s)", pub.Curve.Params().Name) } case *rsa.PublicKey: + case ed25519.PublicKey: default: return fmt.Errorf("tls: unsupported certificate key (%T)", pub) } diff --git a/libgo/go/crypto/tls/auth_test.go b/libgo/go/crypto/tls/auth_test.go index 3f876b9e1a9..1d958cf1410 100644 --- a/libgo/go/crypto/tls/auth_test.go +++ b/libgo/go/crypto/tls/auth_test.go @@ -6,12 +6,14 @@ package tls import ( "crypto" + "crypto/ed25519" "testing" ) func TestSignatureSelection(t *testing.T) { rsaCert := &testRSAPrivateKey.PublicKey ecdsaCert := &testECDSAPrivateKey.PublicKey + ed25519Cert := testEd25519PrivateKey.Public().(ed25519.PublicKey) sigsPKCS1WithSHA := []SignatureScheme{PKCS1WithSHA256, PKCS1WithSHA1} sigsPSSWithSHA := []SignatureScheme{PSSWithSHA256, PSSWithSHA384} sigsECDSAWithSHA := []SignatureScheme{ECDSAWithP256AndSHA256, ECDSAWithSHA1} @@ -22,7 +24,7 @@ func TestSignatureSelection(t *testing.T) { ourSigAlgs []SignatureScheme tlsVersion uint16 - expectedSigAlg SignatureScheme // or 0 if ignored + expectedSigAlg SignatureScheme // if tlsVersion == VersionTLS12 expectedSigType uint8 expectedHash crypto.Hash }{ @@ -56,6 +58,10 @@ func TestSignatureSelection(t *testing.T) { // RSASSA-PSS is defined in TLS 1.3 for TLS 1.2 // https://tools.ietf.org/html/draft-ietf-tls-tls13-21#page-45 {rsaCert, []SignatureScheme{PSSWithSHA256}, sigsPSSWithSHA, VersionTLS12, PSSWithSHA256, signatureRSAPSS, crypto.SHA256}, + + // All results are fixed for Ed25519. RFC 8422, Section 5.10. + {ed25519Cert, []SignatureScheme{Ed25519}, []SignatureScheme{ECDSAWithSHA1, Ed25519}, VersionTLS12, Ed25519, signatureEd25519, directSigning}, + {ed25519Cert, nil, nil, VersionTLS12, Ed25519, signatureEd25519, directSigning}, } for testNo, test := range tests { @@ -63,7 +69,7 @@ func TestSignatureSelection(t *testing.T) { if err != nil { t.Errorf("test[%d]: unexpected error: %v", testNo, err) } - if test.expectedSigAlg != 0 && test.expectedSigAlg != sigAlg { + if test.tlsVersion == VersionTLS12 && test.expectedSigAlg != sigAlg { t.Errorf("test[%d]: expected signature scheme %#x, got %#x", testNo, test.expectedSigAlg, sigAlg) } if test.expectedSigType != sigType { @@ -84,6 +90,12 @@ func TestSignatureSelection(t *testing.T) { {ecdsaCert, sigsPKCS1WithSHA, sigsPKCS1WithSHA, VersionTLS12}, {ecdsaCert, sigsECDSAWithSHA, sigsPKCS1WithSHA, VersionTLS12}, {rsaCert, []SignatureScheme{0}, sigsPKCS1WithSHA, VersionTLS12}, + {ed25519Cert, sigsECDSAWithSHA, sigsECDSAWithSHA, VersionTLS12}, + {ed25519Cert, []SignatureScheme{Ed25519}, sigsECDSAWithSHA, VersionTLS12}, + {ecdsaCert, []SignatureScheme{Ed25519}, []SignatureScheme{Ed25519}, VersionTLS12}, + {ed25519Cert, nil, nil, VersionTLS11}, + {ed25519Cert, nil, nil, VersionTLS10}, + {ed25519Cert, nil, nil, VersionSSL30}, // ECDSA is unspecified for SSL 3.0 in RFC 4492. // TODO a SSL 3.0 client cannot advertise signature_algorithms, diff --git a/libgo/go/crypto/tls/cipher_suites.go b/libgo/go/crypto/tls/cipher_suites.go index ecb4db290a0..61bbc9f9099 100644 --- a/libgo/go/crypto/tls/cipher_suites.go +++ b/libgo/go/crypto/tls/cipher_suites.go @@ -14,8 +14,8 @@ import ( "crypto/sha1" "crypto/sha256" "crypto/x509" + "golang.org/x/crypto/chacha20poly1305" "hash" - "internal/x/crypto/chacha20poly1305" ) // a keyAgreement implements the client and server side of a TLS key agreement @@ -43,11 +43,11 @@ const ( // client indicates that it supports ECC with a curve and point format // that we're happy with. suiteECDHE = 1 << iota - // suiteECDSA indicates that the cipher suite involves an ECDSA - // signature and therefore may only be selected when the server's - // certificate is ECDSA. If this is not set then the cipher suite is - // RSA based. - suiteECDSA + // suiteECSign indicates that the cipher suite involves an ECDSA or + // EdDSA signature and therefore may only be selected when the server's + // certificate is ECDSA or EdDSA. If this is not set then the cipher suite + // is RSA based. + suiteECSign // suiteTLS12 indicates that the cipher suite should only be advertised // and accepted when using TLS 1.2. suiteTLS12 @@ -78,17 +78,17 @@ var cipherSuites = []*cipherSuite{ // Ciphersuite order is chosen so that ECDHE comes before plain RSA and // AEADs are the top preference. {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, 32, 0, 12, ecdheRSAKA, suiteECDHE | suiteTLS12, nil, nil, aeadChaCha20Poly1305}, - {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, 32, 0, 12, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12, nil, nil, aeadChaCha20Poly1305}, + {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, 32, 0, 12, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12, nil, nil, aeadChaCha20Poly1305}, {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12, nil, nil, aeadAESGCM}, - {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12, nil, nil, aeadAESGCM}, + {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12, nil, nil, aeadAESGCM}, {TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, - {TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, + {TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, ecdheRSAKA, suiteECDHE | suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil}, {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil}, - {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil}, - {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECDSA, cipherAES, macSHA1, nil}, + {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil}, + {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECSign, cipherAES, macSHA1, nil}, {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil}, - {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECDSA, cipherAES, macSHA1, nil}, + {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECSign, cipherAES, macSHA1, nil}, {TLS_RSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, rsaKA, suiteTLS12, nil, nil, aeadAESGCM}, {TLS_RSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, rsaKA, suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, {TLS_RSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, rsaKA, suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil}, @@ -100,7 +100,7 @@ var cipherSuites = []*cipherSuite{ // RC4-based cipher suites are disabled by default. {TLS_RSA_WITH_RC4_128_SHA, 16, 20, 0, rsaKA, suiteDefaultOff, cipherRC4, macSHA1, nil}, {TLS_ECDHE_RSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheRSAKA, suiteECDHE | suiteDefaultOff, cipherRC4, macSHA1, nil}, - {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteDefaultOff, cipherRC4, macSHA1, nil}, + {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteDefaultOff, cipherRC4, macSHA1, nil}, } // A cipherSuiteTLS13 defines only the pair of the AEAD algorithm and hash diff --git a/libgo/go/crypto/tls/common.go b/libgo/go/crypto/tls/common.go index f695528fe07..d135b1fc994 100644 --- a/libgo/go/crypto/tls/common.go +++ b/libgo/go/crypto/tls/common.go @@ -149,37 +149,56 @@ const ( // Certificate types (for certificateRequestMsg) const ( certTypeRSASign = 1 - certTypeECDSASign = 64 // RFC 4492, Section 5.5 + certTypeECDSASign = 64 // ECDSA or EdDSA keys, see RFC 8422, Section 3. ) -// Signature algorithms (for internal signaling use). Starting at 16 to avoid overlap with +// Signature algorithms (for internal signaling use). Starting at 225 to avoid overlap with // TLS 1.2 codepoints (RFC 5246, Appendix A.4.1), with which these have nothing to do. const ( - signaturePKCS1v15 uint8 = iota + 16 - signatureECDSA + signaturePKCS1v15 uint8 = iota + 225 signatureRSAPSS + signatureECDSA + signatureEd25519 ) +// directSigning is a standard Hash value that signals that no pre-hashing +// should be performed, and that the input should be signed directly. It is the +// hash function associated with the Ed25519 signature scheme. +var directSigning crypto.Hash = 0 + // supportedSignatureAlgorithms contains the signature and hash algorithms that // the code advertises as supported in a TLS 1.2+ ClientHello and in a TLS 1.2+ // CertificateRequest. The two fields are merged to match with TLS 1.3. // Note that in TLS 1.2, the ECDSA algorithms are not constrained to P-256, etc. var supportedSignatureAlgorithms = []SignatureScheme{ PSSWithSHA256, + ECDSAWithP256AndSHA256, + Ed25519, PSSWithSHA384, PSSWithSHA512, PKCS1WithSHA256, - ECDSAWithP256AndSHA256, PKCS1WithSHA384, - ECDSAWithP384AndSHA384, PKCS1WithSHA512, + ECDSAWithP384AndSHA384, ECDSAWithP521AndSHA512, PKCS1WithSHA1, ECDSAWithSHA1, } -// RSA-PSS is disabled in TLS 1.2 for Go 1.12. See Issue 30055. -var supportedSignatureAlgorithmsTLS12 = supportedSignatureAlgorithms[3:] +// supportedSignatureAlgorithmsTLS12 contains the signature and hash algorithms +// that are supported in TLS 1.2, where it is possible to distinguish the +// protocol version. This is temporary, see Issue 32425. +var supportedSignatureAlgorithmsTLS12 = []SignatureScheme{ + PKCS1WithSHA256, + ECDSAWithP256AndSHA256, + Ed25519, + PKCS1WithSHA384, + PKCS1WithSHA512, + ECDSAWithP384AndSHA384, + ECDSAWithP521AndSHA512, + PKCS1WithSHA1, + ECDSAWithSHA1, +} // helloRetryRequestRandom is set as the Random value of a ServerHello // to signal that the message is actually a HelloRetryRequest. @@ -310,6 +329,9 @@ const ( ECDSAWithP384AndSHA384 SignatureScheme = 0x0503 ECDSAWithP521AndSHA512 SignatureScheme = 0x0603 + // EdDSA algorithms. + Ed25519 SignatureScheme = 0x0807 + // Legacy signature and hash algorithms for TLS 1.2. PKCS1WithSHA1 SignatureScheme = 0x0201 ECDSAWithSHA1 SignatureScheme = 0x0203 @@ -779,7 +801,7 @@ func (c *Config) supportedVersions(isClient bool) []uint16 { if isClient && v < VersionTLS10 { continue } - // TLS 1.3 is opt-in in Go 1.12. + // TLS 1.3 is opt-out in Go 1.13. if v == VersionTLS13 && !isTLS13Supported() { continue } @@ -794,11 +816,11 @@ var tls13Support struct { cached bool } -// isTLS13Supported returns whether the program opted into TLS 1.3 via -// GODEBUG=tls13=1. It's cached after the first execution. +// isTLS13Supported returns whether the program enabled TLS 1.3 by not opting +// out with GODEBUG=tls13=0. It's cached after the first execution. func isTLS13Supported() bool { tls13Support.Do(func() { - tls13Support.cached = goDebugString("tls13") == "1" + tls13Support.cached = goDebugString("tls13") != "0" }) return tls13Support.cached } @@ -969,7 +991,7 @@ var writerMutex sync.Mutex type Certificate struct { Certificate [][]byte // PrivateKey contains the private key corresponding to the public key in - // Leaf. This must implement crypto.Signer with an RSA or ECDSA PublicKey. + // Leaf. This must implement crypto.Signer with an RSA, ECDSA or Ed25519 PublicKey. // For a server up to TLS 1.2, it can also implement crypto.Decrypter with // an RSA PublicKey. PrivateKey crypto.PrivateKey @@ -1185,6 +1207,8 @@ func signatureFromSignatureScheme(signatureAlgorithm SignatureScheme) uint8 { return signatureRSAPSS case ECDSAWithSHA1, ECDSAWithP256AndSHA256, ECDSAWithP384AndSHA384, ECDSAWithP521AndSHA512: return signatureECDSA + case Ed25519: + return signatureEd25519 default: return 0 } diff --git a/libgo/go/crypto/tls/conn.go b/libgo/go/crypto/tls/conn.go index f61d43203fd..0c7952f7b84 100644 --- a/libgo/go/crypto/tls/conn.go +++ b/libgo/go/crypto/tls/conn.go @@ -274,6 +274,17 @@ func extractPadding(payload []byte) (toRemove int, good byte) { good &= good << 1 good = uint8(int8(good) >> 7) + // Zero the padding length on error. This ensures any unchecked bytes + // are included in the MAC. Otherwise, an attacker that could + // distinguish MAC failures from padding failures could mount an attack + // similar to POODLE in SSL 3.0: given a good ciphertext that uses a + // full block's worth of padding, replace the final block with another + // block. If the MAC check passed but the padding check failed, the + // last byte of that block decrypted to the block size. + // + // See also macAndPaddingGood logic below. + paddingLen &= good + toRemove = int(paddingLen) + 1 return } @@ -416,7 +427,15 @@ func (hc *halfConn) decrypt(record []byte) ([]byte, recordType, error) { remoteMAC := payload[n : n+macSize] localMAC := hc.mac.MAC(hc.seq[0:], record[:recordHeaderLen], payload[:n], payload[n+macSize:]) - if subtle.ConstantTimeCompare(localMAC, remoteMAC) != 1 || paddingGood != 255 { + // This is equivalent to checking the MACs and paddingGood + // separately, but in constant-time to prevent distinguishing + // padding failures from MAC failures. Depending on what value + // of paddingLen was returned on bad padding, distinguishing + // bad MAC from bad padding can lead to an attack. + // + // See also the logic at the end of extractPadding. + macAndPaddingGood := subtle.ConstantTimeCompare(localMAC, remoteMAC) & int(paddingGood) + if macAndPaddingGood != 1 { return nil, 0, alertBadRecordMAC } diff --git a/libgo/go/crypto/tls/generate_cert.go b/libgo/go/crypto/tls/generate_cert.go index 8d012be75c1..7329d97a9d0 100644 --- a/libgo/go/crypto/tls/generate_cert.go +++ b/libgo/go/crypto/tls/generate_cert.go @@ -11,6 +11,7 @@ package main import ( "crypto/ecdsa" + "crypto/ed25519" "crypto/elliptic" "crypto/rand" "crypto/rsa" @@ -18,7 +19,6 @@ import ( "crypto/x509/pkix" "encoding/pem" "flag" - "fmt" "log" "math/big" "net" @@ -34,6 +34,7 @@ var ( isCA = flag.Bool("ca", false, "whether this cert should be its own Certificate Authority") rsaBits = flag.Int("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set") ecdsaCurve = flag.String("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256 (recommended), P384, P521") + ed25519Key = flag.Bool("ed25519", false, "Generate an Ed25519 key") ) func publicKey(priv interface{}) interface{} { @@ -42,22 +43,8 @@ func publicKey(priv interface{}) interface{} { return &k.PublicKey case *ecdsa.PrivateKey: return &k.PublicKey - default: - return nil - } -} - -func pemBlockForKey(priv interface{}) *pem.Block { - switch k := priv.(type) { - case *rsa.PrivateKey: - return &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(k)} - case *ecdsa.PrivateKey: - b, err := x509.MarshalECPrivateKey(k) - if err != nil { - fmt.Fprintf(os.Stderr, "Unable to marshal ECDSA private key: %v", err) - os.Exit(2) - } - return &pem.Block{Type: "EC PRIVATE KEY", Bytes: b} + case ed25519.PrivateKey: + return k.Public().(ed25519.PublicKey) default: return nil } @@ -74,7 +61,11 @@ func main() { var err error switch *ecdsaCurve { case "": - priv, err = rsa.GenerateKey(rand.Reader, *rsaBits) + if *ed25519Key { + _, priv, err = ed25519.GenerateKey(rand.Reader) + } else { + priv, err = rsa.GenerateKey(rand.Reader, *rsaBits) + } case "P224": priv, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader) case "P256": @@ -84,11 +75,10 @@ func main() { case "P521": priv, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader) default: - fmt.Fprintf(os.Stderr, "Unrecognized elliptic curve: %q", *ecdsaCurve) - os.Exit(1) + log.Fatalf("Unrecognized elliptic curve: %q", *ecdsaCurve) } if err != nil { - log.Fatalf("failed to generate private key: %s", err) + log.Fatalf("Failed to generate private key: %s", err) } var notBefore time.Time @@ -97,8 +87,7 @@ func main() { } else { notBefore, err = time.Parse("Jan 2 15:04:05 2006", *validFrom) if err != nil { - fmt.Fprintf(os.Stderr, "Failed to parse creation date: %s\n", err) - os.Exit(1) + log.Fatalf("Failed to parse creation date: %s", err) } } @@ -107,7 +96,7 @@ func main() { serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) if err != nil { - log.Fatalf("failed to generate serial number: %s", err) + log.Fatalf("Failed to generate serial number: %s", err) } template := x509.Certificate{ @@ -144,26 +133,30 @@ func main() { certOut, err := os.Create("cert.pem") if err != nil { - log.Fatalf("failed to open cert.pem for writing: %s", err) + log.Fatalf("Failed to open cert.pem for writing: %s", err) } if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil { - log.Fatalf("failed to write data to cert.pem: %s", err) + log.Fatalf("Failed to write data to cert.pem: %s", err) } if err := certOut.Close(); err != nil { - log.Fatalf("error closing cert.pem: %s", err) + log.Fatalf("Error closing cert.pem: %s", err) } log.Print("wrote cert.pem\n") keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { - log.Print("failed to open key.pem for writing:", err) + log.Fatalf("Failed to open key.pem for writing:", err) return } - if err := pem.Encode(keyOut, pemBlockForKey(priv)); err != nil { - log.Fatalf("failed to write data to key.pem: %s", err) + privBytes, err := x509.MarshalPKCS8PrivateKey(priv) + if err != nil { + log.Fatalf("Unable to marshal private key: %v", err) + } + if err := pem.Encode(keyOut, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}); err != nil { + log.Fatalf("Failed to write data to key.pem: %s", err) } if err := keyOut.Close(); err != nil { - log.Fatalf("error closing key.pem: %s", err) + log.Fatalf("Error closing key.pem: %s", err) } log.Print("wrote key.pem\n") } diff --git a/libgo/go/crypto/tls/handshake_client.go b/libgo/go/crypto/tls/handshake_client.go index e760fbf2c1a..ed000eb6192 100644 --- a/libgo/go/crypto/tls/handshake_client.go +++ b/libgo/go/crypto/tls/handshake_client.go @@ -8,6 +8,7 @@ import ( "bytes" "crypto" "crypto/ecdsa" + "crypto/ed25519" "crypto/rsa" "crypto/subtle" "crypto/x509" @@ -85,7 +86,6 @@ func (c *Conn) makeClientHello() (*clientHelloMsg, ecdheParameters, error) { possibleCipherSuites := config.cipherSuites() hello.cipherSuites = make([]uint16, 0, len(possibleCipherSuites)) -NextCipherSuite: for _, suiteId := range possibleCipherSuites { for _, suite := range cipherSuites { if suite.id != suiteId { @@ -94,10 +94,10 @@ NextCipherSuite: // Don't advertise TLS 1.2-only cipher suites unless // we're attempting TLS 1.2. if hello.vers < VersionTLS12 && suite.flags&suiteTLS12 != 0 { - continue + break } hello.cipherSuites = append(hello.cipherSuites, suiteId) - continue NextCipherSuite + break } } @@ -582,7 +582,7 @@ func (hs *clientHandshakeState) doFullHandshake() error { if certVerify.hasSignatureAlgorithm { certVerify.signatureAlgorithm = signatureAlgorithm } - digest, err := hs.finishedHash.hashForClientCertificate(sigType, hashFunc, hs.masterSecret) + signed, err := hs.finishedHash.hashForClientCertificate(sigType, hashFunc, hs.masterSecret) if err != nil { c.sendAlert(alertInternalError) return err @@ -591,7 +591,7 @@ func (hs *clientHandshakeState) doFullHandshake() error { if sigType == signatureRSAPSS { signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: hashFunc} } - certVerify.signature, err = key.Sign(c.config.rand(), digest, signOpts) + certVerify.signature, err = key.Sign(c.config.rand(), signed, signOpts) if err != nil { c.sendAlert(alertInternalError) return err @@ -827,11 +827,7 @@ func (c *Conn) verifyServerCertificate(certificates [][]byte) error { DNSName: c.config.ServerName, Intermediates: x509.NewCertPool(), } - - for i, cert := range certs { - if i == 0 { - continue - } + for _, cert := range certs[1:] { opts.Intermediates.AddCert(cert) } var err error @@ -850,7 +846,7 @@ func (c *Conn) verifyServerCertificate(certificates [][]byte) error { } switch certs[0].PublicKey.(type) { - case *rsa.PublicKey, *ecdsa.PublicKey: + case *rsa.PublicKey, *ecdsa.PublicKey, ed25519.PublicKey: break default: c.sendAlert(alertUnsupportedCertificate) @@ -873,13 +869,13 @@ var ( // certificateRequestInfoFromMsg generates a CertificateRequestInfo from a TLS // <= 1.2 CertificateRequest, making an effort to fill in missing information. func certificateRequestInfoFromMsg(certReq *certificateRequestMsg) *CertificateRequestInfo { - var rsaAvail, ecdsaAvail bool + var rsaAvail, ecAvail bool for _, certType := range certReq.certificateTypes { switch certType { case certTypeRSASign: rsaAvail = true case certTypeECDSASign: - ecdsaAvail = true + ecAvail = true } } @@ -893,25 +889,23 @@ func certificateRequestInfoFromMsg(certReq *certificateRequestMsg) *CertificateR // case we use a plausible list based on the acceptable // certificate types. switch { - case rsaAvail && ecdsaAvail: + case rsaAvail && ecAvail: cri.SignatureSchemes = tls11SignatureSchemes case rsaAvail: cri.SignatureSchemes = tls11SignatureSchemesRSA - case ecdsaAvail: + case ecAvail: cri.SignatureSchemes = tls11SignatureSchemesECDSA } return cri } - // In TLS 1.2, the signature schemes apply to both the certificate chain and - // the leaf key, while the certificate types only apply to the leaf key. + // Filter the signature schemes based on the certificate types. // See RFC 5246, Section 7.4.4 (where it calls this "somewhat complicated"). - // Filter the signature schemes based on the certificate type. cri.SignatureSchemes = make([]SignatureScheme, 0, len(certReq.supportedSignatureAlgorithms)) for _, sigScheme := range certReq.supportedSignatureAlgorithms { switch signatureFromSignatureScheme(sigScheme) { - case signatureECDSA: - if ecdsaAvail { + case signatureECDSA, signatureEd25519: + if ecAvail { cri.SignatureSchemes = append(cri.SignatureSchemes, sigScheme) } case signatureRSAPSS, signaturePKCS1v15: diff --git a/libgo/go/crypto/tls/handshake_client_test.go b/libgo/go/crypto/tls/handshake_client_test.go index 8c4125b7e2a..1b6b9a1074d 100644 --- a/libgo/go/crypto/tls/handshake_client_test.go +++ b/libgo/go/crypto/tls/handshake_client_test.go @@ -6,7 +6,6 @@ package tls import ( "bytes" - "crypto/ecdsa" "crypto/rsa" "crypto/x509" "encoding/base64" @@ -26,18 +25,6 @@ import ( "time" ) -func init() { - // TLS 1.3 cipher suites preferences are not configurable and change based - // on the architecture. Force them to the version with AES accelleration for - // test consistency. - once.Do(initDefaultCipherSuites) - varDefaultCipherSuitesTLS13 = []uint16{ - TLS_AES_128_GCM_SHA256, - TLS_CHACHA20_POLY1305_SHA256, - TLS_AES_256_GCM_SHA384, - } -} - // Note: see comment in handshake_test.go for details of how the reference // tests work. @@ -142,7 +129,7 @@ type clientTest struct { // cert, if not empty, contains a DER-encoded certificate for the // reference server. cert []byte - // key, if not nil, contains either a *rsa.PrivateKey or + // key, if not nil, contains either a *rsa.PrivateKey, ed25519.PrivateKey or // *ecdsa.PrivateKey which is the private key for the reference server. key interface{} // extensions, if not nil, contains a list of extension data to be returned @@ -185,25 +172,13 @@ func (test *clientTest) connFromCommand() (conn *recordingConn, child *exec.Cmd, if test.key != nil { key = test.key } - var pemType string - var derBytes []byte - switch key := key.(type) { - case *rsa.PrivateKey: - pemType = "RSA" - derBytes = x509.MarshalPKCS1PrivateKey(key) - case *ecdsa.PrivateKey: - pemType = "EC" - var err error - derBytes, err = x509.MarshalECPrivateKey(key) - if err != nil { - panic(err) - } - default: - panic("unknown key type") + derBytes, err := x509.MarshalPKCS8PrivateKey(key) + if err != nil { + panic(err) } var pemOut bytes.Buffer - pem.Encode(&pemOut, &pem.Block{Type: pemType + " PRIVATE KEY", Bytes: derBytes}) + pem.Encode(&pemOut, &pem.Block{Type: "PRIVATE KEY", Bytes: derBytes}) keyPath := tempFile(pemOut.String()) defer os.Remove(keyPath) @@ -300,8 +275,6 @@ func (test *clientTest) loadData() (flows [][]byte, err error) { } func (test *clientTest) run(t *testing.T, write bool) { - checkOpenSSLVersion(t) - var clientConn, serverConn net.Conn var recordingConn *recordingConn var childProcess *exec.Cmd @@ -463,12 +436,20 @@ func (test *clientTest) run(t *testing.T, write bool) { } for i, b := range flows { if i%2 == 1 { - serverConn.SetWriteDeadline(time.Now().Add(1 * time.Minute)) + if *fast { + serverConn.SetWriteDeadline(time.Now().Add(1 * time.Second)) + } else { + serverConn.SetWriteDeadline(time.Now().Add(1 * time.Minute)) + } serverConn.Write(b) continue } bb := make([]byte, len(b)) - serverConn.SetReadDeadline(time.Now().Add(1 * time.Minute)) + if *fast { + serverConn.SetReadDeadline(time.Now().Add(1 * time.Second)) + } else { + serverConn.SetReadDeadline(time.Now().Add(1 * time.Minute)) + } _, err := io.ReadFull(serverConn, bb) if err != nil { t.Fatalf("%s, flow %d: %s", test.name, i+1, err) @@ -745,6 +726,29 @@ func TestHandshakeClientECDSATLS13(t *testing.T) { runClientTestTLS13(t, test) } +func TestHandshakeClientEd25519(t *testing.T) { + test := &clientTest{ + name: "Ed25519", + cert: testEd25519Certificate, + key: testEd25519PrivateKey, + } + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) + + config := testConfig.Clone() + cert, _ := X509KeyPair([]byte(clientEd25519CertificatePEM), []byte(clientEd25519KeyPEM)) + config.Certificates = []Certificate{cert} + + test = &clientTest{ + name: "ClientCert-Ed25519", + args: []string{"-Verify", "1"}, + config: config, + } + + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) +} + func TestHandshakeClientCertRSA(t *testing.T) { config := testConfig.Clone() cert, _ := X509KeyPair([]byte(clientCertificatePEM), []byte(clientKeyPEM)) @@ -809,22 +813,26 @@ func TestHandshakeClientCertECDSA(t *testing.T) { runClientTestTLS12(t, test) } -// TestHandshakeClientCertRSAPSS tests a few separate things: -// * that our client can serve a PSS-signed certificate -// * that our client can validate a PSS-signed certificate -// * that our client can use rsa_pss_rsae_sha256 in its CertificateVerify -// * that our client can accpet rsa_pss_rsae_sha256 in the server CertificateVerify +// TestHandshakeClientCertRSAPSS tests rsa_pss_rsae_sha256 signatures from both +// client and server certificates. It also serves from both sides a certificate +// signed itself with RSA-PSS, mostly to check that crypto/x509 chain validation +// works. func TestHandshakeClientCertRSAPSS(t *testing.T) { - issuer, err := x509.ParseCertificate(testRSAPSSCertificate) + cert, err := x509.ParseCertificate(testRSAPSSCertificate) if err != nil { panic(err) } rootCAs := x509.NewCertPool() - rootCAs.AddCert(issuer) + rootCAs.AddCert(cert) config := testConfig.Clone() - cert, _ := X509KeyPair([]byte(clientCertificatePEM), []byte(clientKeyPEM)) - config.Certificates = []Certificate{cert} + // Use GetClientCertificate to bypass the client certificate selection logic. + config.GetClientCertificate = func(*CertificateRequestInfo) (*Certificate, error) { + return &Certificate{ + Certificate: [][]byte{testRSAPSSCertificate}, + PrivateKey: testRSAPrivateKey, + }, nil + } config.RootCAs = rootCAs test := &clientTest{ @@ -835,9 +843,19 @@ func TestHandshakeClientCertRSAPSS(t *testing.T) { cert: testRSAPSSCertificate, key: testRSAPrivateKey, } + runClientTestTLS13(t, test) + // In our TLS 1.2 client, RSA-PSS is only supported for server certificates. + // See Issue 32425. + test = &clientTest{ + name: "ClientCert-RSA-RSAPSS", + args: []string{"-cipher", "AES128", "-Verify", "1", "-client_sigalgs", + "rsa_pkcs1_sha256", "-sigalgs", "rsa_pss_rsae_sha256"}, + config: config, + cert: testRSAPSSCertificate, + key: testRSAPrivateKey, + } runClientTestTLS12(t, test) - runClientTestTLS13(t, test) } func TestHandshakeClientCertRSAPKCS1v15(t *testing.T) { @@ -855,61 +873,6 @@ func TestHandshakeClientCertRSAPKCS1v15(t *testing.T) { runClientTestTLS12(t, test) } -func TestHandshakeClientCertPSSDisabled(t *testing.T) { - config := testConfig.Clone() - cert, _ := X509KeyPair([]byte(clientCertificatePEM), []byte(clientKeyPEM)) - config.Certificates = []Certificate{cert} - - test := &clientTest{ - name: "ClientCert-RSA-PSS-Disabled", - args: []string{"-cipher", "AES128", "-Verify", "1"}, - config: config, - } - - // Restore the default signature algorithms, disabling RSA-PSS in TLS 1.2, - // and check that handshakes still work. - testSupportedSignatureAlgorithmsTLS12 := supportedSignatureAlgorithmsTLS12 - defer func() { supportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }() - supportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12 - - // Use t.Run to ensure the defer runs after all parallel tests end. - t.Run("1024", func(t *testing.T) { - runClientTestTLS12(t, test) - runClientTestTLS13(t, test) - }) - - // Use a 512-bit key to check that the TLS 1.2 handshake is actually using - // PKCS#1 v1.5. PSS would be failing here. - cert, err := X509KeyPair([]byte(`-----BEGIN CERTIFICATE----- -MIIBcTCCARugAwIBAgIQGjQnkCFlUqaFlt6ixyz/tDANBgkqhkiG9w0BAQsFADAS -MRAwDgYDVQQKEwdBY21lIENvMB4XDTE5MDExODIzMjMyOFoXDTIwMDExODIzMjMy -OFowEjEQMA4GA1UEChMHQWNtZSBDbzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDd -ez1rFUDwax2HTxbcnFUP9AhcgEGMHVV2nn4VVEWFJB6I8C/Nkx0XyyQlrmFYBzEQ -nIPhKls4T0hFoLvjJnXpAgMBAAGjTTBLMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE -DDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBYGA1UdEQQPMA2CC2V4YW1wbGUu -Y29tMA0GCSqGSIb3DQEBCwUAA0EAxDuUS+BrrS3c+h+k+fQPOmOScy6yTX9mHw0Q -KbucGamXYEy0URIwOdO0tQ3LHPc1YGvYSPwkDjkjqECs2Vm/AA== ------END CERTIFICATE-----`), []byte(`-----BEGIN RSA PRIVATE KEY----- -MIIBOgIBAAJBAN17PWsVQPBrHYdPFtycVQ/0CFyAQYwdVXaefhVURYUkHojwL82T -HRfLJCWuYVgHMRCcg+EqWzhPSEWgu+MmdekCAwEAAQJBALjQYNTdXF4CFBbXwUz/ -yt9QFDYT9B5WT/12jeGAe653gtYS6OOi/+eAkGmzg1GlRnw6fOfn+HYNFDORST7z -4j0CIQDn2xz9hVWQEu9ee3vecNT3f60huDGTNoRhtqgweQGX0wIhAPSLj1VcRZEz -nKpbtU22+PbIMSJ+e80fmY9LIPx5N4HTAiAthGSimMR9bloz0EY3GyuUEyqoDgMd -hXxjuno2WesoJQIgemilbcALXpxsLmZLgcQ2KSmaVr7jb5ECx9R+hYKTw1sCIG4s -T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g ------END RSA PRIVATE KEY-----`)) - if err != nil { - t.Fatal(err) - } - - test.name = "ClientCert-RSA-PSS-Disabled-512" - config.Certificates = []Certificate{cert} - - t.Run("512", func(t *testing.T) { - runClientTestTLS12(t, test) - }) -} - func TestClientKeyUpdate(t *testing.T) { test := &clientTest{ name: "KeyUpdate", @@ -925,6 +888,9 @@ func TestResumption(t *testing.T) { } func testResumption(t *testing.T, version uint16) { + if testing.Short() { + t.Skip("skipping in -short mode") + } serverConfig := &Config{ MaxVersion: version, CipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA}, @@ -1772,6 +1738,9 @@ func TestAlertFlushing(t *testing.T) { } func TestHandshakeRace(t *testing.T) { + if testing.Short() { + t.Skip("skipping in -short mode") + } t.Parallel() // This test races a Read and Write to try and complete a handshake in // order to provide some evidence that there are no races or deadlocks diff --git a/libgo/go/crypto/tls/handshake_client_tls13.go b/libgo/go/crypto/tls/handshake_client_tls13.go index 85715b721c0..82207eb646d 100644 --- a/libgo/go/crypto/tls/handshake_client_tls13.go +++ b/libgo/go/crypto/tls/handshake_client_tls13.go @@ -462,10 +462,9 @@ func (hs *clientHandshakeStateTLS13) readServerCertificate() error { c.sendAlert(alertIllegalParameter) return errors.New("tls: invalid certificate signature algorithm") } - h := sigHash.New() - writeSignedMessage(h, serverSignatureContext, hs.transcript) + signed := signedMessage(sigHash, serverSignatureContext, hs.transcript) if err := verifyHandshakeSignature(sigType, c.peerCertificates[0].PublicKey, - sigHash, h.Sum(nil), certVerify.signature); err != nil { + sigHash, signed, certVerify.signature); err != nil { c.sendAlert(alertDecryptError) return errors.New("tls: invalid certificate signature") } @@ -580,14 +579,13 @@ func (hs *clientHandshakeStateTLS13) sendClientCertificate() error { if sigType == 0 || err != nil { return c.sendAlert(alertInternalError) } - h := sigHash.New() - writeSignedMessage(h, clientSignatureContext, hs.transcript) + signed := signedMessage(sigHash, clientSignatureContext, hs.transcript) signOpts := crypto.SignerOpts(sigHash) if sigType == signatureRSAPSS { signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: sigHash} } - sig, err := cert.PrivateKey.(crypto.Signer).Sign(c.config.rand(), h.Sum(nil), signOpts) + sig, err := cert.PrivateKey.(crypto.Signer).Sign(c.config.rand(), signed, signOpts) if err != nil { c.sendAlert(alertInternalError) return errors.New("tls: failed to sign handshake: " + err.Error()) diff --git a/libgo/go/crypto/tls/handshake_messages.go b/libgo/go/crypto/tls/handshake_messages.go index c0e049b16f0..2d21377737c 100644 --- a/libgo/go/crypto/tls/handshake_messages.go +++ b/libgo/go/crypto/tls/handshake_messages.go @@ -6,7 +6,7 @@ package tls import ( "fmt" - "internal/x/crypto/cryptobyte" + "golang.org/x/crypto/cryptobyte" "strings" ) @@ -320,7 +320,7 @@ func (m *clientHelloMsg) marshalWithoutBinders() []byte { } // updateBinders updates the m.pskBinders field, if necessary updating the -// cached marshalled representation. The supplied binders must have the same +// cached marshaled representation. The supplied binders must have the same // length as the current m.pskBinders. func (m *clientHelloMsg) updateBinders(pskBinders [][]byte) { if len(pskBinders) != len(m.pskBinders) { diff --git a/libgo/go/crypto/tls/handshake_server.go b/libgo/go/crypto/tls/handshake_server.go index 4f4b60ae2ce..a3d8848caf9 100644 --- a/libgo/go/crypto/tls/handshake_server.go +++ b/libgo/go/crypto/tls/handshake_server.go @@ -7,6 +7,7 @@ package tls import ( "crypto" "crypto/ecdsa" + "crypto/ed25519" "crypto/rsa" "crypto/subtle" "crypto/x509" @@ -23,8 +24,8 @@ type serverHandshakeState struct { clientHello *clientHelloMsg hello *serverHelloMsg suite *cipherSuite - ellipticOk bool - ecdsaOk bool + ecdhOk bool + ecSignOk bool rsaDecryptOk bool rsaSignOk bool sessionState *sessionState @@ -193,7 +194,7 @@ Curves: break } } - hs.ellipticOk = supportedCurve && supportedPointFormat + hs.ecdhOk = supportedCurve && supportedPointFormat foundCompression := false // We only support null compression, so check that the client offered it. @@ -266,7 +267,9 @@ Curves: if priv, ok := hs.cert.PrivateKey.(crypto.Signer); ok { switch priv.Public().(type) { case *ecdsa.PublicKey: - hs.ecdsaOk = true + hs.ecSignOk = true + case ed25519.PublicKey: + hs.ecSignOk = true case *rsa.PublicKey: hs.rsaSignOk = true default: @@ -454,9 +457,10 @@ func (hs *serverHandshakeState) doFullHandshake() error { } } + var certReq *certificateRequestMsg if c.config.ClientAuth >= RequestClientCert { // Request a client certificate - certReq := new(certificateRequestMsg) + certReq = new(certificateRequestMsg) certReq.certificateTypes = []byte{ byte(certTypeRSASign), byte(certTypeECDSASign), @@ -559,15 +563,15 @@ func (hs *serverHandshakeState) doFullHandshake() error { } // Determine the signature type. - _, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, supportedSignatureAlgorithmsTLS12, c.vers) + _, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, certReq.supportedSignatureAlgorithms, c.vers) if err != nil { c.sendAlert(alertIllegalParameter) return err } - var digest []byte - if digest, err = hs.finishedHash.hashForClientCertificate(sigType, hashFunc, hs.masterSecret); err == nil { - err = verifyHandshakeSignature(sigType, pub, hashFunc, digest, certVerify.signature) + signed, err := hs.finishedHash.hashForClientCertificate(sigType, hashFunc, hs.masterSecret) + if err == nil { + err = verifyHandshakeSignature(sigType, pub, hashFunc, signed, certVerify.signature) } if err != nil { c.sendAlert(alertBadCertificate) @@ -754,7 +758,7 @@ func (c *Conn) processCertsFromClient(certificate Certificate) error { } switch certs[0].PublicKey.(type) { - case *ecdsa.PublicKey, *rsa.PublicKey: + case *ecdsa.PublicKey, *rsa.PublicKey, ed25519.PublicKey: default: c.sendAlert(alertUnsupportedCertificate) return fmt.Errorf("tls: client's certificate contains an unsupported public key of type %T", certs[0].PublicKey) @@ -771,33 +775,34 @@ func (c *Conn) processCertsFromClient(certificate Certificate) error { // It returns a bool indicating if the suite was set. func (hs *serverHandshakeState) setCipherSuite(id uint16, supportedCipherSuites []uint16, version uint16) bool { for _, supported := range supportedCipherSuites { - if id == supported { - candidate := cipherSuiteByID(id) - if candidate == nil { + if id != supported { + continue + } + candidate := cipherSuiteByID(id) + if candidate == nil { + continue + } + // Don't select a ciphersuite which we can't + // support for this client. + if candidate.flags&suiteECDHE != 0 { + if !hs.ecdhOk { continue } - // Don't select a ciphersuite which we can't - // support for this client. - if candidate.flags&suiteECDHE != 0 { - if !hs.ellipticOk { - continue - } - if candidate.flags&suiteECDSA != 0 { - if !hs.ecdsaOk { - continue - } - } else if !hs.rsaSignOk { + if candidate.flags&suiteECSign != 0 { + if !hs.ecSignOk { continue } - } else if !hs.rsaDecryptOk { + } else if !hs.rsaSignOk { continue } - if version < VersionTLS12 && candidate.flags&suiteTLS12 != 0 { - continue - } - hs.suite = candidate - return true + } else if !hs.rsaDecryptOk { + continue + } + if version < VersionTLS12 && candidate.flags&suiteTLS12 != 0 { + continue } + hs.suite = candidate + return true } return false } diff --git a/libgo/go/crypto/tls/handshake_server_test.go b/libgo/go/crypto/tls/handshake_server_test.go index c23f98f6bc5..22b126fa22d 100644 --- a/libgo/go/crypto/tls/handshake_server_test.go +++ b/libgo/go/crypto/tls/handshake_server_test.go @@ -7,17 +7,11 @@ package tls import ( "bytes" "crypto" - "crypto/ecdsa" "crypto/elliptic" - "crypto/rsa" - "crypto/x509" - "encoding/hex" "encoding/pem" "errors" "fmt" "io" - "io/ioutil" - "math/big" "net" "os" "os/exec" @@ -27,52 +21,6 @@ import ( "time" ) -// zeroSource is an io.Reader that returns an unlimited number of zero bytes. -type zeroSource struct{} - -func (zeroSource) Read(b []byte) (n int, err error) { - for i := range b { - b[i] = 0 - } - - return len(b), nil -} - -var testConfig *Config - -func allCipherSuites() []uint16 { - ids := make([]uint16, len(cipherSuites)) - for i, suite := range cipherSuites { - ids[i] = suite.id - } - - return ids -} - -func init() { - testConfig = &Config{ - Time: func() time.Time { return time.Unix(0, 0) }, - Rand: zeroSource{}, - Certificates: make([]Certificate, 2), - InsecureSkipVerify: true, - MinVersion: VersionSSL30, - MaxVersion: VersionTLS13, - CipherSuites: allCipherSuites(), - } - testConfig.Certificates[0].Certificate = [][]byte{testRSACertificate} - testConfig.Certificates[0].PrivateKey = testRSAPrivateKey - testConfig.Certificates[1].Certificate = [][]byte{testSNICertificate} - testConfig.Certificates[1].PrivateKey = testRSAPrivateKey - testConfig.BuildNameToCertificate() - if keyFile := os.Getenv("SSLKEYLOGFILE"); keyFile != "" { - f, err := os.OpenFile(keyFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) - if err != nil { - panic("failed to open SSLKEYLOGFILE: " + err.Error()) - } - testConfig.KeyLogWriter = f - } -} - func testClientHello(t *testing.T, serverConfig *Config, m handshakeMessage) { testClientHelloFailure(t, serverConfig, m, "") } @@ -347,46 +295,6 @@ func TestClose(t *testing.T) { } } -func testHandshake(t *testing.T, clientConfig, serverConfig *Config) (serverState, clientState ConnectionState, err error) { - c, s := localPipe(t) - errChan := make(chan error) - go func() { - cli := Client(c, clientConfig) - err := cli.Handshake() - if err != nil { - errChan <- fmt.Errorf("client: %v", err) - c.Close() - return - } - defer cli.Close() - clientState = cli.ConnectionState() - buf, err := ioutil.ReadAll(cli) - if err != nil { - t.Errorf("failed to call cli.Read: %v", err) - } - if got := string(buf); got != opensslSentinel { - t.Errorf("read %q from TLS connection, but expected %q", got, opensslSentinel) - } - errChan <- nil - }() - server := Server(s, serverConfig) - err = server.Handshake() - if err == nil { - serverState = server.ConnectionState() - if _, err := io.WriteString(server, opensslSentinel); err != nil { - t.Errorf("failed to call server.Write: %v", err) - } - if err := server.Close(); err != nil { - t.Errorf("failed to call server.Close: %v", err) - } - err = <-errChan - } else { - s.Close() - <-errChan - } - return -} - func TestVersion(t *testing.T) { serverConfig := &Config{ Certificates: testConfig.Certificates, @@ -632,8 +540,6 @@ func (test *serverTest) loadData() (flows [][]byte, err error) { } func (test *serverTest) run(t *testing.T, write bool) { - checkOpenSSLVersion(t) - var clientConn, serverConn net.Conn var recordingConn *recordingConn var childProcess *exec.Cmd @@ -684,12 +590,20 @@ func (test *serverTest) run(t *testing.T, write bool) { } for i, b := range flows { if i%2 == 0 { - clientConn.SetWriteDeadline(time.Now().Add(1 * time.Minute)) + if *fast { + clientConn.SetWriteDeadline(time.Now().Add(1 * time.Second)) + } else { + clientConn.SetWriteDeadline(time.Now().Add(1 * time.Minute)) + } clientConn.Write(b) continue } bb := make([]byte, len(b)) - clientConn.SetReadDeadline(time.Now().Add(1 * time.Minute)) + if *fast { + clientConn.SetReadDeadline(time.Now().Add(1 * time.Second)) + } else { + clientConn.SetReadDeadline(time.Now().Add(1 * time.Minute)) + } n, err := io.ReadFull(clientConn, bb) if err != nil { t.Fatalf("%s #%d: %s\nRead %d, wanted %d, got %x, wanted %x\n", test.name, i+1, err, n, len(bb), bb[:n], b) @@ -1204,38 +1118,33 @@ func TestHandshakeServerRSAPKCS1v15(t *testing.T) { func TestHandshakeServerRSAPSS(t *testing.T) { test := &serverTest{ + name: "RSA-RSAPSS", + command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha256"}, + expectHandshakeErrorIncluding: "peer doesn't support any common signature algorithms", // See Issue 32425. + } + runServerTestTLS12(t, test) + + test = &serverTest{ name: "RSA-RSAPSS", command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha256"}, } - runServerTestTLS12(t, test) runServerTestTLS13(t, test) } -func TestHandshakeServerPSSDisabled(t *testing.T) { +func TestHandshakeServerEd25519(t *testing.T) { + config := testConfig.Clone() + config.Certificates = make([]Certificate, 1) + config.Certificates[0].Certificate = [][]byte{testEd25519Certificate} + config.Certificates[0].PrivateKey = testEd25519PrivateKey + config.BuildNameToCertificate() + test := &serverTest{ - name: "RSA-PSS-Disabled", + name: "Ed25519", command: []string{"openssl", "s_client", "-no_ticket"}, - wait: true, + config: config, } - - // Restore the default signature algorithms, disabling RSA-PSS in TLS 1.2, - // and check that handshakes still work. - testSupportedSignatureAlgorithmsTLS12 := supportedSignatureAlgorithmsTLS12 - defer func() { supportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }() - supportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12 - runServerTestTLS12(t, test) runServerTestTLS13(t, test) - - test = &serverTest{ - name: "RSA-PSS-Disabled-Required", - command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha256"}, - wait: true, - - expectHandshakeErrorIncluding: "peer doesn't support any common signature algorithms", - } - - runServerTestTLS12(t, test) } func benchmarkHandshakeServer(b *testing.B, version uint16, cipherSuite uint16, curve CurveID, cert []byte, key crypto.PrivateKey) { @@ -1346,67 +1255,8 @@ func BenchmarkHandshakeServer(b *testing.B) { }) } -const clientCertificatePEM = ` ------BEGIN CERTIFICATE----- -MIIB7zCCAVigAwIBAgIQXBnBiWWDVW/cC8m5k5/pvDANBgkqhkiG9w0BAQsFADAS -MRAwDgYDVQQKEwdBY21lIENvMB4XDTE2MDgxNzIxNTIzMVoXDTE3MDgxNzIxNTIz -MVowEjEQMA4GA1UEChMHQWNtZSBDbzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC -gYEAum+qhr3Pv5/y71yUYHhv6BPy0ZZvzdkybiI3zkH5yl0prOEn2mGi7oHLEMff -NFiVhuk9GeZcJ3NgyI14AvQdpJgJoxlwaTwlYmYqqyIjxXuFOE8uCXMyp70+m63K -hAfmDzr/d8WdQYUAirab7rCkPy1MTOZCPrtRyN1IVPQMjkcCAwEAAaNGMEQwDgYD -VR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMAwGA1UdEwEB/wQCMAAw -DwYDVR0RBAgwBocEfwAAATANBgkqhkiG9w0BAQsFAAOBgQBGq0Si+yhU+Fpn+GKU -8ZqyGJ7ysd4dfm92lam6512oFmyc9wnTN+RLKzZ8Aa1B0jLYw9KT+RBrjpW5LBeK -o0RIvFkTgxYEiKSBXCUNmAysEbEoVr4dzWFihAm/1oDGRY2CLLTYg5vbySK3KhIR -e/oCO8HJ/+rJnahJ05XX1Q7lNQ== ------END CERTIFICATE-----` - -const clientKeyPEM = ` ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQC6b6qGvc+/n/LvXJRgeG/oE/LRlm/N2TJuIjfOQfnKXSms4Sfa -YaLugcsQx980WJWG6T0Z5lwnc2DIjXgC9B2kmAmjGXBpPCViZiqrIiPFe4U4Ty4J -czKnvT6brcqEB+YPOv93xZ1BhQCKtpvusKQ/LUxM5kI+u1HI3UhU9AyORwIDAQAB -AoGAEJZ03q4uuMb7b26WSQsOMeDsftdatT747LGgs3pNRkMJvTb/O7/qJjxoG+Mc -qeSj0TAZXp+PXXc3ikCECAc+R8rVMfWdmp903XgO/qYtmZGCorxAHEmR80SrfMXv -PJnznLQWc8U9nphQErR+tTESg7xWEzmFcPKwnZd1xg8ERYkCQQDTGtrFczlB2b/Z -9TjNMqUlMnTLIk/a/rPE2fLLmAYhK5sHnJdvDURaH2mF4nso0EGtENnTsh6LATnY -dkrxXGm9AkEA4hXHG2q3MnhgK1Z5hjv+Fnqd+8bcbII9WW4flFs15EKoMgS1w/PJ -zbsySaSy5IVS8XeShmT9+3lrleed4sy+UwJBAJOOAbxhfXP5r4+5R6ql66jES75w -jUCVJzJA5ORJrn8g64u2eGK28z/LFQbv9wXgCwfc72R468BdawFSLa/m2EECQGbZ -rWiFla26IVXV0xcD98VWJsTBZMlgPnSOqoMdM1kSEd4fUmlAYI/dFzV1XYSkOmVr -FhdZnklmpVDeu27P4c0CQQCuCOup0FlJSBpWY1TTfun/KMBkBatMz0VMA3d7FKIU -csPezl677Yjo8u1r/KzeI6zLg87Z8E6r6ZWNc9wBSZK6 ------END RSA PRIVATE KEY-----` - -const clientECDSACertificatePEM = ` ------BEGIN CERTIFICATE----- -MIIB/DCCAV4CCQCaMIRsJjXZFzAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw -EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 -eSBMdGQwHhcNMTIxMTE0MTMyNTUzWhcNMjIxMTEyMTMyNTUzWjBBMQswCQYDVQQG -EwJBVTEMMAoGA1UECBMDTlNXMRAwDgYDVQQHEwdQeXJtb250MRIwEAYDVQQDEwlK -b2VsIFNpbmcwgZswEAYHKoZIzj0CAQYFK4EEACMDgYYABACVjJF1FMBexFe01MNv -ja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd3kfDdq0Z9kUs -jLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx+U56jb0JuK7q -ixgnTy5w/hOWusPTQBbNZU6sER7m8TAJBgcqhkjOPQQBA4GMADCBiAJCAOAUxGBg -C3JosDJdYUoCdFzCgbkWqD8pyDbHgf9stlvZcPE4O1BIKJTLCRpS8V3ujfK58PDa -2RU6+b0DeoeiIzXsAkIBo9SKeDUcSpoj0gq+KxAxnZxfvuiRs9oa9V2jI/Umi0Vw -jWVim34BmT0Y9hCaOGGbLlfk+syxis7iI6CH8OFnUes= ------END CERTIFICATE-----` - -const clientECDSAKeyPEM = ` ------BEGIN EC PARAMETERS----- -BgUrgQQAIw== ------END EC PARAMETERS----- ------BEGIN EC PRIVATE KEY----- -MIHcAgEBBEIBkJN9X4IqZIguiEVKMqeBUP5xtRsEv4HJEtOpOGLELwO53SD78Ew8 -k+wLWoqizS3NpQyMtrU8JFdWfj+C57UNkOugBwYFK4EEACOhgYkDgYYABACVjJF1 -FMBexFe01MNvja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd -3kfDdq0Z9kUsjLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx -+U56jb0JuK7qixgnTy5w/hOWusPTQBbNZU6sER7m8Q== ------END EC PRIVATE KEY-----` - func TestClientAuth(t *testing.T) { - var certPath, keyPath, ecdsaCertPath, ecdsaKeyPath string + var certPath, keyPath, ecdsaCertPath, ecdsaKeyPath, ed25519CertPath, ed25519KeyPath string if *update { certPath = tempFile(clientCertificatePEM) @@ -1417,82 +1267,70 @@ func TestClientAuth(t *testing.T) { defer os.Remove(ecdsaCertPath) ecdsaKeyPath = tempFile(clientECDSAKeyPEM) defer os.Remove(ecdsaKeyPath) + ed25519CertPath = tempFile(clientEd25519CertificatePEM) + defer os.Remove(ed25519CertPath) + ed25519KeyPath = tempFile(clientEd25519KeyPEM) + defer os.Remove(ed25519KeyPath) + } else { + t.Parallel() } - t.Run("Normal", func(t *testing.T) { - config := testConfig.Clone() - config.ClientAuth = RequestClientCert - - test := &serverTest{ - name: "ClientAuthRequestedNotGiven", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA"}, - config: config, - } - runServerTestTLS12(t, test) - runServerTestTLS13(t, test) - - config.ClientAuth = RequireAnyClientCert + config := testConfig.Clone() + config.ClientAuth = RequestClientCert - test = &serverTest{ - name: "ClientAuthRequestedAndGiven", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pss_rsae_sha256"}, - config: config, - expectedPeerCerts: []string{clientCertificatePEM}, - } - runServerTestTLS12(t, test) - runServerTestTLS13(t, test) - - test = &serverTest{ - name: "ClientAuthRequestedAndECDSAGiven", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", ecdsaCertPath, "-key", ecdsaKeyPath}, - config: config, - expectedPeerCerts: []string{clientECDSACertificatePEM}, - } - runServerTestTLS12(t, test) - runServerTestTLS13(t, test) - - test = &serverTest{ - name: "ClientAuthRequestedAndPKCS1v15Given", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pkcs1_sha256"}, - config: config, - expectedPeerCerts: []string{clientCertificatePEM}, - } - runServerTestTLS12(t, test) - }) + test := &serverTest{ + name: "ClientAuthRequestedNotGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA"}, + config: config, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) - // Restore the default signature algorithms, disabling RSA-PSS in TLS 1.2, - // and check that handshakes still work. - testSupportedSignatureAlgorithmsTLS12 := supportedSignatureAlgorithmsTLS12 - defer func() { supportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }() - supportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12 + test = &serverTest{ + name: "ClientAuthRequestedAndGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", + "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pss_rsae_sha256"}, + config: config, + expectedPeerCerts: []string{}, // See Issue 32425. + } + runServerTestTLS12(t, test) + test = &serverTest{ + name: "ClientAuthRequestedAndGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", + "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pss_rsae_sha256"}, + config: config, + expectedPeerCerts: []string{clientCertificatePEM}, + } + runServerTestTLS13(t, test) - t.Run("PSSDisabled", func(t *testing.T) { - config := testConfig.Clone() - config.ClientAuth = RequireAnyClientCert - - test := &serverTest{ - name: "ClientAuthRequestedAndGiven-PSS-Disabled", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", certPath, "-key", keyPath}, - config: config, - expectedPeerCerts: []string{clientCertificatePEM}, - } - runServerTestTLS12(t, test) - runServerTestTLS13(t, test) + test = &serverTest{ + name: "ClientAuthRequestedAndECDSAGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", + "-cert", ecdsaCertPath, "-key", ecdsaKeyPath}, + config: config, + expectedPeerCerts: []string{clientECDSACertificatePEM}, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) - test = &serverTest{ - name: "ClientAuthRequestedAndGiven-PSS-Disabled-Required", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pss_rsae_sha256"}, - config: config, + test = &serverTest{ + name: "ClientAuthRequestedAndEd25519Given", + command: []string{"openssl", "s_client", "-no_ticket", + "-cert", ed25519CertPath, "-key", ed25519KeyPath}, + config: config, + expectedPeerCerts: []string{clientEd25519CertificatePEM}, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) - expectHandshakeErrorIncluding: "client didn't provide a certificate", - } - runServerTestTLS12(t, test) - }) + test = &serverTest{ + name: "ClientAuthRequestedAndPKCS1v15Given", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", + "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pkcs1_sha256"}, + config: config, + expectedPeerCerts: []string{clientCertificatePEM}, + } + runServerTestTLS12(t, test) } func TestSNIGivenOnFailure(t *testing.T) { @@ -1680,55 +1518,6 @@ func TestGetConfigForClient(t *testing.T) { } } -func bigFromString(s string) *big.Int { - ret := new(big.Int) - ret.SetString(s, 10) - return ret -} - -func fromHex(s string) []byte { - b, _ := hex.DecodeString(s) - return b -} - -var testRSACertificate = fromHex("3082024b308201b4a003020102020900e8f09d3fe25beaa6300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a301a310b3009060355040a1302476f310b300906035504031302476f30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a38193308190300e0603551d0f0101ff0404030205a0301d0603551d250416301406082b0601050507030106082b06010505070302300c0603551d130101ff0402300030190603551d0e041204109f91161f43433e49a6de6db680d79f60301b0603551d230414301280104813494d137e1631bba301d5acab6e7b30190603551d1104123010820e6578616d706c652e676f6c616e67300d06092a864886f70d01010b0500038181009d30cc402b5b50a061cbbae55358e1ed8328a9581aa938a495a1ac315a1a84663d43d32dd90bf297dfd320643892243a00bccf9c7db74020015faad3166109a276fd13c3cce10c5ceeb18782f16c04ed73bbb343778d0c1cf10fa1d8408361c94c722b9daedb4606064df4c1b33ec0d1bd42d4dbfe3d1360845c21d33be9fae7") - -var testRSACertificateIssuer = fromHex("3082021930820182a003020102020900ca5e4e811a965964300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f7430819f300d06092a864886f70d010101050003818d0030818902818100d667b378bb22f34143b6cd2008236abefaf2852adf3ab05e01329e2c14834f5105df3f3073f99dab5442d45ee5f8f57b0111c8cb682fbb719a86944eebfffef3406206d898b8c1b1887797c9c5006547bb8f00e694b7a063f10839f269f2c34fff7a1f4b21fbcd6bfdfb13ac792d1d11f277b5c5b48600992203059f2a8f8cc50203010001a35d305b300e0603551d0f0101ff040403020204301d0603551d250416301406082b0601050507030106082b06010505070302300f0603551d130101ff040530030101ff30190603551d0e041204104813494d137e1631bba301d5acab6e7b300d06092a864886f70d01010b050003818100c1154b4bab5266221f293766ae4138899bd4c5e36b13cee670ceeaa4cbdf4f6679017e2fe649765af545749fe4249418a56bd38a04b81e261f5ce86b8d5c65413156a50d12449554748c59a30c515bc36a59d38bddf51173e899820b282e40aa78c806526fd184fb6b4cf186ec728edffa585440d2b3225325f7ab580e87dd76") - -// testRSAPSSCertificate has signatureAlgorithm rsassaPss, and subjectPublicKeyInfo -// algorithm rsaEncryption, for use with the rsa_pss_rsae_* SignatureSchemes. -// See also TestRSAPSSKeyError. testRSAPSSCertificate is self-signed. -var testRSAPSSCertificate = fromHex("308202583082018da003020102021100f29926eb87ea8a0db9fcc247347c11b0304106092a864886f70d01010a3034a00f300d06096086480165030402010500a11c301a06092a864886f70d010108300d06096086480165030402010500a20302012030123110300e060355040a130741636d6520436f301e170d3137313132333136313631305a170d3138313132333136313631305a30123110300e060355040a130741636d6520436f30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a3463044300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff04023000300f0603551d110408300687047f000001304106092a864886f70d01010a3034a00f300d06096086480165030402010500a11c301a06092a864886f70d010108300d06096086480165030402010500a20302012003818100cdac4ef2ce5f8d79881042707f7cbf1b5a8a00ef19154b40151771006cd41626e5496d56da0c1a139fd84695593cb67f87765e18aa03ea067522dd78d2a589b8c92364e12838ce346c6e067b51f1a7e6f4b37ffab13f1411896679d18e880e0ba09e302ac067efca460288e9538122692297ad8093d4f7dd701424d7700a46a1") - -var testECDSACertificate = fromHex("3082020030820162020900b8bf2d47a0d2ebf4300906072a8648ce3d04013045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c7464301e170d3132313132323135303633325a170d3232313132303135303633325a3045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c746430819b301006072a8648ce3d020106052b81040023038186000400c4a1edbe98f90b4873367ec316561122f23d53c33b4d213dcd6b75e6f6b0dc9adf26c1bcb287f072327cb3642f1c90bcea6823107efee325c0483a69e0286dd33700ef0462dd0da09c706283d881d36431aa9e9731bd96b068c09b23de76643f1a5c7fe9120e5858b65f70dd9bd8ead5d7f5d5ccb9b69f30665b669a20e227e5bffe3b300906072a8648ce3d040103818c0030818802420188a24febe245c5487d1bacf5ed989dae4770c05e1bb62fbdf1b64db76140d311a2ceee0b7e927eff769dc33b7ea53fcefa10e259ec472d7cacda4e970e15a06fd00242014dfcbe67139c2d050ebd3fa38c25c13313830d9406bbd4377af6ec7ac9862eddd711697f857c56defb31782be4c7780daecbbe9e4e3624317b6a0f399512078f2a") - -var testSNICertificate = fromHex("0441883421114c81480804c430820237308201a0a003020102020900e8f09d3fe25beaa6300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a3023310b3009060355040a1302476f311430120603550403130b736e69746573742e636f6d30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a3773075300e0603551d0f0101ff0404030205a0301d0603551d250416301406082b0601050507030106082b06010505070302300c0603551d130101ff0402300030190603551d0e041204109f91161f43433e49a6de6db680d79f60301b0603551d230414301280104813494d137e1631bba301d5acab6e7b300d06092a864886f70d01010b0500038181007beeecff0230dbb2e7a334af65430b7116e09f327c3bbf918107fc9c66cb497493207ae9b4dbb045cb63d605ec1b5dd485bb69124d68fa298dc776699b47632fd6d73cab57042acb26f083c4087459bc5a3bb3ca4d878d7fe31016b7bc9a627438666566e3389bfaeebe6becc9a0093ceed18d0f9ac79d56f3a73f18188988ed") - -var testP256Certificate = fromHex("308201693082010ea00302010202105012dc24e1124ade4f3e153326ff27bf300a06082a8648ce3d04030230123110300e060355040a130741636d6520436f301e170d3137303533313232343934375a170d3138303533313232343934375a30123110300e060355040a130741636d6520436f3059301306072a8648ce3d020106082a8648ce3d03010703420004c02c61c9b16283bbcc14956d886d79b358aa614596975f78cece787146abf74c2d5dc578c0992b4f3c631373479ebf3892efe53d21c4f4f1cc9a11c3536b7f75a3463044300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff04023000300f0603551d1104083006820474657374300a06082a8648ce3d0403020349003046022100963712d6226c7b2bef41512d47e1434131aaca3ba585d666c924df71ac0448b3022100f4d05c725064741aef125f243cdbccaa2a5d485927831f221c43023bd5ae471a") - -var testRSAPrivateKey = &rsa.PrivateKey{ - PublicKey: rsa.PublicKey{ - N: bigFromString("153980389784927331788354528594524332344709972855165340650588877572729725338415474372475094155672066328274535240275856844648695200875763869073572078279316458648124537905600131008790701752441155668003033945258023841165089852359980273279085783159654751552359397986180318708491098942831252291841441726305535546071"), - E: 65537, - }, - D: bigFromString("7746362285745539358014631136245887418412633787074173796862711588221766398229333338511838891484974940633857861775630560092874987828057333663969469797013996401149696897591265769095952887917296740109742927689053276850469671231961384712725169432413343763989564437170644270643461665184965150423819594083121075825"), - Primes: []*big.Int{ - bigFromString("13299275414352936908236095374926261633419699590839189494995965049151460173257838079863316944311313904000258169883815802963543635820059341150014695560313417"), - bigFromString("11578103692682951732111718237224894755352163854919244905974423810539077224889290605729035287537520656160688625383765857517518932447378594964220731750802463"), - }, -} - -var testECDSAPrivateKey = &ecdsa.PrivateKey{ - PublicKey: ecdsa.PublicKey{ - Curve: elliptic.P521(), - X: bigFromString("2636411247892461147287360222306590634450676461695221912739908880441342231985950069527906976759812296359387337367668045707086543273113073382714101597903639351"), - Y: bigFromString("3204695818431246682253994090650952614555094516658732116404513121125038617915183037601737180082382202488628239201196033284060130040574800684774115478859677243"), - }, - D: bigFromString("5477294338614160138026852784385529180817726002953041720191098180813046231640184669647735805135001309477695746518160084669446643325196003346204701381388769751"), -} - -var testP256PrivateKey, _ = x509.ParseECPrivateKey(fromHex("30770201010420012f3b52bc54c36ba3577ad45034e2e8efe1e6999851284cb848725cfe029991a00a06082a8648ce3d030107a14403420004c02c61c9b16283bbcc14956d886d79b358aa614596975f78cece787146abf74c2d5dc578c0992b4f3c631373479ebf3892efe53d21c4f4f1cc9a11c3536b7f75")) - func TestCloseServerConnectionOnIdleClient(t *testing.T) { clientConn, serverConn := localPipe(t) server := Server(serverConn, testConfig.Clone()) @@ -1758,9 +1547,15 @@ func TestCloneHash(t *testing.T) { } } +func expectError(t *testing.T, err error, sub string) { + if err == nil { + t.Errorf(`expected error %q, got nil`, sub) + } else if !strings.Contains(err.Error(), sub) { + t.Errorf(`expected error %q, got %q`, sub, err) + } +} + func TestKeyTooSmallForRSAPSS(t *testing.T) { - clientConn, serverConn := localPipe(t) - client := Client(clientConn, testConfig) cert, err := X509KeyPair([]byte(`-----BEGIN CERTIFICATE----- MIIBcTCCARugAwIBAgIQGjQnkCFlUqaFlt6ixyz/tDANBgkqhkiG9w0BAQsFADAS MRAwDgYDVQQKEwdBY21lIENvMB4XDTE5MDExODIzMjMyOFoXDTIwMDExODIzMjMy @@ -1770,7 +1565,7 @@ nIPhKls4T0hFoLvjJnXpAgMBAAGjTTBLMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE DDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBYGA1UdEQQPMA2CC2V4YW1wbGUu Y29tMA0GCSqGSIb3DQEBCwUAA0EAxDuUS+BrrS3c+h+k+fQPOmOScy6yTX9mHw0Q KbucGamXYEy0URIwOdO0tQ3LHPc1YGvYSPwkDjkjqECs2Vm/AA== ------END CERTIFICATE-----`), []byte(`-----BEGIN RSA PRIVATE KEY----- +-----END CERTIFICATE-----`), []byte(testingKey(`-----BEGIN RSA TESTING KEY----- MIIBOgIBAAJBAN17PWsVQPBrHYdPFtycVQ/0CFyAQYwdVXaefhVURYUkHojwL82T HRfLJCWuYVgHMRCcg+EqWzhPSEWgu+MmdekCAwEAAQJBALjQYNTdXF4CFBbXwUz/ yt9QFDYT9B5WT/12jeGAe653gtYS6OOi/+eAkGmzg1GlRnw6fOfn+HYNFDORST7z @@ -1778,11 +1573,13 @@ yt9QFDYT9B5WT/12jeGAe653gtYS6OOi/+eAkGmzg1GlRnw6fOfn+HYNFDORST7z nKpbtU22+PbIMSJ+e80fmY9LIPx5N4HTAiAthGSimMR9bloz0EY3GyuUEyqoDgMd hXxjuno2WesoJQIgemilbcALXpxsLmZLgcQ2KSmaVr7jb5ECx9R+hYKTw1sCIG4s T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g ------END RSA PRIVATE KEY-----`)) +-----END RSA TESTING KEY-----`))) if err != nil { t.Fatal(err) } + clientConn, serverConn := localPipe(t) + client := Client(clientConn, testConfig) done := make(chan struct{}) go func() { config := testConfig.Clone() @@ -1790,23 +1587,14 @@ T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g config.MinVersion = VersionTLS13 server := Server(serverConn, config) err := server.Handshake() - if !strings.Contains(err.Error(), "key size too small for PSS signature") { - t.Errorf(`expected "key size too small for PSS signature", got %q`, err) - } + expectError(t, err, "key size too small for PSS signature") close(done) }() err = client.Handshake() - if !strings.Contains(err.Error(), "handshake failure") { - t.Errorf(`expected "handshake failure", got %q`, err) - } + expectError(t, err, "handshake failure") <-done - // With RSA-PSS disabled and TLS 1.2, this should work. - - testSupportedSignatureAlgorithmsTLS12 := supportedSignatureAlgorithmsTLS12 - defer func() { supportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }() - supportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12 - + // In TLS 1.2 RSA-PSS is not used, so this should succeed. See Issue 32425. serverConfig := testConfig.Clone() serverConfig.Certificates = []Certificate{cert} serverConfig.MaxVersion = VersionTLS12 diff --git a/libgo/go/crypto/tls/handshake_server_tls13.go b/libgo/go/crypto/tls/handshake_server_tls13.go index fd65ac11909..74f430cf8ad 100644 --- a/libgo/go/crypto/tls/handshake_server_tls13.go +++ b/libgo/go/crypto/tls/handshake_server_tls13.go @@ -626,14 +626,13 @@ func (hs *serverHandshakeStateTLS13) sendServerCertificate() error { if sigType == 0 || err != nil { return c.sendAlert(alertInternalError) } - h := sigHash.New() - writeSignedMessage(h, serverSignatureContext, hs.transcript) + signed := signedMessage(sigHash, serverSignatureContext, hs.transcript) signOpts := crypto.SignerOpts(sigHash) if sigType == signatureRSAPSS { signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: sigHash} } - sig, err := hs.cert.PrivateKey.(crypto.Signer).Sign(c.config.rand(), h.Sum(nil), signOpts) + sig, err := hs.cert.PrivateKey.(crypto.Signer).Sign(c.config.rand(), signed, signOpts) if err != nil { public := hs.cert.PrivateKey.(crypto.Signer).Public() if rsaKey, ok := public.(*rsa.PublicKey); ok && sigType == signatureRSAPSS && @@ -815,10 +814,9 @@ func (hs *serverHandshakeStateTLS13) readClientCertificate() error { c.sendAlert(alertIllegalParameter) return errors.New("tls: invalid certificate signature algorithm") } - h := sigHash.New() - writeSignedMessage(h, clientSignatureContext, hs.transcript) + signed := signedMessage(sigHash, clientSignatureContext, hs.transcript) if err := verifyHandshakeSignature(sigType, c.peerCertificates[0].PublicKey, - sigHash, h.Sum(nil), certVerify.signature); err != nil { + sigHash, signed, certVerify.signature); err != nil { c.sendAlert(alertDecryptError) return errors.New("tls: invalid certificate signature") } diff --git a/libgo/go/crypto/tls/handshake_test.go b/libgo/go/crypto/tls/handshake_test.go index aa072cef059..35c1fe8bf58 100644 --- a/libgo/go/crypto/tls/handshake_test.go +++ b/libgo/go/crypto/tls/handshake_test.go @@ -6,6 +6,8 @@ package tls import ( "bufio" + "crypto/ed25519" + "crypto/x509" "encoding/hex" "errors" "flag" @@ -19,6 +21,7 @@ import ( "strings" "sync" "testing" + "time" ) // TLS reference tests run a connection against a reference implementation @@ -39,37 +42,27 @@ import ( // the reference connection will always change. var ( - update = flag.Bool("update", false, "update golden files on disk") - - opensslVersionTestOnce sync.Once - opensslVersionTestErr error + update = flag.Bool("update", false, "update golden files on disk") + fast = flag.Bool("fast", false, "impose a quick, possibly flaky timeout on recorded tests") + keyFile = flag.String("keylog", "", "destination file for KeyLogWriter") ) -func checkOpenSSLVersion(t *testing.T) { - opensslVersionTestOnce.Do(testOpenSSLVersion) - if opensslVersionTestErr != nil { - t.Fatal(opensslVersionTestErr) - } -} - -func testOpenSSLVersion() { - // This test ensures that the version of OpenSSL looks reasonable - // before updating the test data. - +// checkOpenSSLVersion ensures that the version of OpenSSL looks reasonable +// before updating the test data. +func checkOpenSSLVersion() error { if !*update { - return + return nil } openssl := exec.Command("openssl", "version") output, err := openssl.CombinedOutput() if err != nil { - opensslVersionTestErr = err - return + return err } version := string(output) if strings.HasPrefix(version, "OpenSSL 1.1.1") { - return + return nil } println("***********************************************") @@ -82,7 +75,7 @@ func testOpenSSLVersion() { println("and then add the apps/ directory at the front of your PATH.") println("***********************************************") - opensslVersionTestErr = errors.New("version of OpenSSL does not appear to be suitable for updating test data") + return errors.New("version of OpenSSL does not appear to be suitable for updating test data") } // recordingConn is a net.Conn that records the traffic that passes through it. @@ -253,7 +246,45 @@ func localPipe(t testing.TB) (net.Conn, net.Conn) { return c1, c2 } +// zeroSource is an io.Reader that returns an unlimited number of zero bytes. +type zeroSource struct{} + +func (zeroSource) Read(b []byte) (n int, err error) { + for i := range b { + b[i] = 0 + } + + return len(b), nil +} + +func allCipherSuites() []uint16 { + ids := make([]uint16, len(cipherSuites)) + for i, suite := range cipherSuites { + ids[i] = suite.id + } + + return ids +} + +var testConfig *Config + func TestMain(m *testing.M) { + flag.Parse() + os.Exit(runMain(m)) +} + +func runMain(m *testing.M) int { + // TLS 1.3 cipher suites preferences are not configurable and change based + // on the architecture. Force them to the version with AES acceleration for + // test consistency. + once.Do(initDefaultCipherSuites) + varDefaultCipherSuitesTLS13 = []uint16{ + TLS_AES_128_GCM_SHA256, + TLS_CHACHA20_POLY1305_SHA256, + TLS_AES_256_GCM_SHA384, + } + + // Set up localPipe. l, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { l, err = net.Listen("tcp6", "[::1]:0") @@ -263,7 +294,181 @@ func TestMain(m *testing.M) { os.Exit(1) } localListener.Listener = l - exitCode := m.Run() - localListener.Close() - os.Exit(exitCode) + defer localListener.Close() + + if err := checkOpenSSLVersion(); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v", err) + os.Exit(1) + } + + testConfig = &Config{ + Time: func() time.Time { return time.Unix(0, 0) }, + Rand: zeroSource{}, + Certificates: make([]Certificate, 2), + InsecureSkipVerify: true, + MinVersion: VersionSSL30, + MaxVersion: VersionTLS13, + CipherSuites: allCipherSuites(), + } + testConfig.Certificates[0].Certificate = [][]byte{testRSACertificate} + testConfig.Certificates[0].PrivateKey = testRSAPrivateKey + testConfig.Certificates[1].Certificate = [][]byte{testSNICertificate} + testConfig.Certificates[1].PrivateKey = testRSAPrivateKey + testConfig.BuildNameToCertificate() + if *keyFile != "" { + f, err := os.OpenFile(*keyFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + if err != nil { + panic("failed to open -keylog file: " + err.Error()) + } + testConfig.KeyLogWriter = f + defer f.Close() + } + + return m.Run() +} + +func testHandshake(t *testing.T, clientConfig, serverConfig *Config) (serverState, clientState ConnectionState, err error) { + const sentinel = "SENTINEL\n" + c, s := localPipe(t) + errChan := make(chan error) + go func() { + cli := Client(c, clientConfig) + err := cli.Handshake() + if err != nil { + errChan <- fmt.Errorf("client: %v", err) + c.Close() + return + } + defer cli.Close() + clientState = cli.ConnectionState() + buf, err := ioutil.ReadAll(cli) + if err != nil { + t.Errorf("failed to call cli.Read: %v", err) + } + if got := string(buf); got != sentinel { + t.Errorf("read %q from TLS connection, but expected %q", got, sentinel) + } + errChan <- nil + }() + server := Server(s, serverConfig) + err = server.Handshake() + if err == nil { + serverState = server.ConnectionState() + if _, err := io.WriteString(server, sentinel); err != nil { + t.Errorf("failed to call server.Write: %v", err) + } + if err := server.Close(); err != nil { + t.Errorf("failed to call server.Close: %v", err) + } + err = <-errChan + } else { + s.Close() + <-errChan + } + return } + +func fromHex(s string) []byte { + b, _ := hex.DecodeString(s) + return b +} + +var testRSACertificate = fromHex("3082024b308201b4a003020102020900e8f09d3fe25beaa6300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a301a310b3009060355040a1302476f310b300906035504031302476f30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a38193308190300e0603551d0f0101ff0404030205a0301d0603551d250416301406082b0601050507030106082b06010505070302300c0603551d130101ff0402300030190603551d0e041204109f91161f43433e49a6de6db680d79f60301b0603551d230414301280104813494d137e1631bba301d5acab6e7b30190603551d1104123010820e6578616d706c652e676f6c616e67300d06092a864886f70d01010b0500038181009d30cc402b5b50a061cbbae55358e1ed8328a9581aa938a495a1ac315a1a84663d43d32dd90bf297dfd320643892243a00bccf9c7db74020015faad3166109a276fd13c3cce10c5ceeb18782f16c04ed73bbb343778d0c1cf10fa1d8408361c94c722b9daedb4606064df4c1b33ec0d1bd42d4dbfe3d1360845c21d33be9fae7") + +var testRSACertificateIssuer = fromHex("3082021930820182a003020102020900ca5e4e811a965964300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f7430819f300d06092a864886f70d010101050003818d0030818902818100d667b378bb22f34143b6cd2008236abefaf2852adf3ab05e01329e2c14834f5105df3f3073f99dab5442d45ee5f8f57b0111c8cb682fbb719a86944eebfffef3406206d898b8c1b1887797c9c5006547bb8f00e694b7a063f10839f269f2c34fff7a1f4b21fbcd6bfdfb13ac792d1d11f277b5c5b48600992203059f2a8f8cc50203010001a35d305b300e0603551d0f0101ff040403020204301d0603551d250416301406082b0601050507030106082b06010505070302300f0603551d130101ff040530030101ff30190603551d0e041204104813494d137e1631bba301d5acab6e7b300d06092a864886f70d01010b050003818100c1154b4bab5266221f293766ae4138899bd4c5e36b13cee670ceeaa4cbdf4f6679017e2fe649765af545749fe4249418a56bd38a04b81e261f5ce86b8d5c65413156a50d12449554748c59a30c515bc36a59d38bddf51173e899820b282e40aa78c806526fd184fb6b4cf186ec728edffa585440d2b3225325f7ab580e87dd76") + +// testRSAPSSCertificate has signatureAlgorithm rsassaPss, but subjectPublicKeyInfo +// algorithm rsaEncryption, for use with the rsa_pss_rsae_* SignatureSchemes. +// See also TestRSAPSSKeyError. testRSAPSSCertificate is self-signed. +var testRSAPSSCertificate = fromHex("308202583082018da003020102021100f29926eb87ea8a0db9fcc247347c11b0304106092a864886f70d01010a3034a00f300d06096086480165030402010500a11c301a06092a864886f70d010108300d06096086480165030402010500a20302012030123110300e060355040a130741636d6520436f301e170d3137313132333136313631305a170d3138313132333136313631305a30123110300e060355040a130741636d6520436f30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a3463044300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff04023000300f0603551d110408300687047f000001304106092a864886f70d01010a3034a00f300d06096086480165030402010500a11c301a06092a864886f70d010108300d06096086480165030402010500a20302012003818100cdac4ef2ce5f8d79881042707f7cbf1b5a8a00ef19154b40151771006cd41626e5496d56da0c1a139fd84695593cb67f87765e18aa03ea067522dd78d2a589b8c92364e12838ce346c6e067b51f1a7e6f4b37ffab13f1411896679d18e880e0ba09e302ac067efca460288e9538122692297ad8093d4f7dd701424d7700a46a1") + +var testECDSACertificate = fromHex("3082020030820162020900b8bf2d47a0d2ebf4300906072a8648ce3d04013045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c7464301e170d3132313132323135303633325a170d3232313132303135303633325a3045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c746430819b301006072a8648ce3d020106052b81040023038186000400c4a1edbe98f90b4873367ec316561122f23d53c33b4d213dcd6b75e6f6b0dc9adf26c1bcb287f072327cb3642f1c90bcea6823107efee325c0483a69e0286dd33700ef0462dd0da09c706283d881d36431aa9e9731bd96b068c09b23de76643f1a5c7fe9120e5858b65f70dd9bd8ead5d7f5d5ccb9b69f30665b669a20e227e5bffe3b300906072a8648ce3d040103818c0030818802420188a24febe245c5487d1bacf5ed989dae4770c05e1bb62fbdf1b64db76140d311a2ceee0b7e927eff769dc33b7ea53fcefa10e259ec472d7cacda4e970e15a06fd00242014dfcbe67139c2d050ebd3fa38c25c13313830d9406bbd4377af6ec7ac9862eddd711697f857c56defb31782be4c7780daecbbe9e4e3624317b6a0f399512078f2a") + +var testEd25519Certificate = fromHex("3082012e3081e1a00302010202100f431c425793941de987e4f1ad15005d300506032b657030123110300e060355040a130741636d6520436f301e170d3139303531363231333830315a170d3230303531353231333830315a30123110300e060355040a130741636d6520436f302a300506032b65700321003fe2152ee6e3ef3f4e854a7577a3649eede0bf842ccc92268ffa6f3483aaec8fa34d304b300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff0402300030160603551d11040f300d820b6578616d706c652e636f6d300506032b65700341006344ed9cc4be5324539fd2108d9fe82108909539e50dc155ff2c16b71dfcab7d4dd4e09313d0a942e0b66bfe5d6748d79f50bc6ccd4b03837cf20858cdaccf0c") + +var testSNICertificate = fromHex("0441883421114c81480804c430820237308201a0a003020102020900e8f09d3fe25beaa6300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a3023310b3009060355040a1302476f311430120603550403130b736e69746573742e636f6d30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a3773075300e0603551d0f0101ff0404030205a0301d0603551d250416301406082b0601050507030106082b06010505070302300c0603551d130101ff0402300030190603551d0e041204109f91161f43433e49a6de6db680d79f60301b0603551d230414301280104813494d137e1631bba301d5acab6e7b300d06092a864886f70d01010b0500038181007beeecff0230dbb2e7a334af65430b7116e09f327c3bbf918107fc9c66cb497493207ae9b4dbb045cb63d605ec1b5dd485bb69124d68fa298dc776699b47632fd6d73cab57042acb26f083c4087459bc5a3bb3ca4d878d7fe31016b7bc9a627438666566e3389bfaeebe6becc9a0093ceed18d0f9ac79d56f3a73f18188988ed") + +var testP256Certificate = fromHex("308201693082010ea00302010202105012dc24e1124ade4f3e153326ff27bf300a06082a8648ce3d04030230123110300e060355040a130741636d6520436f301e170d3137303533313232343934375a170d3138303533313232343934375a30123110300e060355040a130741636d6520436f3059301306072a8648ce3d020106082a8648ce3d03010703420004c02c61c9b16283bbcc14956d886d79b358aa614596975f78cece787146abf74c2d5dc578c0992b4f3c631373479ebf3892efe53d21c4f4f1cc9a11c3536b7f75a3463044300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff04023000300f0603551d1104083006820474657374300a06082a8648ce3d0403020349003046022100963712d6226c7b2bef41512d47e1434131aaca3ba585d666c924df71ac0448b3022100f4d05c725064741aef125f243cdbccaa2a5d485927831f221c43023bd5ae471a") + +var testRSAPrivateKey, _ = x509.ParsePKCS1PrivateKey(fromHex("3082025b02010002818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d702030100010281800b07fbcf48b50f1388db34b016298b8217f2092a7c9a04f77db6775a3d1279b62ee9951f7e371e9de33f015aea80660760b3951dc589a9f925ed7de13e8f520e1ccbc7498ce78e7fab6d59582c2386cc07ed688212a576ff37833bd5943483b5554d15a0b9b4010ed9bf09f207e7e9805f649240ed6c1256ed75ab7cd56d9671024100fded810da442775f5923debae4ac758390a032a16598d62f059bb2e781a9c2f41bfa015c209f966513fe3bf5a58717cbdb385100de914f88d649b7d15309fa49024100dd10978c623463a1802c52f012cfa72ff5d901f25a2292446552c2568b1840e49a312e127217c2186615aae4fb6602a4f6ebf3f3d160f3b3ad04c592f65ae41f02400c69062ca781841a09de41ed7a6d9f54adc5d693a2c6847949d9e1358555c9ac6a8d9e71653ac77beb2d3abaf7bb1183aa14278956575dbebf525d0482fd72d90240560fe1900ba36dae3022115fd952f2399fb28e2975a1c3e3d0b679660bdcb356cc189d611cfdd6d87cd5aea45aa30a2082e8b51e94c2f3dd5d5c6036a8a615ed0240143993d80ece56f877cb80048335701eb0e608cc0c1ca8c2227b52edf8f1ac99c562f2541b5ce81f0515af1c5b4770dba53383964b4b725ff46fdec3d08907df")) + +var testECDSAPrivateKey, _ = x509.ParseECPrivateKey(fromHex("3081dc0201010442019883e909ad0ac9ea3d33f9eae661f1785206970f8ca9a91672f1eedca7a8ef12bd6561bb246dda5df4b4d5e7e3a92649bc5d83a0bf92972e00e62067d0c7bd99d7a00706052b81040023a18189038186000400c4a1edbe98f90b4873367ec316561122f23d53c33b4d213dcd6b75e6f6b0dc9adf26c1bcb287f072327cb3642f1c90bcea6823107efee325c0483a69e0286dd33700ef0462dd0da09c706283d881d36431aa9e9731bd96b068c09b23de76643f1a5c7fe9120e5858b65f70dd9bd8ead5d7f5d5ccb9b69f30665b669a20e227e5bffe3b")) + +var testP256PrivateKey, _ = x509.ParseECPrivateKey(fromHex("30770201010420012f3b52bc54c36ba3577ad45034e2e8efe1e6999851284cb848725cfe029991a00a06082a8648ce3d030107a14403420004c02c61c9b16283bbcc14956d886d79b358aa614596975f78cece787146abf74c2d5dc578c0992b4f3c631373479ebf3892efe53d21c4f4f1cc9a11c3536b7f75")) + +var testEd25519PrivateKey = ed25519.PrivateKey(fromHex("3a884965e76b3f55e5faf9615458a92354894234de3ec9f684d46d55cebf3dc63fe2152ee6e3ef3f4e854a7577a3649eede0bf842ccc92268ffa6f3483aaec8f")) + +const clientCertificatePEM = ` +-----BEGIN CERTIFICATE----- +MIIB7zCCAVigAwIBAgIQXBnBiWWDVW/cC8m5k5/pvDANBgkqhkiG9w0BAQsFADAS +MRAwDgYDVQQKEwdBY21lIENvMB4XDTE2MDgxNzIxNTIzMVoXDTE3MDgxNzIxNTIz +MVowEjEQMA4GA1UEChMHQWNtZSBDbzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC +gYEAum+qhr3Pv5/y71yUYHhv6BPy0ZZvzdkybiI3zkH5yl0prOEn2mGi7oHLEMff +NFiVhuk9GeZcJ3NgyI14AvQdpJgJoxlwaTwlYmYqqyIjxXuFOE8uCXMyp70+m63K +hAfmDzr/d8WdQYUAirab7rCkPy1MTOZCPrtRyN1IVPQMjkcCAwEAAaNGMEQwDgYD +VR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMAwGA1UdEwEB/wQCMAAw +DwYDVR0RBAgwBocEfwAAATANBgkqhkiG9w0BAQsFAAOBgQBGq0Si+yhU+Fpn+GKU +8ZqyGJ7ysd4dfm92lam6512oFmyc9wnTN+RLKzZ8Aa1B0jLYw9KT+RBrjpW5LBeK +o0RIvFkTgxYEiKSBXCUNmAysEbEoVr4dzWFihAm/1oDGRY2CLLTYg5vbySK3KhIR +e/oCO8HJ/+rJnahJ05XX1Q7lNQ== +-----END CERTIFICATE-----` + +var clientKeyPEM = testingKey(` +-----BEGIN RSA TESTING KEY----- +MIICXQIBAAKBgQC6b6qGvc+/n/LvXJRgeG/oE/LRlm/N2TJuIjfOQfnKXSms4Sfa +YaLugcsQx980WJWG6T0Z5lwnc2DIjXgC9B2kmAmjGXBpPCViZiqrIiPFe4U4Ty4J +czKnvT6brcqEB+YPOv93xZ1BhQCKtpvusKQ/LUxM5kI+u1HI3UhU9AyORwIDAQAB +AoGAEJZ03q4uuMb7b26WSQsOMeDsftdatT747LGgs3pNRkMJvTb/O7/qJjxoG+Mc +qeSj0TAZXp+PXXc3ikCECAc+R8rVMfWdmp903XgO/qYtmZGCorxAHEmR80SrfMXv +PJnznLQWc8U9nphQErR+tTESg7xWEzmFcPKwnZd1xg8ERYkCQQDTGtrFczlB2b/Z +9TjNMqUlMnTLIk/a/rPE2fLLmAYhK5sHnJdvDURaH2mF4nso0EGtENnTsh6LATnY +dkrxXGm9AkEA4hXHG2q3MnhgK1Z5hjv+Fnqd+8bcbII9WW4flFs15EKoMgS1w/PJ +zbsySaSy5IVS8XeShmT9+3lrleed4sy+UwJBAJOOAbxhfXP5r4+5R6ql66jES75w +jUCVJzJA5ORJrn8g64u2eGK28z/LFQbv9wXgCwfc72R468BdawFSLa/m2EECQGbZ +rWiFla26IVXV0xcD98VWJsTBZMlgPnSOqoMdM1kSEd4fUmlAYI/dFzV1XYSkOmVr +FhdZnklmpVDeu27P4c0CQQCuCOup0FlJSBpWY1TTfun/KMBkBatMz0VMA3d7FKIU +csPezl677Yjo8u1r/KzeI6zLg87Z8E6r6ZWNc9wBSZK6 +-----END RSA TESTING KEY-----`) + +const clientECDSACertificatePEM = ` +-----BEGIN CERTIFICATE----- +MIIB/DCCAV4CCQCaMIRsJjXZFzAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw +EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 +eSBMdGQwHhcNMTIxMTE0MTMyNTUzWhcNMjIxMTEyMTMyNTUzWjBBMQswCQYDVQQG +EwJBVTEMMAoGA1UECBMDTlNXMRAwDgYDVQQHEwdQeXJtb250MRIwEAYDVQQDEwlK +b2VsIFNpbmcwgZswEAYHKoZIzj0CAQYFK4EEACMDgYYABACVjJF1FMBexFe01MNv +ja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd3kfDdq0Z9kUs +jLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx+U56jb0JuK7q +ixgnTy5w/hOWusPTQBbNZU6sER7m8TAJBgcqhkjOPQQBA4GMADCBiAJCAOAUxGBg +C3JosDJdYUoCdFzCgbkWqD8pyDbHgf9stlvZcPE4O1BIKJTLCRpS8V3ujfK58PDa +2RU6+b0DeoeiIzXsAkIBo9SKeDUcSpoj0gq+KxAxnZxfvuiRs9oa9V2jI/Umi0Vw +jWVim34BmT0Y9hCaOGGbLlfk+syxis7iI6CH8OFnUes= +-----END CERTIFICATE-----` + +var clientECDSAKeyPEM = testingKey(` +-----BEGIN EC PARAMETERS----- +BgUrgQQAIw== +-----END EC PARAMETERS----- +-----BEGIN EC TESTING KEY----- +MIHcAgEBBEIBkJN9X4IqZIguiEVKMqeBUP5xtRsEv4HJEtOpOGLELwO53SD78Ew8 +k+wLWoqizS3NpQyMtrU8JFdWfj+C57UNkOugBwYFK4EEACOhgYkDgYYABACVjJF1 +FMBexFe01MNvja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd +3kfDdq0Z9kUsjLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx ++U56jb0JuK7qixgnTy5w/hOWusPTQBbNZU6sER7m8Q== +-----END EC TESTING KEY-----`) + +const clientEd25519CertificatePEM = ` +-----BEGIN CERTIFICATE----- +MIIBLjCB4aADAgECAhAX0YGTviqMISAQJRXoNCNPMAUGAytlcDASMRAwDgYDVQQK +EwdBY21lIENvMB4XDTE5MDUxNjIxNTQyNloXDTIwMDUxNTIxNTQyNlowEjEQMA4G +A1UEChMHQWNtZSBDbzAqMAUGAytlcAMhAAvgtWC14nkwPb7jHuBQsQTIbcd4bGkv +xRStmmNveRKRo00wSzAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUH +AwIwDAYDVR0TAQH/BAIwADAWBgNVHREEDzANggtleGFtcGxlLmNvbTAFBgMrZXAD +QQD8GRcqlKUx+inILn9boF2KTjRAOdazENwZ/qAicbP1j6FYDc308YUkv+Y9FN/f +7Q7hF9gRomDQijcjKsJGqjoI +-----END CERTIFICATE-----` + +var clientEd25519KeyPEM = testingKey(` +-----BEGIN TESTING KEY----- +MC4CAQAwBQYDK2VwBCIEINifzf07d9qx3d44e0FSbV4mC/xQxT644RRbpgNpin7I +-----END TESTING KEY-----`) diff --git a/libgo/go/crypto/tls/key_agreement.go b/libgo/go/crypto/tls/key_agreement.go index 05fe77b3e20..2922017cc4d 100644 --- a/libgo/go/crypto/tls/key_agreement.go +++ b/libgo/go/crypto/tls/key_agreement.go @@ -105,26 +105,34 @@ func md5SHA1Hash(slices [][]byte) []byte { // hashForServerKeyExchange hashes the given slices and returns their digest // using the given hash function (for >= TLS 1.2) or using a default based on -// the sigType (for earlier TLS versions). -func hashForServerKeyExchange(sigType uint8, hashFunc crypto.Hash, version uint16, slices ...[]byte) ([]byte, error) { +// the sigType (for earlier TLS versions). For Ed25519 signatures, which don't +// do pre-hashing, it returns the concatenation of the slices. +func hashForServerKeyExchange(sigType uint8, hashFunc crypto.Hash, version uint16, slices ...[]byte) []byte { + if sigType == signatureEd25519 { + var signed []byte + for _, slice := range slices { + signed = append(signed, slice...) + } + return signed + } if version >= VersionTLS12 { h := hashFunc.New() for _, slice := range slices { h.Write(slice) } digest := h.Sum(nil) - return digest, nil + return digest } if sigType == signatureECDSA { - return sha1Hash(slices), nil + return sha1Hash(slices) } - return md5SHA1Hash(slices), nil + return md5SHA1Hash(slices) } // ecdheKeyAgreement implements a TLS key agreement where the server // generates an ephemeral EC public/private key pair and signs it. The // pre-master secret is then calculated using ECDH. The signature may -// either be ECDSA or RSA. +// be ECDSA, Ed25519 or RSA. type ecdheKeyAgreement struct { version uint16 isRSA bool @@ -185,16 +193,13 @@ NextCandidate: return nil, errors.New("tls: certificate cannot be used with the selected cipher suite") } - digest, err := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, hello.random, serverECDHParams) - if err != nil { - return nil, err - } + signed := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, hello.random, serverECDHParams) signOpts := crypto.SignerOpts(hashFunc) if sigType == signatureRSAPSS { signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: hashFunc} } - sig, err := priv.Sign(config.rand(), digest, signOpts) + sig, err := priv.Sign(config.rand(), signed, signOpts) if err != nil { return nil, errors.New("tls: failed to sign ECDHE parameters: " + err.Error()) } @@ -297,11 +302,8 @@ func (ka *ecdheKeyAgreement) processServerKeyExchange(config *Config, clientHell } sig = sig[2:] - digest, err := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, serverHello.random, serverECDHParams) - if err != nil { - return err - } - return verifyHandshakeSignature(sigType, cert.PublicKey, hashFunc, digest, sig) + signed := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, serverHello.random, serverECDHParams) + return verifyHandshakeSignature(sigType, cert.PublicKey, hashFunc, signed, sig) } func (ka *ecdheKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) { diff --git a/libgo/go/crypto/tls/key_schedule.go b/libgo/go/crypto/tls/key_schedule.go index 2cfc226d7f6..83e5480fc5e 100644 --- a/libgo/go/crypto/tls/key_schedule.go +++ b/libgo/go/crypto/tls/key_schedule.go @@ -7,11 +7,12 @@ package tls import ( "crypto/elliptic" "crypto/hmac" + "crypto/subtle" "errors" + "golang.org/x/crypto/cryptobyte" + "golang.org/x/crypto/curve25519" + "golang.org/x/crypto/hkdf" "hash" - "internal/x/crypto/cryptobyte" - "internal/x/crypto/curve25519" - "internal/x/crypto/hkdf" "io" "math/big" ) @@ -193,8 +194,16 @@ func (p *x25519Parameters) SharedKey(peerPublicKey []byte) []byte { if len(peerPublicKey) != 32 { return nil } + var theirPublicKey, sharedKey [32]byte copy(theirPublicKey[:], peerPublicKey) curve25519.ScalarMult(&sharedKey, &p.privateKey, &theirPublicKey) + + // Check for low-order inputs. See RFC 8422, Section 5.11. + var allZeroes [32]byte + if subtle.ConstantTimeCompare(allZeroes[:], sharedKey[:]) == 1 { + return nil + } + return sharedKey[:] } diff --git a/libgo/go/crypto/tls/prf.go b/libgo/go/crypto/tls/prf.go index 5379397c265..5e97726e792 100644 --- a/libgo/go/crypto/tls/prf.go +++ b/libgo/go/crypto/tls/prf.go @@ -187,6 +187,8 @@ func hashFromSignatureScheme(signatureAlgorithm SignatureScheme) (crypto.Hash, e return crypto.SHA384, nil case PKCS1WithSHA512, PSSWithSHA512, ECDSAWithP521AndSHA512: return crypto.SHA512, nil + case Ed25519: + return directSigning, nil default: return 0, fmt.Errorf("tls: unsupported signature algorithm: %#04x", signatureAlgorithm) } @@ -308,11 +310,11 @@ func (h finishedHash) serverSum(masterSecret []byte) []byte { return out } -// hashForClientCertificate returns a digest over the handshake messages so far, -// suitable for signing by a TLS client certificate. +// hashForClientCertificate returns the handshake messages so far, pre-hashed if +// necessary, suitable for signing by a TLS client certificate. func (h finishedHash) hashForClientCertificate(sigType uint8, hashAlg crypto.Hash, masterSecret []byte) ([]byte, error) { - if (h.version == VersionSSL30 || h.version >= VersionTLS12) && h.buffer == nil { - panic("a handshake hash for a client-certificate was requested after discarding the handshake buffer") + if (h.version == VersionSSL30 || h.version >= VersionTLS12 || sigType == signatureEd25519) && h.buffer == nil { + panic("tls: handshake hash for a client certificate requested after discarding the handshake buffer") } if h.version == VersionSSL30 { @@ -326,6 +328,11 @@ func (h finishedHash) hashForClientCertificate(sigType uint8, hashAlg crypto.Has sha1Hash.Write(h.buffer) return finishedSum30(md5Hash, sha1Hash, masterSecret, nil), nil } + + if sigType == signatureEd25519 { + return h.buffer, nil + } + if h.version >= VersionTLS12 { hash := hashAlg.New() hash.Write(h.buffer) diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA b/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA index 009e6585c6a..9de3f1437b4 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 80 87 8d 86 82 |....Y...U.......| -00000010 b7 ab d8 7d 1c b5 86 ca 1c af 7e c0 07 6d 43 3e |...}......~..mC>| -00000020 10 59 aa 08 19 ae d0 b8 a1 f5 23 20 b6 3d 32 8b |.Y........# .=2.| -00000030 f9 52 1a 01 eb 69 35 7c be 2d a9 ca 55 21 f3 b3 |.R...i5|.-..U!..| -00000040 87 89 1e 05 cb cb 5d af 97 84 7e 07 c0 09 00 00 |......]...~.....| +00000000 16 03 01 00 59 02 00 00 55 03 01 94 1f ba 79 da |....Y...U.....y.| +00000010 4b 58 3e 08 2c c5 31 36 a4 7e 32 bf e1 a0 f7 71 |KX>.,.16.~2....q| +00000020 01 48 63 3c 5f cb 08 7a 25 80 c7 20 35 0c c0 8b |.Hc<_..z%.. 5...| +00000030 df 30 fc dc 3d f1 48 96 0d b6 ff a8 cd 35 29 57 |.0..=.H......5)W| +00000040 7d 3f c2 9d e2 32 b1 c2 4c 05 5e 3b c0 09 00 00 |}?...2..L.^;....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 01 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,18 +55,18 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 01 00 b5 0c 00 00 b1 03 00 1d 20 db cd |*............ ..| -00000280 1a f4 85 72 91 7c ee 8c 5c 02 c7 5b 09 c3 97 5b |...r.|..\..[...[| -00000290 5a 5c 2a af 84 5d 40 e9 2a e6 71 29 85 5d 00 8b |Z\*..]@.*.q).]..| -000002a0 30 81 88 02 42 00 ec 5a 5c b8 29 7d b6 58 15 62 |0...B..Z\.)}.X.b| -000002b0 b4 45 21 84 d6 d8 3a cc b8 c5 ff 79 66 07 57 28 |.E!...:....yf.W(| -000002c0 29 af 1d e3 cf db 1b 23 bb 5a 2f 23 8f 29 ed d4 |)......#.Z/#.)..| -000002d0 6c 3b ab a4 09 76 38 cf 63 bf 74 f9 5b 87 a2 e2 |l;...v8.c.t.[...| -000002e0 b7 1c 03 29 bd c6 1e 02 42 01 65 17 a6 34 04 01 |...)....B.e..4..| -000002f0 f4 f6 57 95 85 44 57 f5 34 02 aa fa 8b 63 57 69 |..W..DW.4....cWi| -00000300 6f e4 23 8a e6 c2 c4 4a b9 ac a9 44 3e c7 bc 47 |o.#....J...D>..G| -00000310 77 ae fe 22 14 5f bc 1c e2 20 ab 3f f6 dd c3 8f |w.."._... .?....| -00000320 ed dd 39 c3 47 01 28 66 33 e6 c6 16 03 01 00 0a |..9.G.(f3.......| +00000270 2a 16 03 01 00 b5 0c 00 00 b1 03 00 1d 20 1a 74 |*............ .t| +00000280 c4 96 9e 65 45 9a 0a 01 7c ed 7b 51 01 d8 ba 5b |...eE...|.{Q...[| +00000290 3e 2f b1 4b 36 69 e8 47 75 7e 27 be b3 2f 00 8b |>/.K6i.Gu~'../..| +000002a0 30 81 88 02 42 01 cb 20 d9 1e ae 05 6f 1f 37 ce |0...B.. ....o.7.| +000002b0 dc 38 20 2f 8f 52 9a 92 f6 80 d6 f9 97 99 a5 8b |.8 /.R..........| +000002c0 6e 73 0b 95 a4 4e 82 67 bd 1a 34 d9 5c 4e b4 d7 |ns...N.g..4.\N..| +000002d0 35 e6 45 81 14 23 9c 4e 5a 4c 1b 93 fd 7f 43 18 |5.E..#.NZL....C.| +000002e0 db 54 4b e0 d1 d3 fa 02 42 00 ab 8e 34 d5 c2 04 |.TK.....B...4...| +000002f0 d0 a4 44 b1 b3 25 a0 af c8 80 b3 88 ae da b3 c6 |..D..%..........| +00000300 4f 57 ae 31 54 c6 d9 ee 4e 21 56 01 cc b9 6a e9 |OW.1T...N!V...j.| +00000310 e9 7e 62 2a 64 0e a4 a0 79 1e a3 64 52 70 b1 a5 |.~b*d...y..dRp..| +00000320 19 2c a4 6d 4b 3b a3 63 ed 56 2f 16 03 01 00 0a |.,.mK;.c.V/.....| 00000330 0d 00 00 06 03 01 02 40 00 00 16 03 01 00 04 0e |.......@........| 00000340 00 00 00 |...| >>> Flow 3 (client to server) @@ -105,30 +105,30 @@ 00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| 00000210 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd 62 |...%...! /.}.G.b| 00000220 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| -00000230 c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 91 0f 00 |...._X.;t.......| -00000240 00 8d 00 8b 30 81 88 02 42 01 b1 4c 5b 98 0d 02 |....0...B..L[...| -00000250 57 ed 5a 6a ba b2 25 b8 fe ab 0b c2 d2 f7 4f cf |W.Zj..%.......O.| -00000260 05 fd 66 85 85 10 da 84 b5 30 76 92 70 5f 73 5b |..f......0v.p_s[| -00000270 5e c1 ce 1d 3c 88 1d 50 b1 85 f8 66 07 a8 16 6a |^...<..P...f...j| -00000280 f0 d5 61 80 e2 8e 75 dc e2 e1 45 02 42 01 2f 2f |..a...u...E.B.//| -00000290 17 58 50 18 25 9e 99 9c 89 69 aa 55 69 26 6d 88 |.XP.%....i.Ui&m.| -000002a0 8d c9 76 8b d5 40 5e 9d 0b f5 9f 6f dd 93 94 50 |..v..@^....o...P| -000002b0 c0 6e c5 7a 4d 9e fb 64 61 31 88 be fa 0c 11 b8 |.n.zM..da1......| -000002c0 ab 7e 7c 3d bf 4e da de aa aa 19 af 1c 1f 35 14 |.~|=.N........5.| -000002d0 03 01 00 01 01 16 03 01 00 30 58 e2 f6 52 c6 6f |.........0X..R.o| -000002e0 8d ba 2d be 84 8d fd 19 b7 2a e6 c4 b9 47 0d 3b |..-......*...G.;| -000002f0 af a8 8d 91 90 9d ff a1 f0 65 af 8e fe 8a 9b 39 |.........e.....9| -00000300 1c b1 e4 0b e3 c5 9a bf 86 18 |..........| +00000230 c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 90 0f 00 |...._X.;t.......| +00000240 00 8c 00 8a 30 81 87 02 42 01 89 0f 43 df a8 34 |....0...B...C..4| +00000250 dd d7 c9 d4 2b 8d ec 29 77 7b 64 d0 0e 8c e8 2b |....+..)w{d....+| +00000260 e3 25 1c ed 0a 1b 05 e0 66 42 37 c0 e6 fa 3e 81 |.%......fB7...>.| +00000270 ec e1 06 99 f4 62 3f ea 55 79 ae 68 56 9e e3 3c |.....b?.Uy.hV..<| +00000280 83 ba 9b 1c 65 b9 eb a6 e7 f7 4e 02 41 61 2c 52 |....e.....N.Aa,R| +00000290 4c 48 92 b0 93 d8 31 58 c3 90 b0 e3 7d 55 94 fc |LH....1X....}U..| +000002a0 70 bf 18 42 51 73 d0 45 17 2e 0e 00 b0 12 76 0d |p..BQs.E......v.| +000002b0 35 78 cb fd 34 60 36 ff ed 19 ef 0a 1e 21 cc 4c |5x..4`6......!.L| +000002c0 9a ff a0 f7 cf 72 03 cd 00 bb 73 0d 1d e5 14 03 |.....r....s.....| +000002d0 01 00 01 01 16 03 01 00 30 69 76 1f 5b 81 5f 62 |........0iv.[._b| +000002e0 cf d5 d9 2c 19 71 80 d0 2a 97 8a 89 21 7f 6d 02 |...,.q..*...!.m.| +000002f0 b6 01 a4 ed fe 18 9f 34 ae 95 f6 a1 29 0b 9a 1c |.......4....)...| +00000300 04 b6 ce c7 d1 0c 5a b5 3f |......Z.?| >>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 bc 72 19 6f bb |..........0.r.o.| -00000010 a0 79 dd 23 cf 44 0c be 48 9e ef 94 f3 47 fb 03 |.y.#.D..H....G..| -00000020 7d c6 af 0d 35 e2 4d 73 92 42 04 fa 5b 74 be 4d |}...5.Ms.B..[t.M| -00000030 0e 1b bf 3d 4a c9 d9 66 10 02 9f |...=J..f...| +00000000 14 03 01 00 01 01 16 03 01 00 30 7d 4b fc 73 20 |..........0}K.s | +00000010 e4 ac c4 39 15 79 e3 89 e1 24 ce 28 30 e5 f1 87 |...9.y...$.(0...| +00000020 cd c0 cc 39 a8 77 3b 06 a5 f9 b0 a1 3d 54 53 3b |...9.w;.....=TS;| +00000030 53 ec ac b2 ea 24 1b 2d 6a ef c3 |S....$.-j..| >>> Flow 5 (client to server) -00000000 17 03 01 00 20 96 d0 e8 8d 10 80 14 f0 61 fa a9 |.... ........a..| -00000010 61 f0 52 a9 22 b3 78 66 9d a4 79 6f 77 1e dc 2f |a.R.".xf..yow../| -00000020 0d f7 83 86 58 17 03 01 00 20 f9 91 e6 bf d9 c6 |....X.... ......| -00000030 34 5c 2c a2 94 55 55 74 83 03 58 5f 02 a8 00 da |4\,..UUt..X_....| -00000040 70 22 e8 1d 54 c8 43 17 4e b8 15 03 01 00 20 b1 |p"..T.C.N..... .| -00000050 6f a7 15 cc e5 50 e3 ab 70 14 ed 7f 8d fc 3a ff |o....P..p.....:.| -00000060 6a ea 4f bd b0 58 59 b7 38 36 2c b2 df 3c 4a |j.O..XY.86,..>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 a1 68 ff ed 89 |....Y...U...h...| -00000010 15 1b 21 de e0 23 e9 b0 ea 6c 1a 10 c7 f2 bb c1 |..!..#...l......| -00000020 c7 7a 76 6c df 17 45 2d 71 8d 6a 20 12 5b 28 d2 |.zvl..E-q.j .[(.| -00000030 94 ed d3 f5 6d 0b 40 2b 6f ec 7d 1f 8b 37 5c da |....m.@+o.}..7\.| -00000040 ae b3 47 fd e5 13 36 c0 2f 50 33 58 c0 13 00 00 |..G...6./P3X....| +00000000 16 03 01 00 59 02 00 00 55 03 01 97 0c 7e fc 7f |....Y...U....~..| +00000010 96 47 02 21 a7 19 45 a5 79 5c 5e fc c2 15 b3 fa |.G.!..E.y\^.....| +00000020 84 98 7d 67 65 c8 48 58 a1 5d 67 20 ad 2a c6 b3 |..}ge.HX.]g .*..| +00000030 a4 17 82 12 4a c5 97 af 12 6b 7d f6 9e 49 f1 38 |....J....k}..I.8| +00000040 d0 56 76 bc 81 23 ad 3a 3e 7f bc 2d c0 13 00 00 |.Vv..#.:>..-....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 01 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,17 +60,17 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 01 00 |.=.`.\!.;.......| -000002c0 aa 0c 00 00 a6 03 00 1d 20 67 3f fc ee e2 3f 93 |........ g?...?.| -000002d0 c9 f9 f3 a2 41 97 86 04 ce f5 e5 6d ac 00 85 64 |....A......m...d| -000002e0 01 83 89 75 5f 27 7c 5f 41 00 80 30 d3 2d ce bc |...u_'|_A..0.-..| -000002f0 9a 45 ea 21 4c 28 9b 36 ba a9 d0 24 c9 1a 1b 3b |.E.!L(.6...$...;| -00000300 6c 2d c3 72 3d d6 09 b2 07 d2 f2 54 b0 02 29 d7 |l-.r=......T..).| -00000310 99 f6 5e ee 71 d9 6f 1d 0a 74 f3 ee 23 79 60 d3 |..^.q.o..t..#y`.| -00000320 fd 14 99 d9 12 bd f7 5b 73 08 24 f2 3e 1f f5 38 |.......[s.$.>..8| -00000330 6a c9 43 72 ea 97 78 b9 48 7b aa 05 b2 9a fc 6a |j.Cr..x.H{.....j| -00000340 1f 4d 01 6a 9f 05 a3 0e 84 1f 09 9d e3 1a 07 6b |.M.j...........k| -00000350 c6 82 5f cc 4a db 33 86 4a 03 50 21 d7 9e ca a1 |.._.J.3.J.P!....| -00000360 9a 4f 52 53 43 67 81 53 3b ed fd 16 03 01 00 0a |.ORSCg.S;.......| +000002c0 aa 0c 00 00 a6 03 00 1d 20 a4 24 f7 67 e3 da fa |........ .$.g...| +000002d0 10 33 95 b4 46 00 c0 3c cd 74 12 e4 a3 3b 01 70 |.3..F..<.t...;.p| +000002e0 fb 98 01 9a e9 2d d0 18 7b 00 80 ce c5 7b 4b 87 |.....-..{....{K.| +000002f0 cd bc 5d 63 09 7e d4 ce 09 53 7a 1b e5 b4 10 54 |..]c.~...Sz....T| +00000300 89 52 ac 82 9c 78 88 ed e8 1a 8c 3a 7a 2c 9a c5 |.R...x.....:z,..| +00000310 2b 97 1c 79 43 bd b1 ee 93 6f 4c 4d fc 3c 47 91 |+..yC....oLM.>> Flow 3 (client to server) @@ -110,29 +110,29 @@ 00000210 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd 62 |...%...! /.}.G.b| 00000220 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| 00000230 c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 91 0f 00 |...._X.;t.......| -00000240 00 8d 00 8b 30 81 88 02 42 00 a6 8c ff 5a 40 01 |....0...B....Z@.| -00000250 bc 1c 28 f7 95 34 93 1b 78 58 34 04 d9 3e 8b 1e |..(..4..xX4..>..| -00000260 bb 2a 3f aa a8 a0 24 38 05 c2 38 4f 8b 55 08 17 |.*?...$8..8O.U..| -00000270 e4 68 9b 9a 6c f1 94 cc 61 52 90 8a 38 6e 76 f5 |.h..l...aR..8nv.| -00000280 0b 59 60 94 67 b5 78 83 93 eb cd 02 42 00 eb 7b |.Y`.g.x.....B..{| -00000290 a4 90 f5 8a 07 ab 80 49 41 48 6e 37 7b e2 f8 b8 |.......IAHn7{...| -000002a0 27 2d 06 2b cf 5a e9 eb 5c 36 a3 de 50 b9 40 b5 |'-.+.Z..\6..P.@.| -000002b0 14 0a 5c a4 ec 8f 2b 0c d4 ca a3 45 db 2a 3a 65 |..\...+....E.*:e| -000002c0 b4 8e c4 a6 d8 e9 f7 c3 48 34 f7 e7 65 b9 90 14 |........H4..e...| -000002d0 03 01 00 01 01 16 03 01 00 30 a3 4b 62 d6 25 40 |.........0.Kb.%@| -000002e0 84 6c 3f 2c d8 fa 69 93 49 4f 4e 75 06 09 0c 1a |.l?,..i.IONu....| -000002f0 01 b9 09 2e 9d 4d 0a f7 57 c0 8b d8 d0 44 5d f4 |.....M..W....D].| -00000300 c1 19 61 a7 a7 36 05 ad 96 92 |..a..6....| +00000240 00 8d 00 8b 30 81 88 02 42 01 71 f3 c4 3a 85 08 |....0...B.q..:..| +00000250 3b 18 26 48 5c 3f c3 8a 4f e9 d7 29 48 59 1a 35 |;.&H\?..O..)HY.5| +00000260 ee b3 0d 5e 29 03 1d 34 95 0e 40 73 85 13 14 d0 |...^)..4..@s....| +00000270 fb fb 96 77 21 fb d8 43 d7 e2 bf 2c 95 7b 75 5d |...w!..C...,.{u]| +00000280 59 15 81 71 d2 b6 82 96 d9 cc 78 02 42 01 d3 51 |Y..q......x.B..Q| +00000290 af 25 d0 f8 a4 e2 e7 8e 7e 46 56 53 8f d1 09 f6 |.%......~FVS....| +000002a0 76 88 5a 42 83 89 92 7b c7 e4 40 9c 3d 05 ac 43 |v.ZB...{..@.=..C| +000002b0 bf 6e 24 14 fe 36 f8 43 a6 90 8e a1 bd e2 92 84 |.n$..6.C........| +000002c0 60 e3 92 34 1c 7b 53 d5 57 6d 23 32 12 a8 23 14 |`..4.{S.Wm#2..#.| +000002d0 03 01 00 01 01 16 03 01 00 30 6f 06 c7 84 fa 7f |.........0o.....| +000002e0 c9 66 a9 6f 26 37 45 db 42 c8 8f 63 c3 5b 05 07 |.f.o&7E.B..c.[..| +000002f0 ef 07 41 be 71 60 35 d3 16 8f 92 f6 89 cb c7 dc |..A.q`5.........| +00000300 4e 45 61 99 31 45 66 40 36 86 |NEa.1Ef@6.| >>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 0a 75 fa 5e 6e |..........0.u.^n| -00000010 50 48 e9 b1 67 e2 e1 04 c4 d9 27 63 7a a3 74 9e |PH..g.....'cz.t.| -00000020 0d 70 13 b9 1c b6 f5 e4 43 eb e1 20 86 08 d0 39 |.p......C.. ...9| -00000030 91 5e 72 f7 9b 30 25 db aa 8c 72 |.^r..0%...r| +00000000 14 03 01 00 01 01 16 03 01 00 30 d3 83 ac 08 7f |..........0.....| +00000010 a1 91 51 7c b7 99 6f 24 cd b1 cd 31 7b 12 20 47 |..Q|..o$...1{. G| +00000020 66 08 22 f6 28 ea 81 fe 92 b5 c8 40 60 bc 5b 19 |f.".(......@`.[.| +00000030 e0 2b d1 26 fd 4c 12 22 c5 13 9a |.+.&.L."...| >>> Flow 5 (client to server) -00000000 17 03 01 00 20 9a f8 b3 97 b0 90 7e c7 2c 15 74 |.... ......~.,.t| -00000010 03 c9 15 5d 95 fa 5c 37 ca 1e 8f 5a 3c af dc 9b |...]..\7...Z<...| -00000020 30 64 41 66 d0 17 03 01 00 20 1f 65 3e 77 1b 39 |0dAf..... .e>w.9| -00000030 c4 b9 de 44 67 a2 1d 73 a8 83 bf dd 4f 50 ad d2 |...Dg..s....OP..| -00000040 67 cf 45 9d 48 19 d8 67 fd 70 15 03 01 00 20 2d |g.E.H..g.p.... -| -00000050 6e d3 18 d1 55 6a 68 88 9d c0 3b a7 2e 93 fe e5 |n...Ujh...;.....| -00000060 f9 6c b9 b4 3e 28 f0 9a 3f f0 67 4f 32 ab 6b |.l..>(..?.gO2.k| +00000000 17 03 01 00 20 79 06 89 7e e0 17 9a e3 dc 4c ee |.... y..~.....L.| +00000010 70 63 13 bc 27 f5 43 fa f8 90 49 d9 89 43 7a 15 |pc..'.C...I..Cz.| +00000020 d4 e2 a8 e6 3e 17 03 01 00 20 ea 84 0e 21 62 d5 |....>.... ...!b.| +00000030 ee 26 5e fc 3e 0c 83 3b 91 01 c4 a7 8e 9b c4 1a |.&^.>..;........| +00000040 86 f8 a0 44 21 44 2f 31 cf a1 15 03 01 00 20 c6 |...D!D/1...... .| +00000050 11 f1 65 ea f3 39 d1 d2 ac 95 1f 81 36 ae db b1 |..e..9......6...| +00000060 88 a8 42 25 86 ec 1b c1 7e 12 60 a9 6b 7f 66 |..B%....~.`.k.f| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-Ed25519 b/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-Ed25519 new file mode 100644 index 00000000000..a14cef13569 --- /dev/null +++ b/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-Ed25519 @@ -0,0 +1,110 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| +00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| +00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| +00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| +00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| +000000a0 00 00 0d 00 1a 00 18 08 04 08 05 08 06 04 01 04 |................| +000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 08 07 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 59 02 00 00 55 03 01 55 df 11 fe c6 |....Y...U..U....| +00000010 aa d4 85 4b 87 c2 35 4c ac a9 c3 15 a3 7f 6d 7e |...K..5L......m~| +00000020 15 d1 47 b2 d2 09 16 4d 08 1b dd 20 49 d9 51 42 |..G....M... I.QB| +00000030 97 cf 36 b3 74 3e 05 0a e5 c9 97 ef 01 9c 24 34 |..6.t>........$4| +00000040 31 17 e1 8a 6a ce 37 60 02 47 46 7f c0 13 00 00 |1...j.7`.GF.....| +00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| +00000060 01 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| +00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| +00000080 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| +00000090 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| +000000a0 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| +000000b0 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| +000000c0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| +000000d0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| +000000e0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| +000000f0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| +00000100 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| +00000110 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| +00000120 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| +00000130 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| +00000140 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| +00000150 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| +00000160 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| +00000170 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| +00000180 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| +00000190 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| +000001a0 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| +000001b0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| +000001c0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| +000001d0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| +000001e0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| +000001f0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| +00000200 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| +00000210 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| +00000220 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| +00000230 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| +00000240 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| +00000250 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| +00000260 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| +00000270 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| +00000280 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| +00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| +000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| +000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 01 00 |.=.`.\!.;.......| +000002c0 aa 0c 00 00 a6 03 00 1d 20 17 27 58 d2 5f 59 a3 |........ .'X._Y.| +000002d0 62 62 d4 97 4a 49 c4 ff ec dc f7 d3 c9 ea f3 00 |bb..JI..........| +000002e0 61 1b d3 73 38 9e af 7d 17 00 80 59 7a 4e 55 97 |a..s8..}...YzNU.| +000002f0 5a 81 0e 2e 85 0b c2 61 f0 79 72 0e d1 d5 3b bf |Z......a.yr...;.| +00000300 6a 77 03 0a 9a 51 42 f5 98 2f 09 d5 7b 17 76 b8 |jw...QB../..{.v.| +00000310 2c a7 95 ee 61 65 d7 37 b3 1b 16 3c 48 7e 9d ed |,...ae.7...>> Flow 3 (client to server) +00000000 16 03 01 01 3c 0b 00 01 38 00 01 35 00 01 32 30 |....<...8..5..20| +00000010 82 01 2e 30 81 e1 a0 03 02 01 02 02 10 17 d1 81 |...0............| +00000020 93 be 2a 8c 21 20 10 25 15 e8 34 23 4f 30 05 06 |..*.! .%..4#O0..| +00000030 03 2b 65 70 30 12 31 10 30 0e 06 03 55 04 0a 13 |.+ep0.1.0...U...| +00000040 07 41 63 6d 65 20 43 6f 30 1e 17 0d 31 39 30 35 |.Acme Co0...1905| +00000050 31 36 32 31 35 34 32 36 5a 17 0d 32 30 30 35 31 |16215426Z..20051| +00000060 35 32 31 35 34 32 36 5a 30 12 31 10 30 0e 06 03 |5215426Z0.1.0...| +00000070 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 2a 30 05 |U....Acme Co0*0.| +00000080 06 03 2b 65 70 03 21 00 0b e0 b5 60 b5 e2 79 30 |..+ep.!....`..y0| +00000090 3d be e3 1e e0 50 b1 04 c8 6d c7 78 6c 69 2f c5 |=....P...m.xli/.| +000000a0 14 ad 9a 63 6f 79 12 91 a3 4d 30 4b 30 0e 06 03 |...coy...M0K0...| +000000b0 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 |U...........0...| +000000c0 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 |U.%..0...+......| +000000d0 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 |.0...U.......0.0| +000000e0 16 06 03 55 1d 11 04 0f 30 0d 82 0b 65 78 61 6d |...U....0...exam| +000000f0 70 6c 65 2e 63 6f 6d 30 05 06 03 2b 65 70 03 41 |ple.com0...+ep.A| +00000100 00 fc 19 17 2a 94 a5 31 fa 29 c8 2e 7f 5b a0 5d |....*..1.)...[.]| +00000110 8a 4e 34 40 39 d6 b3 10 dc 19 fe a0 22 71 b3 f5 |.N4@9......."q..| +00000120 8f a1 58 0d cd f4 f1 85 24 bf e6 3d 14 df df ed |..X.....$..=....| +00000130 0e e1 17 d8 11 a2 60 d0 8a 37 23 2a c2 46 aa 3a |......`..7#*.F.:| +00000140 08 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 |.....%...! /.}.G| +00000150 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +00000160 c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 46 |......_X.;t....F| +00000170 0f 00 00 42 00 40 14 6a d7 c1 9c 3d 81 fa e9 da |...B.@.j...=....| +00000180 96 5c 3a 09 e2 fc 36 e2 30 39 e4 6e 0d ac aa 54 |.\:...6.09.n...T| +00000190 24 4d 8c f0 35 14 b0 0b e9 5b 57 52 31 02 9f 6c |$M..5....[WR1..l| +000001a0 6f 6c d7 e9 b5 7f cb 30 fe b9 ba b9 7a 46 67 e3 |ol.....0....zFg.| +000001b0 a7 50 ca ce e4 04 14 03 01 00 01 01 16 03 01 00 |.P..............| +000001c0 30 8d 0a ca d1 5e 2c 7e 92 d0 69 f4 d9 e8 5d 0a |0....^,~..i...].| +000001d0 11 72 67 20 3e 80 64 29 e5 79 f5 33 ad 06 78 07 |.rg >.d).y.3..x.| +000001e0 4c 03 fc 2e 16 35 70 b1 72 e7 35 a9 cc 49 b8 29 |L....5p.r.5..I.)| +000001f0 30 |0| +>>> Flow 4 (server to client) +00000000 15 03 01 00 02 02 50 |......P| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA b/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA index 14ed93ca096..641ab1bd156 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 04 4a 64 8e 4f |....Y...U...Jd.O| -00000010 f1 4e 06 19 e2 cb b8 92 93 7b f5 ec 1b 0e 30 8e |.N.......{....0.| -00000020 1f 89 6c a1 28 e7 87 7f 9e 9e 19 20 cf aa b7 1f |..l.(...... ....| -00000030 77 43 26 3e 15 5e 67 68 0d a6 a3 b1 25 e5 63 27 |wC&>.^gh....%.c'| -00000040 00 f9 59 23 e0 a3 1c d7 49 e9 dc b3 c0 09 00 00 |..Y#....I.......| +00000000 16 03 01 00 59 02 00 00 55 03 01 3b 4c b9 76 d2 |....Y...U..;L.v.| +00000010 c3 d1 ea 81 71 1a 10 e1 b1 69 5c 54 c2 df 17 0a |....q....i\T....| +00000020 de 41 cb d1 69 c3 9a da 90 fd 25 20 1e 02 11 16 |.A..i.....% ....| +00000030 ab 66 13 56 3d 94 00 a9 80 7c d8 57 12 99 1c 5f |.f.V=....|.W..._| +00000040 7a b2 02 8c 23 f3 76 b8 59 5e 16 dd c0 09 00 00 |z...#.v.Y^......| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 01 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,20 +55,20 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 01 00 b4 0c 00 00 b0 03 00 1d 20 6c 3b |*............ l;| -00000280 3f 6b 18 21 57 c4 df bf 3d ac 92 ee bc 99 0b 2f |?k.!W...=....../| -00000290 d5 b3 f5 ff 5f 6c 6b 33 db a9 7c 02 f8 4c 00 8a |...._lk3..|..L..| -000002a0 30 81 87 02 42 00 8e 15 e5 bb dc f5 3d c6 10 d7 |0...B.......=...| -000002b0 67 54 3d 80 b5 6a 4d 69 f1 2c fe 99 bc 32 e1 ab |gT=..jMi.,...2..| -000002c0 42 c0 7d f2 5d e0 d6 22 95 58 25 5e 63 ba f0 9c |B.}.]..".X%^c...| -000002d0 9f 29 91 c9 a9 42 99 ab b0 4f ed a9 42 8e 1f 3a |.)...B...O..B..:| -000002e0 44 34 48 d9 5a dd 9b 02 41 44 21 e1 54 b5 a3 e7 |D4H.Z...AD!.T...| -000002f0 0a 57 45 52 ae 9d b5 fe 45 8a 3f 8b e7 50 e8 01 |.WER....E.?..P..| -00000300 8c 26 27 85 f4 ef 80 30 7e d6 d8 27 4f d5 5e 9d |.&'....0~..'O.^.| -00000310 7b 65 1a c6 5a ab 57 17 3f 6e 5c 66 aa cd 46 bc |{e..Z.W.?n\f..F.| -00000320 5d 32 db a5 48 f8 f8 35 11 8b 16 03 01 00 0a 0d |]2..H..5........| -00000330 00 00 06 03 01 02 40 00 00 16 03 01 00 04 0e 00 |......@.........| -00000340 00 00 |..| +00000270 2a 16 03 01 00 b5 0c 00 00 b1 03 00 1d 20 16 64 |*............ .d| +00000280 ca 24 70 6f 61 2f 9e 2d 43 0a 73 ac 67 f0 7a e5 |.$poa/.-C.s.g.z.| +00000290 c7 4e c4 1f ad 13 0d eb df ff 0d ff a3 27 00 8b |.N...........'..| +000002a0 30 81 88 02 42 01 1a 33 8b 88 78 ed 5c c1 56 0d |0...B..3..x.\.V.| +000002b0 75 51 69 a0 e7 45 6d ae b0 67 55 3f be 23 3e 92 |uQi..Em..gU?.#>.| +000002c0 fe 26 68 a2 30 84 2f b3 33 66 f6 dd 71 67 99 5e |.&h.0./.3f..qg.^| +000002d0 1c 6f bf 87 ed 33 a0 87 69 f6 35 65 8d cb 3a 7e |.o...3..i.5e..:~| +000002e0 95 a7 a4 40 54 cb 97 02 42 00 a3 fe 50 34 68 9f |...@T...B...P4h.| +000002f0 f2 43 98 23 e4 24 ad 36 e9 d3 e0 75 2c 11 46 6c |.C.#.$.6...u,.Fl| +00000300 48 33 c5 bc 2d 04 ff cc bb ec 38 ec f4 b3 55 31 |H3..-.....8...U1| +00000310 8a 6e 38 a5 6d a0 9c fc f6 98 75 48 c6 79 53 de |.n8.m.....uH.yS.| +00000320 dd 91 49 f0 b6 32 83 45 61 89 4e 16 03 01 00 0a |..I..2.Ea.N.....| +00000330 0d 00 00 06 03 01 02 40 00 00 16 03 01 00 04 0e |.......@........| +00000340 00 00 00 |...| >>> Flow 3 (client to server) 00000000 16 03 01 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| 00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| @@ -105,29 +105,29 @@ 00000200 e5 35 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| 00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| 00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 |......._X.;t....| -00000230 86 0f 00 00 82 00 80 9a 02 82 fb dd 68 e7 91 9f |............h...| -00000240 83 12 57 35 23 7c de 88 97 07 a3 b2 67 77 0f c1 |..W5#|......gw..| -00000250 bd 33 36 b3 ce fb f7 96 26 91 ab dc 96 26 64 fa |.36.....&....&d.| -00000260 34 66 31 2b fa 6d 52 60 3e fb a3 87 27 a7 7c ac |4f1+.mR`>...'.|.| -00000270 8c 87 ff c5 5e 6f 6f e1 db bf bc 58 3d b3 f6 89 |....^oo....X=...| -00000280 a0 8e 0b 9d 26 74 68 57 ca e9 c2 ab 79 7b 6a dd |....&thW....y{j.| -00000290 c7 89 ef 0d 62 aa 47 7b 67 18 f2 ad 00 98 56 45 |....b.G{g.....VE| -000002a0 12 ca de 6a d1 1a b5 a9 d2 53 ba 3b 90 a6 cf 69 |...j.....S.;...i| -000002b0 12 65 32 c2 95 46 01 14 03 01 00 01 01 16 03 01 |.e2..F..........| -000002c0 00 30 f7 2d b9 19 66 b2 2c 1b 96 08 bc 70 5b f5 |.0.-..f.,....p[.| -000002d0 6d 58 9e 51 fb b5 3c a6 4f 4a fc 52 1f 10 20 c4 |mX.Q..<.OJ.R.. .| -000002e0 3f d6 3c 0e 99 e3 1c b5 21 7f 0d fa 08 ec 17 27 |?.<.....!......'| -000002f0 75 9f |u.| +00000230 86 0f 00 00 82 00 80 90 68 a8 2f 6f 2b 70 e4 25 |........h./o+p.%| +00000240 7d fb b7 85 db 44 ec 1a ad 6d 84 fb 95 21 fa 24 |}....D...m...!.$| +00000250 7b 31 6a 97 4f 06 ee 87 22 c3 7c 81 70 ed e3 2a |{1j.O...".|.p..*| +00000260 d5 2c d1 4e 6d f0 12 52 2f 98 05 08 af 41 fa 87 |.,.Nm..R/....A..| +00000270 d1 62 98 6c 06 47 ec 7a 44 e0 7d ae 7a 7d ef 1b |.b.l.G.zD.}.z}..| +00000280 d5 2c fa 1b 70 a3 fb 9a 5d 8c 60 b4 44 6a e5 b8 |.,..p...].`.Dj..| +00000290 80 4c 29 fc f1 2d f1 11 46 81 c4 01 e4 11 2e 05 |.L)..-..F.......| +000002a0 cb 2b ca d9 4a 14 39 06 93 77 19 db 80 03 82 38 |.+..J.9..w.....8| +000002b0 e5 c1 0f 11 17 47 a7 14 03 01 00 01 01 16 03 01 |.....G..........| +000002c0 00 30 a6 68 28 50 75 6d eb f4 32 c8 a3 57 3f b1 |.0.h(Pum..2..W?.| +000002d0 37 84 8e 7e 1d 1d 93 7d 9f ec ff ac 1c 8d bf 30 |7..~...}.......0| +000002e0 d2 b0 0f 3f 02 c3 ef ac a3 62 94 26 1c 8f 7e 8d |...?.....b.&..~.| +000002f0 74 99 |t.| >>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 db ac b4 71 dc |..........0...q.| -00000010 92 06 9c fe 87 11 69 eb a6 4e e9 50 29 6d 06 37 |......i..N.P)m.7| -00000020 02 73 b8 6d 7e ca 89 02 cf fa ad 0c 7c d0 90 cb |.s.m~.......|...| -00000030 af e5 50 68 fc 76 c5 09 a1 a1 d3 |..Ph.v.....| +00000000 14 03 01 00 01 01 16 03 01 00 30 80 3e 0d 50 13 |..........0.>.P.| +00000010 5f 00 ba 2e 47 46 5d 63 1b 72 a8 02 24 1c 3e 1f |_...GF]c.r..$.>.| +00000020 ed e2 3a 45 d7 7d 3a f2 33 97 c3 ab 13 9b 0e 4a |..:E.}:.3......J| +00000030 04 f0 08 48 ab d3 46 0b 40 7d 5c |...H..F.@}\| >>> Flow 5 (client to server) -00000000 17 03 01 00 20 cd b3 a4 99 da 5d 59 36 6f f8 26 |.... .....]Y6o.&| -00000010 2d b2 4a 47 a1 54 7f b0 b3 df 0d 52 cc 13 7a 8b |-.JG.T.....R..z.| -00000020 a3 6a 8b 1f ee 17 03 01 00 20 d6 ab 8a 3e b3 41 |.j....... ...>.A| -00000030 0a be 61 50 79 19 1a 45 03 c6 b9 b4 84 b2 18 46 |..aPy..E.......F| -00000040 86 1f c3 b7 78 77 fc 7f 4f 30 15 03 01 00 20 2d |....xw..O0.... -| -00000050 c0 f2 71 06 dc 19 9d 88 82 b9 3a 6b be a4 77 98 |..q.......:k..w.| -00000060 87 32 46 54 27 e4 17 47 8a 83 9c 5a 45 6e 6b |.2FT'..G...ZEnk| +00000000 17 03 01 00 20 f7 32 e7 36 4f 77 2f 4a 05 fd 27 |.... .2.6Ow/J..'| +00000010 19 57 52 f7 8a 0c 7f fb 14 78 b2 06 bf ca 86 73 |.WR......x.....s| +00000020 32 13 33 04 91 17 03 01 00 20 7e e4 fe c5 6d f7 |2.3...... ~...m.| +00000030 d4 69 30 57 89 a0 76 70 40 a7 b5 17 74 2f 5d 16 |.i0W..vp@...t/].| +00000040 c1 19 30 73 f8 37 c4 10 5b b7 15 03 01 00 20 08 |..0s.7..[..... .| +00000050 41 5e 0b 9f 36 23 bd 9a 09 f7 58 9d a3 d7 26 3a |A^..6#....X...&:| +00000060 f4 5e 6b bf 9c d4 6f 0c d3 9e cd de cb 95 57 |.^k...o.......W| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA b/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA index c5b33c01fe5..c46a9670e84 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 6b 8a f7 68 78 |....Y...U..k..hx| -00000010 f1 ea ad 9b 20 40 42 52 eb fa 55 fb 37 a7 21 22 |.... @BR..U.7.!"| -00000020 71 0d f7 4d 46 bf 38 df 6e 00 e0 20 17 73 28 32 |q..MF.8.n.. .s(2| -00000030 30 3f f4 01 df 70 98 ce 33 d0 c3 8c 0a fd 0a ba |0?...p..3.......| -00000040 6b 56 d7 f9 16 a2 24 0d 07 b1 32 47 c0 13 00 00 |kV....$...2G....| +00000000 16 03 01 00 59 02 00 00 55 03 01 97 fe 7f 92 37 |....Y...U......7| +00000010 67 99 e0 d8 62 a9 31 80 bd 1f 31 8e 7d 0b 08 0a |g...b.1...1.}...| +00000020 de a5 82 a2 f2 d0 c1 35 66 34 6e 20 39 46 b1 b0 |.......5f4n 9F..| +00000030 6e 2d 0e fe 8c 48 ea ab 1c c4 49 ee f4 21 cf cb |n-...H....I..!..| +00000040 2a 20 57 78 18 99 a1 b9 7f 88 4f 64 c0 13 00 00 |* Wx......Od....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 01 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,17 +60,17 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 01 00 |.=.`.\!.;.......| -000002c0 aa 0c 00 00 a6 03 00 1d 20 b1 de e2 91 3f 1f be |........ ....?..| -000002d0 0e 21 49 44 db d1 d3 a7 89 db 61 56 97 bf 4c 73 |.!ID......aV..Ls| -000002e0 7b d3 da 81 a5 cc 0a e3 13 00 80 66 fd 15 8d 8a |{..........f....| -000002f0 a2 f9 8d b9 d9 cb a5 6b 45 7c 11 05 24 6d de e5 |.......kE|..$m..| -00000300 8f 3e 42 ba 3e bd 5a b8 f7 51 c0 b9 55 06 db d7 |.>B.>.Z..Q..U...| -00000310 2d 78 d2 5d 47 2d 52 c9 7b 59 20 73 1a 1d 26 c4 |-x.]G-R.{Y s..&.| -00000320 84 3d 5b 57 5f 1a fd 52 8c 40 87 be 58 58 73 d2 |.=[W_..R.@..XXs.| -00000330 4b 84 9a 6c 96 c0 36 82 95 13 f9 12 74 c3 3b dd |K..l..6.....t.;.| -00000340 27 11 c3 66 fa de 28 b4 c0 d9 6e 65 e0 8a 5e b6 |'..f..(...ne..^.| -00000350 3a a8 52 db 62 89 2b 1d d0 be fb b7 6e 03 bd f7 |:.R.b.+.....n...| -00000360 e3 a5 df c2 b3 5a 16 09 d8 1e df 16 03 01 00 0a |.....Z..........| +000002c0 aa 0c 00 00 a6 03 00 1d 20 07 80 79 40 4b b1 0e |........ ..y@K..| +000002d0 05 ce e4 ca 9d f5 d7 ad a6 98 f2 40 f9 b9 66 a8 |...........@..f.| +000002e0 04 6e ae b5 da 99 67 09 69 00 80 01 4a f2 c1 c9 |.n....g.i...J...| +000002f0 2f 46 4f b8 9e 8b 2c c4 a1 32 44 3c dc 2c 5e b9 |/FO...,..2D<.,^.| +00000300 76 5f 41 20 23 1b 82 dd ec 37 b4 24 68 6d a7 39 |v_A #....7.$hm.9| +00000310 4f f2 e5 97 09 75 64 2a 64 16 b8 99 04 8a 74 77 |O....ud*d.....tw| +00000320 19 bb 12 5f 27 f6 41 09 f7 2e 1c 33 80 3b 01 57 |..._'.A....3.;.W| +00000330 5c f9 20 6e 0c 48 76 59 e1 8b 1f bb 2a 33 1a 28 |\. n.HvY....*3.(| +00000340 a0 5a 05 44 94 eb 35 62 5e ae 7f e4 01 76 b6 b4 |.Z.D..5b^....v..| +00000350 64 91 bf 25 09 ff 88 8a af 73 00 d0 7e ea 0f ca |d..%.....s..~...| +00000360 4a 2b d4 6f 02 26 98 28 5a ed 11 16 03 01 00 0a |J+.o.&.(Z.......| 00000370 0d 00 00 06 03 01 02 40 00 00 16 03 01 00 04 0e |.......@........| 00000380 00 00 00 |...| >>> Flow 3 (client to server) @@ -109,29 +109,29 @@ 00000200 e5 35 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| 00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| 00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 |......._X.;t....| -00000230 86 0f 00 00 82 00 80 9c f0 ab 90 83 2a 47 ba 5c |............*G.\| -00000240 37 a4 19 b8 62 b1 01 74 35 4d 1a 62 5e 3f 0b 54 |7...b..t5M.b^?.T| -00000250 5a 6f b7 b5 99 4b b4 84 68 90 46 2b 95 e6 10 77 |Zo...K..h.F+...w| -00000260 bf 68 81 b1 96 11 5c e9 93 a4 d5 78 42 c0 c4 92 |.h....\....xB...| -00000270 cf 4e ce 25 e7 da 7d d9 2c 4d ab 71 2d b5 a7 1c |.N.%..}.,M.q-...| -00000280 5f b5 a3 32 f6 3e 38 79 17 36 45 94 8a e3 f8 1e |_..2.>8y.6E.....| -00000290 9e 95 23 48 0f f6 aa 1b 00 d2 45 85 c7 95 b2 d1 |..#H......E.....| -000002a0 c1 81 e8 31 34 45 bd 28 32 26 a8 d1 23 90 cb 40 |...14E.(2&..#..@| -000002b0 1c ed db eb c3 ec b6 14 03 01 00 01 01 16 03 01 |................| -000002c0 00 30 16 97 3e a2 2a 11 d5 3f 29 f6 5b b8 7a d5 |.0..>.*..?).[.z.| -000002d0 83 24 51 f0 0c c3 79 18 9c 58 b6 f4 2f 70 9f c0 |.$Q...y..X../p..| -000002e0 52 be a0 f0 eb d7 0e de 42 36 14 39 84 fc 84 ed |R.......B6.9....| -000002f0 77 0c |w.| +00000230 86 0f 00 00 82 00 80 81 aa 68 1f a9 a4 de f1 4d |.........h.....M| +00000240 30 9a fe e6 a5 f6 f6 18 b6 3e d2 c7 f1 e6 77 e3 |0........>....w.| +00000250 6a cd 61 01 81 3a 02 31 a5 aa d6 db b6 02 9d 4b |j.a..:.1.......K| +00000260 f5 78 50 c3 95 fe 43 88 33 3a 95 32 bc e8 02 1a |.xP...C.3:.2....| +00000270 e6 f4 d5 54 b9 fc e0 4a 4e f0 92 21 35 4b de c8 |...T...JN..!5K..| +00000280 a4 b0 01 c3 ca 3a 87 ed cb 21 1c ce c2 14 7b 8d |.....:...!....{.| +00000290 90 68 b9 21 49 13 dd cd e7 68 83 41 7c 84 6a 75 |.h.!I....h.A|.ju| +000002a0 76 ee 19 8b fa d5 a6 57 3d a7 f1 f1 6f 11 ca 77 |v......W=...o..w| +000002b0 95 0e b5 c7 3d 99 d4 14 03 01 00 01 01 16 03 01 |....=...........| +000002c0 00 30 5e be 40 82 f8 db 05 20 23 45 a4 42 48 e8 |.0^.@.... #E.BH.| +000002d0 06 69 eb 4c ef 79 53 52 4a 5a 3a ba cc d6 99 59 |.i.L.ySRJZ:....Y| +000002e0 4d c2 b0 34 0f 14 68 03 93 8b a4 95 7e cf 26 f8 |M..4..h.....~.&.| +000002f0 5c 8a |\.| >>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 8a 97 aa 38 29 |..........0...8)| -00000010 a4 7a 25 ae d5 5f 66 17 cb 8e de d3 ac 0f b3 9d |.z%.._f.........| -00000020 ba 61 54 31 cb c8 fc 1f 4c f5 76 b0 7e 7e 74 04 |.aT1....L.v.~~t.| -00000030 8a 2e 45 a8 5f c7 43 d7 d5 f4 7d |..E._.C...}| +00000000 14 03 01 00 01 01 16 03 01 00 30 ef 9b 5c da 0a |..........0..\..| +00000010 2e c4 79 fa ea 8a 9c 78 4a 1f 08 77 56 73 6e fa |..y....xJ..wVsn.| +00000020 3a 5b 3c cd cd e9 0c a8 bb 59 9e 22 ab 67 2c 03 |:[<......Y.".g,.| +00000030 de ad 7c e4 cb 85 d7 8f c1 1c e3 |..|........| >>> Flow 5 (client to server) -00000000 17 03 01 00 20 22 4d 00 3f 2a 41 f0 53 06 93 fe |.... "M.?*A.S...| -00000010 aa 79 9b 69 bb d5 9b e5 e4 3b 48 ff e5 ce 7d db |.y.i.....;H...}.| -00000020 d8 e8 e6 e1 04 17 03 01 00 20 e8 01 13 cb f1 1f |......... ......| -00000030 17 68 33 6a ad 74 ae a7 c5 d9 00 ea 0b dc bb 9c |.h3j.t..........| -00000040 5c 5f 49 01 1e 53 74 30 58 e6 15 03 01 00 20 bb |\_I..St0X..... .| -00000050 30 7d c2 43 c3 0d b9 b5 3a 70 14 2c 4a 64 c9 fe |0}.C....:p.,Jd..| -00000060 20 25 a7 0a 01 11 3c 62 ca d6 28 80 ed cd 73 | %....-F;...| +00000020 70 99 ce d7 3c 17 03 01 00 20 69 27 e9 89 78 e6 |p...<.... i'..x.| +00000030 64 c0 a9 40 4f 0d 97 53 b2 2e 15 f3 2b 54 3b 77 |d..@O..S....+T;w| +00000040 f2 24 2c 94 dc b3 8b f0 c4 ce 15 03 01 00 20 1b |.$,........... .| +00000050 50 55 83 d8 6b b4 04 b2 f0 2d 1c 9c 0d fa de 58 |PU..k....-.....X| +00000060 cd 0a 1d 55 d6 36 f4 a4 fb cc 55 c5 b1 f3 d3 |...U.6....U....| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES b/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES index 248ab45deff..7d6683c026a 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES +++ b/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 ec 11 a0 ef 24 |....Y...U......$| -00000010 30 9c 83 8c 12 7c 61 a8 39 bd 40 41 22 5c 58 7f |0....|a.9.@A"\X.| -00000020 ca 0c b2 41 66 dc 87 2d f1 4c cc 20 f6 53 42 ce |...Af..-.L. .SB.| -00000030 56 81 58 c1 70 30 37 55 64 f1 28 e4 63 50 e0 f4 |V.X.p07Ud.(.cP..| -00000040 af 7d 01 af 5e 1a 50 19 64 e6 c2 76 c0 09 00 00 |.}..^.P.d..v....| +00000000 16 03 01 00 59 02 00 00 55 03 01 a7 ea 63 8c 7d |....Y...U....c.}| +00000010 54 70 04 d5 5e a2 2e 8b 75 4f 17 c8 a8 8c 3d bc |Tp..^...uO....=.| +00000020 08 aa 82 48 85 ed 1a ff 42 e1 54 20 3b 77 9d 32 |...H....B.T ;w.2| +00000030 4d 60 f2 81 f8 20 aa d2 b0 eb ea 7c 6a 39 52 20 |M`... .....|j9R | +00000040 94 4a 2a 88 05 8a fe 6c 50 5c 95 39 c0 09 00 00 |.J*....lP\.9....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 01 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,37 +55,37 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 01 00 b4 0c 00 00 b0 03 00 1d 20 cc 73 |*............ .s| -00000280 bf 89 65 cc cf f2 dc ed df d3 25 9b b2 16 f8 df |..e.......%.....| -00000290 97 56 f6 29 4e 08 17 19 f0 5a 2f 9d e3 57 00 8a |.V.)N....Z/..W..| -000002a0 30 81 87 02 42 01 91 4e d1 9a 13 69 44 6c 79 01 |0...B..N...iDly.| -000002b0 99 bb ac 65 c7 bd 0c c3 d1 4c ed 54 e3 7b ff ef |...e.....L.T.{..| -000002c0 c3 c2 44 ee ec 3b 8d b4 22 98 31 89 07 a7 b7 c9 |..D..;..".1.....| -000002d0 dc 6f 0c e0 78 a9 79 fc 74 20 0b 55 48 16 d7 d6 |.o..x.y.t .UH...| -000002e0 c8 c8 f8 81 67 e2 50 02 41 61 43 bd 1f e1 68 f1 |....g.P.AaC...h.| -000002f0 7c e1 bf 10 3f 58 16 74 5c 98 ee 4c 18 17 bf f0 ||...?X.t\..L....| -00000300 64 d9 9e be c6 d7 73 e8 20 89 b6 4e fa 93 7d 82 |d.....s. ..N..}.| -00000310 7c 78 96 d1 d9 d1 81 1b 66 5f 87 7b a1 20 40 3c ||x......f_.{. @<| -00000320 13 49 e1 73 8e e9 52 e4 f0 46 16 03 01 00 04 0e |.I.s..R..F......| -00000330 00 00 00 |...| +00000270 2a 16 03 01 00 b5 0c 00 00 b1 03 00 1d 20 3a 1f |*............ :.| +00000280 18 e9 f2 09 3e 79 4b a0 62 73 ef 87 0d ea 90 51 |....>yK.bs.....Q| +00000290 7f 9d d2 79 59 e4 11 7f 69 f7 a9 d7 78 7f 00 8b |...yY...i...x...| +000002a0 30 81 88 02 42 01 65 ac eb e6 b0 86 73 95 a4 27 |0...B.e.....s..'| +000002b0 e3 82 55 cf 88 16 80 c2 68 4b 39 77 2a b1 a9 d3 |..U.....hK9w*...| +000002c0 08 d5 ac 77 ce 5b 16 73 2c ad b5 57 2a 7a 75 34 |...w.[.s,..W*zu4| +000002d0 ec 99 23 bd df b2 27 36 5a 4b 40 e0 d3 b0 d2 31 |..#...'6ZK@....1| +000002e0 9b c7 9e 0a cb 5b 69 02 42 00 88 d7 5a 6a 9e 4c |.....[i.B...Zj.L| +000002f0 c5 7b 2c 8e 93 3b 75 27 b4 00 11 88 ba cf 99 8c |.{,..;u'........| +00000300 e5 f2 60 22 de f2 fe 86 a6 48 86 9c 40 31 08 75 |..`".....H..@1.u| +00000310 aa bc 5d 6d fa 2e a4 a9 a1 0d fc e1 d9 5a a1 60 |..]m.........Z.`| +00000320 93 b9 69 c7 c2 3e f5 a9 cb 31 41 16 03 01 00 04 |..i..>...1A.....| +00000330 0e 00 00 00 |....| >>> Flow 3 (client to server) 00000000 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 01 00 01 01 |....._X.;t......| -00000030 16 03 01 00 30 c6 44 20 88 b8 3b e4 a9 67 ca 54 |....0.D ..;..g.T| -00000040 f6 98 79 0e c5 8d d4 da 71 ce 40 51 59 e9 3f ee |..y.....q.@QY.?.| -00000050 a0 bb 7d 8a 84 4d 0a be 37 37 a8 cc fe bb 5d b6 |..}..M..77....].| -00000060 37 1b a8 a0 04 |7....| +00000030 16 03 01 00 30 30 25 15 82 a1 7f 11 32 13 52 17 |....00%.....2.R.| +00000040 b8 bd 5b b9 1e 69 88 0b b3 5f 12 40 e3 4b 03 cb |..[..i..._.@.K..| +00000050 cd 07 3c 43 4f ab f7 5d 2c 6a a3 02 a9 64 d0 77 |..>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 d3 c0 74 ba 22 |..........0..t."| -00000010 e5 c6 8d c6 82 ac f4 63 90 28 73 a4 7a c3 43 ca |.......c.(s.z.C.| -00000020 0d 09 5a 84 70 d6 64 de 4b 06 9b fc b9 a9 3f d8 |..Z.p.d.K.....?.| -00000030 a0 02 67 2b 63 1e 61 91 b7 f9 a2 |..g+c.a....| +00000000 14 03 01 00 01 01 16 03 01 00 30 b5 3e 18 97 a1 |..........0.>...| +00000010 ca 2e 7f 5f b9 72 cb aa d4 f6 85 86 d3 27 40 13 |..._.r.......'@.| +00000020 e3 99 35 13 67 a8 9e 6e bb 63 15 97 96 42 e4 b3 |..5.g..n.c...B..| +00000030 fc 15 ee b7 d8 cb a2 64 3d 55 b8 |.......d=U.| >>> Flow 5 (client to server) -00000000 17 03 01 00 20 b2 55 db d3 41 5d 5c 9b b5 b8 c8 |.... .U..A]\....| -00000010 fd ab 30 74 08 59 22 e3 8c e0 43 d0 63 14 33 f8 |..0t.Y"...C.c.3.| -00000020 00 b6 3d 1e a0 17 03 01 00 20 fa 14 95 a5 e3 a0 |..=...... ......| -00000030 09 04 e1 49 35 c5 ef c1 b4 c5 7d b5 6a c7 13 db |...I5.....}.j...| -00000040 88 2f 4c 65 f8 c4 d5 2a a5 3a 15 03 01 00 20 05 |./Le...*.:.... .| -00000050 21 da 3d 87 62 0c a7 e6 eb aa f6 bd 2f 77 fd a4 |!.=.b......./w..| -00000060 cd 2a ac 22 73 7c 75 60 59 db 0f 8f df 86 73 |.*."s|u`Y.....s| +00000000 17 03 01 00 20 12 6c bf f2 39 2d e6 ad a8 38 d5 |.... .l..9-...8.| +00000010 1c ea 5b 79 e5 c7 4a 41 eb 58 70 f0 7d f7 60 e7 |..[y..JA.Xp.}.`.| +00000020 ee 77 98 75 f2 17 03 01 00 20 ac 5e 6d b0 81 0b |.w.u..... .^m...| +00000030 14 ca c2 70 53 d8 6d 55 49 63 da 8a 61 66 80 2d |...pS.mUIc..af.-| +00000040 e4 7c 2e 60 1f eb 3c f2 27 66 15 03 01 00 20 7a |.|.`..<.'f.... z| +00000050 2b 80 f8 00 0f 06 f5 6e fe b7 b7 6b 12 6c 8d 8e |+......n...k.l..| +00000060 c4 11 23 2b a2 bb 16 93 b4 e0 e0 fd 8c 42 db |..#+.........B.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES b/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES index ccc71f606a1..c0e842d155c 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES +++ b/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 29 ae 9f 95 df |....Y...U..)....| -00000010 c0 c9 77 0a cc 61 5e f2 7b bb 50 28 95 30 cd 6f |..w..a^.{.P(.0.o| -00000020 7f 23 ca 62 ee 35 20 31 85 6b 77 20 16 82 4f 3a |.#.b.5 1.kw ..O:| -00000030 13 67 6e cc 71 5c f8 7a 4a b2 1f 02 a6 1a a4 2b |.gn.q\.zJ......+| -00000040 32 cd 5a 81 4b 82 a2 e3 7e 67 fa e7 c0 13 00 00 |2.Z.K...~g......| +00000000 16 03 01 00 59 02 00 00 55 03 01 16 f4 24 01 94 |....Y...U....$..| +00000010 68 d2 0f 15 4d d6 65 54 84 73 ab 2c b2 11 c5 64 |h...M.eT.s.,...d| +00000020 d8 93 66 50 cd b0 f0 ab 11 5c 72 20 b1 13 c1 f5 |..fP.....\r ....| +00000030 63 ed 70 0b 21 52 85 36 84 99 1d b6 bb dc d3 1c |c.p.!R.6........| +00000040 b3 76 13 d9 ef 47 c4 c0 18 57 23 3b c0 13 00 00 |.v...G...W#;....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 01 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,36 +60,36 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 01 00 |.=.`.\!.;.......| -000002c0 aa 0c 00 00 a6 03 00 1d 20 89 38 c8 65 ea 1e 0f |........ .8.e...| -000002d0 6d 85 41 9e c4 f2 51 fd 0f f5 18 7d 60 1b c1 79 |m.A...Q....}`..y| -000002e0 55 dc eb 35 8b 0b 64 9c 1e 00 80 d0 9c 8a 95 1b |U..5..d.........| -000002f0 0b 44 37 fc b7 53 98 05 23 e4 83 40 38 f5 1b 68 |.D7..S..#..@8..h| -00000300 dd 4b eb 46 cf 26 7b 0b 37 89 b2 fd 13 2d 5d cd |.K.F.&{.7....-].| -00000310 c5 16 8f e5 ff c6 51 45 77 c5 59 02 71 2e d6 51 |......QEw.Y.q..Q| -00000320 2a 2b ce 93 52 d9 56 e4 37 25 04 2e 5d 95 3d ea |*+..R.V.7%..].=.| -00000330 40 5e 86 8a ae 51 5a 87 17 00 a6 a1 77 c1 ec 40 |@^...QZ.....w..@| -00000340 88 f9 a5 6f ec 73 b3 3e b6 15 14 a1 5f 9a 85 18 |...o.s.>...._...| -00000350 0b 19 82 2a d7 5a 37 4c 7b 4e 06 f7 86 24 15 25 |...*.Z7L{N...$.%| -00000360 58 95 a0 aa 56 f2 3c 36 18 5d 2f 16 03 01 00 04 |X...V.<6.]/.....| +000002c0 aa 0c 00 00 a6 03 00 1d 20 7e aa 30 94 7b fb 09 |........ ~.0.{..| +000002d0 b5 55 ce b3 e9 e0 5b 55 82 f4 e6 7c d0 e4 57 eb |.U....[U...|..W.| +000002e0 9b ec 82 48 d6 0e 2a bb 16 00 80 80 da c5 75 4f |...H..*.......uO| +000002f0 82 95 ee 47 28 af 09 08 d5 13 68 33 5d 91 dd 13 |...G(.....h3]...| +00000300 43 84 e9 54 d9 e7 39 7c 38 74 d5 92 8f 46 37 86 |C..T..9|8t...F7.| +00000310 44 68 ae c7 3a ad e1 33 5f cd d8 c6 a5 7c 5e 83 |Dh..:..3_....|^.| +00000320 44 ba b1 09 44 ec 42 7f 41 80 d6 b6 4c 6d ae 24 |D...D.B.A...Lm.$| +00000330 a9 3b 53 87 2f 3b 3a 1f da 87 2b 7d cf 9e ed a5 |.;S./;:...+}....| +00000340 04 54 ad c2 3c 7b 21 60 55 67 41 47 60 02 1e 62 |.T..<{!`UgAG`..b| +00000350 bb 9f ee 2c 6e 79 20 6e 65 e2 d0 ae 73 70 3e a7 |...,ny ne...sp>.| +00000360 3f 74 96 8e 2a 6e a6 7e 7a e0 e4 16 03 01 00 04 |?t..*n.~z.......| 00000370 0e 00 00 00 |....| >>> Flow 3 (client to server) 00000000 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 01 00 01 01 |....._X.;t......| -00000030 16 03 01 00 30 85 63 fe 57 56 dc ee 8c e6 66 e0 |....0.c.WV....f.| -00000040 5c 06 37 0c 15 76 a2 51 b8 95 d6 b8 64 a3 dc 70 |\.7..v.Q....d..p| -00000050 e7 2d 70 a8 73 ff fb 11 5a 96 bb 0e 23 b4 0a 5b |.-p.s...Z...#..[| -00000060 5e 6e c0 45 91 |^n.E.| +00000030 16 03 01 00 30 5a cb 36 c8 1c 43 a8 e1 88 db c9 |....0Z.6..C.....| +00000040 ae 78 b0 af 97 e4 c3 f6 25 51 8e 4d 57 94 ee ca |.x......%Q.MW...| +00000050 a4 8b 3f 4d 17 75 34 58 c3 fa a6 6f d4 e5 ae 3a |..?M.u4X...o...:| +00000060 cb 5a cb 11 ef |.Z...| >>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 3b 02 9e ba 9e |..........0;....| -00000010 ae 5c 03 81 ba c4 13 9e a8 0f 29 3c a3 e8 bd 2e |.\........)<....| -00000020 af 2c c7 45 c2 05 b1 03 2c 4b 45 07 5d ad 09 c6 |.,.E....,KE.]...| -00000030 4d 9a fb 72 53 54 d7 a7 59 72 c9 |M..rST..Yr.| +00000000 14 03 01 00 01 01 16 03 01 00 30 96 92 50 6f f0 |..........0..Po.| +00000010 d1 ff 7c 39 fb 75 0c 8b c9 d7 29 7d 9d 32 4c 19 |..|9.u....)}.2L.| +00000020 2e 93 ea 11 87 07 fc 5a 7d 3c 30 e1 bd 64 7f 90 |.......Z}<0..d..| +00000030 fd 70 1d 50 eb ec f2 d6 de 09 61 |.p.P......a| >>> Flow 5 (client to server) -00000000 17 03 01 00 20 b4 b4 ad 09 c7 2f ce 80 0b ec 5b |.... ...../....[| -00000010 3f 59 b9 fb 8e 73 fe 23 d6 b0 39 c3 7f a9 61 12 |?Y...s.#..9...a.| -00000020 a7 0f 76 08 f1 17 03 01 00 20 84 c5 c4 22 c8 0c |..v...... ..."..| -00000030 9c c7 04 f9 85 49 fb 8f 0b 49 4e c3 6b b4 5c 62 |.....I...IN.k.\b| -00000040 2a 41 91 41 01 a2 17 43 7c 3d 15 03 01 00 20 e6 |*A.A...C|=.... .| -00000050 5d fa 04 a1 72 9a b3 34 0e 59 e3 0b 8f 3e 6d f7 |]...r..4.Y...>m.| -00000060 cd 85 4e d8 62 27 2c 21 c3 2e c6 64 d2 66 10 |..N.b',!...d.f.| +00000000 17 03 01 00 20 fd a4 ba f1 78 a9 a2 45 d3 d2 5a |.... ....x..E..Z| +00000010 1e 41 6b 89 8d bd a4 21 69 03 a1 7c b8 56 ff df |.Ak....!i..|.V..| +00000020 67 bc 85 5e 21 17 03 01 00 20 a7 6d 4c 11 d0 f3 |g..^!.... .mL...| +00000030 7d e2 f0 69 18 7c 42 71 78 e4 3b 71 7d 13 27 bb |}..i.|Bqx.;q}.'.| +00000040 79 fd d7 b2 d7 28 ca 92 83 f1 15 03 01 00 20 10 |y....(........ .| +00000050 b3 79 d4 1d 70 db b7 6c f2 15 05 3c 4d 65 ba ec |.y..p..l...>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 65 28 68 37 bf |....Y...U..e(h7.| -00000010 79 50 5d e6 20 07 ea 1c 6d 46 3b f9 95 a9 97 fa |yP]. ...mF;.....| -00000020 3c 37 87 45 e7 62 f2 e8 44 bb 02 20 e9 e0 63 8e |<7.E.b..D.. ..c.| -00000030 a1 0a cc a4 b3 e6 a9 3b b0 88 c7 af cd d5 73 0a |.......;......s.| -00000040 b4 30 14 cf d9 f5 e0 e8 e2 2e fa 47 c0 13 00 00 |.0.........G....| +00000000 16 03 01 00 59 02 00 00 55 03 01 7a a4 22 4f 19 |....Y...U..z."O.| +00000010 54 37 47 cb e5 dd b4 54 86 9e 9e d6 3f f1 bd ca |T7G....T....?...| +00000020 9a 3e 16 3c 7e 1a 29 22 0d c8 95 20 ac 85 42 c1 |.>.<~.)"... ..B.| +00000030 e7 f3 38 62 38 24 a8 24 d2 67 bd 0d 06 44 74 cf |..8b8$.$.g...Dt.| +00000040 3d a4 37 17 bc 8c 5d 41 9f 5a 74 69 c0 13 00 00 |=.7...]A.Zti....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 01 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,36 +60,36 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 01 00 |.=.`.\!.;.......| -000002c0 aa 0c 00 00 a6 03 00 1d 20 33 83 7d 9b d5 61 57 |........ 3.}..aW| -000002d0 d1 d3 73 b8 f2 76 f8 31 fd 65 30 5a 6b ab c1 2f |..s..v.1.e0Zk../| -000002e0 0f 38 eb 54 bf 8b 09 a3 5a 00 80 34 a3 a6 86 46 |.8.T....Z..4...F| -000002f0 e5 4d d9 73 23 6a 19 fb f8 77 38 e1 00 74 00 c6 |.M.s#j...w8..t..| -00000300 b2 58 3c 14 a3 7e 57 6d 85 5c 37 4d 82 f1 70 2a |.X<..~Wm.\7M..p*| -00000310 55 c9 e8 89 d1 45 03 e1 ac 84 2e ed 36 1c d5 90 |U....E......6...| -00000320 cf 2d fe a6 9b f0 41 ee 0f 0a 3c 2b bd 18 da a3 |.-....A...<+....| -00000330 f3 21 07 a4 4b 52 1e 3c c4 cf 71 60 c7 05 39 75 |.!..KR.<..q`..9u| -00000340 16 20 f0 6c 18 e8 82 28 3e fc f0 a0 43 6e 77 df |. .l...(>...Cnw.| -00000350 2f fd a1 6a fe 37 9c 67 4e a1 2a 86 23 79 a9 1f |/..j.7.gN.*.#y..| -00000360 4c 9f 2f 04 0c be 27 58 97 57 1d 16 03 01 00 04 |L./...'X.W......| +000002c0 aa 0c 00 00 a6 03 00 1d 20 71 52 12 72 a7 56 0b |........ qR.r.V.| +000002d0 51 81 af 9f e1 95 43 44 54 0e 9e 3d cc 6f 3c 4c |Q.....CDT..=.o| +00000360 cb 59 5d 81 da 58 07 83 e7 af 25 16 03 01 00 04 |.Y]..X....%.....| 00000370 0e 00 00 00 |....| >>> Flow 3 (client to server) 00000000 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 01 00 01 01 |....._X.;t......| -00000030 16 03 01 00 30 2a f4 6d db f7 d5 12 3d 3a c0 46 |....0*.m....=:.F| -00000040 cb db 19 82 70 5c 4d 98 f4 42 27 85 eb 90 77 2a |....p\M..B'...w*| -00000050 d7 60 f0 0a 98 a5 da 59 85 ac 65 68 79 91 64 bd |.`.....Y..ehy.d.| -00000060 3a c6 d6 3f 6d |:..?m| +00000030 16 03 01 00 30 c3 26 49 92 5a 8c d0 da 48 ba 60 |....0.&I.Z...H.`| +00000040 29 c0 5c d5 44 04 11 7a 25 b5 d6 9f a4 cf fe bf |).\.D..z%.......| +00000050 33 a7 ba c2 96 2b 4d c1 fb dc 4c ba b8 2b 6f 20 |3....+M...L..+o | +00000060 2d 2a 02 ee 17 |-*...| >>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 e2 d4 12 a3 5d |..........0....]| -00000010 dd 4b 72 a2 0b 5c 47 52 f1 2d cd 5f 13 c7 e8 a6 |.Kr..\GR.-._....| -00000020 7c 7c ba 94 f8 f3 54 73 3f c0 1f 90 e7 d3 78 78 |||....Ts?.....xx| -00000030 0b be f9 b2 d9 9a 39 83 45 f5 2c |......9.E.,| +00000000 14 03 01 00 01 01 16 03 01 00 30 f4 4e 0a ea 58 |..........0.N..X| +00000010 18 c6 9d 5f aa 5d f0 03 d4 63 0d e7 83 cb a8 18 |..._.]...c......| +00000020 06 fa b6 82 da df 16 89 5c 8b 5d 92 87 b1 42 da |........\.]...B.| +00000030 cd 2a ee dc 43 08 f1 0d 1f 18 5c |.*..C.....\| >>> Flow 5 (client to server) -00000000 17 03 01 00 20 a0 51 37 c8 db c1 c9 03 41 35 7e |.... .Q7.....A5~| -00000010 7c b4 c1 d2 b8 b4 63 e6 ac e7 6d 15 db ef 2d 4e ||.....c...m...-N| -00000020 70 c3 62 51 2c 17 03 01 00 20 55 0e e9 5a 5c 57 |p.bQ,.... U..Z\W| -00000030 fb d9 f9 1b ae c5 ad fc 13 e3 5e 7c 79 c6 f8 92 |..........^|y...| -00000040 9f b9 0e 94 e4 8b d4 cf 75 5c 15 03 01 00 20 bf |........u\.... .| -00000050 76 01 09 a9 b4 1e 54 cd 27 77 35 9e 5c 10 d5 dc |v.....T.'w5.\...| -00000060 3e 6c d6 1c 0b b0 97 b2 27 81 59 92 75 db 90 |>l......'.Y.u..| +00000000 17 03 01 00 20 e6 95 10 e0 98 07 9f 2b 42 06 b8 |.... .......+B..| +00000010 2a 6c 5d 4a 95 2a 2c 17 d5 cc 68 42 18 bd 72 58 |*l]J.*,...hB..rX| +00000020 c1 39 73 05 75 17 03 01 00 20 d4 ae 70 ee a0 ed |.9s.u.... ..p...| +00000030 3e dd f9 aa 93 03 ff f5 a4 f6 f3 0d e7 a6 59 a9 |>.............Y.| +00000040 40 b4 f6 ad a5 46 0b eb ee 0e 15 03 01 00 20 7c |@....F........ || +00000050 1a 29 f3 49 60 47 2e 52 ec 00 4a 62 44 30 93 5f |.).I`G.R..JbD0._| +00000060 df 73 2f 44 65 3f 77 c1 3d 04 32 c8 bb 86 ed |.s/De?w.=.2....| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv10-RSA-RC4 b/libgo/go/crypto/tls/testdata/Client-TLSv10-RSA-RC4 index 8a564081880..1fe13b9f97a 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv10-RSA-RC4 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv10-RSA-RC4 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 01 00 51 02 00 00 4d 03 01 d8 84 eb 07 33 |....Q...M......3| -00000010 03 0d 9d c7 6d 90 a7 1f 92 33 6e d0 fc 67 7b 4f |....m....3n..g{O| -00000020 c5 47 84 9c 6b 1d 6d 15 82 0d e2 20 78 95 16 fc |.G..k.m.... x...| -00000030 9a c6 a9 8d 29 d7 5b aa 24 6a 60 48 88 85 f7 b5 |....).[.$j`H....| -00000040 a0 72 f9 c0 ae 3d 01 ae f7 6c b1 3a 00 05 00 00 |.r...=...l.:....| +00000000 16 03 01 00 51 02 00 00 4d 03 01 5a 4f 78 41 d5 |....Q...M..ZOxA.| +00000010 86 2f d2 0a c6 05 bc c9 8e cc bd b2 39 ac a5 78 |./..........9..x| +00000020 e3 e5 31 b9 cb 01 af cb ca fc 88 20 c9 61 c6 91 |..1........ .a..| +00000030 b2 e5 70 df ca d0 41 a8 20 61 ab 08 f6 dc fe c0 |..p...A. a......| +00000040 cc ea 1e 80 89 02 6a 26 ea f0 c8 71 00 05 00 00 |......j&...q....| 00000050 05 ff 01 00 01 00 16 03 01 02 59 0b 00 02 55 00 |..........Y...U.| 00000060 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 00000070 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| @@ -70,15 +70,15 @@ 00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| 00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| 00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 01 00 01 |.Y(.....ia5.....| -00000090 01 16 03 01 00 24 c5 cc 6d 58 66 41 6e 24 3d 77 |.....$..mXfAn$=w| -000000a0 c6 dd b2 2e 39 6f 84 4c e8 32 0b 0b 22 8b 8f d3 |....9o.L.2.."...| -000000b0 e0 fc 8a 0e 88 8f 69 35 88 48 |......i5.H| +00000090 01 16 03 01 00 24 48 fd e6 fc 4a 94 33 82 22 ff |.....$H...J.3.".| +000000a0 af c3 44 98 d2 c6 4e 8a 39 43 dd 4b 2a 11 2b 4e |..D...N.9C.K*.+N| +000000b0 5b d9 a4 fc 6c 95 d7 69 05 f9 |[...l..i..| >>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 24 9c 13 f1 b9 96 |..........$.....| -00000010 4a dc 99 34 51 3e 5f 00 e4 93 94 ee 91 25 9d f2 |J..4Q>_......%..| -00000020 5d f1 8c 7e df b7 4a 42 9c 51 cb c0 83 92 cb |]..~..JB.Q.....| +00000000 14 03 01 00 01 01 16 03 01 00 24 61 d2 68 5e 12 |..........$a.h^.| +00000010 91 6e 7f fe bf b7 42 58 e9 06 38 09 c1 16 34 e5 |.n....BX..8...4.| +00000020 a1 46 d6 cf 23 ca 48 c1 ed 76 f9 48 a1 9a 2a |.F..#.H..v.H..*| >>> Flow 5 (client to server) -00000000 17 03 01 00 1a 7f 06 af 43 39 09 7b c7 52 fd 67 |........C9.{.R.g| -00000010 cd 4f 44 8f b5 d4 60 db ed dd 7e 10 5e df 1c 15 |.OD...`...~.^...| -00000020 03 01 00 16 7b 2b ee 08 a0 6a c5 64 d8 6d dc 91 |....{+...j.d.m..| -00000030 e8 e0 44 11 23 a9 c8 4c 9d 5b |..D.#..L.[| +00000000 17 03 01 00 1a 3a e1 39 7c fe 25 50 dc 66 3f b6 |.....:.9|.%P.f?.| +00000010 6f fd 79 3b 12 83 af 89 b1 c5 f6 75 56 ad a1 15 |o.y;.......uV...| +00000020 03 01 00 16 07 d1 d3 7a 54 1c 71 0b c8 64 10 46 |.......zT.q..d.F| +00000030 30 d0 bf df 75 a6 dc 10 b1 d1 |0...u.....| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES b/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES index e7a6cf5e086..9d18cd62f78 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES +++ b/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 02 00 59 02 00 00 55 03 02 48 df b9 04 7d |....Y...U..H...}| -00000010 92 50 cb 8f f7 03 8d 34 76 f5 4f 3a a0 d3 8e cc |.P.....4v.O:....| -00000020 2a cd 5d 31 1a 55 d8 08 48 3f d9 20 0c 3b c2 e1 |*.]1.U..H?. .;..| -00000030 8f 94 68 6e e2 31 e4 f9 a6 3d bf 27 84 38 43 95 |..hn.1...=.'.8C.| -00000040 b6 d9 d3 4b fa 0a a2 c6 5a ae 83 bd c0 09 00 00 |...K....Z.......| +00000000 16 03 02 00 59 02 00 00 55 03 02 23 a8 e7 14 3f |....Y...U..#...?| +00000010 64 61 3c ee 80 a2 94 84 ab b8 66 76 30 84 06 78 |da<.......fv0..x| +00000020 96 ba a7 d3 1e 81 1b 16 64 76 88 20 3d 21 21 b3 |........dv. =!!.| +00000030 45 dd fe cb 5b d7 9a 86 39 ee 4f f8 60 eb 95 ea |E...[...9.O.`...| +00000040 ab 64 48 14 74 16 fd e9 47 07 66 60 c0 09 00 00 |.dH.t...G.f`....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 02 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,39 +55,39 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 02 00 b4 0c 00 00 b0 03 00 1d 20 1d 08 |*............ ..| -00000280 90 e5 39 31 40 7a 35 73 66 ff 41 e5 02 1f 8d a0 |..91@z5sf.A.....| -00000290 12 e6 14 c8 24 b0 cc 1e 0f ad 4b 1b f9 1a 00 8a |....$.....K.....| -000002a0 30 81 87 02 42 00 bf 9d 0c 38 71 af 56 52 d7 5d |0...B....8q.VR.]| -000002b0 35 98 50 d2 fa 31 29 83 6d 53 9d 2a ef ae 6a 5f |5.P..1).mS.*..j_| -000002c0 4d aa 8b 27 a4 73 51 e7 eb 2d c2 13 54 87 41 23 |M..'.sQ..-..T.A#| -000002d0 98 0b 47 96 ba 50 95 c2 58 ed 23 8e 0b 78 9f cf |..G..P..X.#..x..| -000002e0 6c 61 e6 e5 2b 0e b9 02 41 4b e0 f9 d6 03 cf b4 |la..+...AK......| -000002f0 fa 6f 08 51 b7 3a 2a 60 d0 76 72 c8 28 8e 6e 67 |.o.Q.:*`.vr.(.ng| -00000300 69 42 e3 e0 49 85 e9 cc 6a a0 c4 30 52 3b 3e 46 |iB..I...j..0R;>F| -00000310 a7 a7 2b 95 7f bf 25 6e 54 ea 3c 48 1e 1d 28 96 |..+...%nT.-a.ok.| +000002c0 1d 32 4b 88 93 9b 22 b0 3d 09 c3 93 9e 25 31 d6 |.2K...".=....%1.| +000002d0 5f 06 3a f0 4a 61 0b 06 03 5d 6c 0e b3 5e 48 5a |_.:.Ja...]l..^HZ| +000002e0 f0 5b 21 48 58 8f b2 02 41 1c 57 f1 51 04 d6 f8 |.[!HX...A.W.Q...| +000002f0 a2 51 e6 e6 3e e0 99 63 aa d2 1c 7b 92 be 44 ec |.Q..>..c...{..D.| +00000300 86 c3 31 fa e7 9b 98 1a 59 a5 93 3e a9 73 f0 ec |..1.....Y..>.s..| +00000310 03 22 37 19 db 78 30 27 ab bf 52 07 6c 3a 79 f5 |."7..x0'..R.l:y.| +00000320 ad 70 59 76 84 44 f0 47 e0 3d 16 03 02 00 04 0e |.pYv.D.G.=......| 00000330 00 00 00 |...| >>> Flow 3 (client to server) 00000000 16 03 02 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 02 00 01 01 |....._X.;t......| 00000030 16 03 02 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| -00000040 00 00 00 00 00 3b 28 96 4f 03 dd 04 4e a3 73 73 |.....;(.O...N.ss| -00000050 48 40 ef e3 4f 9d ab 39 3b db c6 0e fa 7f 0c 18 |H@..O..9;.......| -00000060 f5 94 cd 55 23 2f f5 5c 69 14 bb 0b 49 e3 98 d7 |...U#/.\i...I...| -00000070 c0 db 9e 3a 8b |...:.| +00000040 00 00 00 00 00 ef 0f 92 ac 11 fe 97 1a 46 69 e4 |.............Fi.| +00000050 b3 26 8d d7 92 46 02 25 5b 2e 86 3e 96 3d 64 ed |.&...F.%[..>.=d.| +00000060 37 92 dd ae a5 a6 9f 03 f0 c2 42 78 9f b9 78 ac |7.........Bx..x.| +00000070 97 ab 82 25 e2 |...%.| >>> Flow 4 (server to client) -00000000 14 03 02 00 01 01 16 03 02 00 40 76 98 c8 7d 95 |..........@v..}.| -00000010 ac 40 73 36 c1 49 ae 20 f4 a0 ef 70 59 bf d3 5e |.@s6.I. ...pY..^| -00000020 71 ec 2e f8 c5 ea 9d cc 4d 06 44 e3 aa 46 cd c3 |q.......M.D..F..| -00000030 c9 1b a0 5a 9a 76 ce 3b b5 16 85 33 cf ba 46 08 |...Z.v.;...3..F.| -00000040 b8 c0 a7 da 2a 4d 23 b9 02 cc 3f |....*M#...?| +00000000 14 03 02 00 01 01 16 03 02 00 40 df a9 23 37 74 |..........@..#7t| +00000010 47 d8 98 87 53 b4 0a 4d b0 a5 fb cb d6 37 c8 7c |G...S..M.....7.|| +00000020 61 95 81 ef b3 63 78 2b 53 c2 86 fc 39 df c4 5f |a....cx+S...9.._| +00000030 e4 4b af 1d fe bc 4c fe 1b 6a 28 c3 46 6f 24 94 |.K....L..j(.Fo$.| +00000040 a8 bf ef ce e8 e8 ad 2c d9 10 32 |.......,..2| >>> Flow 5 (client to server) 00000000 17 03 02 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 03 dd b7 03 45 4d 4c 0a 7a e7 36 |.........EML.z.6| -00000020 a0 93 82 4e 15 73 b1 b8 18 17 35 c6 e1 84 47 4b |...N.s....5...GK| -00000030 8c 3f 5c a2 9d 15 03 02 00 30 00 00 00 00 00 00 |.?\......0......| -00000040 00 00 00 00 00 00 00 00 00 00 c2 f9 0f cb 78 53 |..............xS| -00000050 43 55 f3 fd 8a cc 16 32 19 0b 81 5d 90 a4 31 ff |CU.....2...]..1.| -00000060 58 ea 70 73 92 ad e8 ed 0c e3 |X.ps......| +00000010 00 00 00 00 00 34 50 ce 9c 7f f5 2d a2 c1 e4 5c |.....4P....-...\| +00000020 fa d1 a0 f4 38 e8 4f 51 54 36 07 da f1 af 6d ef |....8.OQT6....m.| +00000030 b8 b0 bc bc a6 15 03 02 00 30 00 00 00 00 00 00 |.........0......| +00000040 00 00 00 00 00 00 00 00 00 00 0b d4 8e e8 69 64 |..............id| +00000050 53 38 7c 72 d8 1d 9f d5 8a 83 74 a7 37 6b e2 c0 |S8|r......t.7k..| +00000060 8f 26 e7 5d 0e 06 ae e0 db fb |.&.]......| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES b/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES index 02175ac954e..4cc9610faa9 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES +++ b/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 02 00 59 02 00 00 55 03 02 98 e4 68 fc f9 |....Y...U....h..| -00000010 df 3e 77 31 50 88 fb c7 9c 53 37 20 97 9d 66 e1 |.>w1P....S7 ..f.| -00000020 7f 2b bd 1f 59 2e b4 e1 12 71 0a 20 fe dc fa 3d |.+..Y....q. ...=| -00000030 a5 41 2c 4c 0f 30 73 a8 35 4a 6a 14 1b 6c b6 22 |.A,L.0s.5Jj..l."| -00000040 aa be ae be 7c 53 6d 29 c1 da 0e 6b c0 13 00 00 |....|Sm)...k....| +00000000 16 03 02 00 59 02 00 00 55 03 02 6e ff 3b 26 66 |....Y...U..n.;&f| +00000010 7c 32 3f 42 fd 92 7c 12 db 26 b2 45 6e 28 b9 49 ||2?B..|..&.En(.I| +00000020 86 6b 00 54 92 3b 65 a6 02 6d 94 20 ea 44 db 5c |.k.T.;e..m. .D.\| +00000030 d1 39 35 b2 ea 1c 6d 3e 94 bb 47 60 25 1e 9c 74 |.95...m>..G`%..t| +00000040 e7 bd 54 cc 2b 36 14 6a 12 54 5b 6c c0 13 00 00 |..T.+6.j.T[l....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 02 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,38 +60,38 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 02 00 |.=.`.\!.;.......| -000002c0 aa 0c 00 00 a6 03 00 1d 20 e7 c9 40 dc 8c e7 4a |........ ..@...J| -000002d0 52 c5 47 3d 41 9e 43 75 9a 3e 01 db 85 dd 6e 27 |R.G=A.Cu.>....n'| -000002e0 89 c1 88 3f d3 1b 62 50 6b 00 80 26 d0 b2 dc c7 |...?..bPk..&....| -000002f0 2f 94 03 ff be db bc ee d1 2b 83 29 6e 73 6b 69 |/........+.)nski| -00000300 39 eb a7 38 c3 4b d7 93 1d c7 94 ae 83 1e 70 2c |9..8.K........p,| -00000310 18 bb 82 b6 fe 18 74 a1 33 aa f8 a5 8a 41 c3 b8 |......t.3....A..| -00000320 5d 30 7e 5e cd 05 ef df bf 8a 77 96 1c cb e9 c5 |]0~^......w.....| -00000330 82 0e 79 e0 04 2f ba 0a 63 f5 de 70 b6 ef 09 08 |..y../..c..p....| -00000340 24 36 b6 01 c3 8c d7 3e 54 1b f1 39 08 2e 18 79 |$6.....>T..9...y| -00000350 85 58 73 a2 f4 51 2b 04 1b c5 da b4 47 b0 a8 ca |.Xs..Q+.....G...| -00000360 38 35 75 78 2b 53 97 93 50 01 c3 16 03 02 00 04 |85ux+S..P.......| +000002c0 aa 0c 00 00 a6 03 00 1d 20 82 3b d2 56 dd cd d8 |........ .;.V...| +000002d0 e1 98 a7 90 d1 08 2d 37 dc e8 21 cd 29 af 29 a5 |......-7..!.).).| +000002e0 78 8e 59 9e 4c ac c9 d2 4b 00 80 25 20 91 4e 0d |x.Y.L...K..% .N.| +000002f0 74 12 9e 1c 98 fb 5f 4b ad fd c8 68 df 6b 82 98 |t....._K...h.k..| +00000300 a8 7c ee 17 44 47 91 2a 42 c1 82 d0 ce aa cd f8 |.|..DG.*B.......| +00000310 69 1e 85 79 27 fe ef 5a a2 e1 35 30 9a 2d c6 b0 |i..y'..Z..50.-..| +00000320 43 84 39 7f 8d 68 09 d6 6c 1a 84 0f c0 9a c0 9f |C.9..h..l.......| +00000330 64 56 cb fc 32 f2 4a a3 26 e8 c2 5f d7 16 3e 7c |dV..2.J.&.._..>|| +00000340 4e 8b 89 f8 7f f4 c2 26 fe 01 cd 48 b6 61 9c 93 |N......&...H.a..| +00000350 1a bc a1 d1 01 c5 bf ef 43 b4 ca 86 62 37 b4 99 |........C...b7..| +00000360 54 69 db 74 51 92 92 dd c1 b1 75 16 03 02 00 04 |Ti.tQ.....u.....| 00000370 0e 00 00 00 |....| >>> Flow 3 (client to server) 00000000 16 03 02 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 02 00 01 01 |....._X.;t......| 00000030 16 03 02 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| -00000040 00 00 00 00 00 46 e7 d3 6c ca df 1e 98 43 dd fc |.....F..l....C..| -00000050 7c 0e 51 7c 32 0a 76 41 7a c5 19 4a b2 75 e0 43 ||.Q|2.vAz..J.u.C| -00000060 27 7e 84 b3 e2 2b ee fd 6f a5 11 f3 f8 68 e2 b1 |'~...+..o....h..| -00000070 5e 7e ec 3a 89 |^~.:.| +00000040 00 00 00 00 00 c5 bf e6 b3 86 12 92 df 68 fa 75 |.............h.u| +00000050 79 5f ee fe 60 91 d1 fd 8a 48 3b 97 b4 da 7f 58 |y_..`....H;....X| +00000060 3e 7e 40 d7 93 1d 6b e2 0e 2a a4 45 20 e0 9d f9 |>~@...k..*.E ...| +00000070 b6 5e b1 f1 4f |.^..O| >>> Flow 4 (server to client) -00000000 14 03 02 00 01 01 16 03 02 00 40 a1 8f f2 23 62 |..........@...#b| -00000010 42 71 dd dc d6 8c 5e 3e d7 cf ef 8b b8 26 d4 99 |Bq....^>.....&..| -00000020 d9 4f 58 ac cf eb 5d 56 00 be 20 3e 32 c2 72 2a |.OX...]V.. >2.r*| -00000030 46 6a c4 b6 51 8c 3d c7 b3 e7 28 32 8c b7 f6 4c |Fj..Q.=...(2...L| -00000040 9a 3d 30 56 42 84 25 c7 aa f4 e7 |.=0VB.%....| +00000000 14 03 02 00 01 01 16 03 02 00 40 bf 58 92 80 02 |..........@.X...| +00000010 75 91 40 30 35 e0 16 76 f4 97 bd 77 46 a3 a3 4e |u.@05..v...wF..N| +00000020 f1 be 53 eb b8 56 45 b1 71 c9 f8 a9 bf c6 9a 00 |..S..VE.q.......| +00000030 83 46 91 88 d5 7b 72 95 27 33 80 43 3f 3e f6 60 |.F...{r.'3.C?>.`| +00000040 c6 55 90 6a 87 8e 7d 48 27 e2 40 |.U.j..}H'.@| >>> Flow 5 (client to server) 00000000 17 03 02 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 c1 55 65 98 a8 15 c1 80 95 e0 85 |......Ue........| -00000020 c0 0e f5 68 27 b1 f2 27 c2 cc 0e fd 36 15 ed 75 |...h'..'....6..u| -00000030 9f 87 78 ae 3a 15 03 02 00 30 00 00 00 00 00 00 |..x.:....0......| -00000040 00 00 00 00 00 00 00 00 00 00 b1 1a 15 9d f2 93 |................| -00000050 4b 2d 0c 32 9d e6 34 1b 37 bf 89 b2 ca 44 95 16 |K-.2..4.7....D..| -00000060 10 26 bd 47 e9 cb 62 76 1e 72 |.&.G..bv.r| +00000010 00 00 00 00 00 f5 6b bc 6d 2c 70 b1 c0 f0 ab 78 |......k.m,p....x| +00000020 44 c9 97 f6 59 ef 15 e4 05 cf e0 55 ee a4 68 8c |D...Y......U..h.| +00000030 86 57 82 bd 84 15 03 02 00 30 00 00 00 00 00 00 |.W.......0......| +00000040 00 00 00 00 00 00 00 00 00 00 ef b2 a9 a5 bb a3 |................| +00000050 6e e5 d1 2b ef 83 1d 11 de 29 d2 30 2c fc 78 73 |n..+.....).0,.xs| +00000060 6b 6e 0a d2 55 67 5c d4 58 b3 |kn..Ug\.X.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv11-Ed25519 b/libgo/go/crypto/tls/testdata/Client-TLSv11-Ed25519 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv11-RSA-RC4 b/libgo/go/crypto/tls/testdata/Client-TLSv11-RSA-RC4 index 6340eb1bbcc..9dae5dd6d2b 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv11-RSA-RC4 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv11-RSA-RC4 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 02 00 51 02 00 00 4d 03 02 63 10 cc 62 2c |....Q...M..c..b,| -00000010 7c 1f 2a 30 cc 2f fc cf 57 4e b1 a8 48 1a e8 e6 ||.*0./..WN..H...| -00000020 fe 3c ec cd e6 bf b4 0b 90 4f 28 20 f4 f9 6a 6d |.<.......O( ..jm| -00000030 73 cf 9f 86 7e d1 10 ab 7f 48 9c 1e c2 14 1d 18 |s...~....H......| -00000040 cc e8 57 48 65 c5 2e 86 a8 e2 da 4a 00 05 00 00 |..WHe......J....| +00000000 16 03 02 00 51 02 00 00 4d 03 02 96 ca 2a e7 23 |....Q...M....*.#| +00000010 af 2e 45 62 15 fa 5a 84 bc aa 7c 79 03 1b 37 69 |..Eb..Z...|y..7i| +00000020 a0 77 ce 03 81 b7 e5 7d 31 34 6e 20 93 83 5d 7c |.w.....}14n ..]|| +00000030 e8 c7 48 f9 67 ec 97 b1 27 b6 de de 89 07 5a cf |..H.g...'.....Z.| +00000040 44 77 48 4b e9 62 43 e3 87 fd de 87 00 05 00 00 |DwHK.bC.........| 00000050 05 ff 01 00 01 00 16 03 02 02 59 0b 00 02 55 00 |..........Y...U.| 00000060 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 00000070 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| @@ -70,15 +70,15 @@ 00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| 00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| 00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 02 00 01 |.Y(.....ia5.....| -00000090 01 16 03 02 00 24 cf ee c8 cd b5 06 a4 5a 3a 3e |.....$.......Z:>| -000000a0 6a 11 9b 40 48 b2 89 95 5c ba 30 59 df 05 63 46 |j..@H...\.0Y..cF| -000000b0 0c 23 54 34 a8 f5 b2 51 1b 3c |.#T4...Q.<| +00000090 01 16 03 02 00 24 33 5d 7f cb 6e 36 19 8b db 35 |.....$3]..n6...5| +000000a0 88 16 87 7a 9d 5a 51 27 51 13 17 64 0e 57 d5 e1 |...z.ZQ'Q..d.W..| +000000b0 6e 34 8d e6 99 a8 38 b2 e7 3a |n4....8..:| >>> Flow 4 (server to client) -00000000 14 03 02 00 01 01 16 03 02 00 24 5e 7b 1a c0 81 |..........$^{...| -00000010 94 bc 22 87 6f 6a 09 9d ad b4 9c 90 ae 80 4f ed |..".oj........O.| -00000020 3f 6d ac 40 7a 20 0a 9a 7f b2 f9 7d c2 50 7a |?m.@z .....}.Pz| +00000000 14 03 02 00 01 01 16 03 02 00 24 e0 8b 90 9b 83 |..........$.....| +00000010 f5 3d 00 e9 cf 7b 1d 75 cf c8 16 f2 29 8d de 0b |.=...{.u....)...| +00000020 75 82 b1 c4 6e 1c 1f ab e9 90 74 31 99 f2 ad |u...n.....t1...| >>> Flow 5 (client to server) -00000000 17 03 02 00 1a bb f8 a5 2d ef c6 34 c7 1a 1b 87 |........-..4....| -00000010 8c 59 31 72 64 19 a3 d4 ab 40 b3 b9 75 1c 92 15 |.Y1rd....@..u...| -00000020 03 02 00 16 e0 65 24 90 8e 53 9c 2e 48 52 83 ec |.....e$..S..HR..| -00000030 09 b0 92 2b 21 42 c1 ed 45 bb |...+!B..E.| +00000000 17 03 02 00 1a ca 2a 95 13 de 40 0d af 44 a4 aa |......*...@..D..| +00000010 9a 35 d7 38 c7 9f 74 4f 3a bf d1 9c cd 9e ee 15 |.5.8..tO:.......| +00000020 03 02 00 16 d3 a4 32 78 a9 00 1b 7a 48 3e 7c 2b |......2x...zH>|+| +00000030 f9 3b 92 32 20 0b f4 16 39 18 |.;.2 ...9.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-AES128-GCM-SHA256 b/libgo/go/crypto/tls/testdata/Client-TLSv12-AES128-GCM-SHA256 index dde850651ab..4412f53c90a 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-AES128-GCM-SHA256 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-AES128-GCM-SHA256 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 51 02 00 00 4d 03 03 4c 7d 80 b6 78 |....Q...M..L}..x| -00000010 9f 5c 70 7d fe 4a 0a b2 e3 12 80 14 6d 20 e3 cc |.\p}.J......m ..| -00000020 ec c9 08 8e 44 f6 c2 92 65 90 56 20 86 57 75 b4 |....D...e.V .Wu.| -00000030 3d 5a 00 5f bb 25 f3 21 a9 e2 1e 10 4a 1e 8a 30 |=Z._.%.!....J..0| -00000040 9a 93 b0 87 04 a1 d5 c6 ad 0f c9 fc 00 9c 00 00 |................| +00000000 16 03 03 00 51 02 00 00 4d 03 03 1d be be 1e eb |....Q...M.......| +00000010 59 2c d5 07 b9 7a 64 47 95 84 ef cf d9 3e 82 4c |Y,...zdG.....>.L| +00000020 00 c0 0a 69 8a 01 2a b3 42 78 02 20 5e 32 5c 88 |...i..*.Bx. ^2\.| +00000030 50 ed d5 44 41 4f bf a9 4e 49 83 5d aa 7c 2e 5d |P..DAO..NI.].|.]| +00000040 85 e8 64 92 5e 49 5d 8a d0 0e 89 eb 00 9c 00 00 |..d.^I].........| 00000050 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| 00000060 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 00000070 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| @@ -70,17 +70,17 @@ 00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| 00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| 00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 03 00 01 |.Y(.....ia5.....| -00000090 01 16 03 03 00 28 00 00 00 00 00 00 00 00 14 74 |.....(.........t| -000000a0 ff 19 e7 d3 2c b4 5e 43 c2 38 d2 53 ca a2 3e f6 |....,.^C.8.S..>.| -000000b0 f0 12 92 0c 68 6f d7 5c 37 ff 8e d7 98 bf |....ho.\7.....| +00000090 01 16 03 03 00 28 00 00 00 00 00 00 00 00 69 38 |.....(........i8| +000000a0 97 84 2e 77 5c b8 58 82 b5 78 85 2e f3 7b 92 81 |...w\.X..x...{..| +000000b0 00 72 91 23 41 ae 59 6c 18 64 f0 62 f2 c9 |.r.#A.Yl.d.b..| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 20 60 01 e9 d0 |..........( `...| -00000010 f7 5a 03 c6 6c 6e 37 5e ad e2 2f 93 84 31 88 38 |.Z..ln7^../..1.8| -00000020 da b7 55 4d 3d 0c 8a 6b 7c 57 05 2a ef 6f 24 6b |..UM=..k|W.*.o$k| -00000030 6f 1d d6 |o..| +00000000 14 03 03 00 01 01 16 03 03 00 28 37 f7 98 2f 78 |..........(7../x| +00000010 54 85 5f 2e cb a9 b7 bf 4b 2d 62 06 e2 32 cd 18 |T._.....K-b..2..| +00000020 de f5 54 c8 e0 54 2d c5 b4 98 07 7e c7 b7 79 a0 |..T..T-....~..y.| +00000030 75 af 5c |u.\| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 4f 20 33 |.............O 3| -00000010 83 73 86 0a ca 92 4d 8b d5 cf 2e e8 b1 f0 81 9c |.s....M.........| -00000020 c1 3b 0a 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.;..............| -00000030 9c a9 02 e8 ad cf 5f 33 f0 15 86 c7 4a 11 85 20 |......_3....J.. | -00000040 06 04 |..| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 78 c1 c0 |.............x..| +00000010 7d 1b a8 b2 80 0e a3 64 cf e0 fa 71 9d 37 5d 32 |}......d...q.7]2| +00000020 8d 36 38 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.68.............| +00000030 c2 f3 41 1a 2c a4 4f 48 fa 61 14 40 60 51 e5 99 |..A.,.OH.a.@`Q..| +00000040 c6 e5 |..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-AES128-SHA256 b/libgo/go/crypto/tls/testdata/Client-TLSv12-AES128-SHA256 index 8714fdbcef7..d7568843b48 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-AES128-SHA256 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-AES128-SHA256 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 51 02 00 00 4d 03 03 fa f4 c1 2c 7a |....Q...M.....,z| -00000010 a0 09 f0 35 06 c3 79 90 a4 df fa 3c 14 1a 95 92 |...5..y....<....| -00000020 23 16 19 9d 38 83 89 6f ee 7e 7b 20 1f 2d 6c 2b |#...8..o.~{ .-l+| -00000030 bf 93 e4 58 00 13 6d ac 4d 0b c2 b4 4a e5 b3 39 |...X..m.M...J..9| -00000040 80 8e 35 1b 7b ec 9a 2e b8 bb 0b 04 00 3c 00 00 |..5.{........<..| +00000000 16 03 03 00 51 02 00 00 4d 03 03 c3 41 d7 9c 1b |....Q...M...A...| +00000010 9a ff f8 17 af 41 df 8d 96 70 bb b8 f6 9a 4c a2 |.....A...p....L.| +00000020 03 25 31 2c 58 fa 05 5b 12 85 6a 20 18 3c 34 d6 |.%1,X..[..j .<4.| +00000030 08 44 46 a5 5c b1 40 0d 38 33 c0 2d ea a6 46 53 |.DF.\.@.83.-..FS| +00000040 0e 09 39 6f 11 35 02 63 cf 21 74 c2 00 3c 00 00 |..9o.5.c.!t..<..| 00000050 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| 00000060 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 00000070 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| @@ -71,25 +71,25 @@ 00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| 00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 03 00 01 |.Y(.....ia5.....| 00000090 01 16 03 03 00 50 00 00 00 00 00 00 00 00 00 00 |.....P..........| -000000a0 00 00 00 00 00 00 ab 11 61 9b 81 32 bc 64 54 55 |........a..2.dTU| -000000b0 4d 76 5d 75 77 10 c4 df 34 43 af a5 83 37 24 e9 |Mv]uw...4C...7$.| -000000c0 6c c8 73 ad 28 24 a8 3a be 5d a9 22 21 fc e5 95 |l.s.($.:.]."!...| -000000d0 7e 27 18 d4 c4 b4 c5 70 f6 48 73 a6 97 2a c7 5d |~'.....p.Hs..*.]| -000000e0 46 78 37 9f f1 30 |Fx7..0| +000000a0 00 00 00 00 00 00 88 20 99 51 5e fb 72 79 7f f8 |....... .Q^.ry..| +000000b0 b2 a9 56 96 a3 03 1d a0 e0 38 1a be 4c ea 80 f9 |..V......8..L...| +000000c0 c0 ef 45 81 91 7f b9 1b f7 91 3b 4e 05 87 d6 73 |..E.......;N...s| +000000d0 c0 27 94 50 4f 00 ee c1 02 af 5f 6f 4c a5 0e 5b |.'.PO....._oL..[| +000000e0 6c 76 87 28 b4 bf |lv.(..| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 50 c3 5f 95 d2 ee |..........P._...| -00000010 3d 98 c9 29 ab 06 fc 8c 9b 9c fa 98 36 f1 6c f4 |=..)........6.l.| -00000020 0c bd c6 d3 79 7e ce 90 fa 23 04 d3 41 ea 35 f0 |....y~...#..A.5.| -00000030 3e bc dc 02 ae 0d 87 27 1a 8b d8 f0 e4 32 7d 89 |>......'.....2}.| -00000040 9c 89 50 38 ae 02 e2 c7 65 43 a9 1f ce 42 c9 e3 |..P8....eC...B..| -00000050 ce 0d 68 16 f6 46 6d 40 47 66 3c |..h..Fm@Gf<| +00000000 14 03 03 00 01 01 16 03 03 00 50 93 14 a5 13 16 |..........P.....| +00000010 d7 af 14 81 94 33 2d ae f7 7a b1 b1 a5 38 fb e8 |.....3-..z...8..| +00000020 c8 38 b3 ce f1 eb 70 e7 84 b6 fc 25 25 32 a9 09 |.8....p....%%2..| +00000030 d1 0d 2d 59 57 6d d0 42 e8 c1 81 92 d0 af fb 5a |..-YWm.B.......Z| +00000040 08 7e 0f 3d 10 e5 42 6d 27 cd 8c 32 b2 20 4b 0a |.~.=..Bm'..2. K.| +00000050 75 76 ed 08 54 fe 74 94 72 35 9e |uv..T.t.r5.| >>> Flow 5 (client to server) 00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| -00000010 00 00 00 00 00 55 d6 ad fe d9 c9 28 f1 6e 80 e3 |.....U.....(.n..| -00000020 54 38 52 96 9f cb cb 94 67 ef a1 ed e0 6b 83 c6 |T8R.....g....k..| -00000030 c8 48 c2 bb ed 18 a5 ec cc 6d cc f1 78 a1 be 45 |.H.......m..x..E| -00000040 88 e9 c9 5a 03 15 03 03 00 40 00 00 00 00 00 00 |...Z.....@......| -00000050 00 00 00 00 00 00 00 00 00 00 8a 47 d5 d1 ba 89 |...........G....| -00000060 cb 14 1a a7 99 6b 41 14 4c 85 f3 df f2 51 42 23 |.....kA.L....QB#| -00000070 0d 44 b1 a4 52 3c e8 34 5c 09 cc 92 06 3a 3f 75 |.D..R<.4\....:?u| -00000080 b1 b2 cb bf c7 ff da f7 7a 90 |........z.| +00000010 00 00 00 00 00 53 91 38 34 33 20 94 0d 76 d7 72 |.....S.843 ..v.r| +00000020 48 f3 17 34 01 ae 0e 89 db 60 f1 4e 64 a5 cf 0c |H..4.....`.Nd...| +00000030 32 52 3f a0 18 f8 c5 57 ed 3a d1 41 19 81 cf 0a |2R?....W.:.A....| +00000040 f2 d8 90 4b ba 15 03 03 00 40 00 00 00 00 00 00 |...K.....@......| +00000050 00 00 00 00 00 00 00 00 00 00 05 2b 31 3c 1b a2 |...........+1<..| +00000060 11 87 5f 0f 49 72 bb 67 e6 75 18 9c b1 f4 6c ed |.._.Ir.g.u....l.| +00000070 4d 01 58 35 30 43 44 e8 ee 1d f2 81 9d 67 6d 77 |M.X50CD......gmw| +00000080 1e 36 61 7f f3 32 3d 60 73 6d |.6a..2=`sm| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-AES256-GCM-SHA384 b/libgo/go/crypto/tls/testdata/Client-TLSv12-AES256-GCM-SHA384 index 61abb55a519..2f552cbb627 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-AES256-GCM-SHA384 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-AES256-GCM-SHA384 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 51 02 00 00 4d 03 03 f9 28 80 d0 c1 |....Q...M...(...| -00000010 26 36 81 01 db 60 7a 37 77 ff 57 da 2a 4c ab f3 |&6...`z7w.W.*L..| -00000020 5d 00 df f9 84 db bd 2d 95 37 ae 20 f7 00 8d 5d |]......-.7. ...]| -00000030 1e ba e7 cc ed 36 d6 a5 87 63 5d c3 9b 4b a0 9c |.....6...c]..K..| -00000040 cf ee bc b3 de 8a ec 61 41 a3 3a df 00 9d 00 00 |.......aA.:.....| +00000000 16 03 03 00 51 02 00 00 4d 03 03 2b 59 94 f3 9e |....Q...M..+Y...| +00000010 23 ae d3 58 82 1f 2e be 38 1d 14 e4 4c a4 b8 ed |#..X....8...L...| +00000020 95 08 b9 44 60 02 4b 0b a9 6e ae 20 9b 43 e5 2a |...D`.K..n. .C.*| +00000030 0f 08 8e a4 c1 c0 15 79 9f af a5 ab a3 67 9d 09 |.......y.....g..| +00000040 23 0e 8e 96 a9 aa 7d 26 74 d8 0c 9a 00 9d 00 00 |#.....}&t.......| 00000050 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| 00000060 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 00000070 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| @@ -70,17 +70,17 @@ 00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| 00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| 00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 03 00 01 |.Y(.....ia5.....| -00000090 01 16 03 03 00 28 00 00 00 00 00 00 00 00 0c e7 |.....(..........| -000000a0 cc 31 51 9b 03 cc bb 21 51 a7 5f 23 59 cf 5f 29 |.1Q....!Q._#Y._)| -000000b0 4e bd db 3d d2 fb 92 73 27 2b 6f 9a b7 f2 |N..=...s'+o...| +00000090 01 16 03 03 00 28 00 00 00 00 00 00 00 00 59 fc |.....(........Y.| +000000a0 aa b1 84 ab 09 82 00 88 8e e4 82 6e cd 24 9f b5 |...........n.$..| +000000b0 01 95 d3 c3 f4 a2 16 54 25 91 77 76 fc f0 |.......T%.wv..| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 68 27 f4 6c ac |..........(h'.l.| -00000010 ae 31 68 1a b3 7c 5f 6f 41 18 5a 24 d3 04 00 d2 |.1h..|_oA.Z$....| -00000020 2d ce 9b 30 a1 55 df f6 7a ff 80 42 9c 86 c7 13 |-..0.U..z..B....| -00000030 c8 fc ca |...| +00000000 14 03 03 00 01 01 16 03 03 00 28 67 ac 20 d9 b6 |..........(g. ..| +00000010 a9 f0 ec f6 7b 34 31 3a 5e 06 20 0f 5b 32 86 1b |....{41:^. .[2..| +00000020 da 5a c5 54 47 d0 ad 4f 95 2c b5 1f 17 3f ec 17 |.Z.TG..O.,...?..| +00000030 a3 01 fc |...| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 e3 e7 af |................| -00000010 ee cc 1b e2 13 85 a7 37 85 e9 bd a7 3e 18 e2 f0 |.......7....>...| -00000020 e3 2d 64 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.-d.............| -00000030 3d fe 35 3c b3 13 25 f8 a3 b8 81 da 91 3b 8d 69 |=.5<..%......;.i| -00000040 fc c5 |..| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 6c 9c 0a |.............l..| +00000010 ae 0b 40 57 8b 24 6d 09 77 ae 2f 14 be 06 26 9e |..@W.$m.w./...&.| +00000020 0a bf 18 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| +00000030 32 50 20 68 3d 05 68 ed 0c ac 7a db 24 21 7e e0 |2P h=.h...z.$!~.| +00000040 9e f0 |..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN b/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN index 72d2b7c4b73..2708b262b6b 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 01 10 01 00 01 0c 03 03 00 00 00 00 00 |................| +00000000 16 03 01 01 12 01 00 01 0e 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,22 +7,22 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 91 33 74 00 00 00 05 00 05 01 00 00 00 |....3t..........| +00000080 01 00 00 93 33 74 00 00 00 05 00 05 01 00 00 00 |....3t..........| 00000090 00 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 |................| -000000a0 0b 00 02 01 00 00 0d 00 18 00 16 08 04 08 05 08 |................| -000000b0 06 04 01 04 03 05 01 05 03 06 01 06 03 02 01 02 |................| -000000c0 03 ff 01 00 01 00 00 10 00 10 00 0e 06 70 72 6f |.............pro| -000000d0 74 6f 32 06 70 72 6f 74 6f 31 00 12 00 00 00 2b |to2.proto1.....+| -000000e0 00 09 08 03 04 03 03 03 02 03 01 00 33 00 26 00 |............3.&.| -000000f0 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 28 da |$... /.}.G.bC.(.| -00000100 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........| -00000110 5f 58 cb 3b 74 |_X.;t| +000000a0 0b 00 02 01 00 00 0d 00 1a 00 18 08 04 04 03 08 |................| +000000b0 07 08 05 08 06 04 01 05 01 06 01 05 03 06 03 02 |................| +000000c0 01 02 03 ff 01 00 01 00 00 10 00 10 00 0e 06 70 |...............p| +000000d0 72 6f 74 6f 32 06 70 72 6f 74 6f 31 00 12 00 00 |roto2.proto1....| +000000e0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| +000000f0 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 |&.$... /.}.G.bC.| +00000100 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| +00000110 90 99 5f 58 cb 3b 74 |.._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 66 02 00 00 62 03 03 44 df ea e4 67 |....f...b..D...g| -00000010 62 77 d5 ee 65 9f 25 8b 54 86 1a 1f 09 46 9c 41 |bw..e.%.T....F.A| -00000020 d3 13 bb 6c f5 73 9a 22 eb cf 8d 20 e8 2e 63 9f |...l.s."... ..c.| -00000030 a3 64 aa 59 7b 88 f8 28 7e 57 00 7c 3a cc 80 5e |.d.Y{..(~W.|:..^| -00000040 7d 9a 03 1e 5d 89 c0 ff 53 aa c0 4d cc a8 00 00 |}...]...S..M....| +00000000 16 03 03 00 66 02 00 00 62 03 03 0e b3 00 4c e5 |....f...b.....L.| +00000010 e4 08 c5 3d c2 9c 19 a1 de ae 43 24 9a 4d 81 99 |...=......C$.M..| +00000020 df 60 cf a5 be ae c1 e8 e8 b9 a8 20 14 e6 e1 91 |.`......... ....| +00000030 7a ab 9f 7b 3c dc c5 71 4b 28 80 5e fa 56 c9 b7 |z..{<..qK(.^.V..| +00000040 d4 2f 0e 80 49 df 81 93 df 5d 34 49 cc a8 00 00 |./..I....]4I....| 00000050 1a ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 10 |................| 00000060 00 09 00 07 06 70 72 6f 74 6f 31 16 03 03 02 59 |.....proto1....Y| 00000070 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 |...U..R..O0..K0.| @@ -63,31 +63,31 @@ 000002a0 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 |.....@.a.Lr+...F| 000002b0 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 |..M...>...B...=.| 000002c0 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c 00 |`.\!.;..........| -000002d0 00 a8 03 00 1d 20 5e d1 0b 33 b0 c2 e9 12 eb 00 |..... ^..3......| -000002e0 4d 2f b8 1b 74 b0 b2 a0 01 7a 67 5a 54 9e a5 d1 |M/..t....zgZT...| -000002f0 c5 a5 2e 59 af 53 08 04 00 80 1f ac 73 b9 62 55 |...Y.S......s.bU| -00000300 a2 53 ae 64 db 2a f7 a1 a8 69 09 2d a2 fa 0c d8 |.S.d.*...i.-....| -00000310 9e e8 9a 2f b6 8f f0 e1 5e 53 bb 4c 9e fa e4 7a |.../....^S.L...z| -00000320 68 06 20 d5 e7 d0 de cf 29 a8 bd 6b 54 82 e4 bb |h. .....)..kT...| -00000330 dd 6e ab d1 d1 c9 af 77 01 b1 06 e1 9d 2f 00 7a |.n.....w...../.z| -00000340 2b e7 6f d1 da 7c 6f f5 2c 03 0d 57 9e 19 41 be |+.o..|o.,..W..A.| -00000350 91 85 17 c2 4a 5e 9b 87 44 0e df 81 64 b1 2e 4b |....J^..D...d..K| -00000360 64 80 fb f2 7f 23 f1 19 2c 8a 8d 6d 08 1e e9 0d |d....#..,..m....| -00000370 47 ec 94 b0 db c6 7a 44 79 04 16 03 03 00 04 0e |G.....zDy.......| +000002d0 00 a8 03 00 1d 20 18 37 3a d3 0a 4f 9b 95 c7 f0 |..... .7:..O....| +000002e0 a2 00 43 5f df 2e a8 16 a9 9f 2a 0e 51 cf c9 b9 |..C_......*.Q...| +000002f0 14 62 a7 ab 4b 6a 08 04 00 80 1a b2 78 e7 cd b6 |.b..Kj......x...| +00000300 18 65 31 19 f9 91 9f a6 cb 77 97 69 86 27 ef 06 |.e1......w.i.'..| +00000310 b5 bc f4 8f 75 96 01 72 64 2c d4 e4 67 0a d5 58 |....u..rd,..g..X| +00000320 e0 e1 05 82 a6 58 f6 e0 06 c2 15 03 69 ba 5a a0 |.....X......i.Z.| +00000330 2b af 6f b1 cd 16 84 1d 89 9c d0 c7 d2 c7 83 e8 |+.o.............| +00000340 43 b7 4f e8 ca 97 c0 e2 57 d0 10 48 0c 26 cf 58 |C.O.....W..H.&.X| +00000350 50 69 d8 86 b6 f5 aa 02 b8 f6 41 c4 15 52 99 52 |Pi........A..R.R| +00000360 05 05 5b 42 80 6d 8a bf 7a e6 f3 60 c5 67 23 dc |..[B.m..z..`.g#.| +00000370 39 4b e6 74 0e 0e 47 a7 57 02 16 03 03 00 04 0e |9K.t..G.W.......| 00000380 00 00 00 |...| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 20 b9 03 a2 50 29 94 cc 5b 6c 3c 7f |.... ...P)..[l<.| -00000040 71 13 4b f0 3e 1a 13 df a0 a6 e3 15 a7 36 a2 40 |q.K.>........6.@| -00000050 86 88 d4 63 c0 |...c.| +00000030 16 03 03 00 20 0d 3c cf 6f 13 e3 73 d2 c5 05 06 |.... .<.o..s....| +00000040 85 8d 41 e0 46 3b 25 e7 0a ae b9 00 1e c3 3f 61 |..A.F;%.......?a| +00000050 82 2d e1 19 a4 |.-...| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 20 c0 4e 72 ff 58 |.......... .Nr.X| -00000010 40 70 90 8a ac 4e 94 28 ae 45 5e 2f 5f f4 c3 61 |@p...N.(.E^/_..a| -00000020 64 5d d9 af 43 a0 c1 65 78 2a 5e |d]..C..ex*^| +00000000 14 03 03 00 01 01 16 03 03 00 20 43 1a 5d c1 dc |.......... C.]..| +00000010 42 10 81 bc af 2d 40 82 fa 27 41 81 cc e5 97 99 |B....-@..'A.....| +00000020 80 27 3a b5 db f5 8e 2a 6d 72 86 |.':....*mr.| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 e3 fb 93 b5 c4 17 c2 6a 9c 15 ca |............j...| -00000010 de ca c6 49 67 d6 59 65 4a ee d2 15 03 03 00 12 |...Ig.YeJ.......| -00000020 8b f7 3f 3d ad 68 2b bf f2 96 18 21 d0 0f ea e8 |..?=.h+....!....| -00000030 a0 d9 |..| +00000000 17 03 03 00 16 f1 0a 98 3b 2a 06 98 ad 46 f5 f7 |........;*...F..| +00000010 42 cf 89 c0 d4 a7 08 df bb dc 4d 15 03 03 00 12 |B.........M.....| +00000020 9c d4 d2 a1 fb 38 98 31 7d ce 39 50 0b 58 d8 a8 |.....8.1}.9P.X..| +00000030 3e 19 |>.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA index 0968c160a59..e40999fb852 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 8d 42 b5 ca 09 |....Y...U...B...| -00000010 22 3a a8 c0 09 57 81 1c e9 40 20 14 a6 b5 6d c7 |":...W...@ ...m.| -00000020 2a 62 69 7f 5f a8 e2 74 d5 c1 b0 20 9a bf c7 2c |*bi._..t... ...,| -00000030 b9 1b d5 45 8a a1 49 fa 0f 3b d2 74 da 6f ef 6a |...E..I..;.t.o.j| -00000040 87 75 9a be 04 8a 9e ef 7e ea d7 16 c0 09 00 00 |.u......~.......| +00000000 16 03 03 00 59 02 00 00 55 03 03 08 a4 b1 ad 21 |....Y...U......!| +00000010 3a 60 7a d3 3b 60 67 48 5d de da ff 3f a8 55 a9 |:`z.;`gH]...?.U.| +00000020 c4 72 69 32 12 c1 d1 4e d4 78 e1 20 6e 9f ed 1e |.ri2...N.x. n...| +00000030 50 9a 31 e2 ae e2 6a f4 01 cc 94 21 25 73 f3 a5 |P.1...j....!%s..| +00000040 f6 28 b3 c6 6b c1 b3 2d fc 0c d3 66 c0 09 00 00 |.(..k..-...f....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,18 +55,18 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 b7 0c 00 00 b3 03 00 1d 20 1c 45 |*............ .E| -00000280 5f 18 e9 5f 2f 0d 3b 3f f2 a8 dc f8 15 1c 03 e4 |_.._/.;?........| -00000290 c1 fa f8 f7 75 cb 74 17 cd 82 7d 26 8e 41 04 03 |....u.t...}&.A..| -000002a0 00 8b 30 81 88 02 42 01 6c ae 9f 61 16 bb 03 50 |..0...B.l..a...P| -000002b0 52 94 7f 89 59 92 a5 3e 74 54 97 7a f0 22 a5 7d |R...Y..>tT.z.".}| -000002c0 de 80 c4 6a 0d a0 cb 50 e1 aa 27 a9 44 4f 24 db |...j...P..'.DO$.| -000002d0 69 b2 d2 6c 6e 26 79 99 d8 31 9d 2d 47 26 f1 c6 |i..ln&y..1.-G&..| -000002e0 42 25 f5 66 6b 03 7a 19 b1 02 42 00 f4 5c 98 a4 |B%.fk.z...B..\..| -000002f0 d3 d7 af 36 42 cc 95 91 be 7e b1 3c 61 df a9 9c |...6B....~...0........| 00000330 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......| 00000340 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| 00000350 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| @@ -109,31 +109,31 @@ 00000210 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd 62 |...%...! /.}.G.b| 00000220 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| 00000230 c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 93 0f 00 |...._X.;t.......| -00000240 00 8f 04 03 00 8b 30 81 88 02 42 01 83 b1 39 05 |......0...B...9.| -00000250 25 f1 1b 2b 55 c0 7e 56 e1 0e 33 bc 03 c7 0a 17 |%..+U.~V..3.....| -00000260 b7 c2 b7 da ab 9d 5d 22 da 60 74 7d 85 5e 53 ff |......]".`t}.^S.| -00000270 57 4e c3 0a 47 fd e5 f6 dc 05 56 4c 7a 9f e4 5c |WN..G.....VLz..\| -00000280 04 97 80 61 d5 9f db a5 74 9b ec fc bf 02 42 01 |...a....t.....B.| -00000290 27 f8 0e 21 c2 c2 68 72 82 1b 4b cf d8 0c 1a 09 |'..!..hr..K.....| -000002a0 b0 f5 0f b9 3b e9 63 dc 68 33 5e 41 e2 2c a4 04 |....;.c.h3^A.,..| -000002b0 ec ee 84 6d f3 28 fc 6d c4 f1 04 8c 1d 38 6e e9 |...m.(.m.....8n.| -000002c0 ae 0d 0a 82 0e 42 c4 42 e7 12 33 c5 38 4f 19 51 |.....B.B..3.8O.Q| -000002d0 61 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 |a..........@....| -000002e0 00 00 00 00 00 00 00 00 00 00 00 00 9e b0 80 10 |................| -000002f0 4c da e3 cd 1e 56 e6 90 10 c5 ea d6 25 f9 34 31 |L....V......%.41| -00000300 cd 42 60 5d ab 3b 13 05 48 cd f6 53 c3 b7 ea ea |.B`].;..H..S....| -00000310 30 f0 58 2d 17 3c 77 fb a7 8f 9f a8 |0.X-.>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 68 2a 2b af 97 |..........@h*+..| -00000010 68 8d 96 ed 55 bc aa d2 d3 81 97 54 a1 01 88 7f |h...U......T....| -00000020 72 b7 3a 38 66 c2 53 9a 01 56 0d e0 02 b5 93 66 |r.:8f.S..V.....f| -00000030 b3 93 74 e2 e0 c5 22 1c 0d 8f bb 7d e1 43 bf bd |..t..."....}.C..| -00000040 bc 69 2e 58 96 7b 39 f0 55 6f 1b |.i.X.{9.Uo.| +00000000 14 03 03 00 01 01 16 03 03 00 40 18 c0 f3 96 7b |..........@....{| +00000010 45 91 6d 5b 1c 67 4f 37 74 b7 db 72 45 57 09 25 |E.m[.gO7t..rEW.%| +00000020 4a 14 68 4d 78 6c c7 15 6a b1 57 e6 ff 53 c4 58 |J.hMxl..j.W..S.X| +00000030 41 c5 6b 08 3c 5a 8c b9 04 d0 27 62 ee a6 e3 36 |A.k.>> Flow 5 (client to server) 00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 a6 98 ea d6 b2 81 83 18 5d 73 13 |.............]s.| -00000020 dc e9 e9 bc 4c 1e a8 ec a5 62 93 f6 b8 0c 0f f0 |....L....b......| -00000030 91 6e 51 2c fe 15 03 03 00 30 00 00 00 00 00 00 |.nQ,.....0......| -00000040 00 00 00 00 00 00 00 00 00 00 7f e8 f5 80 8e 27 |...............'| -00000050 1b 31 aa d0 ec 91 51 d0 18 21 de e3 63 1f ee 80 |.1....Q..!..c...| -00000060 bc db 2f 4f ce 26 46 ce 65 2e |../O.&F.e.| +00000010 00 00 00 00 00 a6 c2 ef 07 bb 38 4a e4 8f 0c 12 |..........8J....| +00000020 19 1a 96 62 22 57 57 a2 b5 b3 06 70 95 28 a7 f7 |...b"WW....p.(..| +00000030 0d 42 69 37 7f 15 03 03 00 30 00 00 00 00 00 00 |.Bi7.....0......| +00000040 00 00 00 00 00 00 00 00 00 00 04 ed 3e 68 40 eb |............>h@.| +00000050 a0 7e 57 da 27 e7 f5 e8 6c e5 6d 58 c8 a5 18 47 |.~W.'...l.mX...G| +00000060 92 5a 43 90 de 07 9e 9a 3b cc |.ZC.....;.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA index 995e9a9bc98..f5fae453a86 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 87 08 05 c4 11 |....Y...U.......| -00000010 d3 bb ca 40 4a 0a 95 79 8c b9 82 54 6f e2 11 ba |...@J..y...To...| -00000020 bd 7b 0d e4 f4 64 0d 35 a0 66 0b 20 41 e2 af c4 |.{...d.5.f. A...| -00000030 e0 db f1 52 6a 6b f3 77 0d 83 f7 00 d0 05 3f 3e |...Rjk.w......?>| -00000040 d8 3f d2 66 fa 19 3d 36 bd ff ae 13 c0 2f 00 00 |.?.f..=6...../..| +00000000 16 03 03 00 59 02 00 00 55 03 03 be ba ac 2a 81 |....Y...U.....*.| +00000010 33 b1 6e 4d 8b 9b 29 f9 16 86 bc cd b2 03 50 72 |3.nM..).......Pr| +00000020 91 9a 93 f9 e1 d6 27 55 8b b8 6c 20 84 c2 21 9e |......'U..l ..!.| +00000030 60 aa b3 f0 ec 2f 66 0d 59 31 02 08 9e 68 68 c0 |`..../f.Y1...hh.| +00000040 58 9a 8e 6c 25 ce 4d e3 3f 9d dc 91 c0 2f 00 00 |X..l%.M.?..../..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,17 +60,17 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 39 84 75 e0 64 4e 6d |........ 9.u.dNm| -000002d0 37 4a cd ae 78 6f d3 b5 bd 3e fb dc 9b f8 51 39 |7J..xo...>....Q9| -000002e0 85 35 a2 11 4b 59 be 57 01 08 04 00 80 a1 dd a6 |.5..KY.W........| -000002f0 f4 e0 89 8a c1 ff e6 20 1e cf 73 41 94 e6 4a 4f |....... ..sA..JO| -00000300 64 49 43 0e 53 90 61 31 92 a5 af 13 2e 00 2b e2 |dIC.S.a1......+.| -00000310 61 6e 3f a1 9a e3 7d f6 79 0e cd f6 c1 84 e0 62 |an?...}.y......b| -00000320 15 69 5a 94 8f af c5 c9 db b8 f4 4b 40 4c ea f7 |.iZ........K@L..| -00000330 bb e9 cd f2 3a 00 c3 f1 c9 5e 43 67 36 c5 73 f1 |....:....^Cg6.s.| -00000340 88 c1 6d 14 2f 92 63 ae 30 9d 3c 59 33 aa 78 62 |..m./.c.0.>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 36 f9 5d 31 f6 |..........(6.]1.| -00000010 a2 62 16 db 9b ea 79 28 52 1b 06 e1 59 39 f3 4a |.b....y(R...Y9.J| -00000020 67 77 6d 2b 98 80 9d e9 80 55 53 82 37 17 61 65 |gwm+.....US.7.ae| -00000030 f5 fa 06 |...| +00000000 14 03 03 00 01 01 16 03 03 00 28 b8 e9 dd 30 75 |..........(...0u| +00000010 40 7d 71 76 db 9a 95 92 81 02 3a 9e 36 d5 15 ca |@}qv......:.6...| +00000020 5d 63 a1 0f 8c 53 c9 1c 37 56 b2 0d 54 15 a2 dc |]c...S..7V..T...| +00000030 03 d6 2e |...| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 a0 3f 7e |..............?~| -00000010 ce c3 cf 73 0f 2f 9d ba 5d 2e 3b 84 8b ef cd c4 |...s./..].;.....| -00000020 2a 31 32 15 03 03 00 1a 00 00 00 00 00 00 00 02 |*12.............| -00000030 58 7e 4f 75 06 0d 16 f5 6d 06 0f af 5a 40 9b bd |X~Ou....m...Z@..| -00000040 79 f4 |y.| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 01 85 96 |................| +00000010 67 b2 4b d3 e3 27 80 9f 2d a8 f4 bf 47 91 58 6e |g.K..'..-...G.Xn| +00000020 47 d8 98 15 03 03 00 1a 00 00 00 00 00 00 00 02 |G...............| +00000030 36 54 82 d1 a2 0f 2a c3 53 f6 09 d0 5c 78 46 97 |6T....*.S...\xF.| +00000040 20 41 | A| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-Ed25519 b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-Ed25519 new file mode 100644 index 00000000000..e415b126e56 --- /dev/null +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-Ed25519 @@ -0,0 +1,119 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| +00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| +00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| +00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| +00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 59 02 00 00 55 03 03 1c 50 4e 50 35 |....Y...U...PNP5| +00000010 51 02 a9 62 ba 82 a5 d3 fa 40 4e f3 28 9b 50 a6 |Q..b.....@N.(.P.| +00000020 f0 75 30 e9 fe be a3 42 1d 1c f5 20 9e 88 46 57 |.u0....B... ..FW| +00000030 c5 b4 a3 a3 fc 88 bb e0 1c 5e ea 77 a0 75 93 5a |.........^.w.u.Z| +00000040 6d 4c c7 57 6f 3a 05 af 3f 3f ac 75 cc a8 00 00 |mL.Wo:..??.u....| +00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| +00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| +00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| +00000080 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| +00000090 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| +000000a0 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| +000000b0 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| +000000c0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| +000000d0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| +000000e0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| +000000f0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| +00000100 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| +00000110 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| +00000120 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| +00000130 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| +00000140 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| +00000150 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| +00000160 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| +00000170 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| +00000180 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| +00000190 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| +000001a0 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| +000001b0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| +000001c0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| +000001d0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| +000001e0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| +000001f0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| +00000200 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| +00000210 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| +00000220 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| +00000230 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| +00000240 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| +00000250 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| +00000260 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| +00000270 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| +00000280 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| +00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| +000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| +000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| +000002c0 ac 0c 00 00 a8 03 00 1d 20 82 c1 f5 7b 68 eb 7a |........ ...{h.z| +000002d0 cf 02 c9 95 28 4b 31 76 a9 84 93 a9 1f 5b f4 2a |....(K1v.....[.*| +000002e0 5c a5 31 94 5f f0 e0 ed 2e 08 04 00 80 7a 99 38 |\.1._........z.8| +000002f0 7f d0 25 4b bf a9 e0 2b db ce 17 9d 30 4b 82 9e |..%K...+....0K..| +00000300 b1 50 84 fc dd b0 a8 5c 39 20 00 40 5b 92 dc 7c |.P.....\9 .@[..|| +00000310 25 3b 53 7d 5a 4b ad 05 6f 3a 4f e5 84 b6 3a e2 |%;S}ZK..o:O...:.| +00000320 fb bf cb c8 94 39 a5 28 ad c8 5f 94 53 90 0e 61 |.....9.(.._.S..a| +00000330 af f2 92 2c 3b ec 3c bf 1d d3 8b a5 65 58 5b bf |...,;.<.....eX[.| +00000340 5a 21 3d cd 40 7c 9e 1d e9 62 3c 67 71 7c ec b4 |Z!=.@|...b....| +00000370 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......| +00000380 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| +00000390 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| +000003a0 03 02 02 02 04 02 05 02 06 02 00 00 16 03 03 00 |................| +000003b0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 01 3c 0b 00 01 38 00 01 35 00 01 32 30 |....<...8..5..20| +00000010 82 01 2e 30 81 e1 a0 03 02 01 02 02 10 17 d1 81 |...0............| +00000020 93 be 2a 8c 21 20 10 25 15 e8 34 23 4f 30 05 06 |..*.! .%..4#O0..| +00000030 03 2b 65 70 30 12 31 10 30 0e 06 03 55 04 0a 13 |.+ep0.1.0...U...| +00000040 07 41 63 6d 65 20 43 6f 30 1e 17 0d 31 39 30 35 |.Acme Co0...1905| +00000050 31 36 32 31 35 34 32 36 5a 17 0d 32 30 30 35 31 |16215426Z..20051| +00000060 35 32 31 35 34 32 36 5a 30 12 31 10 30 0e 06 03 |5215426Z0.1.0...| +00000070 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 2a 30 05 |U....Acme Co0*0.| +00000080 06 03 2b 65 70 03 21 00 0b e0 b5 60 b5 e2 79 30 |..+ep.!....`..y0| +00000090 3d be e3 1e e0 50 b1 04 c8 6d c7 78 6c 69 2f c5 |=....P...m.xli/.| +000000a0 14 ad 9a 63 6f 79 12 91 a3 4d 30 4b 30 0e 06 03 |...coy...M0K0...| +000000b0 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 |U...........0...| +000000c0 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 |U.%..0...+......| +000000d0 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 |.0...U.......0.0| +000000e0 16 06 03 55 1d 11 04 0f 30 0d 82 0b 65 78 61 6d |...U....0...exam| +000000f0 70 6c 65 2e 63 6f 6d 30 05 06 03 2b 65 70 03 41 |ple.com0...+ep.A| +00000100 00 fc 19 17 2a 94 a5 31 fa 29 c8 2e 7f 5b a0 5d |....*..1.)...[.]| +00000110 8a 4e 34 40 39 d6 b3 10 dc 19 fe a0 22 71 b3 f5 |.N4@9......."q..| +00000120 8f a1 58 0d cd f4 f1 85 24 bf e6 3d 14 df df ed |..X.....$..=....| +00000130 0e e1 17 d8 11 a2 60 d0 8a 37 23 2a c2 46 aa 3a |......`..7#*.F.:| +00000140 08 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 |.....%...! /.}.G| +00000150 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +00000160 c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 48 |......_X.;t....H| +00000170 0f 00 00 44 08 07 00 40 af a6 03 14 53 7a 4f 75 |...D...@....SzOu| +00000180 9d cc 2f e3 e7 2a 51 16 16 b0 1d 28 e0 2a 59 f0 |../..*Q....(.*Y.| +00000190 3c df cc 18 dd b8 ef d1 9f 9d 03 8e 59 00 27 d1 |<...........Y.'.| +000001a0 39 2f 3b 33 53 1f b2 f0 22 1d 06 f6 50 0b a7 98 |9/;3S..."...P...| +000001b0 cc fa 78 53 bf 8e ff 0b 14 03 03 00 01 01 16 03 |..xS............| +000001c0 03 00 20 e5 81 3e a3 34 29 52 14 19 49 cf 04 82 |.. ..>.4)R..I...| +000001d0 8b e7 83 aa 6c db 96 ec 97 29 b4 a3 db 87 21 2e |....l....)....!.| +000001e0 a5 c0 66 |..f| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 84 67 d4 ce cf |.......... .g...| +00000010 fb 54 2c dc f7 53 31 8a aa 03 60 37 3d 33 f2 79 |.T,..S1...`7=3.y| +00000020 d0 65 2e 3f 0e f9 1a d3 6e 6d 8e |.e.?....nm.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 e5 b7 4c 92 05 fc 81 cf 11 ef cd |.......L........| +00000010 0f 4b df ef a1 54 ae 26 4e ec aa 15 03 03 00 12 |.K...T.&N.......| +00000020 0a f3 5b 06 63 84 a6 eb d4 73 94 db fe d8 e0 ae |..[.c....s......| +00000030 d6 fc |..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 index e6791c0da47..22115d55651 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 10 af 03 5d d2 |....Y...U.....].| -00000010 4d c8 e6 2e 88 08 57 65 8c c6 fa af b5 e7 bd 49 |M.....We.......I| -00000020 4c d0 dc 04 e6 14 e0 83 40 79 dd 20 5a 11 db 9d |L.......@y. Z...| -00000030 c0 10 71 f5 27 89 5a 7e 17 80 9b 26 39 09 cc ad |..q.'.Z~...&9...| -00000040 be 1a 24 37 d7 08 a2 e1 fe 75 54 71 c0 30 00 00 |..$7.....uTq.0..| +00000000 16 03 03 00 59 02 00 00 55 03 03 41 6b 69 65 47 |....Y...U..AkieG| +00000010 8c 15 2f d5 6d 1a 3d 0c ff 56 ad 42 31 6c 1f 86 |../.m.=..V.B1l..| +00000020 06 62 e3 e4 18 9c 5c 47 9e 8c 66 20 af ba 7c 62 |.b....\G..f ..|b| +00000030 c2 32 f4 49 f1 8d f4 ba 7a 51 23 32 46 96 7e b8 |.2.I....zQ#2F.~.| +00000040 f0 2c ae 0a d4 04 49 16 4a 64 79 c8 c0 30 00 00 |.,....I.Jdy..0..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,17 +60,17 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 42 0e 6e 06 83 b5 4e |........ B.n...N| -000002d0 d9 f5 45 2b 82 1c 30 c7 65 5d 40 44 10 b8 63 aa |..E+..0.e]@D..c.| -000002e0 6f ef 92 13 4b 8d fd 1b 0e 08 04 00 80 63 8f 8a |o...K........c..| -000002f0 f3 6a 42 b9 e2 6d c3 06 c5 04 2d df 4b 06 0f b7 |.jB..m....-.K...| -00000300 e5 36 d2 5f be aa 36 83 82 eb e8 06 e9 a5 b8 47 |.6._..6........G| -00000310 db 43 fb 7d ab 0b 3a db 13 df ab 62 16 7d 80 57 |.C.}..:....b.}.W| -00000320 4b 07 79 f6 d9 9c ad d4 1b b5 cd cb 92 44 bc 74 |K.y..........D.t| -00000330 d0 f3 67 0c e6 1a 5a 18 53 bc bc 65 19 7a 13 f3 |..g...Z.S..e.z..| -00000340 78 36 e7 14 7d 36 6d 85 ea d7 96 18 e2 bc 1d af |x6..}6m.........| -00000350 58 50 f3 f7 a3 27 49 a4 89 10 e2 cc 2d db c5 4a |XP...'I.....-..J| -00000360 4c 24 3e 9b 70 17 ae 2f f9 d0 96 8f b0 16 03 03 |L$>.p../........| +000002c0 ac 0c 00 00 a8 03 00 1d 20 9e 80 b0 95 af 3b 4c |........ .....;L| +000002d0 e7 fb 97 65 d0 36 8f 97 88 0d 3b 5d a0 21 a8 78 |...e.6....;].!.x| +000002e0 81 39 4c 80 5c 58 52 6e 68 08 04 00 80 41 c6 e7 |.9L.\XRnh....A..| +000002f0 c9 48 c1 be 17 a6 a3 3c 3a de c8 c8 86 6e 70 37 |.H.....<:....np7| +00000300 2f d3 ed 8a dd 3a 73 5c b5 23 49 a8 4a fe e9 2b |/....:s\.#I.J..+| +00000310 4e 99 43 b8 e8 05 f9 fe 90 bf 74 be 92 3d d8 a3 |N.C.......t..=..| +00000320 c2 b2 38 80 1c 82 1f 35 e1 2e 04 bf a6 0a ec 3f |..8....5.......?| +00000330 81 4c a2 2b 19 8f 91 4c 51 b5 0d 52 1e 69 84 0a |.L.+...LQ..R.i..| +00000340 b0 cb de 41 1a bd a6 3d 50 9a ca d2 c0 26 11 3f |...A...=P....&.?| +00000350 cd 80 b4 2d 6e 03 f2 c5 2b cd 9c b6 a4 d8 e6 cf |...-n...+.......| +00000360 ec 1d 7a a9 17 59 6c 89 17 2f 64 0a 7c 16 03 03 |..z..Yl../d.|...| 00000370 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......| 00000380 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| 00000390 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| @@ -112,26 +112,26 @@ 00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| 00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| 00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| -00000230 88 0f 00 00 84 08 04 00 80 0d 7c 62 81 7d fc c9 |..........|b.}..| -00000240 d4 4c 3e dd 4c b0 fe ce 43 90 27 39 2c be 01 24 |.L>.L...C.'9,..$| -00000250 bc 55 f5 87 d7 31 00 47 6c 49 ce 82 db 0e 3d af |.U...1.GlI....=.| -00000260 a5 f3 4a 28 c9 f7 0b d3 68 e2 b8 de 2d b3 d8 5d |..J(....h...-..]| -00000270 c6 6d da 2f 74 c4 0a f4 93 ed 58 10 00 94 55 d6 |.m./t.....X...U.| -00000280 c8 62 d0 35 20 cc 90 dc 70 bf 1d 6f c9 76 10 de |.b.5 ...p..o.v..| -00000290 c2 50 ba e9 b4 bd 80 d7 01 b2 aa 1d 27 03 0f ad |.P..........'...| -000002a0 39 46 ec 30 b0 fb 68 0f 1f b3 4c 0c 26 70 4c 33 |9F.0..h...L.&pL3| -000002b0 bf 18 79 81 11 c0 7f b9 ae 14 03 03 00 01 01 16 |..y.............| -000002c0 03 03 00 28 00 00 00 00 00 00 00 00 a2 ee 76 00 |...(..........v.| -000002d0 77 2b 70 9d f7 0a 11 b4 25 00 07 92 d4 4c 9c 68 |w+p.....%....L.h| -000002e0 64 54 11 6d 39 46 6c ea 20 0c 15 ed |dT.m9Fl. ...| +00000230 88 0f 00 00 84 04 01 00 80 29 22 23 51 c5 71 4a |.........)"#Q.qJ| +00000240 32 eb 72 6b f2 c8 46 99 df fe d5 a7 0c 55 3c 40 |2.rk..F......U<@| +00000250 e1 1e 09 4c 40 83 8a 0d 67 27 63 21 d2 36 66 8f |...L@...g'c!.6f.| +00000260 cb 97 4b 87 8a ed 9a 44 81 97 34 4b 9b 12 27 f5 |..K....D..4K..'.| +00000270 d8 63 9b 1f cf d7 b4 2b 54 99 86 2d cd 36 9f 3e |.c.....+T..-.6.>| +00000280 92 af 5a a6 0c 8a e0 e3 d3 b9 9b 47 ea 67 61 69 |..Z........G.gai| +00000290 d8 c1 86 1d fd 43 d4 1f 5c f5 48 d8 4a 97 a7 0f |.....C..\.H.J...| +000002a0 57 59 b0 5f e8 24 3f 9e 1d 96 3d 4b be 9c fa e3 |WY._.$?...=K....| +000002b0 3b 34 7e aa 67 d7 cc ea 78 14 03 03 00 01 01 16 |;4~.g...x.......| +000002c0 03 03 00 28 00 00 00 00 00 00 00 00 33 b3 7b c9 |...(........3.{.| +000002d0 3f e8 7d 08 3d 65 a3 22 fa e3 04 79 d9 9f 54 a3 |?.}.=e."...y..T.| +000002e0 45 e7 64 b2 5d 95 cf dd 88 cc ba 0b |E.d.].......| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 f5 f7 fe 25 12 |..........(...%.| -00000010 d8 e2 d9 ee b3 c8 02 a9 6e d9 80 ee 7b 7e 95 1f |........n...{~..| -00000020 8e 97 a6 5f e8 4c ee 67 e9 a1 43 ab 0e 17 ce 92 |..._.L.g..C.....| -00000030 7c 03 0f ||..| +00000000 14 03 03 00 01 01 16 03 03 00 28 7e 38 ab 82 0c |..........(~8...| +00000010 fd fa b9 83 3e 77 ed 22 b5 9d d3 c1 ca cd 18 c5 |....>w."........| +00000020 1c 01 a0 b8 8b 96 20 92 7b bd 0a 33 ee fe be 75 |...... .{..3...u| +00000030 95 6e 0c |.n.| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 4c 67 fb |.............Lg.| -00000010 76 75 0d a4 56 d5 9c 1a 6d 7d 94 06 df 6d 05 98 |vu..V...m}...m..| -00000020 39 be 1e 15 03 03 00 1a 00 00 00 00 00 00 00 02 |9...............| -00000030 31 e3 f4 a1 b7 0e cc 48 17 a6 69 4d ba 43 a0 2d |1......H..iM.C.-| -00000040 12 a2 |..| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 9d f0 cd |................| +00000010 53 8d 1a 45 ae 4a e4 01 97 dd ac f1 00 d3 aa b6 |S..E.J..........| +00000020 bf c9 bc 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| +00000030 aa 1b 41 d5 f5 68 41 b8 32 94 9b 23 f8 60 7b 60 |..A..hA.2..#.`{`| +00000040 2c 8a |,.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA index 06a9be85a02..db82b3837ea 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 69 98 98 c5 21 |....Y...U..i...!| -00000010 2e b7 a6 8e ba d1 11 b4 0a 84 ad 33 b9 8c 81 d7 |...........3....| -00000020 26 ba 77 32 24 e5 c2 95 5f d2 b8 20 23 79 50 e0 |&.w2$..._.. #yP.| -00000030 59 94 e1 05 47 58 ce a0 52 32 3f 96 1a e5 d8 15 |Y...GX..R2?.....| -00000040 ec ae c9 51 a1 1c 19 e0 ac 40 28 9d c0 09 00 00 |...Q.....@(.....| +00000000 16 03 03 00 59 02 00 00 55 03 03 59 e6 a5 3d 5a |....Y...U..Y..=Z| +00000010 bf 25 a3 16 e7 e3 da cb ac b7 11 09 0a 1a 8a c5 |.%..............| +00000020 33 a2 a6 58 12 27 cd 52 15 28 c9 20 23 9a f5 d3 |3..X.'.R.(. #...| +00000030 d4 df 49 1d 01 87 12 36 03 c6 36 17 39 d0 db 62 |..I....6..6.9..b| +00000040 22 48 7e 57 20 ab a3 7c b0 53 7e f1 c0 09 00 00 |"H~W ..|.S~.....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,23 +55,23 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 b7 0c 00 00 b3 03 00 1d 20 b8 1d |*............ ..| -00000280 dd 31 88 3e 51 9e d8 b3 7f f0 93 7c 77 70 79 2c |.1.>Q......|wpy,| -00000290 cb 21 d3 b8 8d 3d 65 33 2b a0 0d bb 5f 6a 04 03 |.!...=e3+..._j..| -000002a0 00 8b 30 81 88 02 42 01 50 71 c1 68 9b a3 b3 7f |..0...B.Pq.h....| -000002b0 ab 3f b0 32 d8 57 36 db 3f e5 5b 26 36 51 ed 89 |.?.2.W6.?.[&6Q..| -000002c0 33 a5 e3 e3 49 2b ac d7 b2 9c 3f 6b 4d 8e 21 3d |3...I+....?kM.!=| -000002d0 f6 bc 22 af 0a 48 f0 14 ff ed 14 95 16 e3 45 b3 |.."..H........E.| -000002e0 b3 e7 c2 09 a5 e9 12 a1 4b 02 42 01 35 34 64 1c |........K.B.54d.| -000002f0 d3 28 48 66 82 f3 93 8e 36 0b f7 ac ad f7 f5 4f |.(Hf....6......O| -00000300 e5 fc b7 a8 a3 f0 fb 28 70 9e 36 bc c3 82 1b 22 |.......(p.6...."| -00000310 ef 95 ab 70 28 07 0d aa c0 42 d6 c6 0e ed 37 d7 |...p(....B....7.| -00000320 a6 a0 75 e6 db 03 b7 3c 61 26 8a 47 e1 16 03 03 |..u..........z../| +000002c0 d7 90 da 18 a0 14 8a 7c 51 4c a6 ae ec 13 ee 5e |.......|QL.....^| +000002d0 1a 60 aa 2f 5a d2 05 48 fb bb bb 3a 1a dc fa 21 |.`./Z..H...:...!| +000002e0 df 7b 6d 83 23 d6 62 0f 02 42 01 7f 5a 36 6d f4 |.{m.#.b..B..Z6m.| +000002f0 0d f5 d0 6f d9 71 52 f8 eb e3 ed 7c 40 fd 64 14 |...o.qR....|@.d.| +00000300 c1 31 4d 4b 78 70 5d 9f 61 18 3b 87 01 10 94 e5 |.1MKxp].a.;.....| +00000310 7b 83 34 2d cd 90 50 db 10 62 8d 36 40 45 20 c0 |{.4-..P..b.6@E .| +00000320 db ce de 5e b3 63 de 60 db bb fe be 16 03 03 00 |...^.c.`........| +00000330 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 06 |:...6...@.......| +00000340 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 08 |................| +00000350 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 03 |................| +00000360 02 02 02 04 02 05 02 06 02 00 00 16 03 03 00 04 |................| +00000370 0e 00 00 00 |....| >>> Flow 3 (client to server) 00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| 00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| @@ -108,31 +108,31 @@ 00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| 00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| 00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| -00000230 88 0f 00 00 84 08 04 00 80 0a f0 58 cc 8a d0 1c |...........X....| -00000240 77 22 05 20 40 d3 74 f8 af d9 17 ed 01 61 5e c2 |w". @.t......a^.| -00000250 9d 3a 53 ce 55 c6 11 9c 63 01 14 97 38 5f d8 17 |.:S.U...c...8_..| -00000260 68 6f ee 09 73 42 23 dc 40 f8 4a 41 4d ca c8 98 |ho..sB#.@.JAM...| -00000270 65 09 22 ca cd 27 00 8b 27 36 8a f9 1c 07 7f 3b |e."..'..'6.....;| -00000280 98 46 2e fc 50 8e ca 4c 0e 2a f0 c4 e5 87 e2 24 |.F..P..L.*.....$| -00000290 46 8b 3b 03 d3 03 78 f1 76 f5 14 12 c1 63 f7 21 |F.;...x.v....c.!| -000002a0 e7 27 17 ce 2d a6 eb 50 ef e4 aa 32 14 89 f4 02 |.'..-..P...2....| -000002b0 02 b7 9b 47 27 ca 56 5b 32 14 03 03 00 01 01 16 |...G'.V[2.......| +00000230 88 0f 00 00 84 04 01 00 80 88 59 ec 09 a4 c9 5e |..........Y....^| +00000240 37 b4 e3 04 71 52 1a 5a 6d d6 9b f6 09 14 01 c2 |7...qR.Zm.......| +00000250 3e 07 19 2f ec 15 d9 5b 12 6a 6e de 78 a3 ac 58 |>../...[.jn.x..X| +00000260 40 44 f2 66 0a 12 a5 62 37 8b af 5a 3a 20 be f2 |@D.f...b7..Z: ..| +00000270 6f 43 c8 00 69 21 c8 fd b0 cf 00 74 c3 96 a0 8b |oC..i!.....t....| +00000280 6f ce c1 09 e6 90 1d 8e 53 40 b8 44 83 b9 46 9c |o.......S@.D..F.| +00000290 78 3b c1 0a 36 68 a5 04 e8 b5 ed 6d 7d 09 21 8c |x;..6h.....m}.!.| +000002a0 0e 00 0c 5e d0 2b 47 c9 f6 31 f6 8f 7b b6 2d 8d |...^.+G..1..{.-.| +000002b0 ec 4e c2 0d 08 c5 1b 26 b6 14 03 03 00 01 01 16 |.N.....&........| 000002c0 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 00 |...@............| -000002d0 00 00 00 00 5e ab 60 05 38 88 e6 d3 ba fd 13 2a |....^.`.8......*| -000002e0 8a 17 c8 6e 54 d4 4e fd c4 12 87 c4 20 ef de 62 |...nT.N..... ..b| -000002f0 fd d3 50 6f 5f 6b 9d b2 00 aa 5a ab 2c d1 3d 39 |..Po_k....Z.,.=9| -00000300 46 20 ab d7 |F ..| +000002d0 00 00 00 00 e7 64 7d 04 bb bf dd 2a ac fd 96 81 |.....d}....*....| +000002e0 25 d8 3e 6c 1d 53 c7 79 31 4d 13 c3 71 d3 da c0 |%.>l.S.y1M..q...| +000002f0 f8 74 11 bb 6b 9d 62 66 ed f0 97 ab 43 fe 12 cb |.t..k.bf....C...| +00000300 da 8d c2 4b |...K| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 d7 80 4d 81 26 |..........@..M.&| -00000010 8f 46 5b b4 63 56 cd bd a6 ca 31 ba 8e b8 5b a2 |.F[.cV....1...[.| -00000020 47 a3 ef 5f ca a2 6a af d2 2c f9 bb c9 1b 20 fc |G.._..j..,.... .| -00000030 a1 78 ca 7e 79 09 66 08 2c cb 0c a5 a3 35 01 ed |.x.~y.f.,....5..| -00000040 90 90 3d 32 f3 7b 30 25 ca 5c 66 |..=2.{0%.\f| +00000000 14 03 03 00 01 01 16 03 03 00 40 35 ee 36 65 9a |..........@5.6e.| +00000010 e5 ac c7 30 18 b6 ff f9 fd fa 66 88 a7 73 be ba |...0......f..s..| +00000020 d5 89 59 26 cf 2d 8d 31 48 f0 fb 09 c1 66 ef eb |..Y&.-.1H....f..| +00000030 94 30 b7 47 71 a1 cb 03 34 37 14 f5 76 14 13 a9 |.0.Gq...47..v...| +00000040 6f d7 4d 59 c1 63 f8 db 8b 74 36 |o.MY.c...t6| >>> Flow 5 (client to server) 00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 58 dc 0e 2b 4a 58 05 aa 22 cb 21 |.....X..+JX..".!| -00000020 1c 6b 93 40 ab 6b 99 aa ae c0 e0 f8 31 22 a3 1b |.k.@.k......1"..| -00000030 4a 98 bc 70 08 15 03 03 00 30 00 00 00 00 00 00 |J..p.....0......| -00000040 00 00 00 00 00 00 00 00 00 00 8a 7b b8 60 83 23 |...........{.`.#| -00000050 53 04 cf 14 b7 cf a9 d8 70 51 fe 92 f3 9c 25 6a |S.......pQ....%j| -00000060 bf 43 e0 bd ca 33 33 6c 30 dc |.C...33l0.| +00000010 00 00 00 00 00 19 16 39 bc a3 30 b5 1d ae e5 a9 |.......9..0.....| +00000020 74 89 1e d1 77 86 8f 85 55 fa af cb 0a 94 45 f4 |t...w...U.....E.| +00000030 a9 fa 21 c5 54 15 03 03 00 30 00 00 00 00 00 00 |..!.T....0......| +00000040 00 00 00 00 00 00 00 00 00 00 40 17 27 41 8c ae |..........@.'A..| +00000050 74 59 34 f0 2e 72 34 4e 98 6e d8 da 17 07 b3 14 |tY4..r4N.n......| +00000060 d8 c8 2c ad b6 3e 44 5a 3e d7 |..,..>DZ>.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled deleted file mode 100644 index 71d26ea5e77..00000000000 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled +++ /dev/null @@ -1,137 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| -00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| -00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| -00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| -00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| -00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 05 c1 62 2b 2f |....Y...U....b+/| -00000010 12 46 4d c5 47 61 bd 43 6d bb 3a 60 42 c1 cf da |.FM.Ga.Cm.:`B...| -00000020 47 96 0a 11 35 f0 71 d8 f6 39 69 20 0f 9c c1 3f |G...5.q..9i ...?| -00000030 9c 68 e7 86 13 7c 1f 83 6b 56 39 ee 0d c0 82 0b |.h...|..kV9.....| -00000040 24 1b 8a 39 a6 dc bf 57 79 27 02 e4 c0 2f 00 00 |$..9...Wy'.../..| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| -00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| -00000080 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| -00000090 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| -000000a0 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| -000000b0 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| -000000c0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| -000000d0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| -000000e0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| -000000f0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -00000100 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| -00000110 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| -00000120 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| -00000130 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| -00000140 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| -00000150 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| -00000160 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| -00000170 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| -00000180 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| -00000190 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -000001a0 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001b0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001c0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001d0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001e0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| -000001f0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| -00000200 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| -00000210 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000220 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000230 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| -00000240 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| -00000250 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| -00000260 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| -00000270 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| -00000280 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| -00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| -000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| -000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 94 54 54 4c 52 a7 a5 |........ .TTLR..| -000002d0 c0 01 ed 59 bf 46 03 59 25 3b 57 f8 24 99 1b dc |...Y.F.Y%;W.$...| -000002e0 f6 f4 1d 42 0e 2e c3 7c 02 08 04 00 80 5a 42 35 |...B...|.....ZB5| -000002f0 78 c8 a9 37 6f 61 a4 ef 3a a3 12 03 f7 ee 44 be |x..7oa..:.....D.| -00000300 8b c9 52 4f de db f5 1e 9c c8 33 32 3c 0a 9e d6 |..RO......32<...| -00000310 32 bf 2e 12 f7 b0 9b 15 dc eb 24 6e d6 f2 ad 5d |2.........$n...]| -00000320 9e 77 c4 a7 7a a1 a0 13 0b 90 b4 aa 3e 51 a1 3d |.w..z.......>Q.=| -00000330 71 09 15 84 1c c5 98 bb 12 db 11 e2 4c 2c d1 a9 |q...........L,..| -00000340 5a ed 8e fb c6 ae ec d5 6d ec d8 d8 2a a7 23 ae |Z.......m...*.#.| -00000350 d7 d2 03 d0 23 8a 21 ac 7e 56 b4 23 7f c6 2a 72 |....#.!.~V.#..*r| -00000360 85 0b 6d 6c 9d 6f ad ee 15 20 d9 2b b9 16 03 03 |..ml.o... .+....| -00000370 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......| -00000380 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| -00000390 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| -000003a0 03 02 02 02 04 02 05 02 06 02 00 00 16 03 03 00 |................| -000003b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| -00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| -00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| -00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| -00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| -00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| -00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| -00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| -00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| -00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| -000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| -000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| -000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| -000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| -000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| -000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| -00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| -00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| -00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| -00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| -00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| -00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| -00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| -00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| -00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| -00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| -000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| -000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| -000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| -000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| -000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| -000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| -00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| -00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| -00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| -00000230 88 0f 00 00 84 04 01 00 80 61 11 ba 1a fe 08 7c |.........a.....|| -00000240 40 68 88 01 a4 3a 46 bf f6 e9 bb b6 08 92 20 f0 |@h...:F....... .| -00000250 13 90 c2 4b 53 83 a1 12 c2 d5 8d e6 67 82 df 80 |...KS.......g...| -00000260 85 a5 b4 e0 cf 1b d6 3a 46 1e 62 e5 7f 21 bc 91 |.......:F.b..!..| -00000270 4a 8c c0 79 16 64 5f 7e 40 c5 fb 7a 52 5b bf db |J..y.d_~@..zR[..| -00000280 cc 31 f8 b8 37 ef df dc 5f 96 30 ad dd 0b 8a 87 |.1..7..._.0.....| -00000290 af 4d c6 5c a5 5e d7 2e fa c7 72 68 85 71 c3 0e |.M.\.^....rh.q..| -000002a0 1b 26 87 ff 46 47 4a 1b ce b7 a5 aa 13 d2 5a e3 |.&..FGJ.......Z.| -000002b0 36 02 35 df 68 d9 bf 3f 24 14 03 03 00 01 01 16 |6.5.h..?$.......| -000002c0 03 03 00 28 00 00 00 00 00 00 00 00 e3 8e cc e5 |...(............| -000002d0 2e ab 40 fa 3d 47 c1 4f 3f de 97 a9 3d 96 73 ba |..@.=G.O?...=.s.| -000002e0 eb a0 ce 67 f6 d1 14 b8 7e cd 1f 85 |...g....~...| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 6a 0a 74 70 75 |..........(j.tpu| -00000010 0b 39 33 a5 15 0d 7c 7f f8 13 de 0e 0a 8f 13 3b |.93...|........;| -00000020 62 4f 8a 0b bd 0a aa 9b 5a 52 d5 e6 9f e5 b9 3f |bO......ZR.....?| -00000030 bd d8 3b |..;| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 0e 4d 62 |..............Mb| -00000010 d3 ac cd 11 15 6d 24 c7 00 fa f9 d2 91 ba eb 06 |.....m$.........| -00000020 f2 44 f1 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.D..............| -00000030 d1 5a 58 ba ae 65 15 67 79 1f 52 f1 1a da 50 99 |.ZX..e.gy.R...P.| -00000040 e8 50 |.P| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled-512 b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled-512 deleted file mode 100644 index 0e047294e09..00000000000 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled-512 +++ /dev/null @@ -1,125 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| -00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| -00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| -00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| -00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| -00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 68 11 23 f1 8d |....Y...U..h.#..| -00000010 2b a0 71 8f 6e ad 9f ae 43 58 c2 93 2e f5 01 3d |+.q.n...CX.....=| -00000020 15 b6 d6 0d f5 42 25 ca b7 b4 96 20 00 c7 86 06 |.....B%.... ....| -00000030 ed d1 23 99 dd e3 c4 f5 f9 31 42 51 a3 51 5a 40 |..#......1BQ.QZ@| -00000040 11 f6 07 90 51 04 f8 a2 f6 66 c1 f7 c0 2f 00 00 |....Q....f.../..| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| -00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| -00000080 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| -00000090 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| -000000a0 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| -000000b0 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| -000000c0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| -000000d0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| -000000e0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| -000000f0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -00000100 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| -00000110 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| -00000120 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| -00000130 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| -00000140 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| -00000150 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| -00000160 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| -00000170 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| -00000180 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| -00000190 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -000001a0 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001b0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001c0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001d0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001e0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| -000001f0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| -00000200 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| -00000210 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000220 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000230 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| -00000240 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| -00000250 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| -00000260 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| -00000270 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| -00000280 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| -00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| -000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| -000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 fe 68 1c bf 2b d7 75 |........ .h..+.u| -000002d0 c2 dd 96 03 5d 77 61 c1 7d dd 6f bc ea 3c aa 27 |....]wa.}.o..<.'| -000002e0 ba cf 93 e2 8b d8 66 a1 1c 08 04 00 80 5e 16 b9 |......f......^..| -000002f0 53 17 7d 8d bb 46 4b 1f 37 be cd fe e1 45 c3 10 |S.}..FK.7....E..| -00000300 68 54 e4 61 20 a5 a5 98 4b df a7 5d 41 4a aa f8 |hT.a ...K..]AJ..| -00000310 0e 36 c2 02 a6 56 a9 f1 aa 76 86 fd a7 86 fb 06 |.6...V...v......| -00000320 94 55 56 bd eb 57 10 9a d5 ba 70 59 46 75 e3 b3 |.UV..W....pYFu..| -00000330 29 14 c2 65 0e 5c a1 47 e6 bf 12 9d 31 8f 65 4d |)..e.\.G....1.eM| -00000340 af dc 1b 6e d2 de d7 fb 85 e7 5a 42 4f de bf d8 |...n......ZBO...| -00000350 d5 d8 5c 95 71 27 e7 04 af 58 0a d8 77 fb 3d 22 |..\.q'...X..w.="| -00000360 84 f6 f6 53 c0 79 7a 72 01 6e 5c e1 a8 16 03 03 |...S.yzr.n\.....| -00000370 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......| -00000380 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| -00000390 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| -000003a0 03 02 02 02 04 02 05 02 06 02 00 00 16 03 03 00 |................| -000003b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 03 01 7f 0b 00 01 7b 00 01 78 00 01 75 30 |........{..x..u0| -00000010 82 01 71 30 82 01 1b a0 03 02 01 02 02 10 1a 34 |..q0...........4| -00000020 27 90 21 65 52 a6 85 96 de a2 c7 2c ff b4 30 0d |'.!eR......,..0.| -00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| -00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| -00000050 6f 30 1e 17 0d 31 39 30 31 31 38 32 33 32 33 32 |o0...19011823232| -00000060 38 5a 17 0d 32 30 30 31 31 38 32 33 32 33 32 38 |8Z..200118232328| -00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| -00000080 6d 65 20 43 6f 30 5c 30 0d 06 09 2a 86 48 86 f7 |me Co0\0...*.H..| -00000090 0d 01 01 01 05 00 03 4b 00 30 48 02 41 00 dd 7b |.......K.0H.A..{| -000000a0 3d 6b 15 40 f0 6b 1d 87 4f 16 dc 9c 55 0f f4 08 |=k.@.k..O...U...| -000000b0 5c 80 41 8c 1d 55 76 9e 7e 15 54 45 85 24 1e 88 |\.A..Uv.~.TE.$..| -000000c0 f0 2f cd 93 1d 17 cb 24 25 ae 61 58 07 31 10 9c |./.....$%.aX.1..| -000000d0 83 e1 2a 5b 38 4f 48 45 a0 bb e3 26 75 e9 02 03 |..*[8OHE...&u...| -000000e0 01 00 01 a3 4d 30 4b 30 0e 06 03 55 1d 0f 01 01 |....M0K0...U....| -000000f0 ff 04 04 03 02 05 a0 30 13 06 03 55 1d 25 04 0c |.......0...U.%..| -00000100 30 0a 06 08 2b 06 01 05 05 07 03 01 30 0c 06 03 |0...+.......0...| -00000110 55 1d 13 01 01 ff 04 02 30 00 30 16 06 03 55 1d |U.......0.0...U.| -00000120 11 04 0f 30 0d 82 0b 65 78 61 6d 70 6c 65 2e 63 |...0...example.c| -00000130 6f 6d 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 |om0...*.H.......| -00000140 00 03 41 00 c4 3b 94 4b e0 6b ad 2d dc fa 1f a4 |..A..;.K.k.-....| -00000150 f9 f4 0f 3a 63 92 73 2e b2 4d 7f 66 1f 0d 10 29 |...:c.s..M.f...)| -00000160 bb 9c 19 a9 97 60 4c b4 51 12 30 39 d3 b4 b5 0d |.....`L.Q.09....| -00000170 cb 1c f7 35 60 6b d8 48 fc 24 0e 39 23 a8 40 ac |...5`k.H.$.9#.@.| -00000180 d9 59 bf 00 16 03 03 00 25 10 00 00 21 20 2f e5 |.Y......%...! /.| -00000190 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff |}.G.bC.(.._.).0.| -000001a0 f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 |........._X.;t..| -000001b0 03 00 48 0f 00 00 44 04 01 00 40 15 33 b2 27 d6 |..H...D...@.3.'.| -000001c0 ad 7f 45 86 df a0 83 5e 7c fb a7 0e 04 8e 3c a1 |..E....^|.....<.| -000001d0 5b 9a 8f 98 04 cf 66 bb cf 6a d4 63 d7 ff b2 a4 |[.....f..j.c....| -000001e0 f1 08 27 f7 53 1c ec 76 35 b1 09 93 91 db 63 e3 |..'.S..v5.....c.| -000001f0 a6 2b e5 55 da 06 5b 2f c7 8d c3 14 03 03 00 01 |.+.U..[/........| -00000200 01 16 03 03 00 28 00 00 00 00 00 00 00 00 98 d8 |.....(..........| -00000210 99 fa 5a fb 79 57 1f 02 4e 07 51 d6 c6 32 9c e8 |..Z.yW..N.Q..2..| -00000220 54 50 6c f9 63 fb 38 e2 ef 88 4b 7e 8d 7a |TPl.c.8...K~.z| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 4c 6b f0 26 84 |..........(Lk.&.| -00000010 97 e6 54 cf 1f 25 1c 91 5d 10 63 22 66 73 d2 ce |..T..%..].c"fs..| -00000020 0d 7c 0b 3d 7d 31 3c 0b 6c be 30 72 9e 04 c0 fb |.|.=}1<.l.0r....| -00000030 73 88 75 |s.u| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 2a b2 2d |.............*.-| -00000010 7f 6e 12 2d d7 63 05 e8 c4 fd 81 de b6 65 2f 2b |.n.-.c.......e/+| -00000020 00 0e 13 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| -00000030 9c c0 ae 5a b4 5f b5 4f cd 3f 27 78 f9 b3 b5 b5 |...Z._.O.?'x....| -00000040 57 f2 |W.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA index a0aff2560d7..02b11a69337 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 82 19 ee 7f ef |....Y...U.......| -00000010 86 a3 70 b1 75 84 05 bc 43 ed 52 df bf 42 c4 e3 |..p.u...C.R..B..| -00000020 87 50 59 5d 88 4f df b6 85 0c 5d 20 c3 1b c3 9d |.PY].O....] ....| -00000030 a0 2c 6b 16 1c 35 7a 3b 98 eb ba 8a 55 7a 10 af |.,k..5z;....Uz..| -00000040 c4 7f cd 74 e5 f2 e4 6b c1 58 5f 18 c0 2f 00 00 |...t...k.X_../..| +00000000 16 03 03 00 59 02 00 00 55 03 03 43 a0 10 ae 54 |....Y...U..C...T| +00000010 09 23 be 14 d7 1d b3 64 66 5e 39 4e 42 ed 58 3a |.#.....df^9NB.X:| +00000020 1b de 35 eb ee 9b 86 44 fe 2b a8 20 e7 f1 4a 47 |..5....D.+. ..JG| +00000030 b1 6b f0 fb d7 ed 3c 33 4a 52 bc 9b 39 c0 16 d3 |.k....<3JR..9...| +00000040 f4 0a 7c 38 7e b3 95 31 7a c7 c8 f4 c0 2f 00 00 |..|8~..1z..../..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,17 +60,17 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 5f 4e f4 61 c0 7a 45 |........ _N.a.zE| -000002d0 82 9e 8e d4 dc cc cf 75 7e 22 47 c4 61 17 fc ae |.......u~"G.a...| -000002e0 b0 0b 10 eb 4b b5 74 38 25 08 04 00 80 d1 db f1 |....K.t8%.......| -000002f0 bf 1a 22 33 54 0f 85 11 3d 07 05 63 c7 1c 71 90 |.."3T...=..c..q.| -00000300 e5 30 8d e6 3b 48 b3 42 e4 2e 72 9d 3e 6b 10 09 |.0..;H.B..r.>k..| -00000310 d6 32 ae 37 d4 37 5e 46 52 52 40 e5 d2 03 a9 db |.2.7.7^FRR@.....| -00000320 89 06 11 db be 67 73 3c 80 51 ce 09 df b0 ea 2a |.....gs<.Q.....*| -00000330 e3 aa 3e c0 4a c4 7d 88 ec 45 7d e8 a8 1e 46 28 |..>.J.}..E}...F(| -00000340 26 9e 38 d2 2a 97 dc a2 90 1a 7c 98 01 d9 f6 22 |&.8.*.....|...."| -00000350 9e 46 4a a2 2f ae 6e a4 3d 00 82 46 8e 8e 04 21 |.FJ./.n.=..F...!| -00000360 e7 39 23 de f6 51 6c 59 5c 63 40 c5 57 16 03 03 |.9#..QlY\c@.W...| +000002c0 ac 0c 00 00 a8 03 00 1d 20 e7 c6 c3 84 0a b7 55 |........ ......U| +000002d0 ff fb ae 43 10 da 03 0d 7d 91 77 90 cd 05 6a ab |...C....}.w...j.| +000002e0 08 35 5a 38 23 79 45 9f 54 08 04 00 80 d8 b8 a1 |.5Z8#yE.T.......| +000002f0 67 15 39 93 cc d0 ac e7 55 85 3e 62 f3 a6 d8 35 |g.9.....U.>b...5| +00000300 5e bb 60 4e 33 70 05 47 b8 9e 8c e6 85 65 09 e2 |^.`N3p.G.....e..| +00000310 95 4f 8a d9 4b cb 60 62 3c ef 57 81 ed b4 20 cf |.O..K.`b<.W... .| +00000320 b1 71 d9 62 57 60 fa 07 89 12 a1 90 8f 8f 06 4a |.q.bW`.........J| +00000330 56 c3 81 e0 b6 11 9e ce 33 fe 0f 4e b2 84 cc 4b |V.......3..N...K| +00000340 dc d4 71 e4 43 04 61 11 a9 a6 8a 20 43 a7 0e b6 |..q.C.a.... C...| +00000350 a8 97 43 1b e0 a9 b1 0f e8 19 68 0a 5d 38 d9 69 |..C.......h.]8.i| +00000360 22 65 16 aa 05 16 11 cd 66 4a 4f be 90 16 03 03 |"e......fJO.....| 00000370 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......| 00000380 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| 00000390 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| @@ -112,26 +112,26 @@ 00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| 00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| 00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| -00000230 88 0f 00 00 84 08 04 00 80 41 a2 d2 32 db ce 5b |.........A..2..[| -00000240 04 45 ad 1c 31 7d f0 bc bb c0 53 65 38 b6 75 10 |.E..1}....Se8.u.| -00000250 de 25 38 c2 3b 54 5b 1e 3d bb d2 6a 70 77 16 62 |.%8.;T[.=..jpw.b| -00000260 c2 e8 d0 17 bd 01 89 89 26 28 75 69 ba 5e a1 4a |........&(ui.^.J| -00000270 6d 7e e6 be 6c 64 7e 8b 0c 45 3b 4b ef 1d 75 69 |m~..ld~..E;K..ui| -00000280 1f 51 4b 02 8e a0 19 de 47 41 44 14 4f e7 1e 23 |.QK.....GAD.O..#| -00000290 b0 c0 41 3f 6a 64 0e 30 80 01 ea d8 a9 75 6d 97 |..A?jd.0.....um.| -000002a0 28 4c ae df b1 6e 53 3b c3 aa 48 f1 5a e8 1c 8f |(L...nS;..H.Z...| -000002b0 ed 8c 59 5d e1 0e 57 b1 7d 14 03 03 00 01 01 16 |..Y]..W.}.......| -000002c0 03 03 00 28 00 00 00 00 00 00 00 00 ee 41 37 7b |...(.........A7{| -000002d0 ea 1e c3 d1 a7 7d 76 5c f8 b6 70 57 3c 02 71 49 |.....}v\..pW<.qI| -000002e0 c5 14 35 bb c3 43 63 61 6c 46 6c 11 |..5..CcalFl.| +00000230 88 0f 00 00 84 04 01 00 80 2e af 25 b4 ff 00 08 |...........%....| +00000240 c8 dc 24 49 d5 9b d0 fe b5 81 8d 4e 15 d4 63 bf |..$I.......N..c.| +00000250 8e 4c a4 7d 96 58 a2 4b f4 25 a8 e3 39 fc df 2d |.L.}.X.K.%..9..-| +00000260 7c a0 20 61 86 35 8e 7e ba a5 2c f3 07 ad 84 36 ||. a.5.~..,....6| +00000270 df ef 66 e9 78 d8 5f b3 17 45 31 d4 4a 38 5c 6c |..f.x._..E1.J8\l| +00000280 03 73 3b 74 60 c9 00 d1 64 59 c9 a5 39 00 fc bf |.s;t`...dY..9...| +00000290 9c 3a 99 46 4b 71 90 64 8a 24 2e 37 cf 8a 42 c2 |.:.FKq.d.$.7..B.| +000002a0 56 a6 94 97 60 c5 56 ba de 71 78 6c f2 be ce 16 |V...`.V..qxl....| +000002b0 47 ca 0d 95 3c cc b8 6f b2 14 03 03 00 01 01 16 |G...<..o........| +000002c0 03 03 00 28 00 00 00 00 00 00 00 00 8e 0e 3b 43 |...(..........;C| +000002d0 63 52 24 16 91 bc 50 85 ef 34 ad b9 f0 45 e7 4c |cR$...P..4...E.L| +000002e0 9a 07 1d 46 53 2c 89 79 0f 27 dc 9d |...FS,.y.'..| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 87 e9 a4 2c 0f |..........(...,.| -00000010 b5 52 a7 1b d0 99 86 27 d0 20 3e b5 44 77 0b 8f |.R.....'. >.Dw..| -00000020 d5 4e db dc 52 ab 01 c0 1c fd 85 2c 41 3b d0 14 |.N..R......,A;..| -00000030 11 26 29 |.&)| +00000000 14 03 03 00 01 01 16 03 03 00 28 2f 40 03 cf 5a |..........(/@..Z| +00000010 76 6c 87 87 8d 99 4c e8 76 73 6a 62 1d a5 31 bc |vl....L.vsjb..1.| +00000020 2e 7e 23 8c 50 bf 07 b9 13 53 4a 59 a0 9b 74 b7 |.~#.P....SJY..t.| +00000030 53 21 2d |S!-| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 e7 09 a0 |................| -00000010 90 12 35 3f 8f 87 41 fc aa 13 24 50 9f 69 a5 c7 |..5?..A...$P.i..| -00000020 37 38 02 15 03 03 00 1a 00 00 00 00 00 00 00 02 |78..............| -00000030 08 53 f5 80 5c eb b2 3b 9d be a3 49 46 24 da 5a |.S..\..;...IF$.Z| -00000040 7d 84 |}.| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 83 69 b1 |..............i.| +00000010 20 19 eb db d4 58 e7 f1 5a 95 b0 d3 9d 3b 74 ad | ....X..Z....;t.| +00000020 bc 94 c4 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| +00000030 7d 89 89 25 40 be 0d fc 24 d0 ff 5a 0f 24 5d f2 |}..%@...$..Z.$].| +00000040 a3 ab |..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15 b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15 index 48c2868aa66..26308fc9dfd 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 27 d5 26 b1 eb |....Y...U..'.&..| -00000010 43 b9 e2 34 e7 3a e2 5e 73 ee b6 d7 4b 0c 88 49 |C..4.:.^s...K..I| -00000020 04 a8 0e fa f7 a1 79 39 e3 a6 29 20 75 68 40 36 |......y9..) uh@6| -00000030 ee c2 11 37 2f ae 43 85 f1 d0 eb ee 3d 69 99 e2 |...7/.C.....=i..| -00000040 3f f1 91 03 5d 00 af c5 f8 0d 4d dc c0 2f 00 00 |?...].....M../..| +00000000 16 03 03 00 59 02 00 00 55 03 03 97 f2 cb de f1 |....Y...U.......| +00000010 bb cf 9a 6c 6d 7e e2 94 af 9d 0b ed 02 cf fc b2 |...lm~..........| +00000020 80 b2 7b 41 2c a6 83 e7 52 62 93 20 63 23 7f 48 |..{A,...Rb. c#.H| +00000030 be c1 7f d3 75 34 fe 3a ad 27 f5 99 b0 73 91 df |....u4.:.'...s..| +00000040 b3 e9 82 95 cd 1b f9 08 b6 3d 4f 9b c0 2f 00 00 |.........=O../..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,17 +60,17 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 41 51 d5 70 34 15 c0 |........ AQ.p4..| -000002d0 76 3e 2b 5c e2 de 36 69 a9 2e bf b8 60 b4 3a 56 |v>+\..6i....`.:V| -000002e0 00 73 c1 85 4a b2 3e a6 54 04 01 00 80 5d 44 f2 |.s..J.>.T....]D.| -000002f0 28 99 f6 4f 45 bc 83 ce f7 98 ab 29 21 05 a6 c3 |(..OE......)!...| -00000300 8c a9 ef c2 82 b5 b3 bd 31 09 ae 11 15 fa 21 02 |........1.....!.| -00000310 43 59 00 fb 53 9d 0f bb b0 ab ca ba ce e8 41 28 |CY..S.........A(| -00000320 0a 7b ff cb d4 eb 81 8a a2 ce a6 32 f8 d7 f2 a0 |.{.........2....| -00000330 3b 0d c8 fc 8d 45 a8 4c 66 ef 48 ce 4a fc d3 7a |;....E.Lf.H.J..z| -00000340 19 1d 7f bd 71 c6 61 4a 93 b9 01 c9 39 32 48 ec |....q.aJ....92H.| -00000350 fd 01 c9 32 6b 9f d1 0e c1 62 bc 78 32 34 af 7e |...2k....b.x24.~| -00000360 58 16 d0 4c c7 44 a6 3a e5 4c 89 d6 f3 16 03 03 |X..L.D.:.L......| +000002c0 ac 0c 00 00 a8 03 00 1d 20 f8 3a 6c 5b 6f 88 48 |........ .:l[o.H| +000002d0 19 c5 a2 e7 4a d9 6d 21 56 23 63 1b 1f 95 aa bc |....J.m!V#c.....| +000002e0 33 ac aa 3b bb f8 35 ba 1a 04 01 00 80 98 6d 7b |3..;..5.......m{| +000002f0 7d 40 13 81 6b 70 ec ac 60 ee 1d 3e 37 36 bc f4 |}@..kp..`..>76..| +00000300 c1 9f 3c 13 b7 06 3d 38 be 4f 8c 3e e2 2e f2 b5 |..<...=8.O.>....| +00000310 de 16 ec a0 5b 64 00 5c c3 50 cc 79 a2 f7 e0 8d |....[d.\.P.y....| +00000320 68 e6 6b 1b b8 57 a4 15 d0 2c d7 4a be 97 26 26 |h.k..W...,.J..&&| +00000330 8c 5c 4e 26 36 96 48 b5 0f 88 7b 37 43 e4 d1 24 |.\N&6.H...{7C..$| +00000340 01 3c 70 38 99 c6 e2 2f 66 e7 db 57 30 f2 72 d0 |.>> Flow 3 (client to server) @@ -109,26 +109,26 @@ 00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| 00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| 00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| -00000230 88 0f 00 00 84 04 01 00 80 02 7e 43 b4 4e a2 07 |..........~C.N..| -00000240 a4 97 70 3f 80 91 5c b5 a0 f9 d7 c4 52 c9 ee 8a |..p?..\.....R...| -00000250 af 59 63 58 bb ac 55 47 cc 25 27 ea ca 48 0e fb |.YcX..UG.%'..H..| -00000260 87 e3 3e 5f 55 67 d8 60 8c 47 45 10 36 aa 66 6c |..>_Ug.`.GE.6.fl| -00000270 6b 16 2b 9e e5 da 50 73 dc 30 ef 2c 01 01 87 2e |k.+...Ps.0.,....| -00000280 68 eb 14 35 f5 ef c4 45 ae 8e 95 29 86 96 6e 04 |h..5...E...)..n.| -00000290 03 d6 3c 29 49 55 7c 7d ea 6c 1a a8 bf f9 5a e1 |..<)IU|}.l....Z.| -000002a0 a9 c4 66 5b 8d b5 78 b8 05 ce 44 ca 98 77 a2 7d |..f[..x...D..w.}| -000002b0 74 26 f4 ed 41 a3 97 2b 29 14 03 03 00 01 01 16 |t&..A..+).......| -000002c0 03 03 00 28 00 00 00 00 00 00 00 00 ac ec 0d 5a |...(...........Z| -000002d0 c7 81 fe c3 b3 ff 3a 6e d0 f3 f7 8e 17 6a 53 db |......:n.....jS.| -000002e0 58 5f 44 bb ce 59 0a 99 06 21 62 24 |X_D..Y...!b$| +00000230 88 0f 00 00 84 04 01 00 80 a8 12 9d 84 c2 17 0a |................| +00000240 03 ae bd 87 9a b6 6f 65 2f 7a 04 1f 69 2a 41 f4 |......oe/z..i*A.| +00000250 d0 9a 4d a4 5b 6e d2 d3 42 c3 77 4f 04 28 ce e6 |..M.[n..B.wO.(..| +00000260 d4 25 c5 81 1b 78 91 e9 1e 93 90 57 b2 58 6f 26 |.%...x.....W.Xo&| +00000270 ed 20 15 62 ff e9 c6 c1 52 4a 9a 05 a6 cd 17 22 |. .b....RJ....."| +00000280 75 c8 81 da a4 96 af c6 83 b5 5c 81 93 59 44 26 |u.........\..YD&| +00000290 5b 03 59 9d ab 93 ee c7 37 61 74 e7 4a 22 1c ec |[.Y.....7at.J"..| +000002a0 96 fb a2 c9 ea 2d 4b 8d d3 a7 e4 60 57 10 be b7 |.....-K....`W...| +000002b0 60 80 4f ee 8e 21 6b a2 13 14 03 03 00 01 01 16 |`.O..!k.........| +000002c0 03 03 00 28 00 00 00 00 00 00 00 00 16 82 4a c0 |...(..........J.| +000002d0 98 7b 62 3e 9b da a9 ac 31 f2 32 a9 23 13 2f e3 |.{b>....1.2.#./.| +000002e0 77 c9 1e ca 39 9f 4c 8a 10 58 33 67 |w...9.L..X3g| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 59 19 13 9f ea |..........(Y....| -00000010 68 14 58 ab 09 0c af 4d b4 a1 05 09 47 08 50 cd |h.X....M....G.P.| -00000020 b0 40 a0 3a 3f 89 68 c9 9c ea 8f 69 0a ea e1 75 |.@.:?.h....i...u| -00000030 11 97 ab |...| +00000000 14 03 03 00 01 01 16 03 03 00 28 8e 56 d0 9c 38 |..........(.V..8| +00000010 4f d9 df 12 9b dd 96 05 94 77 2f 6d 24 a8 cb 56 |O........w/m$..V| +00000020 91 f9 bc ec 00 b5 cc 71 c4 f4 36 42 be 68 37 78 |.......q..6B.h7x| +00000030 8f 6e 8c |.n.| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 38 f1 0f |.............8..| -00000010 d6 4f 5c 0a 60 1a 9f 97 6d 4a 43 e8 c8 a8 18 7e |.O\.`...mJC....~| -00000020 30 6f 67 15 03 03 00 1a 00 00 00 00 00 00 00 02 |0og.............| -00000030 d9 ac f7 69 ca a2 58 78 10 c2 eb 1a 61 da af 28 |...i..Xx....a..(| -00000040 20 02 | .| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 1c 19 9e |................| +00000010 a5 40 f6 d7 8b 80 23 8a 0b fa 14 65 08 6a 3c 66 |.@....#....e.j>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 ce d1 7f 55 bc |....Y...U.....U.| -00000010 b8 a8 fb 08 cc d4 2d a2 e9 fa ff 43 24 d2 14 04 |......-....C$...| -00000020 ad 5a 05 77 d4 67 04 8b c1 3e 5c 20 31 6e ba 32 |.Z.w.g...>\ 1n.2| -00000030 70 bd f0 c8 55 74 a1 49 f3 9f 93 86 e9 b3 ee 81 |p...Ut.I........| -00000040 3e 54 09 e9 15 78 78 7e 71 2b f5 cd c0 2f 00 00 |>T...xx~q+.../..| +00000000 16 03 03 00 59 02 00 00 55 03 03 be 63 44 bb 7e |....Y...U...cD.~| +00000010 0d 88 88 15 b1 ed 7e 75 03 57 25 1a 0c 52 42 31 |......~u.W%..RB1| +00000020 f8 e1 46 e3 11 27 ff 05 5e 26 2e 20 e6 31 d0 a6 |..F..'..^&. .1..| +00000030 d9 7c 69 a6 57 09 ee 50 c5 3c 5e 1d a0 a7 2b 7a |.|i.W..P.<^...+z| +00000040 7c dd 04 b4 38 45 c9 90 a0 98 33 68 c0 2f 00 00 ||...8E....3h./..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 66 0b 00 02 62 00 02 5f 00 02 5c 30 82 02 |..f...b.._..\0..| 00000070 58 30 82 01 8d a0 03 02 01 02 02 11 00 f2 99 26 |X0.............&| @@ -61,75 +61,82 @@ 000002a0 11 89 66 79 d1 8e 88 0e 0b a0 9e 30 2a c0 67 ef |..fy.......0*.g.| 000002b0 ca 46 02 88 e9 53 81 22 69 22 97 ad 80 93 d4 f7 |.F...S."i"......| 000002c0 dd 70 14 24 d7 70 0a 46 a1 16 03 03 00 ac 0c 00 |.p.$.p.F........| -000002d0 00 a8 03 00 1d 20 62 1f 63 aa 80 a5 b5 a3 e3 71 |..... b.c......q| -000002e0 71 63 0d be 4d d2 bd f4 3b 0d 78 e8 c1 fe 43 0d |qc..M...;.x...C.| -000002f0 e3 09 9a 01 ed 72 08 04 00 80 59 a7 96 03 f4 60 |.....r....Y....`| -00000300 fa 56 73 a2 14 e8 1e 0b 66 d5 7e 91 7c 99 50 6b |.Vs.....f.~.|.Pk| -00000310 c0 74 8d 24 a5 98 2d df 47 e4 42 73 09 a0 c4 6a |.t.$..-.G.Bs...j| -00000320 42 22 3d 85 f0 a4 05 f8 b5 74 96 85 f7 b0 22 9a |B"=......t....".| -00000330 ee 25 b5 19 c1 ec f0 3b 32 bd 28 6a eb ac 32 e4 |.%.....;2.(j..2.| -00000340 54 18 2e 6c b9 c0 74 d5 e8 36 2b 47 67 65 ba fb |T..l..t..6+Gge..| -00000350 53 18 b2 e3 30 6c 49 4c 8f 07 91 54 93 47 3b b9 |S...0lIL...T.G;.| -00000360 f1 92 81 53 b9 de 5a f5 28 08 e7 4a 46 fa 63 8f |...S..Z.(..JF.c.| -00000370 d0 66 29 0d 6d f0 6b 11 c1 2b 16 03 03 00 0c 0d |.f).m.k..+......| -00000380 00 00 08 01 01 00 02 08 04 00 00 16 03 03 00 04 |................| +000002d0 00 a8 03 00 1d 20 60 8e 8a 17 8a fc b4 4f 01 ad |..... `......O..| +000002e0 f8 ef 44 f3 fc af 2a 90 57 7d ba 1d dd a6 17 cc |..D...*.W}......| +000002f0 c6 4a 5f a2 fb 47 08 04 00 80 46 d8 62 04 19 4a |.J_..G....F.b..J| +00000300 29 9b cc 3c 2c 0d 7e 67 3d 97 c0 32 65 90 28 e2 |)..<,.~g=..2e.(.| +00000310 e9 df 7d 9b e1 62 82 a9 0b 22 99 a0 ae b9 7a 31 |..}..b..."....z1| +00000320 75 c2 6e 61 e7 a5 64 b9 72 ce b8 04 b2 ca 14 78 |u.na..d.r......x| +00000330 d4 b4 c2 b4 57 b4 a4 70 f9 d1 bf d0 77 e3 f5 66 |....W..p....w..f| +00000340 c0 3f dd b2 40 30 3d d5 e9 a6 d1 49 79 ac ea b9 |.?..@0=....Iy...| +00000350 38 43 52 3c a0 1c be 0d 18 a2 fc c0 a6 43 80 91 |8CR<.........C..| +00000360 3f c5 c2 3a 43 31 92 ff 58 a8 40 52 b3 99 0f c4 |?..:C1..X.@R....| +00000370 c6 00 89 0b b9 f4 9e 28 cd bf 16 03 03 00 0c 0d |.......(........| +00000380 00 00 08 01 01 00 02 04 01 00 00 16 03 03 00 04 |................| 00000390 0e 00 00 00 |....| >>> Flow 3 (client to server) -00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| -00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| -00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| -00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| -00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| -00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| -00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| -00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| -00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| -00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| -000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| -000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| -000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| -000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| -000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| -000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| -00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| -00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| -00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| -00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| -00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| -00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| -00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| -00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| -00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| -00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| -000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| -000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| -000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| -000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| -000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| -000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| -00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| -00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| -00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| -00000230 88 0f 00 00 84 08 04 00 80 a4 3b 32 76 8f fd 9a |..........;2v...| -00000240 42 99 24 e1 58 f8 21 39 b7 b2 55 ed 25 5c 67 a7 |B.$.X.!9..U.%\g.| -00000250 d3 79 f2 04 36 03 18 ad 76 4e db 9f ce 4f 97 86 |.y..6...vN...O..| -00000260 6f 0c 72 f5 8e 52 44 16 01 f2 4d c2 74 9f 75 51 |o.r..RD...M.t.uQ| -00000270 ea a4 0a 9c 1f a0 96 7e 2b e2 fc f9 80 c8 31 f9 |.......~+.....1.| -00000280 40 19 fe 40 d2 62 fd 9c 1a 29 ed ea 33 b3 ac f7 |@..@.b...)..3...| -00000290 e6 52 b6 2b 69 62 b2 a4 8d 62 db 4b 67 d9 fb b0 |.R.+ib...b.Kg...| -000002a0 2a 25 c5 c1 7e ca 7d 56 75 a0 b4 8e 65 18 ea ba |*%..~.}Vu...e...| -000002b0 fb 86 dc 60 b1 d3 fb 4b ce 14 03 03 00 01 01 16 |...`...K........| -000002c0 03 03 00 28 00 00 00 00 00 00 00 00 40 48 84 70 |...(........@H.p| -000002d0 05 89 8a 4d 25 4b 4f 14 96 bd 29 5f f8 1a e5 c0 |...M%KO...)_....| -000002e0 87 f5 b7 1e 1f ba 73 b4 66 e7 9f ea |......s.f...| +00000000 16 03 03 02 66 0b 00 02 62 00 02 5f 00 02 5c 30 |....f...b.._..\0| +00000010 82 02 58 30 82 01 8d a0 03 02 01 02 02 11 00 f2 |..X0............| +00000020 99 26 eb 87 ea 8a 0d b9 fc c2 47 34 7c 11 b0 30 |.&........G4|..0| +00000030 41 06 09 2a 86 48 86 f7 0d 01 01 0a 30 34 a0 0f |A..*.H......04..| +00000040 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 a1 |0...`.H.e.......| +00000050 1c 30 1a 06 09 2a 86 48 86 f7 0d 01 01 08 30 0d |.0...*.H......0.| +00000060 06 09 60 86 48 01 65 03 04 02 01 05 00 a2 03 02 |..`.H.e.........| +00000070 01 20 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 |. 0.1.0...U....A| +00000080 63 6d 65 20 43 6f 30 1e 17 0d 31 37 31 31 32 33 |cme Co0...171123| +00000090 31 36 31 36 31 30 5a 17 0d 31 38 31 31 32 33 31 |161610Z..1811231| +000000a0 36 31 36 31 30 5a 30 12 31 10 30 0e 06 03 55 04 |61610Z0.1.0...U.| +000000b0 0a 13 07 41 63 6d 65 20 43 6f 30 81 9f 30 0d 06 |...Acme Co0..0..| +000000c0 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 |.*.H............| +000000d0 30 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 |0.......F}...'.H| +000000e0 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a |..(!.~...]..RE.z| +000000f0 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 |6G....B[.....y.@| +00000100 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e |.Om..+.....g....| +00000110 d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 |."8.J.ts+.4.....| +00000120 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b |.t{.X.la<..A..++| +00000130 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 |$#w[.;.u]. T..c.| +00000140 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 |..$....P....C...| +00000150 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 46 30 44 |ub...R.......F0D| +00000160 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 |0...U...........| +00000170 30 13 06 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 |0...U.%..0...+..| +00000180 05 05 07 03 01 30 0c 06 03 55 1d 13 01 01 ff 04 |.....0...U......| +00000190 02 30 00 30 0f 06 03 55 1d 11 04 08 30 06 87 04 |.0.0...U....0...| +000001a0 7f 00 00 01 30 41 06 09 2a 86 48 86 f7 0d 01 01 |....0A..*.H.....| +000001b0 0a 30 34 a0 0f 30 0d 06 09 60 86 48 01 65 03 04 |.04..0...`.H.e..| +000001c0 02 01 05 00 a1 1c 30 1a 06 09 2a 86 48 86 f7 0d |......0...*.H...| +000001d0 01 01 08 30 0d 06 09 60 86 48 01 65 03 04 02 01 |...0...`.H.e....| +000001e0 05 00 a2 03 02 01 20 03 81 81 00 cd ac 4e f2 ce |...... ......N..| +000001f0 5f 8d 79 88 10 42 70 7f 7c bf 1b 5a 8a 00 ef 19 |_.y..Bp.|..Z....| +00000200 15 4b 40 15 17 71 00 6c d4 16 26 e5 49 6d 56 da |.K@..q.l..&.ImV.| +00000210 0c 1a 13 9f d8 46 95 59 3c b6 7f 87 76 5e 18 aa |.....F.Y<...v^..| +00000220 03 ea 06 75 22 dd 78 d2 a5 89 b8 c9 23 64 e1 28 |...u".x.....#d.(| +00000230 38 ce 34 6c 6e 06 7b 51 f1 a7 e6 f4 b3 7f fa b1 |8.4ln.{Q........| +00000240 3f 14 11 89 66 79 d1 8e 88 0e 0b a0 9e 30 2a c0 |?...fy.......0*.| +00000250 67 ef ca 46 02 88 e9 53 81 22 69 22 97 ad 80 93 |g..F...S."i"....| +00000260 d4 f7 dd 70 14 24 d7 70 0a 46 a1 16 03 03 00 25 |...p.$.p.F.....%| +00000270 10 00 00 21 20 2f e5 7d a3 47 cd 62 43 15 28 da |...! /.}.G.bC.(.| +00000280 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........| +00000290 5f 58 cb 3b 74 16 03 03 00 88 0f 00 00 84 04 01 |_X.;t...........| +000002a0 00 80 d5 bf 41 e0 65 7b 32 16 bb a3 92 48 f6 0e |....A.e{2....H..| +000002b0 31 eb ca a2 b7 1c b3 3a b4 8f 91 0e 44 e8 9e ad |1......:....D...| +000002c0 f7 71 4c 71 20 da 59 29 09 4f 0b 1e fb 92 c5 ce |.qLq .Y).O......| +000002d0 7b a3 26 de 89 be f5 cc b6 be dc af 09 6a f9 a2 |{.&..........j..| +000002e0 f0 65 5c 39 2d ad 2c 46 ce df 26 09 2e 99 5d 9e |.e\9-.,F..&...].| +000002f0 58 2b cf 1f ed b5 1a 4b 21 0b d8 ec 14 fb bb f2 |X+.....K!.......| +00000300 eb 41 9d 1c 6a 06 d8 38 b9 68 fc 1d 90 ad ff 9c |.A..j..8.h......| +00000310 91 c1 4a ff b0 49 59 8a 0b 25 26 eb 28 b1 a5 f8 |..J..IY..%&.(...| +00000320 0d 8e 14 03 03 00 01 01 16 03 03 00 28 00 00 00 |............(...| +00000330 00 00 00 00 00 cd a4 31 83 38 57 c8 91 98 4c 6c |.......1.8W...Ll| +00000340 76 c7 e1 d8 af f9 47 ee 45 75 f4 51 6c e5 7e da |v.....G.Eu.Ql.~.| +00000350 00 0f da 44 49 |...DI| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 9b d9 9c b6 21 |..........(....!| -00000010 4f 16 83 6d 53 a4 df 76 a4 79 60 9d fb 92 b0 57 |O..mS..v.y`....W| -00000020 7f 9b 4e 35 80 d6 d4 04 e6 a9 93 62 f7 41 8a 23 |..N5.......b.A.#| -00000030 78 22 4e |x"N| +00000000 14 03 03 00 01 01 16 03 03 00 28 7f 1d 85 46 4c |..........(...FL| +00000010 7f 93 d7 e3 c1 3f a7 71 69 16 90 9a a6 f8 9a 22 |.....?.qi......"| +00000020 a5 8b 0e 6d 6a f2 08 7e 40 6d ba 87 74 e4 e6 1d |...mj..~@m..t...| +00000030 ba 5e ff |.^.| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 81 49 a3 |..............I.| -00000010 c8 46 e1 9a 79 fa 94 02 69 94 24 0d e2 44 95 76 |.F..y...i.$..D.v| -00000020 ee a0 ca 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| -00000030 41 df 97 11 9e 64 12 ce 6f 96 be 90 af d8 4a 13 |A....d..o.....J.| -00000040 c5 01 |..| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 2a 5a a1 |.............*Z.| +00000010 d5 31 ba 8b 9d 3f f1 54 e0 53 cf 84 70 3b f5 bf |.1...?.T.S..p;..| +00000020 11 3c ad 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.<..............| +00000030 1b ad 23 3d 37 69 87 9d b5 60 f1 8a 13 d6 09 ab |..#=7i...`......| +00000040 a4 9b |..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES index 4e021207c13..95781c6853b 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 fa c6 67 00 b7 |....Y...U....g..| -00000010 e2 10 1e 8e b4 64 0e 4e 78 38 25 ff fb 5f bf 9f |.....d.Nx8%.._..| -00000020 b6 de b2 91 50 6c 67 0a bd dc dd 20 83 f5 41 e7 |....Plg.... ..A.| -00000030 98 0c 38 d9 3b 09 18 d2 2e 16 f5 ef 98 a9 ce 38 |..8.;..........8| -00000040 f1 36 3e bb 6d 45 81 b8 03 82 57 3d c0 09 00 00 |.6>.mE....W=....| +00000000 16 03 03 00 59 02 00 00 55 03 03 eb a2 77 eb b6 |....Y...U....w..| +00000010 1e e4 5c 2c ed 5a dc 93 1b 7e 8a 75 a1 8c ac a6 |..\,.Z...~.u....| +00000020 69 13 f6 f6 a4 69 07 93 99 cf 12 20 37 d7 f8 26 |i....i..... 7..&| +00000030 46 ea 3a 21 03 d0 25 0f 22 84 8d 24 2f 98 3d 42 |F.:!..%."..$/.=B| +00000040 eb 47 1d de 0c 12 ab 95 7a 55 46 f7 c0 09 00 00 |.G......zUF.....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,39 +55,39 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 b7 0c 00 00 b3 03 00 1d 20 da 76 |*............ .v| -00000280 af 3a be 2d da 07 b1 41 61 16 f3 ad c1 3f b5 95 |.:.-...Aa....?..| -00000290 27 4a 91 9d de f0 b8 a3 c7 ad c8 64 47 35 04 03 |'J.........dG5..| -000002a0 00 8b 30 81 88 02 42 01 86 ea 56 df 52 76 06 31 |..0...B...V.Rv.1| -000002b0 ae d9 80 6b 51 a0 61 84 9c a2 e5 aa dc d5 54 ba |...kQ.a.......T.| -000002c0 ca c9 88 d2 90 f6 a1 76 6c 38 39 d4 0b 2e e0 e5 |.......vl89.....| -000002d0 6a f5 f1 98 97 d4 a9 5a 73 a8 c7 67 eb 8b e2 8a |j......Zs..g....| -000002e0 2c 2a 80 a3 7e 5d 5e d8 0c 02 42 01 96 20 c9 4a |,*..~]^...B.. .J| -000002f0 a5 43 f1 c0 08 20 72 ea d2 9c 89 2b ef aa f1 37 |.C... r....+...7| -00000300 ff 00 78 3a 51 61 6a 13 61 7b e9 ea 37 bf 35 18 |..x:Qaj.a{..7.5.| -00000310 5a 19 33 29 4d fe e6 d4 0e cc 1e 21 13 6e ed 62 |Z.3)M......!.n.b| -00000320 bc d5 66 26 a4 82 d5 e0 99 3b ed 70 78 16 03 03 |..f&.....;.px...| +00000270 2a 16 03 03 00 b7 0c 00 00 b3 03 00 1d 20 90 68 |*............ .h| +00000280 81 8b 1d 7f d5 69 36 d3 4e 63 40 fa 3a 21 ee a4 |.....i6.Nc@.:!..| +00000290 c7 b4 09 bc 34 51 89 df d5 d2 79 51 34 32 04 03 |....4Q....yQ42..| +000002a0 00 8b 30 81 88 02 42 01 b4 69 6b 1c e6 35 99 81 |..0...B..ik..5..| +000002b0 fb aa cb b4 2d e9 e0 48 6a 6c 5e 14 54 77 b7 9d |....-..Hjl^.Tw..| +000002c0 df a3 c2 1b 53 8c d2 46 6d 2e ae 83 3a db 7c 86 |....S..Fm...:.|.| +000002d0 4a 45 c7 51 cd 30 d6 8c f5 4f ea 37 cb 1e 27 18 |JE.Q.0...O.7..'.| +000002e0 ba df d5 5f 11 ae 0e af 75 02 42 01 2b 37 2e 6d |..._....u.B.+7.m| +000002f0 7c 11 57 b7 b7 8b 90 73 cd e0 c9 38 3c ee aa d5 ||.W....s...8<...| +00000300 f2 cd ff b9 66 6a be 62 70 74 ee a4 f4 e3 fb 4f |....fj.bpt.....O| +00000310 ed 2e d5 a7 b5 a4 53 c8 1b 17 9e e9 48 e1 dd a6 |......S.....H...| +00000320 e8 6a 05 cf 73 b2 85 11 13 37 be e0 26 16 03 03 |.j..s....7..&...| 00000330 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| 00000030 16 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| -00000040 00 00 00 00 00 08 0a dc 8c c5 3e 8d 03 ab e1 c3 |..........>.....| -00000050 ea aa 03 d8 1d 19 99 9c 2c 15 09 4b 39 a8 51 c6 |........,..K9.Q.| -00000060 4e 15 46 1c d2 7c b0 a9 4b 7f be c9 35 99 ab db |N.F..|..K...5...| -00000070 4b e0 6c 62 17 |K.lb.| +00000040 00 00 00 00 00 7f 83 b7 cd 14 66 fb c3 2a f9 9f |..........f..*..| +00000050 79 ec 40 e5 dd 15 46 f3 25 8d dd b2 8e d5 78 97 |y.@...F.%.....x.| +00000060 e5 d6 4e 1a 2e 35 21 b2 aa ac 28 6f 2c 36 a6 6e |..N..5!...(o,6.n| +00000070 44 92 84 1b b9 |D....| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 ae ce d9 46 bc |..........@...F.| -00000010 2f df aa fb d6 7d 52 e3 e9 a0 e6 e9 22 14 ae fe |/....}R....."...| -00000020 ce 34 c2 b2 16 ae aa 6b 72 90 d3 a6 e9 1e 96 3f |.4.....kr......?| -00000030 fd 45 d7 cc 28 db ac f7 42 55 3e 24 2c 5e dc 3e |.E..(...BU>$,^.>| -00000040 5f 6e 36 76 6e ab 1c 35 76 e5 4b |_n6vn..5v.K| +00000000 14 03 03 00 01 01 16 03 03 00 40 db ee f8 c1 0e |..........@.....| +00000010 7f 23 b4 cb e6 db 03 2a fb 68 40 78 85 03 9e dc |.#.....*.h@x....| +00000020 ac f8 f0 b5 65 8d 7c 01 4a ce 86 29 a9 c5 c3 b2 |....e.|.J..)....| +00000030 12 8d d1 58 af e7 21 75 e4 be f3 c0 03 55 f8 bb |...X..!u.....U..| +00000040 71 bd 85 ee 46 87 a0 32 75 ee 4c |q...F..2u.L| >>> Flow 5 (client to server) 00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 48 f8 b0 95 19 6b 5f 9a 03 5d 10 |.....H....k_..].| -00000020 d6 1a 3c ed d1 f8 73 4f 84 52 63 a2 3a f5 3c 4d |..<...sO.Rc.:.>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 d1 cf 2d 7a f6 |....Y...U....-z.| -00000010 a2 09 06 6e 67 c1 ce 6e ae 25 49 da fc 24 4f d1 |...ng..n.%I..$O.| -00000020 8a a0 2e d0 7f 87 a4 8b 58 c8 37 20 22 d2 39 81 |........X.7 ".9.| -00000030 5b 59 bd 0f 7b 59 b4 2c 38 d4 e0 03 1c 3b 5a 99 |[Y..{Y.,8....;Z.| -00000040 20 57 75 30 3d 3f a8 d9 cd 33 41 17 c0 2b 00 00 | Wu0=?...3A..+..| +00000000 16 03 03 00 59 02 00 00 55 03 03 c9 a1 8b 70 59 |....Y...U.....pY| +00000010 8b 88 41 56 b7 bc 9a 1f 50 57 46 7d 79 d8 ef b2 |..AV....PWF}y...| +00000020 15 3f ad ad bb 48 09 ce e1 c2 2c 20 84 43 65 e7 |.?...H...., .Ce.| +00000030 3f 2f d8 13 9a 79 ac 54 ee b9 13 a1 7c a7 05 f7 |?/...y.T....|...| +00000040 c8 b4 fc bd 20 40 17 ca 15 cd 91 1e c0 2b 00 00 |.... @.......+..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,34 +55,34 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 b6 0c 00 00 b2 03 00 1d 20 1a b3 |*............ ..| -00000280 9a e4 c6 dd ca 36 10 16 55 e4 97 36 a5 b2 e7 e9 |.....6..U..6....| -00000290 42 b3 f3 a0 bb df d8 a5 00 be 40 35 8c 50 04 03 |B.........@5.P..| -000002a0 00 8a 30 81 87 02 42 01 90 c8 0f 71 3e 83 c9 6b |..0...B....q>..k| -000002b0 f2 b0 75 7d 9c 54 d4 33 59 fd ef 69 b4 d9 4d 9b |..u}.T.3Y..i..M.| -000002c0 48 fd cd 45 e5 e4 6c 8a 3a d5 1d 60 dc 88 65 3b |H..E..l.:..`..e;| -000002d0 98 81 e1 69 38 d9 bf fe 19 65 6b d9 da 57 8b d3 |...i8....ek..W..| -000002e0 b3 ef 54 db 4b dc f5 42 02 02 41 0d ab cd 01 a9 |..T.K..B..A.....| -000002f0 fc b8 10 40 2c 1a c7 46 e1 54 c0 5b 7f 24 28 49 |...@,..F.T.[.$(I| -00000300 fc 8b 62 e5 3e 99 db 2f 3d 69 d9 4c 86 c2 45 bb |..b.>../=i.L..E.| -00000310 89 0a f7 2e 7d 9f fb f8 fc 49 f9 c3 fb 21 f6 21 |....}....I...!.!| -00000320 10 35 7f 92 14 09 37 76 8b 2c 6c f2 16 03 03 00 |.5....7v.,l.....| -00000330 04 0e 00 00 00 |.....| +00000270 2a 16 03 03 00 b7 0c 00 00 b3 03 00 1d 20 58 f9 |*............ X.| +00000280 2e 03 90 fa 3d 33 0d 3e e1 3a b1 5a 45 ec 5c ee |....=3.>.:.ZE.\.| +00000290 9f 47 51 4b 93 89 33 11 e0 63 86 fd b2 3b 04 03 |.GQK..3..c...;..| +000002a0 00 8b 30 81 88 02 42 01 c2 fa 7b f8 ed 6b a5 0f |..0...B...{..k..| +000002b0 33 87 02 35 5b 8e 5d 31 5e 92 df c2 90 ae 58 24 |3..5[.]1^.....X$| +000002c0 43 0f ba e3 b8 77 12 7a 97 c3 77 15 62 d3 f2 cc |C....w.z..w.b...| +000002d0 10 cd a9 be b6 b2 37 93 b1 ce 8b b2 6c fa 93 74 |......7.....l..t| +000002e0 5e 14 8e ba 9e d7 66 48 b8 02 42 01 8e 9a 10 1d |^.....fH..B.....| +000002f0 7d e0 d3 cf 0d d0 3c bc 34 1c 16 20 85 50 03 3f |}.....<.4.. .P.?| +00000300 e1 6d a3 a0 d4 6e d8 fd 7e df b4 c1 84 29 c3 68 |.m...n..~....).h| +00000310 c2 01 dd 77 fc 2c a5 8f 3b 74 c6 e4 32 20 b7 a0 |...w.,..;t..2 ..| +00000320 8c 1b 2d 93 6a 9c 8a ed 21 b5 9a e0 cb 16 03 03 |..-.j...!.......| +00000330 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 28 00 00 00 00 00 00 00 00 0b f4 58 |....(..........X| -00000040 bd 46 cf 10 2b 5b f7 6b 89 44 12 a2 25 95 cd a3 |.F..+[.k.D..%...| -00000050 df ce 5c e4 e2 50 5f ef 06 84 06 03 8f |..\..P_......| +00000030 16 03 03 00 28 00 00 00 00 00 00 00 00 c2 14 2d |....(..........-| +00000040 fc d7 a2 cb 18 b9 2a ae 38 70 b7 78 7c 88 97 d3 |......*.8p.x|...| +00000050 ff 7f df 12 23 96 ab 4d 6c 5c 67 72 c4 |....#..Ml\gr.| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 2f 02 07 37 3f |..........(/..7?| -00000010 3c 9d 0a fb 03 31 a2 df 0f d6 b4 53 f8 fa 38 bb |<....1.....S..8.| -00000020 47 ed 9d 69 b7 64 72 75 8a 06 f2 fa 9f 06 a4 91 |G..i.dru........| -00000030 65 c5 6e |e.n| +00000000 14 03 03 00 01 01 16 03 03 00 28 2a dd b3 5b c6 |..........(*..[.| +00000010 76 e7 c0 ac 8c 70 77 d6 d8 4e 79 4a 04 3d 91 a9 |v....pw..NyJ.=..| +00000020 ad 79 ef c9 22 78 17 9e ef b0 03 c8 e6 85 b7 8c |.y.."x..........| +00000030 e5 74 95 |.t.| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 31 4a a6 |.............1J.| -00000010 a1 88 d0 36 6a 11 b7 4f 81 a8 f5 1d c1 c6 d1 51 |...6j..O.......Q| -00000020 3b a2 b1 15 03 03 00 1a 00 00 00 00 00 00 00 02 |;...............| -00000030 0e 35 89 7d 67 0e 8d b7 6f c9 86 6d 33 05 9f 7c |.5.}g...o..m3..|| -00000040 ab 8e |..| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 84 b5 0f |................| +00000010 1f ed f9 4c 0d a1 f3 7b 8e 23 87 65 b1 39 98 50 |...L...{.#.e.9.P| +00000020 3d ff 1b 15 03 03 00 1a 00 00 00 00 00 00 00 02 |=...............| +00000030 aa 34 cc f1 4a d3 de 4c 42 bc 2c 0f 3e 71 af 6b |.4..J..LB.,.>q.k| +00000040 3c fc |<.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES128-SHA256 b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES128-SHA256 index 12b87c95c8f..96f6218a35d 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES128-SHA256 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES128-SHA256 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 bd b8 d6 c0 5c |....Y...U......\| -00000010 0c 7f e3 50 4c 1c d3 b0 0f 67 1a 32 cc 49 18 03 |...PL....g.2.I..| -00000020 41 91 87 43 0c eb 40 53 a4 2c 0c 20 ec a4 59 bd |A..C..@S.,. ..Y.| -00000030 cb 3e b8 94 d9 74 ee ab 8e 7a 24 c8 cc af 08 87 |.>...t...z$.....| -00000040 e7 9c d1 01 4e fe 7d 1d 5d cf e0 2c c0 23 00 00 |....N.}.]..,.#..| +00000000 16 03 03 00 59 02 00 00 55 03 03 87 87 6f ce 44 |....Y...U....o.D| +00000010 94 5f 2f cc 94 03 50 68 a7 4f 37 70 8a d4 cf e3 |._/...Ph.O7p....| +00000020 23 7f 11 f5 93 c7 3f 96 87 49 45 20 9c d4 96 b2 |#.....?..IE ....| +00000030 dc 8c 16 c5 fb cc 2f 8e 0e a5 ef a3 ea cf 57 d0 |....../.......W.| +00000040 09 70 bd 16 c4 d9 e4 1b a0 40 f7 f3 c0 23 00 00 |.p.......@...#..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,43 +55,43 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 b6 0c 00 00 b2 03 00 1d 20 6d 7f |*............ m.| -00000280 23 3f 8c 08 0f db 54 cc dc 84 d7 97 f0 18 85 68 |#?....T........h| -00000290 e3 17 94 f6 48 f3 c2 9c 4c 3e 58 47 ed 29 04 03 |....H...L>XG.)..| -000002a0 00 8a 30 81 87 02 42 01 c1 d9 7a d0 fb d9 ff 31 |..0...B...z....1| -000002b0 78 20 9e 2e 5c f0 22 97 1b 24 e8 50 6f 5d 8c db |x ..\."..$.Po]..| -000002c0 fb 97 0d 2d 73 08 ae 46 14 1c 76 2b 38 ad 75 2d |...-s..F..v+8.u-| -000002d0 a2 8e 5a 99 40 47 51 1f 11 af c0 86 bc c9 3b e3 |..Z.@GQ.......;.| -000002e0 a0 ff 6a e6 87 e6 74 d8 fd 02 41 7a 72 6a 93 12 |..j...t...Azrj..| -000002f0 4b 48 f9 46 af 95 90 1e 3b c7 2c fe 67 a1 44 d8 |KH.F....;.,.g.D.| -00000300 77 1c 7e 03 fe be ba 9d a1 85 81 42 fb 18 7d 08 |w.~........B..}.| -00000310 e6 04 1f 3e 05 eb 48 87 4e 28 1c e9 00 db 7f c4 |...>..H.N(......| -00000320 17 cb 21 02 37 90 47 fd 2f db 95 a7 16 03 03 00 |..!.7.G./.......| +00000270 2a 16 03 03 00 b6 0c 00 00 b2 03 00 1d 20 3f a6 |*............ ?.| +00000280 d1 0d ae 8d c0 06 14 ca da 2c 69 1c f1 84 c4 dd |.........,i.....| +00000290 14 f4 0e a6 ce b5 d6 37 9d 9f a5 ba 7b 74 04 03 |.......7....{t..| +000002a0 00 8a 30 81 87 02 42 00 b5 2b 9a 32 9d af b9 cc |..0...B..+.2....| +000002b0 0d b6 f1 9b 87 35 af d7 dc 04 0f 1b 04 d7 fa 62 |.....5.........b| +000002c0 20 bd 2c 31 41 17 e7 c0 ea 22 78 e4 de 37 14 a8 | .,1A...."x..7..| +000002d0 f9 f3 f1 3e 0c 55 59 b3 e3 0e 31 26 ce d0 c1 19 |...>.UY...1&....| +000002e0 b8 17 07 2a 23 98 7b 17 0f 02 41 41 d5 51 80 4d |...*#.{...AA.Q.M| +000002f0 8a 14 56 b1 39 7b 8b 37 24 ef e0 ec 43 44 5a cc |..V.9{.7$...CDZ.| +00000300 9b ab dc 63 e7 cc 7b 29 c0 66 ae 9c 23 c5 1b 98 |...c..{).f..#...| +00000310 6e 35 64 97 12 43 16 73 a6 6b c8 09 2c 26 7c f5 |n5d..C.s.k..,&|.| +00000320 b1 1f 9f 55 04 9e 53 33 c1 89 7a d0 16 03 03 00 |...U..S3..z.....| 00000330 04 0e 00 00 00 |.....| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| 00000030 16 03 03 00 50 00 00 00 00 00 00 00 00 00 00 00 |....P...........| -00000040 00 00 00 00 00 7a c5 98 1b ac 30 7c ea 9b cc 6d |.....z....0|...m| -00000050 5d 40 19 5d 6e 47 8a 46 d4 de 8c a3 f8 9b b1 2c |]@.]nG.F.......,| -00000060 9f 90 e9 83 2c a6 18 9f 39 92 d5 1f ab d5 5a 03 |....,...9.....Z.| -00000070 79 44 36 e3 0d b5 c9 e4 36 73 08 7d 55 e0 23 d6 |yD6.....6s.}U.#.| -00000080 82 f3 d7 4e ba |...N.| +00000040 00 00 00 00 00 d3 72 3f 9d 37 ba 97 55 83 b4 f0 |......r?.7..U...| +00000050 ad 0b f0 48 98 16 05 f1 b5 6e da a4 79 e4 d9 8e |...H.....n..y...| +00000060 62 af b9 a1 d1 a4 5c 04 d2 b1 86 32 af 64 ac 89 |b.....\....2.d..| +00000070 d3 47 5f 61 ae f4 21 5b 8d 4b ff 74 c1 b8 9c de |.G_a..![.K.t....| +00000080 fd 74 a0 99 c1 |.t...| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 50 a4 84 15 44 2e |..........P...D.| -00000010 6e e3 20 8d 7c a0 e4 85 36 7b a6 19 35 38 52 d0 |n. .|...6{..58R.| -00000020 bf 47 7e b4 09 a7 5b 5b e6 7c ad 4a b0 56 0a 28 |.G~...[[.|.J.V.(| -00000030 50 ef 94 89 8b 54 80 06 7a d8 b2 5d 75 ab e2 ff |P....T..z..]u...| -00000040 b1 6c 11 60 d2 0d 06 af bf 45 fd d8 5a 7b 2d 9c |.l.`.....E..Z{-.| -00000050 7c a1 b7 5e 4c 77 c9 ed 56 f0 68 ||..^Lw..V.h| +00000000 14 03 03 00 01 01 16 03 03 00 50 09 3b 3e 7e 2e |..........P.;>~.| +00000010 d8 46 04 ac b0 3d c9 7e ec 28 8c bd 6c 0f a8 b5 |.F...=.~.(..l...| +00000020 af 8c 86 ed 64 81 6c d4 98 9e 56 2a 48 0d 03 40 |....d.l...V*H..@| +00000030 64 3e 25 58 6f 03 6a 4e be a2 11 6f 6f e7 2f c2 |d>%Xo.jN...oo./.| +00000040 8f 78 c4 11 a1 07 21 91 9d 34 01 08 39 0d 07 d2 |.x....!..4..9...| +00000050 d4 a2 cc 2f 25 ea ee 8d 8b 91 f9 |.../%......| >>> Flow 5 (client to server) 00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| -00000010 00 00 00 00 00 0b 1a da c8 8a 8e 62 45 0b b3 69 |...........bE..i| -00000020 6a 6e 43 20 54 ae 4e 10 4b 64 0c e0 d6 1c 77 9d |jnC T.N.Kd....w.| -00000030 bd 23 f7 0a 7d eb 2e 54 9a d7 08 1d c6 af eb a9 |.#..}..T........| -00000040 6e c2 18 b5 95 15 03 03 00 40 00 00 00 00 00 00 |n........@......| -00000050 00 00 00 00 00 00 00 00 00 00 c7 9c 8c 71 7f 00 |.............q..| -00000060 42 8e 5b 14 4a 9b 88 a1 5b 68 b4 45 16 c0 c1 91 |B.[.J...[h.E....| -00000070 3e 9a 9f 84 b2 9b b3 f2 f5 e3 50 53 2e d8 4b 7c |>.........PS..K|| -00000080 2a e8 e9 91 64 81 5a f4 43 f3 |*...d.Z.C.| +00000010 00 00 00 00 00 1d 76 4c fb 46 f8 02 9a bc 07 8d |......vL.F......| +00000020 b0 52 40 44 58 da ad be 3c a6 d7 44 0f 59 98 f3 |.R@DX...<..D.Y..| +00000030 ae 5c d2 04 bb 07 ee f6 99 9d 2c 14 44 3b 90 bc |.\........,.D;..| +00000040 2b e9 bc 37 59 15 03 03 00 40 00 00 00 00 00 00 |+..7Y....@......| +00000050 00 00 00 00 00 00 00 00 00 00 c4 ef 97 87 35 a2 |..............5.| +00000060 2f cc c2 6f 3d d5 f5 6f fd 74 56 50 37 f8 10 e8 |/..o=..o.tVP7...| +00000070 36 f5 fb 6f 7b 5d 20 07 0d 2f 72 46 a7 3a e0 de |6..o{] ../rF.:..| +00000080 39 b3 76 0e 4f c0 e7 85 4b bb |9.v.O...K.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 index 70608d8e472..90a1639e990 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 97 16 31 62 59 |....Y...U....1bY| -00000010 8f a6 1c c4 b2 65 e5 d3 85 92 16 5e 52 06 03 9f |.....e.....^R...| -00000020 5a 20 35 3f c2 68 a7 3f 40 18 44 20 d1 5f 9f a0 |Z 5?.h.?@.D ._..| -00000030 2c f9 83 69 98 2f 3f ff ad 1c d8 bc ba 36 33 a7 |,..i./?......63.| -00000040 72 8e a4 a7 1e cb 42 db ef 3c ee b0 c0 2c 00 00 |r.....B..<...,..| +00000000 16 03 03 00 59 02 00 00 55 03 03 b8 16 bd ae 15 |....Y...U.......| +00000010 a3 33 52 cc 60 dc 6c fe 7c f3 82 b9 1e 13 ab 87 |.3R.`.l.|.......| +00000020 22 d8 c3 38 dc 8a 76 bb a0 a3 fd 20 8a d1 92 d1 |"..8..v.... ....| +00000030 d6 f3 76 e0 e2 76 32 95 32 a0 eb 5b dc e4 42 81 |..v..v2.2..[..B.| +00000040 14 bb 58 ab b8 e8 9d ee fa 32 58 05 c0 2c 00 00 |..X......2X..,..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -55,34 +55,34 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 b6 0c 00 00 b2 03 00 1d 20 71 52 |*............ qR| -00000280 57 ca a4 04 3b 72 37 67 bc 0f 5d 37 ac 33 21 9f |W...;r7g..]7.3!.| -00000290 65 cd 27 a1 5f b5 19 ff 9b cb 35 ce 98 76 04 03 |e.'._.....5..v..| -000002a0 00 8a 30 81 87 02 41 13 01 36 e8 6e a5 85 d8 65 |..0...A..6.n...e| -000002b0 d4 0c 38 31 bb 99 5f 39 f9 49 6f b7 bd 75 ef 5c |..81.._9.Io..u.\| -000002c0 87 d6 86 b4 76 25 87 72 50 e7 20 14 5f c4 1e b0 |....v%.rP. ._...| -000002d0 fe c0 8c 44 a7 e0 18 1b 01 38 4d 11 d1 c5 ad 05 |...D.....8M.....| -000002e0 87 09 dd dd 8a f0 96 9c 02 42 00 e4 50 9b 26 b0 |.........B..P.&.| -000002f0 3c 00 7f 66 8b 71 12 cc 7f ba 03 6e b5 d9 3c a5 |<..f.q.....n..<.| -00000300 2e 0a 10 d0 66 0b 82 10 97 45 4e 19 6e 95 7c 52 |....f....EN.n.|R| -00000310 ca b1 ae 96 b7 c4 ee 93 67 41 d7 e4 4c 28 7a d6 |........gA..L(z.| -00000320 70 10 dc 95 f9 22 52 3a 38 74 73 54 16 03 03 00 |p...."R:8tsT....| +00000270 2a 16 03 03 00 b6 0c 00 00 b2 03 00 1d 20 5c 9b |*............ \.| +00000280 9b 29 5c 83 36 b8 20 47 2b 04 0d 1b ab f5 f7 81 |.)\.6. G+.......| +00000290 aa 89 b4 93 37 aa 28 4e 44 e1 22 26 b6 46 04 03 |....7.(ND."&.F..| +000002a0 00 8a 30 81 87 02 42 01 2c 87 df 1f 07 86 36 c8 |..0...B.,.....6.| +000002b0 f6 aa 41 c1 8e 99 6e 12 08 5f e2 62 4b 3a 9b ad |..A...n.._.bK:..| +000002c0 e8 26 1c 95 f9 62 c6 f6 c7 e4 f7 db 3b 23 e5 4f |.&...b......;#.O| +000002d0 03 a1 c6 89 74 cb bd 2a 4e 47 3f 0f bf 28 bb 6d |....t..*NG?..(.m| +000002e0 c0 c6 53 4c 02 0b 9a 30 2d 02 41 0c 6f 26 a5 4c |..SL...0-.A.o&.L| +000002f0 b6 6c 8c ab 82 32 19 a0 f0 1b 41 2d 9d 1d 12 1b |.l...2....A-....| +00000300 91 62 6a 3d 17 92 79 f6 59 45 21 2f 6b d0 cb 7b |.bj=..y.YE!/k..{| +00000310 22 b3 79 80 90 90 81 97 06 c8 59 fd 8b 40 f9 ec |".y.......Y..@..| +00000320 80 58 db fc 5e a2 67 9a 96 01 53 d4 16 03 03 00 |.X..^.g...S.....| 00000330 04 0e 00 00 00 |.....| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 28 00 00 00 00 00 00 00 00 1a c4 04 |....(...........| -00000040 eb 27 48 c1 ed 93 75 73 01 06 e3 55 70 6c c6 a0 |.'H...us...Upl..| -00000050 62 eb f5 a9 f3 8c a5 8a e3 e9 43 a4 2e |b.........C..| +00000030 16 03 03 00 28 00 00 00 00 00 00 00 00 17 be e6 |....(...........| +00000040 ba 39 2d 82 38 6e 09 2c 1c ef d5 1f ad 8e e0 47 |.9-.8n.,.......G| +00000050 2d bc 74 f8 3b ed 86 89 9e e9 a5 01 40 |-.t.;.......@| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 6e bc 2f ed 32 |..........(n./.2| -00000010 53 00 47 5c 73 6c e3 86 38 e5 df e2 db 40 bf 31 |S.G\sl..8....@.1| -00000020 87 a5 33 fb af dd c9 c7 1c 98 7b ba 11 42 5e 0a |..3.......{..B^.| -00000030 f1 65 3b |.e;| +00000000 14 03 03 00 01 01 16 03 03 00 28 42 3b b0 5e 66 |..........(B;.^f| +00000010 3e ef a5 3d 49 64 42 34 b1 21 d6 43 d3 f6 f5 84 |>..=IdB4.!.C....| +00000020 21 96 b4 7b ed 73 b5 23 b6 40 cf 86 ab 71 59 58 |!..{.s.#.@...qYX| +00000030 3a bf 79 |:.y| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 75 32 a8 |.............u2.| -00000010 ce 12 60 b4 d6 83 2c 4a e5 43 cb 6d c8 f3 f2 ee |..`...,J.C.m....| -00000020 8e 1e 2c 15 03 03 00 1a 00 00 00 00 00 00 00 02 |..,.............| -00000030 4e bb e9 81 44 f2 44 90 7c ac 8a 35 a3 ef e2 9b |N...D.D.|..5....| -00000040 d9 2b |.+| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 8d 3c f7 |..............<.| +00000010 9e da 91 15 35 10 5f a4 29 32 3f 6a 8c 1d bc 13 |....5._.)2?j....| +00000020 8a 35 2b 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.5+.............| +00000030 1f b3 e3 e3 24 ac 7a a6 ee 81 e7 cc 9e 70 34 2c |....$.z......p4,| +00000040 d2 28 |.(| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305 b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305 index 9acc6be054b..1b3c37be241 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305 @@ -1,24 +1,24 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 ce 01 00 00 ca 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 d0 01 00 00 cc 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 08 cc a9 |................| -00000050 13 01 13 03 13 02 01 00 00 79 00 05 00 05 01 00 |.........y......| +00000050 13 01 13 03 13 02 01 00 00 7b 00 05 00 05 01 00 |.........{......| 00000060 00 00 00 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 |................| -00000070 19 00 0b 00 02 01 00 00 0d 00 18 00 16 08 04 08 |................| -00000080 05 08 06 04 01 04 03 05 01 05 03 06 01 06 03 02 |................| -00000090 01 02 03 ff 01 00 01 00 00 12 00 00 00 2b 00 09 |.............+..| -000000a0 08 03 04 03 03 03 02 03 01 00 33 00 26 00 24 00 |..........3.&.$.| -000000b0 1d 00 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f |.. /.}.G.bC.(.._| -000000c0 bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 |.).0.........._X| -000000d0 cb 3b 74 |.;t| +00000070 19 00 0b 00 02 01 00 00 0d 00 1a 00 18 08 04 04 |................| +00000080 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 06 |................| +00000090 03 02 01 02 03 ff 01 00 01 00 00 12 00 00 00 2b |...............+| +000000a0 00 09 08 03 04 03 03 03 02 03 01 00 33 00 26 00 |............3.&.| +000000b0 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 28 da |$... /.}.G.bC.(.| +000000c0 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........| +000000d0 5f 58 cb 3b 74 |_X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 81 32 be f7 42 |....Y...U...2..B| -00000010 de 0a 50 a4 4e a3 58 2f 7c 6b a8 14 d9 d4 66 ec |..P.N.X/|k....f.| -00000020 ca 4b 07 2e 59 2d f0 b2 24 1d 69 20 53 20 08 85 |.K..Y-..$.i S ..| -00000030 8a 10 34 6d 41 d8 12 02 38 49 d6 1c c8 f5 e3 6c |..4mA...8I.....l| -00000040 bb ac 77 2d 2a 06 69 e9 6c fd d0 da cc a9 00 00 |..w-*.i.l.......| +00000000 16 03 03 00 59 02 00 00 55 03 03 ea 73 50 31 e4 |....Y...U...sP1.| +00000010 7a c7 e2 05 23 a0 22 e3 1a cd 6d b5 0f e7 f2 5e |z...#."...m....^| +00000020 d6 cb 6c 70 05 04 a9 63 4a a3 fc 20 a2 c5 68 f2 |..lp...cJ.. ..h.| +00000030 9b 56 6e 83 66 c1 7f 85 02 b6 6d 37 12 0f 12 5a |.Vn.f.....m7...Z| +00000040 41 7e c3 c9 44 85 3c 00 50 6f c7 f9 cc a9 00 00 |A~..D.<.Po......| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| @@ -53,32 +53,32 @@ 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 b7 0c 00 00 b3 03 00 1d 20 fd 29 |*............ .)| -00000280 57 4f 25 0b 83 38 bb da 84 c4 39 52 60 97 83 88 |WO%..8....9R`...| -00000290 31 5e 38 df 9c 24 29 8b 29 d7 90 6d 19 56 04 03 |1^8..$).)..m.V..| -000002a0 00 8b 30 81 88 02 42 01 04 ae 1f e9 dd fe 81 62 |..0...B........b| -000002b0 5b 68 b5 2b dd fb d0 92 18 b4 8d 6b ed 87 0e d2 |[h.+.......k....| -000002c0 ba 3c 83 ca f4 a1 09 87 89 bf 0e 5d 40 04 a5 e3 |.<.........]@...| -000002d0 30 22 19 0d 0c be 64 3d c4 8a b4 22 79 98 91 0e |0"....d=..."y...| -000002e0 7a d6 f8 71 75 7f 5b 30 c5 02 42 01 c0 0b 0a 14 |z..qu.[0..B.....| -000002f0 93 15 f3 b4 36 4f 06 7d 70 42 52 b5 10 66 66 db |....6O.}pBR..ff.| -00000300 55 40 2b b9 4c aa 77 11 b8 27 5c aa eb df df a0 |U@+.L.w..'\.....| -00000310 d3 54 ee 14 54 c9 fc e0 a4 10 01 c7 b2 0c 82 6b |.T..T..........k| -00000320 7d c0 b5 80 4d 04 e7 61 63 f9 1e 78 6b 16 03 03 |}...M..ac..xk...| +00000270 2a 16 03 03 00 b7 0c 00 00 b3 03 00 1d 20 a4 6a |*............ .j| +00000280 0d ab f2 7c 1a 31 2a 7d 51 b7 fe 69 cd 59 f5 c1 |...|.1*}Q..i.Y..| +00000290 10 94 a0 b2 6f 6f c4 48 48 9b 20 1e 46 2a 04 03 |....oo.HH. .F*..| +000002a0 00 8b 30 81 88 02 42 00 84 2a 96 88 a4 7a 86 7f |..0...B..*...z..| +000002b0 cf 86 20 37 17 de 54 0c c2 89 5e 27 f4 3b a4 ec |.. 7..T...^'.;..| +000002c0 ce 25 34 4e c7 a8 7d f5 56 6d 96 2c d0 53 ae 42 |.%4N..}.Vm.,.S.B| +000002d0 b5 87 a9 20 9c 4f c9 67 7e ca f6 fc 2f 61 72 35 |... .O.g~.../ar5| +000002e0 78 fe 54 32 1e a1 90 88 c2 02 42 01 a6 7b 98 de |x.T2......B..{..| +000002f0 fd 01 4b 4a 8f 1a e8 18 dd 07 bb 0b 38 41 7f 22 |..KJ........8A."| +00000300 62 3b 7e 37 67 b7 18 46 a7 32 43 1b c9 a9 8a a6 |b;~7g..F.2C.....| +00000310 d7 8a 2f 7b c5 14 f3 33 96 fe 0a fc 22 d0 a5 02 |../{...3...."...| +00000320 37 a5 31 5f b9 6b d2 3b f6 d0 d1 7b a1 16 03 03 |7.1_.k.;...{....| 00000330 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 20 51 20 c3 d5 2d 48 50 98 1a 00 5c |.... Q ..-HP...\| -00000040 35 83 1d c6 22 8d a3 aa 2b 3a ac bf 68 51 a8 9f |5..."...+:..hQ..| -00000050 23 4b c7 91 df |#K...| +00000030 16 03 03 00 20 f5 a0 28 0a 7e d4 8b a2 b6 e1 af |.... ..(.~......| +00000040 83 e2 50 e8 fc 7e f0 59 21 ed 3d 0d a8 ef a9 b1 |..P..~.Y!.=.....| +00000050 5a 13 2a 1b 2c |Z.*.,| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 20 09 1f 51 48 37 |.......... ..QH7| -00000010 b5 c7 d8 b3 8a 17 48 1d cc b7 32 5d 82 73 ad a2 |......H...2].s..| -00000020 db 4a dc 4a 0d 3b 0b 26 32 56 ee |.J.J.;.&2V.| +00000000 14 03 03 00 01 01 16 03 03 00 20 44 15 68 4d e0 |.......... D.hM.| +00000010 3b 34 c5 77 b2 25 f2 e9 35 75 08 f5 a9 53 c9 65 |;4.w.%..5u...S.e| +00000020 19 36 49 fe 43 e4 f5 48 ac 7c d7 |.6I.C..H.|.| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 de 17 a1 32 d6 09 f3 0d 72 19 eb |........2....r..| -00000010 05 c6 41 f9 0f c6 f7 68 b9 f6 cf 15 03 03 00 12 |..A....h........| -00000020 79 da 43 1b 80 2b d1 46 81 f3 33 78 53 58 79 bc |y.C..+.F..3xSXy.| -00000030 df 51 |.Q| +00000000 17 03 03 00 16 f7 fd 2a 83 90 01 f3 d2 82 dc bd |.......*........| +00000010 6c 33 31 a3 92 0f a4 f5 9c fa f4 15 03 03 00 12 |l31.............| +00000020 9e 60 18 02 f1 0d 2f f5 5f 68 69 ae 62 93 04 6a |.`..../._hi.b..j| +00000030 41 f0 |A.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES index 8feca539d88..eff5b979f97 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 1c 68 c5 b0 f8 |....Y...U...h...| -00000010 30 5e df 4e ef 13 06 3c 38 33 bd 70 40 9c 90 cb |0^.N...<83.p@...| -00000020 80 bc 8e 68 af 8f c4 59 1e fd 0d 20 40 58 a4 e2 |...h...Y... @X..| -00000030 32 5a d7 19 11 6c d3 66 94 94 21 02 ca 42 ef 25 |2Z...l.f..!..B.%| -00000040 ce 51 d8 d3 70 07 4f 70 8d c2 8f 55 c0 13 00 00 |.Q..p.Op...U....| +00000000 16 03 03 00 59 02 00 00 55 03 03 f1 07 97 47 f7 |....Y...U.....G.| +00000010 b8 42 f5 ce 2b b5 ec 5a d3 74 f1 fa 1f ea ec 6d |.B..+..Z.t.....m| +00000020 49 4e cf 2e 47 8b 2e 80 9b 8a ed 20 89 ca 35 4a |IN..G...... ..5J| +00000030 f4 35 5e b7 ed b2 96 ad e1 66 1d 43 9d 07 ba ed |.5^......f.C....| +00000040 ff 9d 47 65 c8 7d 91 32 4b 88 4d 83 c0 13 00 00 |..Ge.}.2K.M.....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,38 +60,38 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 5a a4 2f e5 a1 8d 85 |........ Z./....| -000002d0 b5 4e f8 ac 27 83 77 b5 f5 ec c7 0a 92 39 a3 9e |.N..'.w......9..| -000002e0 31 7f e7 10 8f ac 56 07 74 08 04 00 80 6c 8c 2e |1.....V.t....l..| -000002f0 e8 7c d9 a6 d3 e9 bc 74 20 6a ad 01 80 ca 44 0c |.|.....t j....D.| -00000300 14 5d da 64 bd a3 32 07 03 2c 0a cf 87 56 af 01 |.].d..2..,...V..| -00000310 32 4c 46 df c7 3b 34 56 a6 7a f6 1c 43 fb f0 43 |2LF..;4V.z..C..C| -00000320 54 7c c8 47 0b 02 8e 2d 07 e8 bc 4c b2 9e ea 1d |T|.G...-...L....| -00000330 2b 29 9b e4 5d 5f ee 8a 4a 50 eb ec b7 09 68 e4 |+)..]_..JP....h.| -00000340 c1 99 6a 2d b9 d6 11 b2 9f d9 ee 13 ee 2e b3 d2 |..j-............| -00000350 1e be a0 6a 13 86 f0 53 7f aa 60 8e 87 5f ab 5d |...j...S..`.._.]| -00000360 f1 5a a4 1f 0b 85 b1 31 5f 2f af e9 7a 16 03 03 |.Z.....1_/..z...| +000002c0 ac 0c 00 00 a8 03 00 1d 20 78 22 92 20 a9 be 78 |........ x". ..x| +000002d0 12 0f e6 83 13 3d 13 91 16 11 ca 26 9f b7 37 d5 |.....=.....&..7.| +000002e0 f0 97 f9 f2 01 fd 08 4f 42 08 04 00 80 2c f1 4e |.......OB....,.N| +000002f0 79 63 f2 d9 54 1c 0c 56 fd 56 4d e0 37 ee 5d bb |yc..T..V.VM.7.].| +00000300 22 90 fd ee d9 0f e6 d9 85 41 b9 8d d6 76 5f 05 |"........A...v_.| +00000310 1b 8c d7 4e c5 e8 4e 69 b9 5d de 73 c0 ed 4f 3e |...N..Ni.].s..O>| +00000320 09 9d b0 10 d6 61 87 d8 f9 c2 5b 48 f9 ef dd 65 |.....a....[H...e| +00000330 e6 f8 b0 d2 71 f6 e9 ae b1 c0 ea 90 dc 33 c6 72 |....q........3.r| +00000340 3e 9f 31 d4 ae 78 23 54 7a 4f 02 69 72 c1 06 2f |>.1..x#TzO.ir../| +00000350 3f 3c 7b f2 d8 17 40 a6 95 6d 46 62 6b 54 f1 cf |?<{...@..mFbkT..| +00000360 60 08 63 89 f7 a5 2a 52 3b 0e 0c d6 34 16 03 03 |`.c...*R;...4...| 00000370 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| 00000030 16 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| -00000040 00 00 00 00 00 d8 4d 17 e4 39 b7 4e 96 d1 1f 75 |......M..9.N...u| -00000050 db 2c 1d df b9 72 c0 c8 5c b3 22 75 98 81 82 67 |.,...r..\."u...g| -00000060 26 2c 45 d3 f0 34 0f 21 0a dd 6b 99 f8 82 70 3c |&,E..4.!..k...p<| -00000070 f3 7d 6a 15 91 |.}j..| +00000040 00 00 00 00 00 96 55 d3 bd a1 b6 de 93 68 19 ed |......U......h..| +00000050 4a 3a cc 42 7c c4 41 1e b5 37 65 d5 84 10 60 3d |J:.B|.A..7e...`=| +00000060 e9 57 29 28 79 54 da 6c 1b 36 6b b1 75 f4 bb 32 |.W)(yT.l.6k.u..2| +00000070 47 8d de c8 7d |G...}| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 27 83 f0 1d 2e |..........@'....| -00000010 f9 99 0e 36 76 7f 1e 8f 67 5d a8 26 27 c7 ad a1 |...6v...g].&'...| -00000020 9f 51 ab d8 2e c8 1c 62 a3 01 b6 f3 6a 95 69 5f |.Q.....b....j.i_| -00000030 5b 09 eb d1 e6 19 76 72 4a 67 26 01 78 89 ac 77 |[.....vrJg&.x..w| -00000040 e3 5c 7d 5b 17 79 a7 e4 19 bc 1a |.\}[.y.....| +00000000 14 03 03 00 01 01 16 03 03 00 40 db ed ec 54 4a |..........@...TJ| +00000010 20 d8 a7 ee 12 04 e2 e4 95 b4 a4 a7 e1 80 c8 40 | ..............@| +00000020 81 00 6d 3e 58 26 7c d4 26 84 86 ee b4 fc c5 50 |..m>X&|.&......P| +00000030 46 31 e7 4c 1e fd ed 10 7e 72 45 18 43 db 4c 0d |F1.L....~rE.C.L.| +00000040 b5 49 6c 31 04 f0 85 a7 f8 02 e1 |.Il1.......| >>> Flow 5 (client to server) 00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 24 63 76 ce f0 2a 88 0f 9b 51 b7 |.....$cv..*...Q.| -00000020 15 86 74 ac c9 72 88 7a 26 34 ff c5 ec bb a8 6d |..t..r.z&4.....m| -00000030 44 97 00 3f ff 15 03 03 00 30 00 00 00 00 00 00 |D..?.....0......| -00000040 00 00 00 00 00 00 00 00 00 00 f4 9d 5b 90 05 e6 |............[...| -00000050 42 af 3c 4c 86 d8 ba d5 b7 88 8e ec 8c 07 24 5e |B.>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 9a 06 bc 4a 08 |....Y...U.....J.| -00000010 7c e9 b0 32 64 21 d8 bc 41 77 d0 9f a2 0e 9a d4 ||..2d!..Aw......| -00000020 a8 ef ec 18 b7 8b a9 20 27 0a 85 20 46 c0 6b 77 |....... '.. F.kw| -00000030 56 12 53 90 e4 36 72 c4 cb b8 eb 79 6c ed e8 53 |V.S..6r....yl..S| -00000040 c4 36 48 89 fc 3f ff 07 99 47 2d 9e c0 27 00 00 |.6H..?...G-..'..| +00000000 16 03 03 00 59 02 00 00 55 03 03 9e d4 c1 3e c6 |....Y...U.....>.| +00000010 3d 44 eb a7 b8 c5 c8 e0 ab 16 06 83 67 5e b2 d6 |=D..........g^..| +00000020 67 50 4b f3 24 17 97 19 76 7e 71 20 5a 2b dc 15 |gPK.$...v~q Z+..| +00000030 87 37 be bb c7 9c 38 cd 3e 55 4e 33 32 a0 01 1b |.7....8.>UN32...| +00000040 79 13 87 6a 19 09 42 4c fb 59 97 a8 c0 27 00 00 |y..j..BL.Y...'..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,42 +60,42 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 9e a1 5f 87 14 ff b2 |........ .._....| -000002d0 0c b8 82 0d 24 d8 bb 98 6d 3a ca 09 0b 6d 94 98 |....$...m:...m..| -000002e0 16 20 ed 31 0e 54 23 d5 47 08 04 00 80 4a e0 aa |. .1.T#.G....J..| -000002f0 d0 e9 cb 75 f0 c0 6e 2d 74 8f c9 91 d9 32 98 22 |...u..n-t....2."| -00000300 99 ef 91 77 41 80 c6 83 11 9a ed 55 61 fd b7 58 |...wA......Ua..X| -00000310 70 7a a6 ce e1 28 40 7d 94 8a 96 64 7f f1 b4 97 |pz...(@}...d....| -00000320 db 83 2c 77 55 f4 38 c6 4b 9a 77 74 9d 6b ae 06 |..,wU.8.K.wt.k..| -00000330 b6 f0 07 61 7a e1 dc d9 e3 c4 32 5c c5 91 23 8d |...az.....2\..#.| -00000340 a3 53 db 37 4d ee e4 65 ef 58 42 af 63 72 06 5c |.S.7M..e.XB.cr.\| -00000350 4e aa f5 07 4c bc b3 1a 00 82 9f 72 34 64 52 e7 |N...L......r4dR.| -00000360 1f 85 7a c3 36 3f 8d 4e 53 89 7b c2 d3 16 03 03 |..z.6?.NS.{.....| +000002c0 ac 0c 00 00 a8 03 00 1d 20 57 62 97 e9 c8 c6 17 |........ Wb.....| +000002d0 73 d2 9e 31 a6 f8 be 03 65 86 af 6b e2 64 bf 7c |s..1....e..k.d.|| +000002e0 4a f1 b9 fb 84 21 10 76 66 08 04 00 80 2d 08 24 |J....!.vf....-.$| +000002f0 06 2a a3 c5 28 c4 22 5b fe 79 4f 91 56 9e 40 6f |.*..(."[.yO.V.@o| +00000300 e6 0c e8 70 e0 35 9e 55 91 51 86 ec ad ff 6b 3f |...p.5.U.Q....k?| +00000310 a7 19 fa 6f 74 47 8a 86 04 b5 8a f0 0a d5 e5 5f |...otG........._| +00000320 ea 30 cc 79 77 3d ac 99 da 41 7f 25 3b da cd da |.0.yw=...A.%;...| +00000330 aa 4e 2a 54 b5 d3 13 4f e4 e9 cb 76 86 fb 0b b5 |.N*T...O...v....| +00000340 0d a3 be ab d2 e6 6e f6 77 7c 60 a7 50 56 43 60 |......n.w|`.PVC`| +00000350 95 ba 95 c4 b5 1a 8d 6a f7 a5 9f 03 27 93 9f 23 |.......j....'..#| +00000360 44 27 88 f0 d5 51 0f ba 43 84 5c 02 14 16 03 03 |D'...Q..C.\.....| 00000370 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| 00000030 16 03 03 00 50 00 00 00 00 00 00 00 00 00 00 00 |....P...........| -00000040 00 00 00 00 00 ec b0 fe b3 cf eb b0 61 c3 77 f0 |............a.w.| -00000050 ad 63 39 5f 7b 17 0e d7 07 7f cb ea 65 0c b0 8b |.c9_{.......e...| -00000060 45 ab 39 c4 d9 06 c7 3b 2e 98 a2 1f c7 e8 e7 e2 |E.9....;........| -00000070 56 a9 6a b3 75 5e c9 27 66 16 af 0e e4 b4 3d 80 |V.j.u^.'f.....=.| -00000080 8b 1c fd ff 34 |....4| +00000040 00 00 00 00 00 02 19 fd 3e 06 0d 12 0d 03 42 da |........>.....B.| +00000050 76 6f e2 e3 96 eb 42 d9 96 b7 0b ae d6 a0 06 fa |vo....B.........| +00000060 57 4e ff 62 85 dd 3f ab 63 f9 73 87 8d 71 6a c6 |WN.b..?.c.s..qj.| +00000070 f4 ef ce f5 55 5b d2 1f b5 33 fd 12 32 bd 5e 1e |....U[...3..2.^.| +00000080 d5 32 91 9a ae |.2...| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 50 8b 01 85 06 02 |..........P.....| -00000010 9c 71 ac 29 4c 4c 54 28 26 f7 1b d0 81 17 2c 95 |.q.)LLT(&.....,.| -00000020 01 73 45 fe f3 1e bd 43 56 83 50 84 ad 13 9c 3f |.sE....CV.P....?| -00000030 2e bc 2b 25 67 ce 76 cc e7 4d cc bb 8f 2e 09 3b |..+%g.v..M.....;| -00000040 48 3b 9c c5 fd 17 73 01 18 41 02 46 c1 9c fe 8f |H;....s..A.F....| -00000050 76 a4 6b 1d 6d 2c 6d c1 73 55 fd |v.k.m,m.sU.| +00000000 14 03 03 00 01 01 16 03 03 00 50 77 80 95 42 a3 |..........Pw..B.| +00000010 2b 1c 16 0f 3b f4 78 2a bd ab 6e d1 33 1e 0e a5 |+...;.x*..n.3...| +00000020 c7 f4 e9 92 82 00 da 44 0f b6 4e f9 1f ef 67 3b |.......D..N...g;| +00000030 de 5c dc 93 07 68 99 1a 70 7f 92 a7 d7 da f3 60 |.\...h..p......`| +00000040 cf d5 f1 f0 5e 75 68 a1 0b 32 eb d2 96 de e6 34 |....^uh..2.....4| +00000050 c3 e3 26 43 1f a2 8d e7 1b fc 76 |..&C......v| >>> Flow 5 (client to server) 00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| -00000010 00 00 00 00 00 ed 8d fb 10 4e 11 3f 61 35 bd 9c |.........N.?a5..| -00000020 40 16 78 f2 06 68 65 d0 06 85 8e 31 f7 8e d6 b0 |@.x..he....1....| -00000030 a4 bb e6 03 f6 2d 36 12 4e b7 96 4b 42 b2 22 9d |.....-6.N..KB.".| -00000040 93 92 10 8b 0a 15 03 03 00 40 00 00 00 00 00 00 |.........@......| -00000050 00 00 00 00 00 00 00 00 00 00 4c 59 01 7a 1e 64 |..........LY.z.d| -00000060 c9 2a d4 a6 d6 e1 64 a2 e9 7d c0 29 32 53 68 e7 |.*....d..}.)2Sh.| -00000070 a0 66 68 87 70 b5 c3 38 cc ac 18 8b bd 3a 50 85 |.fh.p..8.....:P.| -00000080 d9 9a ca 67 c7 13 5c 74 76 68 |...g..\tvh| +00000010 00 00 00 00 00 f8 35 11 b8 23 cf d9 ec a7 d3 b9 |......5..#......| +00000020 60 1e 34 01 20 49 73 ec 72 78 58 24 3b fc a8 42 |`.4. Is.rxX$;..B| +00000030 b2 a9 69 69 40 65 5a c2 8b 9f 0b 0e 70 ab ac 22 |..ii@eZ.....p.."| +00000040 1a ac d6 04 06 15 03 03 00 40 00 00 00 00 00 00 |.........@......| +00000050 00 00 00 00 00 00 00 00 00 00 fe ed 19 a0 84 06 |................| +00000060 8b f0 e8 4e 30 7a 3c 89 a0 a8 59 74 a5 92 73 f3 |...N0z<...Yt..s.| +00000070 df 1b f0 c6 5a 95 d5 1c b6 57 4a 1b 8f 24 59 87 |....Z....WJ..$Y.| +00000080 b4 2b 7f 6f 89 03 e8 6d e5 d9 |.+.o...m..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-CHACHA20-POLY1305 b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-CHACHA20-POLY1305 index 7a015de464e..38fb4a0be7c 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-CHACHA20-POLY1305 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-CHACHA20-POLY1305 @@ -1,24 +1,24 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 ce 01 00 00 ca 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 d0 01 00 00 cc 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 08 cc a8 |................| -00000050 13 01 13 03 13 02 01 00 00 79 00 05 00 05 01 00 |.........y......| +00000050 13 01 13 03 13 02 01 00 00 7b 00 05 00 05 01 00 |.........{......| 00000060 00 00 00 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 |................| -00000070 19 00 0b 00 02 01 00 00 0d 00 18 00 16 08 04 08 |................| -00000080 05 08 06 04 01 04 03 05 01 05 03 06 01 06 03 02 |................| -00000090 01 02 03 ff 01 00 01 00 00 12 00 00 00 2b 00 09 |.............+..| -000000a0 08 03 04 03 03 03 02 03 01 00 33 00 26 00 24 00 |..........3.&.$.| -000000b0 1d 00 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f |.. /.}.G.bC.(.._| -000000c0 bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 |.).0.........._X| -000000d0 cb 3b 74 |.;t| +00000070 19 00 0b 00 02 01 00 00 0d 00 1a 00 18 08 04 04 |................| +00000080 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 06 |................| +00000090 03 02 01 02 03 ff 01 00 01 00 00 12 00 00 00 2b |...............+| +000000a0 00 09 08 03 04 03 03 03 02 03 01 00 33 00 26 00 |............3.&.| +000000b0 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 28 da |$... /.}.G.bC.(.| +000000c0 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........| +000000d0 5f 58 cb 3b 74 |_X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 94 bf 96 6e 08 |....Y...U.....n.| -00000010 c5 59 6f b5 bc 22 4b 73 4a ba 5f f4 ea 2b 77 1d |.Yo.."KsJ._..+w.| -00000020 f4 6d 45 46 51 3d 0b 60 d8 6b 4e 20 00 4b 00 f8 |.mEFQ=.`.kN .K..| -00000030 a2 81 c9 1c 44 4f 90 73 ea c7 88 70 d9 56 d9 27 |....DO.s...p.V.'| -00000040 c5 0e e2 42 f0 bb 33 73 08 f1 12 ed cc a8 00 00 |...B..3s........| +00000000 16 03 03 00 59 02 00 00 55 03 03 4e fb dc 04 6f |....Y...U..N...o| +00000010 5a 52 37 a3 55 58 26 e5 cd a0 67 4c 0f 87 1a 3a |ZR7.UX&...gL...:| +00000020 f6 84 33 2f 2e 52 d0 48 7c 5b 64 20 6e d0 bc ca |..3/.R.H|[d n...| +00000030 c9 a5 87 8d 99 c5 ec 85 84 89 f0 22 ab 63 55 f4 |...........".cU.| +00000040 70 d7 02 93 b5 fe d7 38 fb c1 b2 da cc a8 00 00 |p......8........| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -58,31 +58,31 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 cd 60 09 2c c1 3b d6 |........ .`.,.;.| -000002d0 3b d1 c2 3c 9f 30 81 bb 6b 47 a3 cd 26 48 f4 41 |;..<.0..kG..&H.A| -000002e0 c0 d4 36 57 05 33 93 f8 75 08 04 00 80 9a 67 4b |..6W.3..u.....gK| -000002f0 36 41 f9 c1 5c 80 67 9d 0d bc 64 f1 0d 08 e1 9f |6A..\.g...d.....| -00000300 85 88 44 e3 bc c9 b7 f4 86 ec 5c 79 e6 2c ac 07 |..D.......\y.,..| -00000310 e9 cd 6a 7e 68 41 67 71 34 cb c5 13 7c ec 1a 73 |..j~hAgq4...|..s| -00000320 f8 30 da 08 d0 14 c6 4b e4 11 ac c6 34 f9 2f ca |.0.....K....4./.| -00000330 b4 81 35 76 17 9e 7b 4c f3 f7 ac 6d d3 d8 f7 7c |..5v..{L...m...|| -00000340 70 b8 36 fa cc 85 fb 15 8e 82 c6 50 0e 90 c0 39 |p.6........P...9| -00000350 13 d9 02 b1 ae 17 ea 63 c4 e8 21 c2 c0 eb 5c 63 |.......c..!...\c| -00000360 e4 43 c5 1e ae 01 ee 64 23 42 b2 2a 52 16 03 03 |.C.....d#B.*R...| +000002c0 ac 0c 00 00 a8 03 00 1d 20 fc 4b 92 ab d2 cb 4f |........ .K....O| +000002d0 61 aa 86 12 1a 1d 75 be 31 dd b8 ee 6c a6 db bd |a.....u.1...l...| +000002e0 0b ea b2 d5 27 49 42 eb 5a 08 04 00 80 02 ad 71 |....'IB.Z......q| +000002f0 e2 e8 f6 44 3c a6 18 6f 76 ee 9a eb 0e d9 ff cb |...D<..ov.......| +00000300 6d 1e 64 dd 29 1d 8c c8 f6 14 40 c0 12 46 74 4c |m.d.).....@..FtL| +00000310 41 2d 71 5f 9c b7 86 0b fc 66 1e 14 cb 26 d0 d7 |A-q_.....f...&..| +00000320 21 b4 bd c2 04 38 77 90 6a f0 01 18 bd 1c 17 45 |!....8w.j......E| +00000330 7e 38 46 4c 2e 97 ba 11 01 1f 20 cc df f2 6b 5b |~8FL...... ...k[| +00000340 a7 29 c0 52 52 9c 2f 23 bd 1c 72 c2 f2 99 d1 dc |.).RR./#..r.....| +00000350 6a 6c ac 8e 87 8a 00 74 47 2e 99 8d 3f 79 04 60 |jl.....tG...?y.`| +00000360 5e dc ba 86 1c f4 f9 03 22 38 96 a7 b3 16 03 03 |^......."8......| 00000370 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 20 8f 97 a6 c4 c1 81 4e 87 8c 17 3a |.... ......N...:| -00000040 6b 85 ad 17 6c 5c 14 b6 84 6b 7e a8 c1 ed 2e 6b |k...l\...k~....k| -00000050 fc e8 8f 8b 84 |.....| +00000030 16 03 03 00 20 0a 17 ee 70 8c 50 24 7c 00 b9 6f |.... ...p.P$|..o| +00000040 82 71 ed 2b 8c 0b 4b ff bb 38 bc 12 7e 0c a5 3e |.q.+..K..8..~..>| +00000050 71 a2 ad f8 52 |q...R| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 20 51 59 b7 f0 cf |.......... QY...| -00000010 07 d4 9a 45 15 b6 2f dd 03 5e 46 f9 c8 87 dc 99 |...E../..^F.....| -00000020 d2 56 cd 95 f9 3e 2e 42 19 2e e3 |.V...>.B...| +00000000 14 03 03 00 01 01 16 03 03 00 20 e9 87 55 12 a8 |.......... ..U..| +00000010 ad 68 42 0c 60 12 be 2f 2c e5 00 2d 01 cf 86 a2 |.hB.`../,..-....| +00000020 1b 06 b3 86 bf 88 48 73 7a d3 cc |......Hsz..| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 6d 16 3b 26 a8 60 d8 2c 9f 08 42 |.....m.;&.`.,..B| -00000010 51 bb 2a 58 c3 3b 42 cb 59 46 02 15 03 03 00 12 |Q.*X.;B.YF......| -00000020 1e c6 5e 68 40 58 9c df 5e 11 a3 c2 1e 50 11 d4 |..^h@X..^....P..| -00000030 ff 17 |..| +00000000 17 03 03 00 16 96 75 4c c6 ba b1 ad ae 2f 44 9d |......uL...../D.| +00000010 10 c3 ef e5 dc fb 0a 3e af 6b 6a 15 03 03 00 12 |.......>.kj.....| +00000020 30 13 8f e5 a1 0f 38 67 b9 53 4e 6a 66 ec ee 45 |0.....8g.SNjf..E| +00000030 c2 b2 |..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-Ed25519 b/libgo/go/crypto/tls/testdata/Client-TLSv12-Ed25519 new file mode 100644 index 00000000000..35513adb842 --- /dev/null +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-Ed25519 @@ -0,0 +1,68 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| +00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| +00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| +00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| +00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 59 02 00 00 55 03 03 66 49 2a a6 a4 |....Y...U..fI*..| +00000010 75 60 58 bb 5f 5e 82 cd e5 c0 9f 6d a4 fd 39 3b |u`X._^.....m..9;| +00000020 d9 17 80 14 89 ea 51 c1 b0 43 d6 20 b2 6b 72 81 |......Q..C. .kr.| +00000030 f6 63 20 22 e2 b6 d2 61 aa 87 b6 67 ae 56 78 44 |.c "...a...g.VxD| +00000040 5d 10 8c cf ea 32 cf 9e 92 e5 59 70 cc a9 00 00 |]....2....Yp....| +00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| +00000060 03 01 3c 0b 00 01 38 00 01 35 00 01 32 30 82 01 |..<...8..5..20..| +00000070 2e 30 81 e1 a0 03 02 01 02 02 10 0f 43 1c 42 57 |.0..........C.BW| +00000080 93 94 1d e9 87 e4 f1 ad 15 00 5d 30 05 06 03 2b |..........]0...+| +00000090 65 70 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 |ep0.1.0...U....A| +000000a0 63 6d 65 20 43 6f 30 1e 17 0d 31 39 30 35 31 36 |cme Co0...190516| +000000b0 32 31 33 38 30 31 5a 17 0d 32 30 30 35 31 35 32 |213801Z..2005152| +000000c0 31 33 38 30 31 5a 30 12 31 10 30 0e 06 03 55 04 |13801Z0.1.0...U.| +000000d0 0a 13 07 41 63 6d 65 20 43 6f 30 2a 30 05 06 03 |...Acme Co0*0...| +000000e0 2b 65 70 03 21 00 3f e2 15 2e e6 e3 ef 3f 4e 85 |+ep.!.?......?N.| +000000f0 4a 75 77 a3 64 9e ed e0 bf 84 2c cc 92 26 8f fa |Juw.d.....,..&..| +00000100 6f 34 83 aa ec 8f a3 4d 30 4b 30 0e 06 03 55 1d |o4.....M0K0...U.| +00000110 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 1d |..........0...U.| +00000120 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 30 |%..0...+.......0| +00000130 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 16 06 |...U.......0.0..| +00000140 03 55 1d 11 04 0f 30 0d 82 0b 65 78 61 6d 70 6c |.U....0...exampl| +00000150 65 2e 63 6f 6d 30 05 06 03 2b 65 70 03 41 00 63 |e.com0...+ep.A.c| +00000160 44 ed 9c c4 be 53 24 53 9f d2 10 8d 9f e8 21 08 |D....S$S......!.| +00000170 90 95 39 e5 0d c1 55 ff 2c 16 b7 1d fc ab 7d 4d |..9...U.,.....}M| +00000180 d4 e0 93 13 d0 a9 42 e0 b6 6b fe 5d 67 48 d7 9f |......B..k.]gH..| +00000190 50 bc 6c cd 4b 03 83 7c f2 08 58 cd ac cf 0c 16 |P.l.K..|..X.....| +000001a0 03 03 00 6c 0c 00 00 68 03 00 1d 20 c4 8c b8 a2 |...l...h... ....| +000001b0 32 92 b8 22 1f 4c f1 96 00 64 35 47 4e f8 3d 08 |2..".L...d5GN.=.| +000001c0 83 12 fe 95 a8 e4 8e c9 30 27 5c 39 08 07 00 40 |........0'\9...@| +000001d0 7f 90 cf e0 87 69 e3 50 e6 fa 5e 28 a1 0f 79 0a |.....i.P..^(..y.| +000001e0 6e cf f4 87 e8 2f 55 b2 dd cb 5e 8f 9a 14 bd c2 |n..../U...^.....| +000001f0 2b 2b 2d ed 72 40 23 5d 6d f4 89 3a ff 09 82 ec |++-.r@#]m..:....| +00000200 b6 4b 27 9a 08 ea e9 73 94 b4 31 1f e1 39 86 0e |.K'....s..1..9..| +00000210 16 03 03 00 04 0e 00 00 00 |.........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 8f 97 36 bd 59 ef 8e 2f 11 28 b0 |.... ..6.Y../.(.| +00000040 d7 20 79 bf 04 07 45 f9 89 de b0 c7 55 1a ad 80 |. y...E.....U...| +00000050 0f 8c ef 1d c6 |.....| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 47 6c 1f 86 47 |.......... Gl..G| +00000010 72 03 94 e0 43 f8 e5 ca 03 7d f5 d5 dd 70 05 f5 |r...C....}...p..| +00000020 98 5d 51 b4 11 49 71 7a fd 37 9a |.]Q..Iqz.7.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 b7 a2 f5 8e 7c d3 7d 61 af 29 1c |.........|.}a.).| +00000010 77 0c 8d b4 5b d3 be 77 a6 a5 99 15 03 03 00 12 |w...[..w........| +00000020 d8 23 dc a8 99 fe 1c 6e f2 2f 41 8e df 40 11 4f |.#.....n./A..@.O| +00000030 6b 92 |k.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-ExportKeyingMaterial b/libgo/go/crypto/tls/testdata/Client-TLSv12-ExportKeyingMaterial index 1a97ddacf15..c900aa6d5e1 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-ExportKeyingMaterial +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-ExportKeyingMaterial @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 de e9 5f 9c 20 |....Y...U...._. | -00000010 c7 37 0d ba e1 2c 21 ad 4b 8a 10 fe 66 4c c2 88 |.7...,!.K...fL..| -00000020 87 fa 43 aa 42 ce e4 ca d8 c2 2d 20 9c cc ef b1 |..C.B.....- ....| -00000030 48 e2 9a e8 5a 61 16 6a 64 dd e9 6e d1 13 06 44 |H...Za.jd..n...D| -00000040 c2 f6 9f e7 68 d3 cc 82 67 54 a0 66 cc a8 00 00 |....h...gT.f....| +00000000 16 03 03 00 59 02 00 00 55 03 03 7c c1 7b 30 03 |....Y...U..|.{0.| +00000010 3c d7 63 5f 47 1c b1 13 56 56 b4 fd 55 e2 27 3e |<.c_G...VV..U.'>| +00000020 39 bb ce 9b 5b 2c 1e 17 33 e1 da 20 65 8b 26 42 |9...[,..3.. e.&B| +00000030 a4 38 29 c7 9a 25 13 fc 1d 69 cb 10 63 c6 26 fc |.8)..%...i..c.&.| +00000040 f4 46 64 31 28 06 b3 a5 a4 c2 f6 5a cc a8 00 00 |.Fd1(......Z....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,31 +60,31 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 30 ef c9 70 70 23 9c |........ 0..pp#.| -000002d0 b6 1c 35 b7 86 6c 9f 82 62 df e3 6e 47 6d 03 61 |..5..l..b..nGm.a| -000002e0 e6 98 5b ca 86 b9 58 e4 18 08 04 00 80 30 82 41 |..[...X......0.A| -000002f0 64 c8 03 a9 25 d8 b9 2f 9e a1 8d 6e 5b 1c b6 da |d...%../...n[...| -00000300 eb c0 63 2b 72 08 2b 50 2a 2e 4b 91 c1 9f fc df |..c+r.+P*.K.....| -00000310 87 6e 07 6c c5 38 24 02 b4 e8 c5 11 32 17 48 49 |.n.l.8$.....2.HI| -00000320 ce d3 3d d8 58 e6 be 1a fb c1 f2 2a 03 54 8f ae |..=.X......*.T..| -00000330 2a f7 84 2a 65 c3 b7 cd 80 64 b1 8c a8 25 ce 1c |*..*e....d...%..| -00000340 73 eb ae 42 7d 9c 87 72 fe f9 cf bd e1 36 ca bd |s..B}..r.....6..| -00000350 69 78 13 9f c8 16 03 9c 0a 02 1e f3 70 6b ed 38 |ix..........pk.8| -00000360 d8 a5 b6 8a 7e 33 7b 62 44 8b 5e 99 ef 16 03 03 |....~3{bD.^.....| +000002c0 ac 0c 00 00 a8 03 00 1d 20 f7 a2 97 2f 50 e4 e2 |........ .../P..| +000002d0 fa ef 80 67 78 1c aa 6c 03 aa 05 3b 6f 98 97 11 |...gx..l...;o...| +000002e0 7e 55 3d 50 f3 a9 9b 21 65 08 04 00 80 34 4a 4b |~U=P...!e....4JK| +000002f0 4b 6e 86 01 1b 6b 8e 3e 84 01 75 b8 05 c3 b2 52 |Kn...k.>..u....R| +00000300 16 ee ac 61 83 dd 09 32 d5 55 6a 5d d6 6b 4a 1a |...a...2.Uj].kJ.| +00000310 2b f7 09 33 6f 3d 4f c1 e3 aa 03 27 fe af cd 6d |+..3o=O....'...m| +00000320 b8 76 00 02 42 98 e6 f6 b7 ed fb 35 35 29 23 b1 |.v..B......55)#.| +00000330 4d 48 0a ba a1 1b e3 8e a2 cb 80 11 ec 92 20 df |MH............ .| +00000340 1f a4 5e 5d 70 85 8e 5d 85 62 81 1f b3 3a 0d 8d |..^]p..].b...:..| +00000350 9a 07 d3 99 a5 3c 6c c2 52 08 f0 be 50 ed d2 4d |.....>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 20 04 8f 3f 72 37 39 12 c4 21 b2 45 |.... ..?r79..!.E| -00000040 5d 90 b9 fa d2 24 70 5f 86 d4 8b 24 e6 af 6e 9f |]....$p_...$..n.| -00000050 71 41 17 a8 54 |qA..T| +00000030 16 03 03 00 20 30 8b ea ef 6c 35 97 5b 26 5f ef |.... 0...l5.[&_.| +00000040 bc 28 fd e9 23 73 bb b3 ae 41 0c be 5f 83 a5 f7 |.(..#s...A.._...| +00000050 96 07 8d 81 67 |....g| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 20 b0 70 aa d3 44 |.......... .p..D| -00000010 df ef 57 0f bb 69 b3 09 70 1a ad b0 33 e5 97 8e |..W..i..p...3...| -00000020 bc 34 7f aa 27 a2 81 a3 08 7e b1 |.4..'....~.| +00000000 14 03 03 00 01 01 16 03 03 00 20 29 fa a8 de f2 |.......... )....| +00000010 8f 94 16 fc be 84 93 e9 34 98 c2 44 08 9b 2e 37 |........4..D...7| +00000020 1f 41 61 53 fa 9c 23 ff d8 6d c3 |.AaS..#..m.| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 52 71 2d 1a 29 2c 84 b7 58 d2 b0 |.....Rq-.),..X..| -00000010 92 c3 64 7f 29 3a da d8 c4 7b 73 15 03 03 00 12 |..d.):...{s.....| -00000020 63 04 d5 2b 6c fc 35 82 bb ba ba 9b 01 a0 0c ac |c..+l.5.........| -00000030 2c 12 |,.| +00000000 17 03 03 00 16 ab 6d 32 1c 16 cc 29 b1 21 4c b1 |......m2...).!L.| +00000010 74 4c 50 e3 1f c5 f1 05 6a 8a 92 15 03 03 00 12 |tLP.....j.......| +00000020 18 88 3d 23 81 d7 ba c5 1e 9a c4 3a 1b c8 cd 5b |..=#.......:...[| +00000030 c5 fa |..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-P256-ECDHE b/libgo/go/crypto/tls/testdata/Client-TLSv12-P256-ECDHE index 819a061fb4f..d75b670e1d5 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-P256-ECDHE +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-P256-ECDHE @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 01 13 01 00 01 0f 03 03 00 00 00 00 00 |................| +00000000 16 03 01 01 15 01 00 01 11 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,22 +7,22 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 94 00 05 00 05 01 00 00 00 00 00 0a 00 |................| -00000090 04 00 02 00 17 00 0b 00 02 01 00 00 0d 00 18 00 |................| -000000a0 16 08 04 08 05 08 06 04 01 04 03 05 01 05 03 06 |................| -000000b0 01 06 03 02 01 02 03 ff 01 00 01 00 00 12 00 00 |................| -000000c0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| -000000d0 47 00 45 00 17 00 41 04 1e 18 37 ef 0d 19 51 88 |G.E...A...7...Q.| -000000e0 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 24 20 |5uq..T[....g..$ | -000000f0 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 07 9f |>.V...(^.+-O....| -00000100 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 b5 68 |lK[.V.2B.X..I..h| -00000110 1a 41 03 56 6b dc 5a 89 |.A.Vk.Z.| +00000080 01 00 00 96 00 05 00 05 01 00 00 00 00 00 0a 00 |................| +00000090 04 00 02 00 17 00 0b 00 02 01 00 00 0d 00 1a 00 |................| +000000a0 18 08 04 04 03 08 07 08 05 08 06 04 01 05 01 06 |................| +000000b0 01 05 03 06 03 02 01 02 03 ff 01 00 01 00 00 12 |................| +000000c0 00 00 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 |...+............| +000000d0 33 00 47 00 45 00 17 00 41 04 1e 18 37 ef 0d 19 |3.G.E...A...7...| +000000e0 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 |Q.5uq..T[....g..| +000000f0 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 |$ >.V...(^.+-O..| +00000100 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 |..lK[.V.2B.X..I.| +00000110 b5 68 1a 41 03 56 6b dc 5a 89 |.h.A.Vk.Z.| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 39 5a 55 c9 46 |....Y...U..9ZU.F| -00000010 87 68 62 04 99 88 9e 60 93 a3 79 c3 d6 e0 30 9f |.hb....`..y...0.| -00000020 e5 2b 70 df 81 1f 33 53 f5 89 91 20 ce 7b aa 43 |.+p...3S... .{.C| -00000030 a2 83 d7 6d 3f b9 86 38 1d 52 da 75 82 2b c6 05 |...m?..8.R.u.+..| -00000040 6f a4 e2 15 27 21 18 36 0d 04 ba 42 c0 2f 00 00 |o...'!.6...B./..| +00000000 16 03 03 00 59 02 00 00 55 03 03 b8 7d f5 69 c3 |....Y...U...}.i.| +00000010 6a ca 8b df f3 30 2c 39 47 2e 74 2e 4f 89 4c 1e |j....0,9G.t.O.L.| +00000020 f0 eb 10 0e 06 1d 2c 4e de 2e 8f 20 6c a0 5b 66 |......,N... l.[f| +00000030 fc a6 05 df 29 6b ce 72 92 e7 d7 78 f5 46 38 f9 |....)k.r...x.F8.| +00000040 91 1c 9a 08 4c b1 9a 41 e5 0c d2 cd c0 2f 00 00 |....L..A...../..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -62,19 +62,19 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 cd 0c 00 00 c9 03 00 17 41 04 76 c4 5d a9 b6 96 |........A.v.]...| -000002d0 aa 4c e2 26 30 ce 69 90 11 42 fe a4 56 4d 4b 1c |.L.&0.i..B..VMK.| -000002e0 5e 1f e1 23 10 c7 8b 52 5a 04 1f 32 85 98 6b d8 |^..#...RZ..2..k.| -000002f0 97 3a 7b 90 79 94 de f4 85 c8 c5 2a 05 b9 6d 79 |.:{.y......*..my| -00000300 6f fb f8 1e b8 ab b8 e9 c3 91 08 04 00 80 b9 00 |o...............| -00000310 a1 01 7d c7 fd 3e bc ba 44 42 64 68 21 7b b7 98 |..}..>..DBdh!{..| -00000320 c1 9f 17 a6 a1 a3 7f 9e 63 d7 ee b7 53 d4 7c 48 |........c...S.|H| -00000330 89 6e 20 0d 29 a1 b4 56 2c 83 7e d7 ab 3a 28 65 |.n .)..V,.~..:(e| -00000340 03 a1 be 6b 0d 89 39 c4 c9 fc fd 41 f0 bd c2 cb |...k..9....A....| -00000350 40 d5 54 2e 98 0a b1 a0 86 65 cc 6a e9 5f 47 51 |@.T......e.j._GQ| -00000360 a4 b4 40 47 25 ae df 93 c2 b6 eb fe b6 71 fe 04 |..@G%........q..| -00000370 1e 98 d0 91 8b c7 ea 58 91 23 a7 76 67 ba 7a fd |.......X.#.vg.z.| -00000380 49 f0 c2 70 70 50 06 23 5e 31 90 4e 58 98 16 03 |I..ppP.#^1.NX...| +000002c0 cd 0c 00 00 c9 03 00 17 41 04 3e 87 67 8b 87 08 |........A.>.g...| +000002d0 fe 4e 4c c3 6b 42 4b 97 ad f4 1c 83 35 72 db 4f |.NL.kBK.....5r.O| +000002e0 39 83 ea 14 69 bb 8c 87 58 c5 a4 a8 8c d7 9d af |9...i...X.......| +000002f0 7a 5e 58 59 31 4d f2 01 4a 23 51 24 1b 04 0c e3 |z^XY1M..J#Q$....| +00000300 94 9e 1b 6c ad aa 83 fd 2d 36 08 04 00 80 ab e9 |...l....-6......| +00000310 ff 6d 7a cd 3b a7 da ff d5 bd 27 49 68 53 f5 45 |.mz.;.....'IhS.E| +00000320 c3 dd 5b a2 99 fb 8f 24 37 49 d3 08 87 d1 06 98 |..[....$7I......| +00000330 39 72 25 78 b3 05 fb a2 c9 ac f9 c8 f7 fc ea 8a |9r%x............| +00000340 98 ce 78 83 64 f6 e0 c7 44 62 af a7 d5 26 df f1 |..x.d...Db...&..| +00000350 2c cc ce 11 8b 03 4a e1 81 54 3f e1 6e 52 c9 1a |,.....J..T?.nR..| +00000360 d8 95 52 e0 3f a5 e3 c8 12 9a c7 57 5d 46 7a ce |..R.?......W]Fz.| +00000370 56 8a 90 0f 0d 1b ba 58 cf 1c a3 4b 39 5a 08 ee |V......X...K9Z..| +00000380 8a 61 bb 0f 7d f7 0e f2 1f 73 e0 c8 6f 54 16 03 |.a..}....s..oT..| 00000390 03 00 04 0e 00 00 00 |.......| >>> Flow 3 (client to server) 00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| @@ -82,17 +82,17 @@ 00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| 00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| 00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 03 00 28 00 00 00 00 00 00 00 00 e8 f8 |.....(..........| -00000060 61 5f dc c0 12 cd e2 09 7a a9 61 4f 77 29 aa 9d |a_......z.aOw)..| -00000070 52 11 b9 35 66 1d ac e1 e7 05 f8 f7 d7 cc |R..5f.........| +00000050 01 16 03 03 00 28 00 00 00 00 00 00 00 00 b8 16 |.....(..........| +00000060 ce 7d df 64 13 07 9e d8 37 bb 3f 9c 9e 2b 3c 0e |.}.d....7.?..+<.| +00000070 26 a7 9d 32 e5 44 b8 d6 66 bc 05 7b 27 7a |&..2.D..f..{'z| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 dd 5b e0 29 02 |..........(.[.).| -00000010 9a 71 85 fb c1 d6 c0 fe 89 22 8d 86 9f 64 ab 70 |.q......."...d.p| -00000020 ec 07 9a 61 a0 af 13 7b 04 e2 73 df f6 c2 06 86 |...a...{..s.....| -00000030 a7 b2 65 |..e| +00000000 14 03 03 00 01 01 16 03 03 00 28 c0 73 5c 27 1b |..........(.s\'.| +00000010 19 d0 66 68 ea c5 ad 7d a8 03 37 d2 9a ff 00 c4 |..fh...}..7.....| +00000020 70 65 98 3b 88 59 c0 ca e3 c0 d6 32 0e 8d 15 3c |pe.;.Y.....2...<| +00000030 e2 c3 f3 |...| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 d8 7a 81 |..............z.| -00000010 28 a5 af fc 7d 02 4a 1c f5 a2 0f 65 65 ad d1 c2 |(...}.J....ee...| -00000020 2b fe 49 15 03 03 00 1a 00 00 00 00 00 00 00 02 |+.I.............| -00000030 94 20 af f9 53 43 6e c0 bd 0a fb ce b8 cc b5 3f |. ..SCn........?| -00000040 39 73 |9s| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 28 ef 47 |.............(.G| +00000010 ad 7f 40 4b 34 78 f3 1e 01 a7 f4 20 0a d5 c1 41 |..@K4x..... ...A| +00000020 f7 be 41 15 03 03 00 1a 00 00 00 00 00 00 00 02 |..A.............| +00000030 fb fc eb 14 f2 a6 e7 2e 80 d6 93 31 25 01 e9 d2 |...........1%...| +00000040 c3 ae |..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-RSA-RC4 b/libgo/go/crypto/tls/testdata/Client-TLSv12-RSA-RC4 index 6b7f11621b8..ab2c4eb14d8 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-RSA-RC4 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-RSA-RC4 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 51 02 00 00 4d 03 03 c1 47 51 e7 59 |....Q...M...GQ.Y| -00000010 d9 0d ae 9b 9c 93 c6 36 c6 33 e9 38 ba 37 4c 60 |.......6.3.8.7L`| -00000020 ec 0b 63 49 11 67 56 29 1b 78 dd 20 1a 60 41 ea |..cI.gV).x. .`A.| -00000030 93 07 16 61 e4 55 11 3f d1 e2 e6 9d 9f 05 c8 3e |...a.U.?.......>| -00000040 37 47 31 0d f9 5d 7a a5 7b 82 63 23 00 05 00 00 |7G1..]z.{.c#....| +00000000 16 03 03 00 51 02 00 00 4d 03 03 34 50 1f 52 15 |....Q...M..4P.R.| +00000010 85 c7 85 2c 4d a9 b2 0c 49 e5 a3 ea 57 21 96 39 |...,M...I...W!.9| +00000020 db c9 97 b6 c4 d0 81 9a 39 a3 e8 20 59 f5 b9 db |........9.. Y...| +00000030 58 2e ef 1c b3 85 96 27 6a 23 71 3f 5c 72 ce cf |X......'j#q?\r..| +00000040 c5 b7 fe 05 00 f4 65 06 54 c1 2e 7c 00 05 00 00 |......e.T..|....| 00000050 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| 00000060 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 00000070 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| @@ -70,15 +70,15 @@ 00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| 00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| 00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 03 00 01 |.Y(.....ia5.....| -00000090 01 16 03 03 00 24 f7 0e a5 ad 5d 6d ab c8 04 b7 |.....$....]m....| -000000a0 07 e7 e7 28 30 72 63 a9 02 05 18 7c 07 61 68 58 |...(0rc....|.ahX| -000000b0 6f 7a 5c d2 4f 32 b5 d3 b1 09 |oz\.O2....| +00000090 01 16 03 03 00 24 ab 48 84 ae 77 f9 8b 82 44 52 |.....$.H..w...DR| +000000a0 3e 65 94 27 cc f2 08 a7 f2 e5 21 0c 02 d0 89 ac |>e.'......!.....| +000000b0 50 be 69 57 c9 7c a0 f2 7f 6d |P.iW.|...m| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 93 ef cc 6a e8 |..........$...j.| -00000010 8c e4 16 6e 05 cd 2f 9a 31 52 e8 67 3b 93 83 0e |...n../.1R.g;...| -00000020 f0 29 04 29 40 b7 6a c8 c4 51 a4 6a 9d 5c 17 |.).)@.j..Q.j.\.| +00000000 14 03 03 00 01 01 16 03 03 00 24 61 94 21 65 0f |..........$a.!e.| +00000010 10 ba 0c a6 d9 e3 08 54 86 ae f9 64 c7 e7 f4 4b |.......T...d...K| +00000020 aa f5 19 ca 2a 0d 50 88 85 42 32 14 04 29 d9 |....*.P..B2..).| >>> Flow 5 (client to server) -00000000 17 03 03 00 1a c0 49 e8 30 49 75 60 93 ec 04 e9 |......I.0Iu`....| -00000010 3e 54 66 78 15 8e 1e 31 2e ab 1b c1 43 a3 44 15 |>Tfx...1....C.D.| -00000020 03 03 00 16 34 97 5d 52 01 da 5d 45 c6 51 14 1a |....4.]R..]E.Q..| -00000030 45 8f 96 af fd 6a ea d2 37 cf |E....j..7.| +00000000 17 03 03 00 1a cb 1d 43 67 de 7a 20 c7 ed 46 99 |.......Cg.z ..F.| +00000010 86 1f b9 61 9f c6 34 9a 07 37 3c 94 45 b4 40 15 |...a..4..7<.E.@.| +00000020 03 03 00 16 4e ac d3 12 23 b4 33 bc 5b 03 91 7e |....N...#.3.[..~| +00000030 d9 d0 7f d7 48 3e 8c 16 16 ec |....H>....| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateOnce b/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateOnce index 9810f522129..96f7b000734 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateOnce +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateOnce @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 8a b7 29 8f 35 |....Y...U....).5| -00000010 0f 6b 07 77 95 15 94 08 ad b8 e3 8f 97 72 17 b5 |.k.w.........r..| -00000020 79 1d b9 ab 57 d2 58 e0 63 04 8f 20 3b 5d 60 f3 |y...W.X.c.. ;]`.| -00000030 d6 92 21 98 27 3d 20 69 ec c8 47 d0 27 ce 42 39 |..!.'= i..G.'.B9| -00000040 1d 82 b0 e7 ef ca 59 f9 f8 fe 06 79 cc a8 00 00 |......Y....y....| +00000000 16 03 03 00 59 02 00 00 55 03 03 1c 04 37 7b 4d |....Y...U....7{M| +00000010 49 2a 45 1d e8 db 60 7e 7d be 7b 2d ff a2 dc aa |I*E...`~}.{-....| +00000020 b7 5e 66 f9 67 bf 58 f7 f1 0a 7b 20 f2 72 71 31 |.^f.g.X...{ .rq1| +00000030 2a 6e 5e 2b e4 29 ef bc 3a 56 45 26 53 b4 9f 98 |*n^+.)..:VE&S...| +00000040 fb 07 d5 2f b3 f3 f0 3b 02 1f 00 9b cc a8 00 00 |.../...;........| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,185 +60,185 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 0d 87 80 0d 1d 7c ad |........ .....|.| -000002d0 a2 da 94 09 a5 23 c9 f2 23 cc f2 0a 2e 94 2d 74 |.....#..#.....-t| -000002e0 01 5f 60 63 5b c7 1e a0 45 08 04 00 80 2f 2f 55 |._`c[...E....//U| -000002f0 44 fb f1 5a 0d 37 7c b0 5d 63 bb 7a e3 a8 f3 e9 |D..Z.7|.]c.z....| -00000300 b4 5d a0 ba 31 ec a8 4b 70 5f ce af 98 91 28 0c |.]..1..Kp_....(.| -00000310 47 a2 c9 03 a3 07 e6 67 1e 34 76 cc b8 14 3d 8f |G......g.4v...=.| -00000320 83 6a 10 34 dc 53 7c 57 39 77 49 48 3e dc 0d 37 |.j.4.S|W9wIH>..7| -00000330 8f 37 f7 28 aa 13 19 b1 2f 31 e1 b6 94 45 b1 0d |.7.(..../1...E..| -00000340 ec 9f 39 78 90 24 31 c6 03 88 67 28 72 fa 24 41 |..9x.$1...g(r.$A| -00000350 5c 5e 3f d8 cd e4 58 00 fb 1a ba c9 cc ff 1b 7a |\^?...X........z| -00000360 23 9a fd 38 04 18 6a 82 69 bd e4 59 87 16 03 03 |#..8..j.i..Y....| +000002c0 ac 0c 00 00 a8 03 00 1d 20 6f fe 48 78 c0 68 41 |........ o.Hx.hA| +000002d0 fa 5a 33 f5 9b e0 b2 ae 93 e9 0c 5a 78 60 32 67 |.Z3........Zx`2g| +000002e0 de cf 17 26 20 88 3a f5 5e 08 04 00 80 58 d9 c5 |...& .:.^....X..| +000002f0 f0 c3 9e f5 4d a5 20 3e ed da a2 7d b9 2a 9b 95 |....M. >...}.*..| +00000300 ec 1c 2a c1 28 22 3e 36 4f 5a fe eb 2a 6a 9e 9e |..*.(">6OZ..*j..| +00000310 01 83 31 93 d1 bd 0f 6f ff 9d e8 4e 7a cb 9d 8f |..1....o...Nz...| +00000320 63 92 bc f2 0e 37 1f e0 8a 1e 22 2c eb 53 e8 25 |c....7....",.S.%| +00000330 15 20 97 1f 0c 75 5a 9d 6a aa e6 a6 86 d9 5d 4d |. ...uZ.j.....]M| +00000340 b8 58 d1 03 63 d4 8d cb 0b 4d 97 2e eb 50 13 39 |.X..c....M...P.9| +00000350 07 5c d9 a8 bf cf eb 05 47 0a 48 30 5b 71 c0 ea |.\......G.H0[q..| +00000360 cb 4f 22 27 1a d2 58 02 ca 07 bd 03 f1 16 03 03 |.O"'..X.........| 00000370 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 20 cb 26 0a 53 64 81 75 f6 f6 17 78 |.... .&.Sd.u...x| -00000040 3f a7 96 52 91 70 91 2d 92 67 cb ae f0 8f 84 9d |?..R.p.-.g......| -00000050 ea 17 3f a1 38 |..?.8| +00000030 16 03 03 00 20 f9 b0 26 8b 30 54 a5 80 7e 5b 47 |.... ..&.0T..~[G| +00000040 2e b1 28 07 ef 12 93 33 5a 8d 5e de 8d 56 d5 c3 |..(....3Z.^..V..| +00000050 3c 05 a8 f1 5e |<...^| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 20 83 7c 41 9e 33 |.......... .|A.3| -00000010 b0 89 6c 2f 88 99 61 b1 71 30 04 9f df 48 e9 9e |..l/..a.q0...H..| -00000020 50 5f 22 d8 09 49 f6 17 7f 6a 10 |P_"..I...j.| +00000000 14 03 03 00 01 01 16 03 03 00 20 c1 77 25 ba a7 |.......... .w%..| +00000010 08 ba 0d 1e 8b e2 eb 11 77 d8 c7 e2 20 e0 60 da |........w... .`.| +00000020 97 f5 42 f4 12 bb 94 35 b7 ee c8 |..B....5...| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 63 50 67 b6 7a 7d 4e 3d f5 a9 93 |.....cPg.z}N=...| -00000010 f9 6d 61 ea 46 c7 5d 28 77 ad 12 |.ma.F.](w..| +00000000 17 03 03 00 16 6f f6 5b 37 2f 21 25 ae e9 30 be |.....o.[7/!%..0.| +00000010 ce b4 66 f7 fd 9a 5a 02 9d 43 e8 |..f...Z..C.| >>> Flow 6 (server to client) -00000000 16 03 03 00 14 f4 d1 27 84 c9 8f 32 7c 0f ff e8 |.......'...2|...| -00000010 ee ba 2e 93 29 cb fa 22 52 |....).."R| +00000000 16 03 03 00 14 8f be 53 56 e9 19 ec 85 79 d0 cc |.......SV....y..| +00000010 8d ab 43 3c b2 7b a3 55 57 |..C<.{.UW| >>> Flow 7 (client to server) -00000000 16 03 03 01 14 ba 60 c0 bb d9 cb 55 0f 08 fc 18 |......`....U....| -00000010 15 81 5d 69 a0 b2 c7 87 94 af c1 63 a6 46 e1 57 |..]i.......c.F.W| -00000020 1e c5 9e 2e f1 aa db ad c9 20 4e a2 88 69 48 b5 |......... N..iH.| -00000030 ed 91 14 f1 d0 ec d2 28 9f e3 b7 de 03 7d 53 a6 |.......(.....}S.| -00000040 25 7f 2f e3 5b 6a 79 29 15 4b 25 90 bf a6 49 0a |%./.[jy).K%...I.| -00000050 29 94 86 29 4b 8b a2 6c 82 1e 0a 57 91 1c 46 f1 |)..)K..l...W..F.| -00000060 94 e3 ef e5 6c d5 e7 c8 82 86 82 dc 48 04 9d 11 |....l.......H...| -00000070 d9 85 1a 41 27 ec 1c 25 72 a5 15 53 ef 70 90 a8 |...A'..%r..S.p..| -00000080 a8 17 ae 4f 22 71 1c d3 7e 00 55 67 67 3b 3d cb |...O"q..~.Ugg;=.| -00000090 2c f3 03 39 f3 d8 46 30 4d 60 c4 58 d1 20 f6 1c |,..9..F0M`.X. ..| -000000a0 f2 13 8d c8 58 36 08 97 c6 82 9e 6d a4 bd 0a 71 |....X6.....m...q| -000000b0 e4 e2 7f 76 69 6f 39 19 43 9f 9c ea 8d fb ec ea |...vio9.C.......| -000000c0 90 a0 e7 67 ea d7 48 c6 e5 ce 7c f6 98 fb 0f 8a |...g..H...|.....| -000000d0 5b 9f 85 0b 9e 6b 50 40 32 12 a0 9e c2 5d d7 af |[....kP@2....]..| -000000e0 b1 57 e0 bf 05 59 3b 4c 93 4f 4b 85 6f 8d bf 65 |.W...Y;L.OK.o..e| -000000f0 94 a9 7c fc ab ef 1a 3a 4e 70 bd 54 35 6d f9 68 |..|....:Np.T5m.h| -00000100 36 8d 5e 30 d7 01 5c 1e b1 91 7c 9a fb 18 08 63 |6.^0..\...|....c| -00000110 28 d8 28 5d 53 1c f9 88 cb |(.(]S....| +00000000 16 03 03 01 16 ab 36 6a 25 3d 93 3c 71 b6 5b 91 |......6j%=.k../.]....| >>> Flow 8 (server to client) -00000000 16 03 03 00 81 b9 47 ca 9a 81 1b 3e 4e 21 cf 05 |......G....>N!..| -00000010 99 31 4c 2a d4 72 9d 71 1f b9 87 e7 19 36 60 84 |.1L*.r.q.....6`.| -00000020 e4 be 4a d9 7d 10 ad b1 d2 28 58 5b 47 09 cd 19 |..J.}....(X[G...| -00000030 de d3 76 c4 56 e1 19 f5 a3 e2 e3 bd 8b d0 d9 e0 |..v.V...........| -00000040 75 b2 d3 23 04 f0 65 ef 22 f6 10 13 28 80 1b c5 |u..#..e."...(...| -00000050 69 75 7b 8c e6 cb 0e f5 e7 e8 fa 1e d0 e3 c3 24 |iu{............$| -00000060 52 83 c9 a2 5b 57 94 da b9 f2 5e 0a bc f4 a0 da |R...[W....^.....| -00000070 a1 02 b5 18 20 de 40 4e 52 97 12 6b e6 00 b6 eb |.... .@NR..k....| -00000080 af 82 f0 08 d7 33 16 03 03 02 69 26 88 2e 6e 74 |.....3....i&..nt| -00000090 21 8d 66 37 b3 77 37 52 0d 04 e6 89 99 00 3f e6 |!.f7.w7R......?.| -000000a0 e5 6b 56 68 8e 07 0b 2b 35 8f 59 81 f0 b0 82 77 |.kVh...+5.Y....w| -000000b0 dd 13 b8 16 a9 e0 84 9c bc 2d cf c4 30 a4 43 f6 |.........-..0.C.| -000000c0 01 04 c3 7d 9d a1 84 16 73 45 f8 85 c8 fc c2 25 |...}....sE.....%| -000000d0 49 24 07 e1 d8 1c 8f da ce 04 0e ca 1a 4f 97 a0 |I$...........O..| -000000e0 ba 8f 0f 2d 87 02 f9 a1 08 33 4e 53 a7 a1 bb c8 |...-.....3NS....| -000000f0 41 d2 9b c6 44 0a 7e 8e 21 ff 0d 23 61 d0 b9 4d |A...D.~.!..#a..M| -00000100 27 74 3a de 3a 7e 76 1e 8f a1 f8 57 ca 6b 1d dc |'t:.:~v....W.k..| -00000110 75 e9 2b 95 ae dc 5e 93 de 23 43 6e 1f b1 4d df |u.+...^..#Cn..M.| -00000120 f7 e6 d8 bd 3d 31 0a 7f 97 7b 07 c5 ac 8a 1e 51 |....=1...{.....Q| -00000130 95 a1 c5 b3 93 ba ec 41 d8 1a 57 28 2f 53 14 d0 |.......A..W(/S..| -00000140 e0 e9 e9 e2 f4 a8 b1 67 15 2d d8 3b 96 82 75 16 |.......g.-.;..u.| -00000150 f9 4e a1 55 1d b0 e1 48 95 bb ee 46 5f dd 48 4a |.N.U...H...F_.HJ| -00000160 6a ae b4 a0 24 21 85 70 20 80 22 dc c0 cc 0e 15 |j...$!.p .".....| -00000170 55 c8 e1 15 1c 8c 38 c3 fb 38 31 0e 3c d8 49 bf |U.....8..81.<.I.| -00000180 63 4d d4 20 09 a4 b1 57 f8 a3 1c b2 8e 8d 28 c8 |cM. ...W......(.| -00000190 af 20 4c 46 ae b5 eb aa 54 ca 74 cc bc b4 5c a5 |. LF....T.t...\.| -000001a0 a0 ab c1 41 fb cc 0d d6 6a 25 58 c9 f1 10 32 59 |...A....j%X...2Y| -000001b0 6a d3 04 5a fe bb 84 58 94 04 aa fd a4 f9 79 6c |j..Z...X......yl| -000001c0 f8 da 28 7f 16 73 5e 4c a2 07 9d cc 8f 8d 25 27 |..(..s^L......%'| -000001d0 2d 60 a3 a0 0d e3 65 0b 69 1f 44 92 97 d7 1e b8 |-`....e.i.D.....| -000001e0 43 f4 ed f5 3c 6c ce 0e f6 cb a2 83 80 c3 ee 00 |C...).| -00000220 ba 26 31 6e e8 a8 d4 d5 da e0 9f d1 8c 76 9a bf |.&1n.........v..| -00000230 18 f9 02 1d a0 c5 07 b7 fe cd d2 34 47 27 84 b4 |...........4G'..| -00000240 d4 07 3b 37 72 74 64 bb c4 31 5e 7b a9 c6 a9 a2 |..;7rtd..1^{....| -00000250 06 03 ea 32 41 64 b2 6c 57 70 bb 5c 0a a0 3f 48 |...2Ad.lWp.\..?H| -00000260 78 e8 0b 8a b7 dd 67 68 43 aa 8e d9 ff 81 a2 f4 |x.....ghC.......| -00000270 c6 25 9d 06 30 a4 6a 24 e0 b1 cd b4 7a d4 09 6e |.%..0.j$....z..n| -00000280 e3 d4 4c 3e b5 16 c3 44 9d f7 92 d6 40 95 d8 3e |..L>...D....@..>| -00000290 22 61 a3 29 87 8d 63 e0 98 0c db 9b eb 86 84 fe |"a.)..c.........| -000002a0 f3 ca 9f ce 7b de a9 04 3a 61 d4 bf d4 d6 51 60 |....{...:a....Q`| -000002b0 02 06 cb 13 e1 a6 bf db f0 f1 53 c6 62 a6 1a 42 |..........S.b..B| -000002c0 11 6f 5d 0c 13 c3 12 ff f5 7c 9b ef 58 54 14 3d |.o]......|..XT.=| -000002d0 4d 4b c2 fc ae 33 4a 00 24 e9 3c 6f 6f 5b ef c4 |MK...3J.$..........:Gw| +00000250 c1 fb b7 b8 82 42 37 95 60 20 be 91 26 ca 2c 48 |.....B7.` ..&.,H| +00000260 44 57 6c 75 24 22 93 32 cf 83 f8 0c 75 b5 4a f1 |DWlu$".2....u.J.| +00000270 88 d0 8e 1d 4e c7 93 1b ba ea 14 04 38 f6 7a c2 |....N.......8.z.| +00000280 d2 4b 7c 9c 1b 8b 31 6c d8 09 88 6a 6d a1 61 d6 |.K|...1l...jm.a.| +00000290 ee 80 ea 76 c0 d9 5a 49 31 3b dd 0f b5 5a a1 29 |...v..ZI1;...Z.)| +000002a0 d4 ff db 68 48 96 26 e7 a7 82 10 e9 6e 5c c4 66 |...hH.&.....n\.f| +000002b0 d5 e0 87 c3 66 d8 7c 4e bf a5 31 0f fa 6e f6 21 |....f.|N..1..n.!| +000002c0 4d fe ea f0 36 91 9e 18 81 c0 21 4f 77 eb 65 c0 |M...6.....!Ow.e.| +000002d0 fe 84 45 22 dd 28 03 eb e5 ce 15 62 e1 b8 9f 0e |..E".(.....b....| +000002e0 aa 9d bc 5c 38 41 01 74 17 d0 92 a5 80 e4 4b 58 |...\8A.t......KX| +000002f0 42 bb 42 5d 16 03 03 00 bc 09 fb 78 c1 36 2e 27 |B.B].......x.6.'| +00000300 b2 44 17 1a a8 2b f5 cd 98 78 a4 c1 1c f2 e7 53 |.D...+...x.....S| +00000310 92 ef c1 88 83 78 37 23 08 f5 7f 5d 9f d1 c4 32 |.....x7#...]...2| +00000320 df 01 c6 9c 3e a8 11 31 f4 77 69 94 d7 67 bc 62 |....>..1.wi..g.b| +00000330 8e 18 57 0a cd d8 ba db cd 2b e8 f9 37 77 16 13 |..W......+..7w..| +00000340 be 18 53 2a 50 0b 0a d7 9a f0 7d 10 d3 13 bb 82 |..S*P.....}.....| +00000350 36 5c aa d1 17 ad 83 69 47 7f 81 5c 36 53 81 e3 |6\.....iG..\6S..| +00000360 1d 65 9f ac b2 3e 76 77 5a 6a 39 e5 df 92 55 e6 |.e...>vwZj9...U.| +00000370 90 96 9c b9 54 ac 09 17 ce f5 43 9f 3e 1e 3a b6 |....T.....C.>.:.| +00000380 cb 61 da 1a 3e e0 b4 51 30 3e 22 09 0b 05 a7 6e |.a..>..Q0>"....n| +00000390 5a df 82 d2 ab b9 d8 d2 37 a7 d7 b5 7f a9 ea 49 |Z.......7......I| +000003a0 2f 64 57 33 5a 19 7f a3 2f 6a 7e 40 18 19 4a 61 |/dW3Z.../j~@..Ja| +000003b0 05 92 35 8b 50 16 03 03 00 4a 50 1e e6 f4 47 dd |..5.P....JP...G.| +000003c0 fb 02 b4 22 71 e7 1e b1 51 28 9f 2d 40 64 2c 85 |..."q...Q(.-@d,.| +000003d0 47 33 69 3e b0 e4 c7 eb a6 31 13 76 45 39 e7 50 |G3i>.....1.vE9.P| +000003e0 94 86 2e dd e1 58 f2 83 60 86 07 94 29 ce 69 12 |.....X..`...).i.| +000003f0 0f 89 e3 89 2f 00 50 2b 56 ed 1d fe 25 55 9f 33 |..../.P+V...%U.3| +00000400 3d 30 93 3c 16 03 03 00 14 0e 3f df b0 79 70 a7 |=0.<......?..yp.| +00000410 08 bb 01 ff 08 44 69 65 49 81 9f e5 3a |.....DieI...:| >>> Flow 9 (client to server) -00000000 16 03 03 02 69 74 87 f6 35 08 6b 36 04 33 bd 50 |....it..5.k6.3.P| -00000010 d8 de c9 0b 8e 98 d4 2a ca f1 68 50 10 03 d4 83 |.......*..hP....| -00000020 56 e2 12 fd 8d 5f ff 7c 16 9b 43 d9 75 f7 c6 ee |V...._.|..C.u...| -00000030 ee dc f6 e9 19 d0 ae 8a 54 fb c6 7e 9e b4 15 79 |........T..~...y| -00000040 17 fa d2 32 8d b4 b0 ff 15 44 ac 4f 28 5d ba 10 |...2.....D.O(]..| -00000050 6e e6 cb b3 ad e8 ef 06 c4 3e aa 1f a8 df 1b 82 |n........>......| -00000060 38 bd 5f 88 5c 0e 5b e7 03 df 9b 6f c2 d9 b8 5f |8._.\.[....o..._| -00000070 bf 60 de 69 f3 12 4f b8 50 28 fc 2d 15 70 92 3b |.`.i..O.P(.-.p.;| -00000080 76 7d 36 13 5e e6 39 e6 29 6d d0 99 14 ca 52 a5 |v}6.^.9.)m....R.| -00000090 12 db 96 d4 d0 38 ef 42 6c 09 ca dc 06 f2 d3 8f |.....8.Bl.......| -000000a0 49 c8 a3 c2 77 c3 c1 f6 18 6a 91 95 36 1b d6 47 |I...w....j..6..G| -000000b0 f6 87 0c 3e 82 b4 22 62 a5 cb 5b e8 73 6e 71 52 |...>.."b..[.snqR| -000000c0 4f 7c 9f b8 b4 f1 5b 77 96 a6 8e 22 52 b6 cf cc |O|....[w..."R...| -000000d0 b4 5b a9 a9 63 4b 9b 1c db a0 ad f4 35 04 20 6c |.[..cK......5. l| -000000e0 33 b2 c6 5c 6f 2a 1e 5f d9 c4 c1 b1 82 4f 6d 12 |3..\o*._.....Om.| -000000f0 e1 6e f9 9f e8 0f e7 9e cf 80 eb 1a 72 de 9e df |.n..........r...| -00000100 b2 6f d4 57 1f cc 01 89 b2 e3 2f 65 dd 05 ae 0d |.o.W....../e....| -00000110 d0 9f 74 21 45 3c c4 00 67 61 2c 37 8e 96 a4 38 |..t!E<..ga,7...8| -00000120 b2 1d d8 58 25 7a 3f 99 0c 7b e7 fd 67 92 e2 3f |...X%z?..{..g..?| -00000130 14 32 79 25 d3 df cd cf 1f fc 5d 67 53 e0 7d 28 |.2y%......]gS.}(| -00000140 60 b1 b0 d8 d9 81 d4 b4 22 81 e4 c2 09 8e 8d 37 |`......."......7| -00000150 82 35 61 37 6c 6e 8e 2d 9f 41 63 b3 e9 f9 1f 73 |.5a7ln.-.Ac....s| -00000160 8f bf 7d 08 65 b8 a2 5a 32 5a 0f 96 70 fc 11 d5 |..}.e..Z2Z..p...| -00000170 b3 af 85 2c 22 cc 8d da 18 80 74 6c d9 64 1e e5 |...,".....tl.d..| -00000180 8a 10 ee 28 6b 3b 85 d9 af b7 65 bd 39 c4 4c 1e |...(k;....e.9.L.| -00000190 c6 40 b7 26 cd 07 1a e1 42 c9 a0 e6 94 34 60 11 |.@.&....B....4`.| -000001a0 5e 1c c1 76 f5 59 70 fb 73 8e 2f 44 53 ea b2 55 |^..v.Yp.s./DS..U| -000001b0 ed 0c 6f 39 f0 0a 04 b9 6c 7e c9 15 dc 3f c7 72 |..o9....l~...?.r| -000001c0 85 78 02 ce 96 49 57 cd 56 dc 9c 76 b9 ae 08 6c |.x...IW.V..v...l| -000001d0 52 82 b2 a0 05 20 f6 2e 28 0d 4c 46 58 42 d5 2f |R.... ..(.LFXB./| -000001e0 83 55 b1 e1 47 f1 b1 70 72 b0 73 7f a5 7f 4d 73 |.U..G..pr.s...Ms| -000001f0 e8 09 46 d7 16 3e 3d df 04 79 24 38 23 e2 a6 e3 |..F..>=..y$8#...| -00000200 e7 70 b5 69 b7 42 fb 45 84 d3 e8 cc eb e5 25 67 |.p.i.B.E......%g| -00000210 ee 71 b9 24 05 8c cc e0 2b 86 1d ac 54 24 e8 7a |.q.$....+...T$.z| -00000220 c3 8f 22 df 01 21 f7 d1 a9 b6 96 3c e8 b4 c9 95 |.."..!.....<....| -00000230 5a e1 2e 46 ac e3 6b a5 14 60 d4 63 c1 37 5e d5 |Z..F..k..`.c.7^.| -00000240 14 d1 97 ae c0 cf 01 d3 b0 b0 3d d7 7e 9f 5a 52 |..........=.~.ZR| -00000250 73 f3 e0 70 22 09 44 85 b9 1e 2f 78 a1 33 cc 39 |s..p".D.../x.3.9| -00000260 fd ff bc 68 1e 96 7e 26 be 31 8e 73 64 21 16 03 |...h..~&.1.sd!..| -00000270 03 00 35 96 4d ac f1 b3 1b 7b e0 ab 2b 47 40 be |..5.M....{..+G@.| -00000280 46 a3 02 2c eb 74 b8 4f 53 b5 7d 05 47 dc 72 d9 |F..,.t.OS.}.G.r.| -00000290 6a 8e 7d 6f 66 2a 6b e2 27 e7 6a bf 39 68 f3 9c |j.}of*k.'.j.9h..| -000002a0 89 51 dc 4e 8c 82 38 57 16 03 03 00 98 fb 44 b6 |.Q.N..8W......D.| -000002b0 36 4a 3e 0a 41 01 3d 78 8b 5d fe 95 69 a5 53 d5 |6J>.A.=x.]..i.S.| -000002c0 d6 37 c3 e3 03 ae b7 33 57 1a 1a dd d0 cf 86 34 |.7.....3W......4| -000002d0 6e 06 30 ac 09 08 13 8b 18 9f a6 ec 96 e4 bc ca |n.0.............| -000002e0 06 6b 01 2d 2e 7c ff 34 9e 16 7e fc e3 0e 3c 0e |.k.-.|.4..~...<.| -000002f0 5c d0 13 88 7d af ec a4 91 fd a1 48 ef b3 fb 2a |\...}......H...*| -00000300 d8 e5 a3 c7 4b 50 34 fc c1 33 dd 43 88 8d 6e 16 |....KP4..3.C..n.| -00000310 9e 0c d7 b0 7f b2 77 cc da e0 8e 02 9e db 2f 12 |......w......./.| -00000320 3b 4f 5b 7b c2 eb e3 10 5c 6f 43 d6 54 e1 8c 55 |;O[{....\oC.T..U| -00000330 ec 51 93 f8 12 5e f6 09 92 a1 95 51 db 75 97 17 |.Q...^.....Q.u..| -00000340 bc cd 80 71 e9 14 03 03 00 11 4b d7 45 5f 00 cd |...q......K.E_..| -00000350 ad 58 83 c6 14 13 d2 89 fa a8 2b 16 03 03 00 20 |.X........+.... | -00000360 33 77 49 9f ff 97 4c 6a f7 42 45 d4 59 6a 1e 6e |3wI...Lj.BE.Yj.n| -00000370 12 29 e7 62 01 0c 9e 8c e2 f1 7f fb aa a4 05 e2 |.).b............| +00000000 16 03 03 02 69 b8 47 2d 3a 7a e4 d0 2b 45 b2 38 |....i.G-:z..+E.8| +00000010 1e 6f 8d 3d e1 26 91 92 d7 1f e9 a4 2c d8 30 2c |.o.=.&......,.0,| +00000020 ce 68 50 e7 80 77 63 e1 bd c7 c8 1b 6f ca b0 bf |.hP..wc.....o...| +00000030 82 1d 75 85 2c 5d b2 f6 9a f2 b6 9b c4 24 54 86 |..u.,].......$T.| +00000040 b8 fb dc ae 09 25 c4 42 fc 4d f2 18 5b a3 92 31 |.....%.B.M..[..1| +00000050 8a 78 1f 1a 74 d4 43 0b 24 2f 14 2b 0e 05 3a 8d |.x..t.C.$/.+..:.| +00000060 7a 1c 21 2f cd 7b 9d 6c 32 b1 f6 14 fa 9d f5 be |z.!/.{.l2.......| +00000070 9c f1 8e 75 b9 27 82 ba e7 fc 14 39 2a 6f 3e 59 |...u.'.....9*o>Y| +00000080 d6 bc 6c 3f f1 33 5e fa bb 07 bc e4 0b 7e 4a 5d |..l?.3^......~J]| +00000090 2b e8 9b d5 00 d2 cc 8f 94 01 82 0e bb 28 f9 d2 |+............(..| +000000a0 1f ee 0c ff 9c 4d 37 5b 23 5b 23 a5 39 fe cd 2b |.....M7[#[#.9..+| +000000b0 ef 30 46 b7 c1 0e a3 fc fd f6 1b d3 78 fb d9 93 |.0F.........x...| +000000c0 3a 52 fe 91 dc 42 63 85 09 64 63 3a 9d 9f 21 74 |:R...Bc..dc:..!t| +000000d0 c6 d9 e4 b5 cc ef 94 96 0f c1 d0 45 f6 e6 b9 32 |...........E...2| +000000e0 01 74 88 24 bb d9 d6 25 23 14 de 25 f4 7e 9c 77 |.t.$...%#..%.~.w| +000000f0 82 83 7e 59 dc c3 f7 d9 e4 b1 95 e0 bb 6e 66 e4 |..~Y.........nf.| +00000100 bd cb a2 72 a0 63 d4 39 9f 57 a7 d1 88 7a 59 64 |...r.c.9.W...zYd| +00000110 38 45 bb fc 5a 02 81 4c 2e e5 e4 1c 7d e9 e8 f0 |8E..Z..L....}...| +00000120 e1 b7 88 f5 a6 ee d0 b7 e5 2f 9e 15 d5 76 8d f7 |........./...v..| +00000130 68 0f 7b 6a 48 e7 19 3a bc ef f5 fc 72 a4 62 ce |h.{jH..:....r.b.| +00000140 a6 66 e5 e8 74 03 c0 4d b4 14 e4 0c 36 fd 99 0b |.f..t..M....6...| +00000150 0e 4f b6 5e 4c db dc 51 fe ae e9 07 37 92 6c 35 |.O.^L..Q....7.l5| +00000160 f7 99 6c b9 36 c2 b9 7c 5e ef 72 c1 1f ba fb 18 |..l.6..|^.r.....| +00000170 57 24 f2 d4 21 cf 46 bd 71 3d 62 63 ba 1c 0f 8b |W$..!.F.q=bc....| +00000180 f4 a6 fc ea 27 de 48 b8 ed e3 6e 4b 30 66 fa 1e |....'.H...nK0f..| +00000190 22 7b 49 e2 03 96 8a 6a 3c 6a 1a 62 81 cc 06 dd |"{I....jL| +000001d0 e7 b9 9f 90 aa 1f 39 13 e2 4b 8c ff b5 13 d1 d2 |......9..K......| +000001e0 cd ac ce 8c 2b bc b3 b3 fc f7 37 db 61 8f 6b 90 |....+.....7.a.k.| +000001f0 c2 bc 6e e3 8e fa d9 16 ab 62 c7 3f d7 e1 0b a8 |..n......b.?....| +00000200 2b 8a 0d b6 2c 90 dc 6e b4 44 e0 13 32 fb 80 23 |+...,..n.D..2..#| +00000210 a9 e4 18 ea 8d c7 8a 14 0a 82 8d 3b 21 88 bf bf |...........;!...| +00000220 ff 10 3c 08 6b 65 70 4c b5 88 7d 9c 92 43 15 55 |..<.kepL..}..C.U| +00000230 18 e9 cf 15 5d 55 3a f0 a1 46 ca d4 9e f3 c0 16 |....]U:..F......| +00000240 4b ee f6 17 95 e0 af 1e 85 54 62 dd 56 88 6b e1 |K........Tb.V.k.| +00000250 29 ac f9 4f dc 5c 89 16 19 6b 21 c9 6c c8 1e 1d |)..O.\...k!.l...| +00000260 89 7c cc a4 9b 1f c8 ce 67 c6 83 79 6a d6 16 03 |.|......g..yj...| +00000270 03 00 35 6f 33 7d 96 3c 8d 66 a5 d1 7a 8b bc fa |..5o3}.<.f..z...| +00000280 ca f0 89 9d 2b 37 0c f5 aa 14 07 f2 58 be d1 d3 |....+7......X...| +00000290 ec 73 dd b6 33 e2 df 46 1a d3 ee e8 26 d9 be 2b |.s..3..F....&..+| +000002a0 43 25 3b e2 78 72 10 43 16 03 03 00 98 18 03 96 |C%;.xr.C........| +000002b0 9c eb 31 50 72 15 0e 9b ff c7 6b b0 60 32 08 c6 |..1Pr.....k.`2..| +000002c0 ef 70 f9 0c 22 4a a2 0f 77 31 b3 ea d0 12 65 af |.p.."J..w1....e.| +000002d0 c9 28 0f f9 5b b7 f3 75 9c 5a 6e df a1 6a e6 d5 |.(..[..u.Zn..j..| +000002e0 82 0b 18 05 94 aa dd 93 e5 1d 60 06 47 f5 3e b1 |..........`.G.>.| +000002f0 d5 e8 e7 b7 9f 43 bf 4b 8a 5e 48 3b f1 42 f6 c0 |.....C.K.^H;.B..| +00000300 c3 65 86 e2 bc 7a 75 1d 93 cf 7f 3d 11 d3 85 c3 |.e...zu....=....| +00000310 c3 90 90 0b 77 e1 d7 64 da 71 3c 55 de 7c b9 71 |....w..d.q...| +00000370 f8 7e fd 4d bd 3b 0e bc 9b 74 27 09 33 c3 27 2a |.~.M.;...t'.3.'*| >>> Flow 10 (server to client) -00000000 14 03 03 00 11 b3 52 01 6f eb 60 f2 1e 3c 03 47 |......R.o.`..<.G| -00000010 0b be 2c 14 06 9c 16 03 03 00 20 ac c1 ed 57 1b |..,....... ...W.| -00000020 87 8a c6 78 a7 36 17 2b 61 fd db d3 cc 23 88 5e |...x.6.+a....#.^| -00000030 8c 40 1b 04 10 40 1c 51 75 a3 3f 17 03 03 00 19 |.@...@.Qu.?.....| -00000040 16 55 b1 d2 86 e7 fa be 59 4a 7f 13 b5 aa af d1 |.U......YJ......| -00000050 0c 50 2a 7f a9 b9 c5 eb 45 |.P*.....E| +00000000 14 03 03 00 11 3d 29 da dc b6 5a 09 66 34 6e 00 |.....=)...Z.f4n.| +00000010 65 8c 29 d2 18 bd 16 03 03 00 20 63 55 d1 84 7d |e.)....... cU..}| +00000020 3e cc 2d f5 d3 48 c2 5c 72 d8 6b cf 69 b4 ed 5f |>.-..H.\r.k.i.._| +00000030 07 96 53 13 1e 53 59 18 c1 bb c7 17 03 03 00 19 |..S..SY.........| +00000040 30 5b 6d d2 26 db ef c1 a9 00 e6 ce 87 86 9b 71 |0[m.&..........q| +00000050 dd fb aa 79 aa b6 39 1e 70 |...y..9.p| >>> Flow 11 (client to server) -00000000 15 03 03 00 12 4c e2 da 21 11 be 48 2d 52 09 32 |.....L..!..H-R.2| -00000010 83 9b 6f dc a8 6c 5c |..o..l\| +00000000 15 03 03 00 12 32 8f cd ef b8 3e 96 01 07 ca 0b |.....2....>.....| +00000010 83 21 83 97 78 25 64 |.!..x%d| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice b/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice index f85c6907fab..983174f5ec8 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 51 2d ad 23 79 |....Y...U..Q-.#y| -00000010 a1 68 89 d6 6d 78 78 ba 0d 65 e7 86 46 c7 5c c9 |.h..mxx..e..F.\.| -00000020 3c fd 70 0e 82 d3 fa 66 5d 98 8a 20 db 5d a5 7f |<.p....f].. .]..| -00000030 85 73 11 b9 cd 80 4c f1 87 a2 5a 33 d7 4d af 49 |.s....L...Z3.M.I| -00000040 ed 3b 5f 3d 13 6f a4 38 1e c9 75 13 cc a8 00 00 |.;_=.o.8..u.....| +00000000 16 03 03 00 59 02 00 00 55 03 03 34 8b db 6b 9e |....Y...U..4..k.| +00000010 68 c3 92 09 72 4f 02 6c b9 7a ac 74 72 0b 32 01 |h...rO.l.z.tr.2.| +00000020 f4 86 9e b5 53 db da 96 c2 65 2a 20 8f 89 24 79 |....S....e* ..$y| +00000030 8a a5 38 7a 52 68 7a a9 cc d0 5a 04 4d ce 87 0e |..8zRhz...Z.M...| +00000040 64 48 51 e0 00 cb 60 f0 b4 e9 99 27 cc a8 00 00 |dHQ...`....'....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,284 +60,284 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 68 e3 7e b2 34 ed 21 |........ h.~.4.!| -000002d0 05 68 aa 61 70 f7 67 5b ab 93 87 9c 8d 70 96 a7 |.h.ap.g[.....p..| -000002e0 63 b8 ab 89 84 6b 89 08 13 08 04 00 80 94 a2 04 |c....k..........| -000002f0 de e3 fa 20 2b ea 31 3b c6 d9 ef 04 d9 7f 83 f8 |... +.1;........| -00000300 f1 1e f3 9b d8 d6 db f1 bc 52 52 15 09 c7 6b 17 |.........RR...k.| -00000310 56 ed 2c 51 2f ba 9c 23 1b 49 0f c6 d9 05 5c 66 |V.,Q/..#.I....\f| -00000320 d0 19 af 29 d3 65 60 75 06 4e 15 7b c1 08 fe ac |...).e`u.N.{....| -00000330 0d b2 8c 65 67 f0 5a 9d 9f ed 33 dd 6a 09 58 0b |...eg.Z...3.j.X.| -00000340 25 ed 45 57 ea 61 a1 72 cb 39 ef fc 8b 06 94 b9 |%.EW.a.r.9......| -00000350 68 ff 73 c5 52 8e 2b ef c5 39 e7 93 34 2a cf c1 |h.s.R.+..9..4*..| -00000360 54 cf c3 63 a2 2c 06 92 9f d9 8b 24 2c 16 03 03 |T..c.,.....$,...| +000002c0 ac 0c 00 00 a8 03 00 1d 20 63 06 67 5c 4e da 3f |........ c.g\N.?| +000002d0 0a 02 78 46 92 fe 8f ed 41 ac 1a d5 04 e6 ca 4a |..xF....A......J| +000002e0 7e 9c d0 32 e8 ee f3 9c 5d 08 04 00 80 c0 51 ba |~..2....].....Q.| +000002f0 71 28 00 53 c6 40 63 20 d4 bd 52 60 d2 f6 e2 57 |q(.S.@c ..R`...W| +00000300 ba 6f a8 bf 42 2a 11 b5 9a eb 9f b6 53 77 87 72 |.o..B*......Sw.r| +00000310 ea 7d bf f8 f4 cf 1d 76 6c 03 75 9d df 88 b1 13 |.}.....vl.u.....| +00000320 66 5c 43 41 1e 97 52 32 86 d0 22 3c f6 ca 90 a5 |f\CA..R2.."<....| +00000330 ba cf 75 94 1f 22 93 c0 0c c9 82 a5 eb d2 07 85 |..u.."..........| +00000340 a0 39 9e 5d fa 88 1f 62 25 09 c3 97 c1 1d 4e a2 |.9.]...b%.....N.| +00000350 fe 98 96 b8 c0 eb b9 18 07 2d e1 cf 9b fd 25 ba |.........-....%.| +00000360 93 fb 73 e5 7e 36 27 b3 11 00 58 95 f8 16 03 03 |..s.~6'...X.....| 00000370 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 20 c5 ed 46 65 cc 21 42 fc 0f 93 4b |.... ..Fe.!B...K| -00000040 0e 73 eb 8f 8e e2 fe 45 f0 0e 64 f5 1b db 79 a6 |.s.....E..d...y.| -00000050 60 7f ca 5c 72 |`..\r| +00000030 16 03 03 00 20 02 50 f6 74 83 31 96 36 c1 22 99 |.... .P.t.1.6.".| +00000040 1d d7 99 b2 8c 2b 04 3a bd 3e 19 e5 ef 71 dc 72 |.....+.:.>...q.r| +00000050 b2 0d c8 d1 3f |....?| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 20 eb 22 65 3b 95 |.......... ."e;.| -00000010 dd f8 04 5c 3e cc cb e7 e3 d0 bf 86 bf d6 70 f7 |...\>.........p.| -00000020 1d 75 87 28 bb be 28 e3 b4 fd 7b |.u.(..(...{| +00000000 14 03 03 00 01 01 16 03 03 00 20 9b a3 02 3e 55 |.......... ...>U| +00000010 4a e6 4c 7f 9a a6 a2 65 bd 74 ff ad c5 ce 43 21 |J.L....e.t....C!| +00000020 d3 b1 d1 89 0c 15 7d 7d a7 d8 4c |......}}..L| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 d0 03 3c 9c 0a 2f 8e 12 d7 9b 3f |.......<../....?| -00000010 66 d3 6b e4 4d 2b be bf 61 e0 f1 |f.k.M+..a..| +00000000 17 03 03 00 16 4c 5e 0a 69 e1 e8 fc 52 f0 3d ea |.....L^.i...R.=.| +00000010 33 f5 02 6b 47 49 cd a5 b5 94 4e |3..kGI....N| >>> Flow 6 (server to client) -00000000 16 03 03 00 14 f2 1c 0c 2c 61 9c 59 eb b5 b2 17 |........,a.Y....| -00000010 50 46 fd a1 3f 06 2c fc ef |PF..?.,..| +00000000 16 03 03 00 14 6a 8d 46 e1 33 c6 63 9d 27 3e e8 |.....j.F.3.c.'>.| +00000010 7f 31 74 7f 4f 60 b3 f7 aa |.1t.O`...| >>> Flow 7 (client to server) -00000000 16 03 03 01 14 06 cd f6 16 2c a0 d5 ee c5 42 68 |.........,....Bh| -00000010 c9 5f a9 b0 e7 79 0f 20 7c 0c 85 a9 ad df ee d6 |._...y. |.......| -00000020 3e 8c ce ea c0 db 1a d4 9d b7 7d db 9f 37 91 93 |>.........}..7..| -00000030 90 1e 48 ce a4 71 df 23 03 0d 29 82 7a 63 ee 2a |..H..q.#..).zc.*| -00000040 82 83 e6 e1 50 ab d2 9b 82 94 de 3d ae 0c e4 8a |....P......=....| -00000050 eb e7 3a d9 cb fb 87 24 2d 91 a3 65 e5 df 36 03 |..:....$-..e..6.| -00000060 ef e4 93 4b 24 aa a5 04 17 60 68 2b 0d c9 e0 24 |...K$....`h+...$| -00000070 18 69 7b 28 59 48 d6 1a 6e 74 23 7c 54 65 8c 3f |.i{(YH..nt#|Te.?| -00000080 51 67 e2 94 35 ce 60 2c 04 3d 04 15 31 b1 42 8a |Qg..5.`,.=..1.B.| -00000090 34 6c b6 47 d9 e0 3c e9 77 62 5f 76 c1 4a d3 f6 |4l.G..<.wb_v.J..| -000000a0 56 b9 08 28 b7 c3 a5 ae 45 0e 26 95 3d fe 97 b4 |V..(....E.&.=...| -000000b0 30 52 6d 57 5a 1f 95 97 67 18 b4 03 f3 b8 8d 0b |0RmWZ...g.......| -000000c0 49 bb 66 87 fb aa 36 35 00 7b fe d9 f1 7b 2b 7e |I.f...65.{...{+~| -000000d0 03 47 80 87 2b c9 17 c9 2e 45 82 af cd 67 49 e2 |.G..+....E...gI.| -000000e0 a7 b5 fb 30 21 23 c6 22 a1 e7 f1 a1 3b 19 ff 04 |...0!#."....;...| -000000f0 1c b4 99 7d b0 5e 49 43 5d 0e d4 62 04 7d 52 ed |...}.^IC]..b.}R.| -00000100 b4 50 86 06 83 d6 e6 9e 42 3d ee 9d 27 f7 6a 11 |.P......B=..'.j.| -00000110 f6 c8 da 92 a2 23 49 8d 80 |.....#I..| +00000000 16 03 03 01 16 6f 4d 64 ff 20 fa 1c 19 26 bc 99 |.....oMd. ...&..| +00000010 ec 09 be e7 6d 88 73 1e 4f c6 74 35 f7 5c b3 e5 |....m.s.O.t5.\..| +00000020 f6 d1 2a 90 7f c3 34 dc 83 6b a9 f1 32 01 a1 84 |..*...4..k..2...| +00000030 0c 4c 06 db 88 d4 19 31 d2 46 1f 2c 3d 13 75 5b |.L.....1.F.,=.u[| +00000040 f3 e5 d0 b7 a8 4f 2c b2 89 35 78 82 78 b7 f5 c6 |.....O,..5x.x...| +00000050 ea a2 1d f3 24 9d e2 01 25 e2 96 a1 06 57 5c 50 |....$...%....W\P| +00000060 d6 5b 56 24 18 6e b4 ce 6a 2e c7 01 65 99 3f 35 |.[V$.n..j...e.?5| +00000070 c1 07 48 75 ad 0b 1a b3 58 df 83 42 f8 78 eb 92 |..Hu....X..B.x..| +00000080 e8 70 c9 34 af db e8 d6 b0 c8 37 ac b2 d7 18 ba |.p.4......7.....| +00000090 a3 1d 35 09 2e 2f 82 e0 3a 68 fd 7f ba 4d 5c 5c |..5../..:h...M\\| +000000a0 6c 6d ac 24 60 bf e0 37 a9 17 8d 6d 8a 69 96 23 |lm.$`..7...m.i.#| +000000b0 4f c7 53 a0 48 65 58 cc 01 03 df 33 36 5a 8a 7e |O.S.HeX....36Z.~| +000000c0 3f 84 33 26 3f 02 66 48 82 22 22 b7 7d 62 7e 56 |?.3&?.fH."".}b~V| +000000d0 94 df 43 df 08 fc 70 f6 bb 1a dd 19 b1 ea ea a2 |..C...p.........| +000000e0 6f 36 ab b0 d2 77 e6 c8 f6 70 a6 a6 a3 0d ab c8 |o6...w...p......| +000000f0 dc d1 9b a2 05 43 44 0c 17 8d 47 86 55 77 56 34 |.....CD...G.UwV4| +00000100 d7 71 2c 75 9a d4 70 e4 77 5e 1a b7 b1 13 ae 14 |.q,u..p.w^......| +00000110 d0 99 a0 9e 50 9c 35 94 4d 34 e5 |....P.5.M4.| >>> Flow 8 (server to client) -00000000 16 03 03 00 81 7b f1 ac 76 fd 28 ba 97 a6 8e 3a |.....{..v.(....:| -00000010 ae f0 9a f6 ed 64 5d 2a 50 7d b2 83 e5 de b9 3c |.....d]*P}.....<| -00000020 3c 5b ab 48 db ec a7 18 d6 fd af a1 98 32 82 1e |<[.H.........2..| -00000030 b4 8d 83 3f 44 ff e6 1e 86 2b e3 f9 39 f8 30 a4 |...?D....+..9.0.| -00000040 26 f9 cc 3f 73 d5 88 f5 90 c7 b4 20 0b d3 6b c3 |&..?s...... ..k.| -00000050 4c 81 e6 4e 83 81 a7 9d 47 0d 0b 29 4c 2a 45 e2 |L..N....G..)L*E.| -00000060 0d 8b 40 61 0d f1 ee e1 e8 db 8f 43 e4 75 71 44 |..@a.......C.uqD| -00000070 f5 e3 69 99 a7 6d 67 79 06 02 65 4a 80 84 ee d8 |..i..mgy..eJ....| -00000080 56 30 f2 a6 ad b5 16 03 03 02 69 c9 6d 2c 0f ed |V0........i.m,..| -00000090 9c 35 b6 61 29 70 0f ab a0 61 00 cc d6 aa 9c 37 |.5.a)p...a.....7| -000000a0 9a 55 e7 a7 73 77 44 1b bb f0 be 1d 28 6a 45 03 |.U..swD.....(jE.| -000000b0 d1 7e c4 ef 42 e2 37 1d 5e 5a 5e cd 73 54 05 bd |.~..B.7.^Z^.sT..| -000000c0 a5 d9 d3 0d 7d 65 a3 a2 72 86 e0 c3 2d e1 91 96 |....}e..r...-...| -000000d0 d5 11 34 e1 f0 24 97 84 95 12 9f e1 89 f5 1b e0 |..4..$..........| -000000e0 fb 59 5b c4 fa 4e d1 f4 44 34 21 5a 5e 97 1a f7 |.Y[..N..D4!Z^...| -000000f0 ba 06 e8 83 b2 4a ca b4 90 ef f2 06 d5 48 2f 18 |.....J.......H/.| -00000100 11 2b fc 5c 41 ef 73 c4 78 8c 43 3f 63 3a bd ab |.+.\A.s.x.C?c:..| -00000110 5b 61 bc 18 6c ce e3 f1 5c 55 3a 4b 78 70 91 06 |[a..l...\U:Kxp..| -00000120 8f 79 19 4b aa 02 1d 86 f9 96 e6 2c a6 01 70 19 |.y.K.......,..p.| -00000130 3a 84 f2 71 0e 18 6d 9a d6 33 d6 4d 45 7e 83 c9 |:..q..m..3.ME~..| -00000140 21 6a dd 3d 82 1d 18 21 d7 fd b3 6f 8b 7e db ef |!j.=...!...o.~..| -00000150 5e 7c 99 5a dd d1 03 22 d1 cf 2e 73 d5 09 33 2e |^|.Z..."...s..3.| -00000160 8c 51 0b a4 7e e5 da 1b bc ed 13 ed d7 ba a9 25 |.Q..~..........%| -00000170 b7 8a 3f 1c 54 bd 1f a8 53 4b 47 37 44 55 a5 4b |..?.T...SKG7DU.K| -00000180 75 de 9c 86 d7 80 eb f5 f7 76 ff 5c 4d 70 69 02 |u........v.\Mpi.| -00000190 a8 4f b4 a0 65 d7 c5 55 34 3f b0 83 5c a8 bc 60 |.O..e..U4?..\..`| -000001a0 d3 46 c1 33 3c ef f9 53 3e 8d 86 3e c8 22 c4 e5 |.F.3<..S>..>."..| -000001b0 dd 6c 59 55 6b fe 3e 04 10 eb 7d c7 bd d8 3d 71 |.lYUk.>...}...=q| -000001c0 c2 2d 0b cd 29 a0 d9 3c cc c6 21 97 3d 24 36 1c |.-..)..<..!.=$6.| -000001d0 f5 6a b5 12 48 98 ec 91 42 85 cb 45 c2 b6 f6 64 |.j..H...B..E...d| -000001e0 c4 76 53 27 64 d3 89 f2 4e d6 98 23 25 a0 5b 54 |.vS'd...N..#%.[T| -000001f0 83 ab 53 29 5d 39 59 67 77 d0 4f 82 9e 0c 45 ae |..S)]9Ygw.O...E.| -00000200 6d 94 1a 9d 69 45 f0 37 0d 11 ee 46 4f 6a f3 81 |m...iE.7...FOj..| -00000210 ce 9b 74 02 54 a6 d6 49 98 e7 3f 7b 4c fc 53 91 |..t.T..I..?{L.S.| -00000220 80 d3 87 dd 55 91 04 ef 33 27 71 98 ef 1f df b8 |....U...3'q.....| -00000230 d6 5c 31 6f ba 58 f3 89 7b ba b6 ea 9f 75 cd 08 |.\1o.X..{....u..| -00000240 11 84 c9 e8 9f f8 8e 02 7d b7 4a 3b 6f 4d 25 46 |........}.J;oM%F| -00000250 46 5d 7c 60 71 b5 02 d1 91 59 a8 10 c2 fa e8 56 |F]|`q....Y.....V| -00000260 0f 6e 93 d1 dd c6 af e9 e1 c1 bf 64 8f 5b 04 78 |.n.........d.[.x| -00000270 74 1c f5 af ef 48 b0 9e 29 a9 6c a0 ff e4 69 bb |t....H..).l...i.| -00000280 e1 95 12 be 73 b0 35 89 82 93 b4 69 84 79 cc 78 |....s.5....i.y.x| -00000290 1d 93 05 a4 85 25 c5 a3 da 4b c7 72 66 2f 35 78 |.....%...K.rf/5x| -000002a0 62 94 d6 f3 1c dd 23 c8 86 11 fe b0 cb 2f 5c 78 |b.....#....../\x| -000002b0 45 8d 2e 0c 08 c6 7c 5c 92 80 70 25 3b 25 53 a8 |E.....|\..p%;%S.| -000002c0 86 f4 54 b6 a5 94 38 10 ff f9 3e 78 bb ce 86 fa |..T...8...>x....| -000002d0 9d 91 df 9e c1 ef 79 db 1b f8 ed b5 53 6d 24 0f |......y.....Sm$.| -000002e0 18 a8 eb cd 25 bb bb 24 64 25 4a 3e 04 00 16 f2 |....%..$d%J>....| -000002f0 9a 8b 8f 25 16 03 03 00 bc 05 1a 5b 08 49 0c 86 |...%.......[.I..| -00000300 8b 23 78 13 9e a7 3f ce 73 6b 30 ff 65 e5 a7 ba |.#x...?.sk0.e...| -00000310 a4 14 8e e2 4e 14 3a 43 d7 03 50 79 8a fb ea a6 |....N.:C..Py....| -00000320 03 06 8b d1 0b 2b 19 49 5c 50 34 67 ae 02 e7 f7 |.....+.I\P4g....| -00000330 c4 91 ff 33 ad 87 62 bd 35 e4 bf bf c8 01 9f f7 |...3..b.5.......| -00000340 69 74 b0 45 eb 10 f8 82 f6 bc 56 fa 0f 26 b7 cf |it.E......V..&..| -00000350 13 ad fa 0a 55 c1 06 b2 e7 4f 9f 75 fc 65 d6 ff |....U....O.u.e..| -00000360 e8 2d 21 22 52 bc a1 60 27 f9 7c 18 70 25 f1 76 |.-!"R..`'.|.p%.v| -00000370 8d 4a f9 83 6e a0 52 d7 37 fe 2b 1c f2 03 8e d7 |.J..n.R.7.+.....| -00000380 7d 51 a8 07 0b b8 9c e0 5d a3 ac cc bd d0 c9 8f |}Q......].......| -00000390 36 62 b7 9e 19 0d 62 82 fb c2 68 e3 0f 4f eb 3f |6b....b...h..O.?| -000003a0 33 ec f9 1a 3d c1 3d 68 46 1a 03 e1 fc 65 36 45 |3...=.=hF....e6E| -000003b0 76 c2 87 6e 21 16 03 03 00 4a 7e 1f 28 4d ae 0e |v..n!....J~.(M..| -000003c0 d3 90 13 53 ba 15 7a 68 88 1a ed 5f 50 3c 5d b2 |...S..zh..._P<].| -000003d0 11 5a 40 3a 11 44 a8 ce fa 37 b3 0a d0 02 1e cc |.Z@:.D...7......| -000003e0 f9 2f 6d 28 a8 f1 26 ea 52 36 52 5a 70 3f de 89 |./m(..&.R6RZp?..| -000003f0 5c 11 5f e0 ba 5e 18 b6 b8 b4 55 74 44 c5 a0 7c |\._..^....UtD..|| -00000400 73 7c 51 e5 16 03 03 00 14 2d fe a4 59 be 8a e0 |s|Q......-..Y...| -00000410 4a 6c e0 1a ae 8b ce 04 a0 f2 2f 1b f8 |Jl......../..| +00000000 16 03 03 00 81 28 ba 2e 7a 2b 59 83 ae aa ba c7 |.....(..z+Y.....| +00000010 d7 49 a5 ca c0 fc 8b 49 f5 10 77 ac e7 ae 12 de |.I.....I..w.....| +00000020 0d ad 0e 2c d9 ee 99 c4 95 7b 09 b2 91 27 44 6a |...,.....{...'Dj| +00000030 7c 08 ce bb 98 4a 1c 8c 47 30 21 c7 5d 1e 86 39 ||....J..G0!.]..9| +00000040 79 07 48 2a ac 90 7b 26 46 6a a5 b1 7c df fa ae |y.H*..{&Fj..|...| +00000050 0f 20 c8 f0 b5 65 57 2b d5 1f 14 cc bc 7e 94 42 |. ...eW+.....~.B| +00000060 b6 30 c1 d7 eb 8d 39 0f 65 7a b7 d0 38 21 eb b0 |.0....9.ez..8!..| +00000070 2d 04 5a 8b 9c 8b 24 91 fe de ac 1f f5 4f aa 74 |-.Z...$......O.t| +00000080 71 e1 98 8b df 2f 16 03 03 02 69 fb 1f be be 41 |q..../....i....A| +00000090 51 00 c5 48 bc a3 18 78 2c dc e3 59 d2 0d 23 c7 |Q..H...x,..Y..#.| +000000a0 2b 03 f3 ce 08 81 62 8a e9 59 52 06 2a cd 7f fe |+.....b..YR.*...| +000000b0 f4 58 5a a4 6c d1 fa f2 1e 31 7e c5 14 39 dc 37 |.XZ.l....1~..9.7| +000000c0 27 4f 70 ef 79 7e b1 d1 32 1b 3c cf 08 e2 8a 44 |'Op.y~..2.<....D| +000000d0 56 48 ea 85 8b 86 1d 77 ea 75 f2 c6 8b 14 9d 57 |VH.....w.u.....W| +000000e0 17 87 29 64 e1 ef 1a 46 25 ed e1 d3 e6 90 63 8d |..)d...F%.....c.| +000000f0 30 b6 4d 3c 98 68 45 95 78 11 2c c5 4e 2c 2b 3a |0.M<.hE.x.,.N,+:| +00000100 a8 8b 02 1c b9 15 09 ea 59 30 c7 a8 d5 28 f3 45 |........Y0...(.E| +00000110 77 eb bc bc 4a d9 82 4a 7d 8b 5e e1 36 17 ba 95 |w...J..J}.^.6...| +00000120 34 ea 7e d7 b8 0d 8c 63 07 30 d9 07 49 df b0 ea |4.~....c.0..I...| +00000130 aa 5e 95 7f 90 ab 09 79 31 88 27 00 9e bd 84 5b |.^.....y1.'....[| +00000140 ab f6 be 18 10 42 11 49 bd ce 42 dc 2b ae 8f 00 |.....B.I..B.+...| +00000150 a1 74 5a d1 e3 0b ba 62 57 5f 0e 65 e4 13 ce 78 |.tZ....bW_.e...x| +00000160 b1 da 89 03 f6 42 cd 1b fe 03 0c f4 89 77 07 bd |.....B.......w..| +00000170 fa 07 5a 4a 86 1f 47 15 2a 18 ec 26 36 e9 c7 04 |..ZJ..G.*..&6...| +00000180 75 bb 66 e1 32 97 65 e2 e8 2c b1 bc 39 14 3a d6 |u.f.2.e..,..9.:.| +00000190 77 d0 15 32 e5 58 eb 49 52 15 c6 d6 9c 4e 2d 97 |w..2.X.IR....N-.| +000001a0 5c 59 5a 51 11 71 1e 3b 1e 25 b8 20 ef 16 d0 27 |\YZQ.q.;.%. ...'| +000001b0 f9 ad 01 61 96 8c 50 a2 60 86 99 8c b3 cf 04 07 |...a..P.`.......| +000001c0 de 8a b3 85 53 95 28 e7 6c db 26 42 b2 6c 51 3c |....S.(.l.&B.lQ<| +000001d0 b7 54 98 ff 78 48 b2 8e 11 b9 3b 59 b9 38 0b 48 |.T..xH....;Y.8.H| +000001e0 ac 11 b3 0c b2 f7 98 58 64 ce 16 ae 78 9f 39 ce |.......Xd...x.9.| +000001f0 20 2b c3 14 74 54 17 54 8e a1 b7 ed 48 77 37 a0 | +..tT.T....Hw7.| +00000200 12 18 77 b2 ab 51 d2 e3 fc 6a af b3 a2 4b 60 87 |..w..Q...j...K`.| +00000210 fb f9 0c e8 33 84 e1 6b 95 f0 af 04 c3 c7 b7 0d |....3..k........| +00000220 bd f2 a6 26 f4 b2 15 c0 9e 90 1b cf 66 3f f8 1e |...&........f?..| +00000230 64 bf 91 30 b9 2f 31 5b 76 99 67 50 6e b3 fa 00 |d..0./1[v.gPn...| +00000240 1f 1f 50 1d 52 ea f9 98 7d 59 3a 1d 10 b5 cf 00 |..P.R...}Y:.....| +00000250 49 a6 72 78 2c e8 2a b2 64 38 34 55 25 b1 4f f7 |I.rx,.*.d84U%.O.| +00000260 3d 5d 18 d8 63 c4 34 b9 78 15 19 c8 6c d8 03 e9 |=]..c.4.x...l...| +00000270 0b cb bd 0c b1 32 9c 32 57 ad 7f bd cd db 99 77 |.....2.2W......w| +00000280 7f 2a 01 60 c6 ce 99 a9 a0 17 ae 02 0c 72 67 b2 |.*.`.........rg.| +00000290 0e d3 24 c4 88 96 7f ab c2 46 fb fe 47 b0 72 a0 |..$......F..G.r.| +000002a0 87 6b 22 00 ee 97 ce 13 eb ab 5b 41 2e 60 79 a1 |.k".......[A.`y.| +000002b0 4b d1 8f d2 d0 5b 02 77 9c 29 1e ea 3e 30 a9 8f |K....[.w.)..>0..| +000002c0 07 b7 22 2a d7 64 50 cf 0a 34 6b db b8 8d e4 f6 |.."*.dP..4k.....| +000002d0 50 71 65 54 0f e0 87 93 ca 3e 1b 68 29 2f d9 dd |PqeT.....>.h)/..| +000002e0 15 76 f0 c3 1c a4 ca e9 5f 17 29 87 bb 0a 5b 74 |.v......_.)...[t| +000002f0 6c 2d 13 63 16 03 03 00 bc a6 81 fa a1 7b 6e 54 |l-.c.........{nT| +00000300 0b 47 30 a5 e9 ca e6 86 db f9 af 19 5e fe ae a6 |.G0.........^...| +00000310 91 c8 e9 c0 c5 17 b4 a6 2b cd 40 ee 9e fc 2d ef |........+.@...-.| +00000320 8c 68 6c ce 05 66 b1 80 7d 6f 07 91 6e 9f 23 ab |.hl..f..}o..n.#.| +00000330 f2 a7 d1 99 d1 5f ed 58 b1 aa 7f 31 f4 7f 2a ea |....._.X...1..*.| +00000340 3e 21 a0 4e 1c 49 d9 ab 1e 43 84 dc 42 cf f5 75 |>!.N.I...C..B..u| +00000350 ae fc 97 a3 e7 b8 51 1b 68 1b f5 83 2b 2d b0 a5 |......Q.h...+-..| +00000360 7c f9 f2 21 c1 68 d9 e2 4f bf f5 1e e6 90 7b 54 ||..!.h..O.....{T| +00000370 2c 45 d2 35 a1 5c da 57 be ce 90 a7 56 90 f2 55 |,E.5.\.W....V..U| +00000380 08 9e b1 52 09 12 b9 f1 8b fd fb 1a f2 9f 39 bf |...R..........9.| +00000390 73 c2 9c dc 6c 0f 19 9b 37 ec 91 86 27 ec 1a e8 |s...l...7...'...| +000003a0 92 f8 a2 05 71 12 e6 8b 04 0c f3 b4 4d 93 d4 b4 |....q.......M...| +000003b0 69 7b c3 9c 22 16 03 03 00 4a ba fe c0 02 30 02 |i{.."....J....0.| +000003c0 33 02 67 87 19 20 13 90 48 80 a1 93 97 cc a6 26 |3.g.. ..H......&| +000003d0 51 14 4d 2b 60 3d da 72 f0 99 51 2a 8b b4 54 ff |Q.M+`=.r..Q*..T.| +000003e0 47 6b 6c b4 6a 92 a9 9c 3c c0 ee ae 79 25 de 17 |Gkl.j...<...y%..| +000003f0 61 cf 06 37 6f 84 e8 b8 4c 7b 9a c1 a1 ff 6e c5 |a..7o...L{....n.| +00000400 f3 0b 7d 8d 16 03 03 00 14 a9 38 b9 f0 df 71 c5 |..}.......8...q.| +00000410 1f fa 77 04 1e b4 4c 2b 64 01 e6 59 cb |..w...L+d..Y.| >>> Flow 9 (client to server) -00000000 16 03 03 02 69 70 17 aa 0e 85 63 a2 39 31 b1 d9 |....ip....c.91..| -00000010 b5 a0 4b 6d 29 eb 23 6c fb 66 11 6f 46 16 65 5e |..Km).#l.f.oF.e^| -00000020 79 75 aa 45 1f eb 07 99 0d 34 fa 10 90 32 5a 94 |yu.E.....4...2Z.| -00000030 2c 85 b2 8f 27 1d ae 15 49 c0 92 49 58 84 54 2a |,...'...I..IX.T*| -00000040 35 d2 f5 56 fd ed c7 0f 33 fe b4 b8 9c 5c 7e 1e |5..V....3....\~.| -00000050 59 ee 41 3e 0c b1 30 f7 2a f4 ca 2c c3 9a 0a a1 |Y.A>..0.*..,....| -00000060 96 96 81 61 77 e4 f2 f5 59 9a 57 71 31 89 7e 25 |...aw...Y.Wq1.~%| -00000070 55 ef 4c 45 8b 54 c8 83 09 41 49 c6 3e cb fe ff |U.LE.T...AI.>...| -00000080 15 ee 48 51 b4 06 c0 c0 27 fb df d1 99 c5 f0 bf |..HQ....'.......| -00000090 fe 07 0b 49 88 fe 53 cf d7 58 12 16 77 5a d1 27 |...I..S..X..wZ.'| -000000a0 29 a2 00 de 48 a6 d3 e6 b2 87 86 55 03 f5 84 3a |)...H......U...:| -000000b0 84 bf 58 ab 48 bc d0 1e f9 89 be 03 d5 af 4b 06 |..X.H.........K.| -000000c0 f2 b5 42 c7 ef a4 bb 92 d1 23 64 ba 36 16 bc ed |..B......#d.6...| -000000d0 ff 3a 43 3a 71 31 66 b5 34 a4 bb 92 3c e2 3e 7c |.:C:q1f.4...<.>|| -000000e0 b2 bb b4 c5 db 1a d4 a8 9a da 16 44 b3 8f 31 39 |...........D..19| -000000f0 3e a7 58 2d 58 af d3 bb ff 70 7e 9d 54 de 90 01 |>.X-X....p~.T...| -00000100 c8 ef d9 24 50 b5 12 c2 ca 7d f6 bf c6 38 1b ad |...$P....}...8..| -00000110 4f 78 70 3d 64 4b 25 4f bc 84 67 5c e1 c6 a4 b7 |Oxp=dK%O..g\....| -00000120 7e 05 30 ad 53 42 d7 40 c8 c0 4d 1b 0c fe 10 a9 |~.0.SB.@..M.....| -00000130 dd 4a 5e 11 3a 79 b7 10 59 a6 5e ef 51 6f cc 4a |.J^.:y..Y.^.Qo.J| -00000140 43 fb fd 5a 51 56 7d d7 d6 23 20 13 13 33 91 43 |C..ZQV}..# ..3.C| -00000150 80 9a 4c e7 f6 78 18 25 02 4a dc 38 19 16 91 ef |..L..x.%.J.8....| -00000160 c9 a6 67 c0 66 85 77 13 3a ff 21 01 ba 65 fc d3 |..g.f.w.:.!..e..| -00000170 23 d8 92 ae 46 a7 a4 7f 5f 57 3d 6d 7c f9 9c d7 |#...F..._W=m|...| -00000180 3d 56 54 4a 69 1d 62 38 d3 75 5c 9b a8 c9 b5 4e |=VTJi.b8.u\....N| -00000190 b7 d6 9e 1a 51 76 57 7b bd bb bd 4b e8 ed 2f df |....QvW{...K../.| -000001a0 34 72 6a 9c 54 3f ff f4 fe 30 3a 4f 2c 74 97 59 |4rj.T?...0:O,t.Y| -000001b0 03 8c cc 71 f3 63 c8 04 55 37 e7 39 5c 0a 84 c6 |...q.c..U7.9\...| -000001c0 75 fc b1 7f 24 59 e0 ca 59 50 29 1a 0d d3 27 47 |u...$Y..YP)...'G| -000001d0 9e ea 6d 66 5a 22 e7 0d 10 56 a2 95 de 84 0e 7e |..mfZ"...V.....~| -000001e0 6d 3a 63 d3 b4 c3 8c 61 79 f5 0a 69 51 a6 c9 69 |m:c....ay..iQ..i| -000001f0 8d 3a f8 e5 7c 04 6b ed c7 5e 70 61 d4 38 c2 93 |.:..|.k..^pa.8..| -00000200 84 26 23 c9 84 a5 ee b5 35 a9 18 6d 84 b1 bd de |.&#.....5..m....| -00000210 72 14 73 a4 ab db 68 47 b3 13 37 e7 56 a3 35 0d |r.s...hG..7.V.5.| -00000220 2c 54 88 21 d4 f1 2f ed 74 85 d6 19 45 9d 62 fa |,T.!../.t...E.b.| -00000230 02 45 d3 14 c9 8f df bd 9f fe da ab c7 e7 4c 96 |.E............L.| -00000240 62 92 ee 4f 41 99 4a 04 18 01 63 cf d1 f6 8a b0 |b..OA.J...c.....| -00000250 b5 d5 f7 26 c6 4a c7 a2 d0 f1 72 3b bf 20 82 c3 |...&.J....r;. ..| -00000260 23 c7 be 4c 55 35 c6 53 27 aa 99 38 8c da 16 03 |#..LU5.S'..8....| -00000270 03 00 35 ba 6e aa 5f 90 48 ee 19 33 dd 0d fc 31 |..5.n._.H..3...1| -00000280 cb ce 1e f2 7b 6b ff 44 60 90 88 13 c6 50 2b f5 |....{k.D`....P+.| -00000290 50 ba 48 ce 6e 3c e5 96 a8 30 bf bd de ba ab 21 |P.H.n<...0.....!| -000002a0 da ff 8b 50 4b 65 5f a3 16 03 03 00 98 87 74 48 |...PKe_.......tH| -000002b0 d2 88 7a b1 67 57 b0 c2 01 be e0 e9 41 6a 56 8f |..z.gW......AjV.| -000002c0 87 6c d2 37 09 45 40 59 9c 50 83 1b 48 6c b4 e4 |.l.7.E@Y.P..Hl..| -000002d0 d3 9b 6d 46 89 83 2a 88 4c b3 b2 58 29 3e 41 76 |..mF..*.L..X)>Av| -000002e0 4c 8a a0 cb aa e9 17 7f 48 7b 14 8a f7 ba 31 b4 |L.......H{....1.| -000002f0 b6 3a e0 12 e6 88 8c 24 5f 97 93 46 bf 27 f3 fd |.:.....$_..F.'..| -00000300 e4 d4 54 54 9e 46 b6 1d 8e 8d 20 49 7e bd 6f 09 |..TT.F.... I~.o.| -00000310 55 af 5d 7f 24 df 69 1b dc a5 76 0c 34 e7 af 4c |U.].$.i...v.4..L| -00000320 2c 1d 2c db 97 37 81 29 41 c1 4e 65 65 33 44 7c |,.,..7.)A.Nee3D|| -00000330 34 a2 dd fd 38 e4 e3 e1 dc af 2f 3f 64 2c 40 80 |4...8...../?d,@.| -00000340 cc ff d2 d4 a7 14 03 03 00 11 8a 81 be 84 7b 14 |..............{.| -00000350 28 fc b3 a5 ad 75 d6 ee 6e 5d 9b 16 03 03 00 20 |(....u..n]..... | -00000360 87 3c 57 93 46 06 f0 6f 18 ce 33 5d 77 33 6c a6 |.>> Flow 10 (server to client) -00000000 14 03 03 00 11 79 d6 72 03 0f 48 d1 78 b5 5e 31 |.....y.r..H.x.^1| -00000010 d6 e0 42 bc 6e 60 16 03 03 00 20 3b f1 7f a5 ab |..B.n`.... ;....| -00000020 b7 b7 10 db 3d d6 7a 8a 5a bc c5 af 58 ca 5a 0b |....=.z.Z...X.Z.| -00000030 07 27 2d df e9 aa 44 47 73 ab c5 17 03 03 00 19 |.'-...DGs.......| -00000040 0c d2 a9 df 85 db f3 99 1d 4a ce 4e 40 69 2f d7 |.........J.N@i/.| -00000050 d7 0b e3 dc b8 af 56 99 89 16 03 03 00 14 01 f2 |......V.........| -00000060 5b 6b c9 00 1c 12 e6 14 8d b6 ea 0d 18 19 a9 bd |[k..............| -00000070 07 e3 |..| +00000000 14 03 03 00 11 ab e7 45 c8 02 30 54 0f 5a ea 63 |.......E..0T.Z.c| +00000010 42 ea 39 9b 46 ba 16 03 03 00 20 60 56 50 ad d0 |B.9.F..... `VP..| +00000020 fe 7d 56 a2 e1 d9 87 76 96 3b b3 27 3b 7f be e4 |.}V....v.;.';...| +00000030 98 d0 7a 6a a2 e3 37 1c f5 a9 a1 17 03 03 00 19 |..zj..7.........| +00000040 67 ee fd 6d 58 de bd b8 df aa 4d 36 e4 93 83 7b |g..mX.....M6...{| +00000050 e5 bd d1 ba 5c f3 2f aa a8 16 03 03 00 14 73 29 |....\./.......s)| +00000060 15 c9 16 62 a2 97 81 f8 44 94 86 c1 94 37 9f 19 |...b....D....7..| +00000070 1d c2 |..| >>> Flow 11 (client to server) -00000000 16 03 03 01 14 5d 6b cf 2d 1d 78 18 d3 88 51 6c |.....]k.-.x...Ql| -00000010 34 c2 bb f0 e6 a9 8c d9 19 7f f8 3e c1 13 19 2b |4..........>...+| -00000020 61 65 46 cd 4b 3d 2e 91 a4 32 5e 49 ac 4c 67 8c |aeF.K=...2^I.Lg.| -00000030 4a 82 70 18 ac c5 70 b5 c8 9b 6b be 01 0d 91 ca |J.p...p...k.....| -00000040 ea 4d 78 e3 e5 e7 0c db 6b f4 03 31 11 e8 32 ea |.Mx.....k..1..2.| -00000050 bf 6b c2 0d f8 5f 5b 56 20 e9 81 41 53 59 e9 0e |.k..._[V ..ASY..| -00000060 a6 53 59 2e d3 cd 36 02 54 b3 c3 d5 70 64 41 b7 |.SY...6.T...pdA.| -00000070 82 55 10 89 7e 3e 4d 5b c3 32 57 ee 6c 80 6c b7 |.U..~>M[.2W.l.l.| -00000080 4e 20 ac 13 cb 9c 78 b3 eb fb 8d 0c 8a e4 4a 58 |N ....x.......JX| -00000090 de 71 71 6a 54 74 5f 12 3a 52 0f 14 93 1b f7 8f |.qqjTt_.:R......| -000000a0 14 fa 76 76 19 5b eb 8d 61 d7 ed c7 68 ed 1b 9d |..vv.[..a...h...| -000000b0 1b 91 e4 92 df 88 4f af 3c 43 38 fa 0d 19 51 3a |......O.| -000000e0 90 6e 9c 03 ff 9e 44 34 43 38 b6 0f 1f 57 11 cf |.n....D4C8...W..| -000000f0 c3 ad 0d 70 98 6e e5 70 7b 76 c7 f1 6b 69 2f 40 |...p.n.p{v..ki/@| -00000100 df fe 47 c4 32 35 1d 03 42 a0 cc ee dd 5f 34 da |..G.25..B...._4.| -00000110 74 85 4d 56 de e4 bd 0d b5 |t.MV.....| +00000000 16 03 03 01 16 bb 29 a6 76 e4 5a ec 09 4e a7 6a |......).v.Z..N.j| +00000010 66 d7 6e 39 fc 5a dd be 9f 34 1e cb 3a b3 3f 1e |f.n9.Z...4..:.?.| +00000020 48 ad 0b e0 0e 43 b1 3e 57 f3 4a d1 c7 c6 1a f0 |H....C.>W.J.....| +00000030 a8 3e d1 37 de 95 ad 0f 92 85 ee b2 2b 1c 30 2f |.>.7........+.0/| +00000040 f5 70 ca 42 28 0c c2 e4 06 73 d5 eb 31 d2 86 f7 |.p.B(....s..1...| +00000050 d6 42 5d e0 b0 a6 c0 94 2c 52 0b 18 2c 95 9c 2a |.B].....,R..,..*| +00000060 56 4d a4 17 fb 51 49 be 3a 37 27 87 c7 d5 94 56 |VM...QI.:7'....V| +00000070 88 c5 94 a6 ff a1 dd cf 2b 70 e1 6c a9 39 1b e7 |........+p.l.9..| +00000080 69 c3 0e ef 08 d2 fb 6d 54 8a 80 64 99 6a b3 e4 |i......mT..d.j..| +00000090 2e 44 62 ce 1c 4d 7a 0a 45 cd ba 52 23 47 6d 05 |.Db..Mz.E..R#Gm.| +000000a0 97 03 c6 c4 c7 5a ca bf 38 73 b4 8c e5 a5 14 1b |.....Z..8s......| +000000b0 10 ea 29 17 af f6 37 bd 7f 56 88 b2 63 92 9f b9 |..)...7..V..c...| +000000c0 6c 18 9b 1b ad ce ac f0 97 45 3e 72 e0 10 8e 64 |l........E>r...d| +000000d0 80 dc cd a1 f9 10 d1 cd 46 2a 98 cd 40 94 5b dc |........F*..@.[.| +000000e0 f5 07 05 96 f3 74 db 91 3c 45 f1 6e b7 f9 52 e8 |.....t..>> Flow 12 (server to client) -00000000 16 03 03 00 81 06 1c 3a f7 71 f8 76 6c b0 7b fc |.......:.q.vl.{.| -00000010 04 d3 69 d9 6d 26 1c 0b fb 7e 16 41 78 bc ba b8 |..i.m&...~.Ax...| -00000020 ee 1f f5 00 e7 1d 32 84 7f 87 66 cb f9 5e e5 6c |......2...f..^.l| -00000030 26 f9 64 83 13 49 a6 ab 98 a2 74 25 61 e1 3a ec |&.d..I....t%a.:.| -00000040 f8 8f 0b e4 ca c3 0d 52 76 38 e2 d1 86 ac ee 7b |.......Rv8.....{| -00000050 5c 69 96 e3 ec 3b f0 5a 4c 5e 8b 73 8f 24 75 bc |\i...;.ZL^.s.$u.| -00000060 7a 48 b3 b2 cc 55 7d 20 4a e1 9b 90 5e 47 b5 71 |zH...U} J...^G.q| -00000070 88 e6 8a a1 a4 f6 45 8e 8b 5b ed 45 96 95 96 7d |......E..[.E...}| -00000080 8b 7c 4d 03 64 34 16 03 03 02 69 d5 41 cd af 43 |.|M.d4....i.A..C| -00000090 42 5f f3 98 87 0a 55 7f c3 02 9c dd b5 8c 22 2e |B_....U.......".| -000000a0 8f 52 71 29 8a 33 dc 22 45 fc 61 bf b4 db fe 4c |.Rq).3."E.a....L| -000000b0 de 69 10 69 df a2 45 e5 fa 78 e8 1c 0a d0 c6 7d |.i.i..E..x.....}| -000000c0 7e 26 3b 12 e0 56 a2 c7 b8 cd 2a 15 8d 20 2a 86 |~&;..V....*.. *.| -000000d0 67 f6 e8 36 3d c6 3e 75 09 15 ba 36 37 46 f0 45 |g..6=.>u...67F.E| -000000e0 de 7a 49 fd 32 3c fc 2f ab de 9c 28 f7 20 ad aa |.zI.2<./...(. ..| -000000f0 e7 10 60 24 71 35 bf 1c ba 4e 98 92 e0 44 0a 39 |..`$q5...N...D.9| -00000100 3c f6 7d 0f 4f aa b4 db 22 7b b5 cc f6 0a 59 46 |<.}.O..."{....YF| -00000110 ba 8d ef dc 13 b5 bd 55 cd 73 50 e7 cb b3 08 3e |.......U.sP....>| -00000120 0c a2 d7 5a 12 bf ce 99 8d 05 ee 4a 03 e9 b7 65 |...Z.......J...e| -00000130 0c 1e 41 46 08 bb 2c 9e 7e e2 c1 6f 3d 9f f4 e2 |..AF..,.~..o=...| -00000140 cc c5 7c b6 87 aa 49 8e a6 67 46 88 d0 ae 17 c9 |..|...I..gF.....| -00000150 14 ae 63 67 bc 57 02 8f 84 90 17 e0 1d 48 80 c2 |..cg.W.......H..| -00000160 7a f2 be c1 5a 44 b3 f3 3a 9a ac b0 41 87 a7 07 |z...ZD..:...A...| -00000170 bb b2 7d 7c 0d 42 a3 c6 d8 d9 ef 0c c6 5b 14 f6 |..}|.B.......[..| -00000180 82 cd 12 01 39 78 dc b2 46 59 22 22 1f d9 39 cf |....9x..FY""..9.| -00000190 b6 ac 13 be 22 50 37 10 33 01 0e 13 ee bc f3 bf |...."P7.3.......| -000001a0 55 c6 61 2a e0 ee 25 f3 01 35 69 7a 74 70 bd 6c |U.a*..%..5iztp.l| -000001b0 d5 08 c5 a3 09 71 8d ea 39 ec 0e c0 f0 16 2f 71 |.....q..9...../q| -000001c0 86 af 28 d9 3e d4 45 b2 ce e7 f8 2b bd 54 9c 98 |..(.>.E....+.T..| -000001d0 85 7d 2a f8 fe a5 95 0b da 08 2a 32 f7 c3 ad 09 |.}*.......*2....| -000001e0 2a aa ee ee 54 fa d5 2d 84 45 cf a0 2c 9c 9b 4a |*...T..-.E..,..J| -000001f0 3c 86 4f 20 12 a7 8a b5 91 36 a9 d2 1a 76 2d 1f |<.O .....6...v-.| -00000200 61 8d 5c 69 15 a1 36 ce 6b 99 48 c9 73 b0 58 69 |a.\i..6.k.H.s.Xi| -00000210 38 c2 48 5d 74 69 7b fb e8 b1 0f a1 03 d6 bd 5f |8.H]ti{........_| -00000220 5c 44 fa 0f 33 33 ce f0 ab 02 f3 26 9f bc 5b 3d |\D..33.....&..[=| -00000230 3f 08 00 a9 1b a5 ee 92 8c 62 a5 32 22 10 05 0e |?........b.2"...| -00000240 bb 59 03 03 6f 5f d1 39 3e 14 66 2f 92 e6 5a 21 |.Y..o_.9>.f/..Z!| -00000250 3a ae b0 12 2c 74 f1 b1 d7 55 9b e9 0c 2a c5 db |:...,t...U...*..| -00000260 ac ae a3 69 49 de 4b 10 68 d4 05 f2 ff 4b c6 21 |...iI.K.h....K.!| -00000270 f8 a7 8f dc 5f 82 f9 4f cf 2e 68 1a 7b 6f 3a eb |...._..O..h.{o:.| -00000280 13 a8 c3 9f 86 aa 80 d3 5c f0 b0 f5 7b 8b 91 2c |........\...{..,| -00000290 e3 d2 bd 9c ad 66 dc 7c 77 0d 73 4e 0b 51 91 23 |.....f.|w.sN.Q.#| -000002a0 f3 38 bb 2b 5a ee 1a 1e 39 40 b1 a3 b9 14 0f 16 |.8.+Z...9@......| -000002b0 78 c9 4a 6e df c4 a4 ce 53 e9 a1 f9 17 14 0a e6 |x.Jn....S.......| -000002c0 b6 3e 4a 25 6f 6e 00 8c a5 67 98 ec e3 22 fe 30 |.>J%on...g...".0| -000002d0 1d 43 c7 62 c8 2a a5 6f 88 99 f6 d1 ba 8a 73 16 |.C.b.*.o......s.| -000002e0 2f 11 b6 a3 46 25 59 67 6e 8b 38 ec ad a4 06 19 |/...F%Ygn.8.....| -000002f0 6e 2e 6c 39 16 03 03 00 bc b5 1d 9a f1 bd 76 6b |n.l9..........vk| -00000300 01 48 91 51 c4 d1 9a a6 35 f5 a8 b3 51 f3 98 cb |.H.Q....5...Q...| -00000310 6d 0e 6d 4f 6f 8b 2b dd 2c 3b b5 0e f0 c5 6a e6 |m.mOo.+.,;....j.| -00000320 ed 04 60 94 3f d2 6a af cf 9b 25 7f d9 56 4e 48 |..`.?.j...%..VNH| -00000330 2c 6b 9c 2c 68 da ed 83 87 13 90 0a 77 39 7e 69 |,k.,h.......w9~i| -00000340 ec 2c 4b bb 51 82 55 9d 8e 59 69 6e 72 dd 4d fb |.,K.Q.U..Yinr.M.| -00000350 2a 5c cf ef 47 13 8d 94 48 5e e8 8f 2c d4 47 14 |*\..G...H^..,.G.| -00000360 82 aa e4 24 04 3f 8c ef c8 3b 15 c0 53 63 b5 6b |...$.?...;..Sc.k| -00000370 ee f7 16 45 17 e4 6b 41 99 4b 18 34 c8 7c 09 f5 |...E..kA.K.4.|..| -00000380 3a f3 79 06 ea 5d f8 96 48 9d 6f c7 ac 55 b0 9e |:.y..]..H.o..U..| -00000390 f9 95 6d e2 31 ce ac 6a b6 4e 8d 66 16 1f dd d9 |..m.1..j.N.f....| -000003a0 e2 2a c6 7d fa ef 37 e6 7b 01 a1 f7 71 76 14 9a |.*.}..7.{...qv..| -000003b0 08 ed a9 f7 8d 16 03 03 00 14 aa 66 05 9c d7 08 |...........f....| -000003c0 9e d8 82 f7 91 18 57 23 4d 9f e9 17 ee f3 |......W#M.....| +00000000 16 03 03 00 81 47 d2 a4 b9 04 d0 39 aa 1f d3 7a |.....G.....9...z| +00000010 f2 c3 a5 03 8a 35 6c 6b bf 18 02 62 d3 ab 8a 0f |.....5lk...b....| +00000020 99 69 f3 84 45 7a 09 28 09 68 3a 67 8a ee 94 b1 |.i..Ez.(.h:g....| +00000030 d3 2a e6 37 b7 f1 88 df c0 18 42 96 78 4e cf 3b |.*.7......B.xN.;| +00000040 e9 35 50 af ee 96 52 e9 1c 58 47 79 87 97 ce d9 |.5P...R..XGy....| +00000050 71 9b 4a 47 bc 60 8f 95 ea 75 4e c8 3e ca 79 0f |q.JG.`...uN.>.y.| +00000060 22 b2 37 19 12 d6 08 4d 01 93 d9 86 ed 4c 9e 42 |".7....M.....L.B| +00000070 fb 9b 37 26 98 33 74 cf 84 f4 e1 23 81 6f b6 b2 |..7&.3t....#.o..| +00000080 a9 27 e7 88 50 77 16 03 03 02 69 6b 78 db e3 0e |.'..Pw....ikx...| +00000090 cc 07 a4 96 1f 75 13 6d fe cd 3d 36 8c b0 44 e9 |.....u.m..=6..D.| +000000a0 4a 3a 41 26 c9 8c 2f 25 28 9d a8 7b dd df 28 6a |J:A&../%(..{..(j| +000000b0 fc ef 87 d4 06 dd 4e 05 ff 40 e3 6c 49 94 ad 1c |......N..@.lI...| +000000c0 c2 30 cc 41 35 39 a2 70 95 db de a7 c0 aa 05 c0 |.0.A59.p........| +000000d0 a2 a7 18 8e ba 70 ee 4b 0d 8d de 98 c7 8a 58 9c |.....p.K......X.| +000000e0 8b 51 f7 8f bb 7c 8f f7 60 53 9e 11 7e 5c e6 25 |.Q...|..`S..~\.%| +000000f0 be 22 aa 0a 3d 35 1c ac 2b 7d 98 fc 01 3a a9 9d |."..=5..+}...:..| +00000100 bf b5 d1 ae 10 52 ae 17 f6 df fc 24 38 0b f2 64 |.....R.....$8..d| +00000110 a8 9a 5c ff cb 42 bd 9d af 41 4d 6b 22 67 94 ac |..\..B...AMk"g..| +00000120 6b 95 2e 43 41 5d 5e c9 67 29 5f f8 8e 13 9d 18 |k..CA]^.g)_.....| +00000130 3c d4 ff 20 66 ff a6 d1 84 1a 33 31 27 5d 28 b5 |<.. f.....31'](.| +00000140 24 57 43 c1 83 6a e7 8c 35 0c a7 6f 5e 78 e8 84 |$WC..j..5..o^x..| +00000150 7c ee 9a 94 dc fd f7 a4 10 3d bb 66 0a 17 14 e7 ||........=.f....| +00000160 d7 29 47 f7 70 76 d6 ec b2 3c e2 a0 22 e6 c5 c3 |.)G.pv...<.."...| +00000170 bf a6 94 72 8b 70 eb 2b b8 4f c9 7d 72 22 75 ce |...r.p.+.O.}r"u.| +00000180 b9 c2 34 08 ac 87 d3 a8 35 81 f7 5e 20 02 0c e8 |..4.....5..^ ...| +00000190 0a 47 4e 37 4a 03 6d b1 c5 8f 29 77 80 c7 6c 5c |.GN7J.m...)w..l\| +000001a0 c3 3e 6f 3d 02 ee 5e f2 fb 20 a2 ad c1 5b 2c 02 |.>o=..^.. ...[,.| +000001b0 ef dd 81 e7 ea af f0 01 4f 0b eb f8 a1 82 3d ee |........O.....=.| +000001c0 be b5 09 df f2 34 49 f0 e8 f3 bc 7e e7 6a 14 0d |.....4I....~.j..| +000001d0 e4 aa e5 38 8a 2c 15 01 52 48 83 46 50 13 2b 71 |...8.,..RH.FP.+q| +000001e0 f4 48 1a 3d 3f 14 dc 3c ba fc a8 68 57 44 5d f1 |.H.=?..<...hWD].| +000001f0 f4 7f 23 8d ca f1 75 99 8c 36 99 38 b9 06 85 d0 |..#...u..6.8....| +00000200 a6 76 8b ae 7e 2a 26 cb cc 9e 8c 7c 98 e6 00 86 |.v..~*&....|....| +00000210 a9 d4 cb 42 8c 04 dc 6b 37 1e 8b e2 98 90 0f b3 |...B...k7.......| +00000220 c0 ea 07 1c 92 45 39 65 12 90 41 23 93 55 59 13 |.....E9e..A#.UY.| +00000230 22 e1 68 05 cc 5d ef a2 40 85 fb 61 d5 53 cb 77 |".h..]..@..a.S.w| +00000240 63 7b 16 bf c6 17 57 fb 58 1e d2 86 1a 4a 79 a2 |c{....W.X....Jy.| +00000250 1f da 2c 64 65 1c 7c 13 21 1b 33 22 36 0e 03 41 |..,de.|.!.3"6..A| +00000260 8e 6a 78 98 ae 29 71 3e 5c be 5f 83 55 f4 80 2d |.jx..)q>\._.U..-| +00000270 b8 2a b8 84 bd 97 7c 60 03 ae 67 77 44 47 70 c2 |.*....|`..gwDGp.| +00000280 09 0d 1b ed a8 17 8e 84 97 1a b4 75 c2 48 86 bd |...........u.H..| +00000290 b1 3c 1f 7c 1a 5b 60 10 a0 66 aa 8e f7 ba 9b e8 |.<.|.[`..f......| +000002a0 35 6c 46 f0 67 3f f1 8b 5f a0 be 31 2e 45 22 80 |5lF.g?.._..1.E".| +000002b0 ba d1 ff 88 f0 c8 bd 31 84 64 6a 07 02 75 bd 99 |.......1.dj..u..| +000002c0 f1 aa 3c 9d 0e b8 f4 76 b3 24 4f 68 f0 83 b1 da |..<....v.$Oh....| +000002d0 eb 70 1e 27 f4 17 90 a4 bc e5 1f d8 8b ee a1 e4 |.p.'............| +000002e0 1e c5 f4 a2 5b c3 0c 6d 2e c8 0e 67 89 4b d9 fe |....[..m...g.K..| +000002f0 9b a0 15 97 16 03 03 00 bc 2c e6 a2 fe 1b d7 1e |.........,......| +00000300 38 85 ef 39 d1 d6 df ae c4 7f af b2 ff c2 92 0b |8..9............| +00000310 37 e3 5c a9 6c 2c 9e f7 0e a3 88 ee 09 14 6b eb |7.\.l,........k.| +00000320 46 81 74 4a a7 f8 39 82 7d a0 16 69 e4 17 52 f0 |F.tJ..9.}..i..R.| +00000330 16 5f f7 2a a1 a0 a2 bb 41 4c 0c f9 9c e3 af 5e |._.*....AL.....^| +00000340 bd 43 47 2d 6d 4a 88 60 95 52 29 94 3d ec 75 d4 |.CG-mJ.`.R).=.u.| +00000350 dc f5 01 4a 57 fd 7b 96 13 75 5b ed a8 9d 29 5f |...JW.{..u[...)_| +00000360 5f 28 dc 04 3a 91 0f 6b d6 7d 32 fe 75 cd 61 49 |_(..:..k.}2.u.aI| +00000370 1b 6d b3 c6 41 87 6b 2d 09 e1 3d 8e f5 fb 9b b7 |.m..A.k-..=.....| +00000380 04 9a 01 ab 82 e5 2b 17 4f 93 d7 ef 31 79 10 b0 |......+.O...1y..| +00000390 1c cb 17 5b 8a 7a e9 22 ea 83 68 93 68 f6 85 34 |...[.z."..h.h..4| +000003a0 d1 4d 75 5a b3 69 46 42 92 04 09 47 b1 8e 67 ad |.MuZ.iFB...G..g.| +000003b0 47 4e 2c 02 48 16 03 03 00 14 b0 40 bb eb e1 a6 |GN,.H......@....| +000003c0 94 fd d0 8a e1 91 a7 c9 d2 4b f8 95 95 c7 |.........K....| >>> Flow 13 (client to server) -00000000 16 03 03 00 35 9c d8 7f 73 12 30 50 85 5c 45 76 |....5...s.0P.\Ev| -00000010 ea c9 c6 4d af 5a 6a 4d a1 89 1e cd 6d 6a b7 49 |...M.ZjM....mj.I| -00000020 cc 3f d5 19 6e 20 d7 f0 8f 1f 62 a1 17 a5 b8 68 |.?..n ....b....h| -00000030 c0 67 f4 5d 97 76 42 00 4f 51 14 03 03 00 11 bb |.g.].vB.OQ......| -00000040 bc 4b 90 9d cd a7 c1 2a c2 e0 26 0e 56 ff 13 53 |.K.....*..&.V..S| -00000050 16 03 03 00 20 79 6d 6d 5a c5 0c 6e be bb 5b f7 |.... ymmZ..n..[.| -00000060 66 02 50 f4 47 bf b3 bf 7c 76 e2 e1 ae dc 99 57 |f.P.G...|v.....W| -00000070 2c 31 bb 7f c9 |,1...| +00000000 16 03 03 00 35 25 1e 49 ad bf 9c 37 e2 d0 2b aa |....5%.I...7..+.| +00000010 44 91 d5 61 e7 a5 16 b2 cb 93 43 d7 a0 2b b7 19 |D..a......C..+..| +00000020 f2 41 d8 36 65 95 4a bb 68 1b 65 7b de 89 a5 af |.A.6e.J.h.e{....| +00000030 1a aa ec bf b4 66 97 fc 76 d0 14 03 03 00 11 94 |.....f..v.......| +00000040 b0 9b 4d 47 6e 63 e3 3d c4 a7 36 94 3f d2 04 a3 |..MGnc.=..6.?...| +00000050 16 03 03 00 20 34 f5 58 f2 80 c9 19 41 07 d8 6c |.... 4.X....A..l| +00000060 6f 64 e7 e9 76 65 cf a8 61 97 27 29 28 f8 0c 7a |od..ve..a.')(..z| +00000070 2c 5e 05 c6 53 |,^..S| >>> Flow 14 (server to client) -00000000 14 03 03 00 11 1b d5 02 f0 2f 26 af 60 d4 c5 18 |........./&.`...| -00000010 86 d6 d3 7a 70 7e 16 03 03 00 20 03 bd c7 ba 11 |...zp~.... .....| -00000020 ab 10 4e 29 23 6c c9 7e 04 b2 da f4 87 3b d7 f1 |..N)#l.~.....;..| -00000030 55 e7 09 29 99 f0 8f cc 3c 98 25 17 03 03 00 19 |U..)....<.%.....| -00000040 6b 68 7e 24 a0 ce 39 e6 1e ca 06 59 71 a1 b1 8a |kh~$..9....Yq...| -00000050 f0 eb 5d 30 84 04 46 64 5f |..]0..Fd_| +00000000 14 03 03 00 11 c3 73 b6 63 12 88 86 2b cb a8 94 |......s.c...+...| +00000010 9b c4 10 9f 98 cb 16 03 03 00 20 1e 06 97 84 3f |.......... ....?| +00000020 7f 2e 8d 1a 81 1d da d1 f5 53 5d a4 89 9e 90 22 |.........S]...."| +00000030 fd 14 58 d1 f7 b2 cd eb 42 2f e8 17 03 03 00 19 |..X.....B/......| +00000040 1f e3 dc 74 9d 6b 81 43 cb 31 6b 48 31 50 15 e8 |...t.k.C.1kH1P..| +00000050 80 f0 60 c4 43 f6 50 9a 3c |..`.C.P.<| >>> Flow 15 (client to server) -00000000 15 03 03 00 12 91 57 e3 8e 3b e2 17 df 7d 1a d1 |......W..;...}..| -00000010 cc 0d 9b bf fc f6 42 |......B| +00000000 15 03 03 00 12 33 e5 90 b6 f4 60 f4 da 3f f5 c4 |.....3....`..?..| +00000010 5c a1 a1 75 01 04 8a |\..u...| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected b/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected index 45c7804aaaf..f9a7a113744 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 e7 f0 26 e8 9f |....Y...U....&..| -00000010 05 30 9e e5 7c 31 a5 b8 a9 38 35 c3 9c c1 d2 d3 |.0..|1...85.....| -00000020 65 ab 3b 55 62 f9 c8 1f 6e 2e 57 20 0e 70 71 1a |e.;Ub...n.W .pq.| -00000030 59 05 45 40 2d 93 c4 0a 15 0b 16 0f 23 bb 28 33 |Y.E@-.......#.(3| -00000040 03 db 44 75 0a 0f 5e 0a 7b 9e 47 63 cc a8 00 00 |..Du..^.{.Gc....| +00000000 16 03 03 00 59 02 00 00 55 03 03 52 6a c1 e9 3d |....Y...U..Rj..=| +00000010 5e 12 f4 95 42 33 5e 56 98 6b e5 b9 c0 e2 b4 02 |^...B3^V.k......| +00000020 3e 99 0c 26 52 66 69 35 ef 4a 66 20 bb ee b5 86 |>..&Rfi5.Jf ....| +00000030 ec 40 54 e7 ef 93 8e cd e4 bd c2 57 e7 2b d3 86 |.@T........W.+..| +00000040 44 93 8f 4f 3a e3 4d eb 53 88 b0 43 cc a8 00 00 |D..O:.M.S..C....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,188 +60,188 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 04 06 15 25 55 6d c0 |........ ...%Um.| -000002d0 d0 71 c9 f8 4e d2 48 f3 7d 0b dc 99 a0 67 2a 5d |.q..N.H.}....g*]| -000002e0 eb ce a1 00 b3 d3 8d cd 4c 08 04 00 80 d3 0d 6d |........L......m| -000002f0 a1 41 2e b5 06 c0 e0 9b 70 c0 1a c3 45 61 3e 86 |.A......p...Ea>.| -00000300 02 a8 04 76 f2 87 1d 58 98 82 38 dc 01 9d 5a 53 |...v...X..8...ZS| -00000310 07 3c 65 66 68 bc e4 8f e9 d4 65 b1 0d 90 0f 7f |.>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 20 50 ea 05 19 9b 2d ea a4 e3 96 6c |.... P....-....l| -00000040 df b1 de db 80 da e9 65 da dd ad 35 42 7f ce fa |.......e...5B...| -00000050 43 79 b5 b7 60 |Cy..`| +00000030 16 03 03 00 20 6e 65 ea 6e 03 fb f9 4e 00 8f d1 |.... ne.n...N...| +00000040 99 24 83 3a 38 ef 28 7b 16 43 70 b5 af 0d de 37 |.$.:8.({.Cp....7| +00000050 cd bf ac 83 09 |.....| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 20 79 ce b5 0f d4 |.......... y....| -00000010 dd 4d 4b 19 9e d4 8c 49 41 2c 14 e3 2e b7 89 d1 |.MK....IA,......| -00000020 3f 9f 2f 90 21 8c 91 98 bf 0c 4a |?./.!.....J| +00000000 14 03 03 00 01 01 16 03 03 00 20 ef 39 04 ca 70 |.......... .9..p| +00000010 71 ee f8 1b 72 10 b7 6a 89 cd 85 ee a4 81 a4 87 |q...r..j........| +00000020 88 1b c7 5b 18 d9 95 fe 31 d9 c8 |...[....1..| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 97 1a f9 8d c2 df 57 b3 c1 10 b9 |...........W....| -00000010 2f 8f 3b 47 95 83 03 af 88 97 b1 |/.;G.......| +00000000 17 03 03 00 16 58 8c 23 1b 8d 7f 44 92 a4 5d 88 |.....X.#...D..].| +00000010 3e ee 7c 98 90 14 b4 61 e9 5c ea |>.|....a.\.| >>> Flow 6 (server to client) -00000000 16 03 03 00 14 30 98 ac 88 1f db 08 3a be 39 26 |.....0......:.9&| -00000010 d8 5a df b9 5e fe 26 72 09 |.Z..^.&r.| +00000000 16 03 03 00 14 32 2b 55 14 4a 65 21 51 b0 72 e0 |.....2+U.Je!Q.r.| +00000010 4c 57 b0 b1 78 0b e3 30 de |LW..x..0.| >>> Flow 7 (client to server) -00000000 16 03 03 01 14 a4 24 c3 2f 54 1c 65 c6 79 11 73 |......$./T.e.y.s| -00000010 a8 9b 6e 8b 81 08 e4 e1 8a 12 56 5d 93 cd 1a 0c |..n.......V]....| -00000020 a4 88 fe 2f a5 dc cf d0 1d 1b e8 d3 76 9e 8e a0 |.../........v...| -00000030 d8 70 44 7d b5 1e be 95 2d 21 c8 0d 0d d0 fe ae |.pD}....-!......| -00000040 b0 0b 73 35 f7 82 6d 0e 36 0f e1 34 cf b7 d4 51 |..s5..m.6..4...Q| -00000050 af d1 bc 83 3e 36 35 10 87 fd 59 ba 4b b5 fb 10 |....>65...Y.K...| -00000060 da 41 f2 ce cb ce 4f 4f 42 4c 11 71 5e 60 c3 13 |.A....OOBL.q^`..| -00000070 6a 10 44 3d 93 49 f4 01 aa c4 a1 6e 81 16 60 66 |j.D=.I.....n..`f| -00000080 d2 7f 22 df e2 68 86 13 d8 e9 e2 2a a3 d5 81 11 |.."..h.....*....| -00000090 af 36 9b 78 2e 33 e5 05 b6 47 1d 1c 3e 2c 43 57 |.6.x.3...G..>,CW| -000000a0 a5 1e 1b a6 b2 20 fa 53 80 cb 11 92 51 93 89 f6 |..... .S....Q...| -000000b0 1c 52 1d 32 c9 b4 ac b3 ac ad a1 02 a5 e1 50 e5 |.R.2..........P.| -000000c0 24 6e 91 75 58 72 39 c9 9b 59 f8 79 ed 08 40 7a |$n.uXr9..Y.y..@z| -000000d0 c5 3c 1c fc 44 9d d9 f6 35 f0 2a 61 a4 7a 8c f3 |.<..D...5.*a.z..| -000000e0 d5 81 e4 54 9d cf a2 14 aa 59 e7 6e 9d 0d e7 f1 |...T.....Y.n....| -000000f0 36 d9 db ef 56 c5 8d 95 89 3d 7c 99 f2 e7 b1 12 |6...V....=|.....| -00000100 4e 53 ca e8 84 cb ca 3c 2a 1d fd 4a e7 af 9b 35 |NS.....<*..J...5| -00000110 20 24 49 ff 95 67 b1 e1 98 | $I..g...| +00000000 16 03 03 01 16 ff 7a 5b 80 e0 cd 83 55 3d b5 97 |......z[....U=..| +00000010 60 d2 51 1e 75 d2 5d b9 ea 2a 5f 67 43 03 7c 50 |`.Q.u.]..*_gC.|P| +00000020 25 5d a2 81 5f fa 0f be 08 9d 80 ac 73 16 bc 64 |%].._.......s..d| +00000030 51 54 33 09 cc 05 90 24 c0 ee 99 a9 d1 8f 1b 3e |QT3....$.......>| +00000040 9f 6a e8 b6 83 b0 30 fe e6 6b 6e 37 dd 95 95 30 |.j....0..kn7...0| +00000050 64 46 c7 fc 15 54 84 ef 3d 1a 28 2d ee 3b aa 19 |dF...T..=.(-.;..| +00000060 60 21 f9 d1 98 04 b4 0f 08 79 34 1f aa 12 2e 60 |`!.......y4....`| +00000070 93 ff 87 16 56 55 24 c7 96 00 3b c2 72 7f 9d 96 |....VU$...;.r...| +00000080 8b b7 2b 50 8f 99 df f5 4c 6a 42 0a cc 2f 27 f2 |..+P....LjB../'.| +00000090 88 6d 42 e3 20 c8 1f 01 2b fb e9 b3 aa f3 2f 02 |.mB. ...+...../.| +000000a0 fa 78 34 38 00 0f 1d f9 c7 5a 08 ae 56 19 c2 6c |.x48.....Z..V..l| +000000b0 0b b0 d1 40 0d 0e 57 d2 00 be 3d 65 9c c1 86 00 |...@..W...=e....| +000000c0 4c a5 1b a6 67 4d 39 cd ba fe 96 3c c5 25 dd 43 |L...gM9....<.%.C| +000000d0 7b 49 f0 b5 8a 66 46 d4 65 6b 2d da 55 13 14 48 |{I...fF.ek-.U..H| +000000e0 76 c8 2c 3d a4 4d 7a 14 1e 70 32 06 b3 96 cd 4e |v.,=.Mz..p2....N| +000000f0 bd 4f 06 a8 83 ae 30 83 b6 6b 61 2e 08 73 0e 14 |.O....0..ka..s..| +00000100 08 13 3d f0 7c ec cf 78 ff b4 25 21 15 5e 80 14 |..=.|..x..%!.^..| +00000110 80 4f af c7 9e 44 04 33 da cb 27 |.O...D.3..'| >>> Flow 8 (server to client) -00000000 16 03 03 00 81 4b cf ec d9 bc 7a 0e d9 ad 98 1f |.....K....z.....| -00000010 a2 53 ff dd 05 f6 97 21 f3 e1 25 28 2d a3 72 5c |.S.....!..%(-.r\| -00000020 ce bd 73 ab da 53 56 78 05 d2 6d 61 8c 7c 68 bc |..s..SVx..ma.|h.| -00000030 b2 be b9 ac ff 6a 57 e2 96 62 b1 22 5f 82 cd 87 |.....jW..b."_...| -00000040 24 d8 19 ca d4 9a 68 b3 12 7d 32 6f ff 35 d8 b7 |$.....h..}2o.5..| -00000050 7a 41 b7 05 ba be f2 c6 b8 58 fb 3d f5 ca 9d 97 |zA.......X.=....| -00000060 b3 c4 48 b0 33 2d 92 25 a2 ec 52 f0 e5 4e 72 65 |..H.3-.%..R..Nre| -00000070 4d bb ce 30 da 8d 99 3b 69 04 b3 f1 e0 43 82 ab |M..0...;i....C..| -00000080 98 f8 f0 a8 4f fc 16 03 03 02 69 7e a5 80 32 0a |....O.....i~..2.| -00000090 ca 95 73 07 76 d9 80 87 f4 5a cd 91 02 86 fa dc |..s.v....Z......| -000000a0 c8 06 b1 77 a6 52 b6 51 fa 1d 27 1e 95 e8 ec 36 |...w.R.Q..'....6| -000000b0 43 29 87 33 09 4e 67 8a cc 20 66 77 b2 7e 36 7d |C).3.Ng.. fw.~6}| -000000c0 1c 06 95 4d ea 73 28 0f 07 2b 9b c7 ab eb fe c0 |...M.s(..+......| -000000d0 65 b1 87 5b 40 c6 11 92 21 18 90 c2 23 32 f1 e0 |e..[@...!...#2..| -000000e0 39 30 c9 c2 78 be 0f 89 9e 73 f3 c1 4b 39 d8 2e |90..x....s..K9..| -000000f0 59 59 38 6e 82 7e 9e cc 41 ab e3 94 14 b8 22 80 |YY8n.~..A.....".| -00000100 63 c9 ca 16 df ce 7f de 17 d5 52 2d b7 a1 a4 c9 |c.........R-....| -00000110 13 1b d9 c3 55 6d 60 48 b3 bf 4e 28 49 9f 30 a6 |....Um`H..N(I.0.| -00000120 3f d5 e7 55 ed 9f 1b 69 5b 16 48 d5 76 01 09 ba |?..U...i[.H.v...| -00000130 1d 0d e6 4e 39 34 8c 42 62 1d 23 b5 77 d5 4f c6 |...N94.Bb.#.w.O.| -00000140 61 d9 1f b5 ab 3c ec f1 c4 a1 ec 7f 96 d2 1c fb |a....<..........| -00000150 d3 c6 60 2c 55 38 3e 66 5d 5e 81 fb f0 23 95 9e |..`,U8>f]^...#..| -00000160 b1 e0 f7 e9 af 4c e2 d4 7d 92 df ef c5 16 57 de |.....L..}.....W.| -00000170 1d 68 23 53 46 8b 22 8c d0 8d 25 f6 07 75 b0 19 |.h#SF."...%..u..| -00000180 e1 80 82 67 d5 74 f2 2e 51 34 f0 84 56 5b 45 de |...g.t..Q4..V[E.| -00000190 d1 eb 00 41 94 f4 15 ef 60 23 39 63 cb f0 86 e7 |...A....`#9c....| -000001a0 ee cc 34 cc b4 14 f7 f9 71 48 0c f0 66 9f d3 0c |..4.....qH..f...| -000001b0 92 a4 20 9c 40 44 da e5 4f a2 91 de a4 6b c3 5f |.. .@D..O....k._| -000001c0 0c dd b4 22 e7 6a b8 f3 46 2d aa 0d f3 c6 b6 10 |...".j..F-......| -000001d0 9a 69 f1 3c a4 89 6f d5 b6 45 6c e5 7b 10 d8 f4 |.i.<..o..El.{...| -000001e0 7f 9e 83 eb 44 5f 6c 00 e0 a9 5a 56 c8 80 5a 92 |....D_l...ZV..Z.| -000001f0 20 48 7c ee 22 65 8a e2 35 55 3f 7c 1a bd 4c cf | H|."e..5U?|..L.| -00000200 84 2e af 26 d1 d1 1a fc 81 d3 90 a8 9e d0 56 c3 |...&..........V.| -00000210 f4 f9 7e ac 29 9e d8 91 57 a0 a2 7b 00 b2 42 0f |..~.)...W..{..B.| -00000220 d0 5e ce 26 3c de f7 75 2d c9 74 c7 98 72 c8 b1 |.^.&<..u-.t..r..| -00000230 86 33 81 21 f5 f7 4c c9 f3 04 c2 48 24 d0 3e a6 |.3.!..L....H$.>.| -00000240 c4 8d 0f 3e 25 09 32 36 66 4c e4 67 27 4d 09 71 |...>%.26fL.g'M.q| -00000250 45 91 8e 6a ca a1 ab 69 4a 20 ea e6 a5 a1 8a 53 |E..j...iJ .....S| -00000260 b3 85 4f de de c8 4d a5 ec bd 4e 11 e7 78 f8 4c |..O...M...N..x.L| -00000270 7a 46 28 a7 0b 3d ce 1f 4a be 2d c3 1b 7c 79 9c |zF(..=..J.-..|y.| -00000280 da ae f3 ee ae 58 1f 93 6e ca f4 03 b7 4d be ac |.....X..n....M..| -00000290 d8 32 d9 0a 4e 3b dd a8 c3 b6 24 c7 e5 78 bc 7d |.2..N;....$..x.}| -000002a0 be 12 d9 c4 f9 c1 16 23 79 ba 00 27 fd 0c 93 38 |.......#y..'...8| -000002b0 2c 36 0f e1 a3 9f 27 46 82 2b 60 b5 3f f9 9b cd |,6....'F.+`.?...| -000002c0 60 39 85 96 60 aa 1c 3d 0a 9e 53 46 90 0e 49 68 |`9..`..=..SF..Ih| -000002d0 67 96 db 82 02 c9 4e f4 d7 fe 06 bf d7 01 ae db |g.....N.........| -000002e0 c5 eb 70 c2 51 72 2d 41 ca 2c ae 48 2c 19 bb ae |..p.Qr-A.,.H,...| -000002f0 7f 2f d4 cf 16 03 03 00 bc 75 f7 cb 92 aa 8c ab |./.......u......| -00000300 d7 ea 79 a1 b6 31 a5 5b 5a 19 98 a2 e2 a7 5a a6 |..y..1.[Z.....Z.| -00000310 9c c8 d5 84 1e f0 cc 18 a3 ba 1b 21 2f 9a 0e 3d |...........!/..=| -00000320 54 10 17 ee a4 40 4d 0f b9 36 bf 4a 41 76 7b 0a |T....@M..6.JAv{.| -00000330 7f d8 50 1c 1f 99 5b bf 50 87 e4 24 67 fe 45 93 |..P...[.P..$g.E.| -00000340 a4 a2 41 ce e4 17 67 08 af 35 43 5c 12 ea c3 0e |..A...g..5C\....| -00000350 1f e6 80 89 76 4f 36 71 fe a2 51 ef 05 cb 10 55 |....vO6q..Q....U| -00000360 16 fd 6d 07 aa ba 6a 68 d8 e5 53 cb 9e 17 cd 25 |..m...jh..S....%| -00000370 98 83 62 a6 55 74 79 36 87 1c 5c ef 4a 65 85 a1 |..b.Uty6..\.Je..| -00000380 a4 1b 5d 7c 0d cf e3 63 37 14 b2 ac 74 12 d9 f3 |..]|...c7...t...| -00000390 25 52 d7 a9 d8 f2 c4 75 08 57 5b 48 c5 5e 07 78 |%R.....u.W[H.^.x| -000003a0 c6 74 f3 6e 5a fb 09 67 4d a0 6a d0 f8 b4 0a 00 |.t.nZ..gM.j.....| -000003b0 71 f2 ce e0 20 16 03 03 00 4a 1d 3b c4 a4 6e e3 |q... ....J.;..n.| -000003c0 a0 43 f3 44 b6 eb d7 bb 47 dc 18 b6 84 4a c1 4d |.C.D....G....J.M| -000003d0 05 ee 71 1a 40 75 d1 ac be c3 cb f0 4b f2 a3 c3 |..q.@u......K...| -000003e0 03 6a 1d 3e 77 09 61 f0 0a 35 47 af 67 23 a1 76 |.j.>w.a..5G.g#.v| -000003f0 9e 90 be 10 a0 6b 9d 49 9e 79 38 b8 6a c4 53 ba |.....k.I.y8.j.S.| -00000400 37 88 86 f2 16 03 03 00 14 c7 e1 2e 8a 83 d1 b0 |7...............| -00000410 3e a6 81 d3 6b 62 89 d1 a3 43 c4 7b 4e |>...kb...C.{N| +00000000 16 03 03 00 81 f5 0b a1 9d 19 be 84 54 fd 42 47 |............T.BG| +00000010 d9 4e f8 35 02 91 06 7e 53 5c ea 64 8b c4 34 ac |.N.5...~S\.d..4.| +00000020 f9 93 54 36 5d 13 d0 0d 75 9f 8f 22 20 70 17 45 |..T6]...u.." p.E| +00000030 37 a9 ed c2 34 23 8b bc c8 87 5f a2 ff 9c 54 48 |7...4#...._...TH| +00000040 1b d4 85 60 39 4b 53 75 6f 65 d0 33 a7 b6 90 7d |...`9KSuoe.3...}| +00000050 4f 84 28 cc 59 ab af bd 85 4b 40 ed 72 ff 30 c6 |O.(.Y....K@.r.0.| +00000060 a5 01 8b fa 03 52 7e 0d a8 5d 86 89 9b 4e c4 05 |.....R~..]...N..| +00000070 83 fb d4 aa f9 13 8b 06 b1 2b 89 82 12 d2 a3 e2 |.........+......| +00000080 79 d6 6a 07 ef a0 16 03 03 02 69 65 b4 cc 90 43 |y.j.......ie...C| +00000090 f7 6f 92 59 1b 47 32 e4 51 be 16 8c bb 7b ef 68 |.o.Y.G2.Q....{.h| +000000a0 60 38 9c 5f 5a f6 04 da 78 1d 4e 89 a7 e9 5b e0 |`8._Z...x.N...[.| +000000b0 27 7d 82 fa 6f 44 df 5d 59 b3 5b 4c 01 76 3e bd |'}..oD.]Y.[L.v>.| +000000c0 d7 b5 0b 9a 9d be d4 ec 03 9d e5 a5 e0 e2 f2 a3 |................| +000000d0 7f b2 87 ed 09 46 b2 e1 6a e2 39 e9 82 0d fb 62 |.....F..j.9....b| +000000e0 a4 ef 1e 29 75 96 68 da f9 8d 75 86 df 0c 57 9c |...)u.h...u...W.| +000000f0 48 e9 3e de 16 ab 22 b2 6d 37 38 d6 33 44 bd 38 |H.>...".m78.3D.8| +00000100 16 2c 49 1c 2c 17 1a 28 05 45 eb 65 44 4e 1a 02 |.,I.,..(.E.eDN..| +00000110 fc 2f 5c c9 e8 d8 16 e6 4f 5f f4 bd b4 d7 ec 73 |./\.....O_.....s| +00000120 2f d1 f5 5b 68 69 b6 6a 59 8e 0b 24 2d 7c 69 96 |/..[hi.jY..$-|i.| +00000130 a6 99 66 3e 38 25 82 30 ba 1a b5 b9 66 23 ea 60 |..f>8%.0....f#.`| +00000140 b6 30 5e f5 29 80 8a 75 fc 96 f0 af 3d d2 8e 83 |.0^.)..u....=...| +00000150 5e 00 fc 76 1c 69 cc 2b e8 d2 70 21 95 65 da 2c |^..v.i.+..p!.e.,| +00000160 ed c3 fd a4 31 de 00 e5 3a b1 81 38 fc 68 da 0f |....1...:..8.h..| +00000170 b0 8c 32 f4 67 08 ed 31 0d fc e1 9b 20 8c 79 99 |..2.g..1.... .y.| +00000180 bd 52 e6 eb 27 04 a5 94 1c e9 a0 5a 18 bf 7b 59 |.R..'......Z..{Y| +00000190 22 e6 5c 63 84 2f 0a f6 ef b8 c9 c0 cf 82 0d 07 |".\c./..........| +000001a0 42 66 65 0b d5 5e ea 27 0d f9 de 7e 13 a9 c2 b5 |Bfe..^.'...~....| +000001b0 ea e2 22 4f a0 13 dc 12 69 9a ec ed d4 44 b2 bc |.."O....i....D..| +000001c0 88 65 09 ea 50 ca d6 48 c2 f2 12 9e b3 ab 29 c5 |.e..P..H......).| +000001d0 61 72 3d 0e 77 bd 96 d9 ff 24 4d 7f 4d 22 e0 67 |ar=.w....$M.M".g| +000001e0 54 02 18 42 e7 78 0c 18 28 89 24 a8 4a a1 cc 70 |T..B.x..(.$.J..p| +000001f0 a2 a1 4f ee a0 b6 1f 7e cb 9b 20 95 1f 10 63 60 |..O....~.. ...c`| +00000200 df fe ce 37 9e 9e ce ff fa 49 4f 4c 5b c0 f6 35 |...7.....IOL[..5| +00000210 b7 eb e1 ac 85 64 11 6e 83 61 6f da d9 e9 09 a6 |.....d.n.ao.....| +00000220 10 eb c2 da 62 9c ac e0 2e 0a ff 21 2e f7 94 6d |....b......!...m| +00000230 a6 56 f9 1c 39 52 f3 c7 29 a9 d6 b2 8c a9 4f bf |.V..9R..).....O.| +00000240 62 c8 74 cb 80 3d 3e 4d d1 25 4c 29 14 21 cd 13 |b.t..=>M.%L).!..| +00000250 b0 92 5a ca 9b 10 f6 4c 91 6e f7 c3 55 5e 0e f0 |..Z....L.n..U^..| +00000260 e2 8f 2f 65 f9 b8 c2 43 0c 38 45 86 22 15 ed 8f |../e...C.8E."...| +00000270 6b 49 ff 45 e5 59 b7 54 f8 c9 d3 b0 f6 71 82 7b |kI.E.Y.T.....q.{| +00000280 7d 52 be 6c 33 f2 27 5c f8 33 96 05 64 fa b2 b9 |}R.l3.'\.3..d...| +00000290 ae 74 23 91 46 6f 9b 42 5b 96 1c c4 1c f4 5e b0 |.t#.Fo.B[.....^.| +000002a0 c7 78 0f f3 da d3 01 ae 25 6c c1 10 31 47 e9 0d |.x......%l..1G..| +000002b0 84 27 5d 5a 23 35 07 3c 2d ea e8 dc cd d3 c6 85 |.']Z#5.<-.......| +000002c0 86 ff 48 07 b8 97 d5 c5 10 f4 47 46 af 87 d9 03 |..H.......GF....| +000002d0 24 3d b0 80 33 46 2a 4d 15 77 5c 21 3c a4 13 99 |$=..3F*M.w\!<...| +000002e0 6c 9e ce 69 81 2e 90 c9 ba 9a 95 91 30 cc 8d 9b |l..i........0...| +000002f0 6c 55 c4 09 16 03 03 00 bc 30 d3 15 d7 3b 42 a9 |lU.......0...;B.| +00000300 9b a2 1f c8 ff 90 43 4c 0f 9c 4e 59 98 23 a2 9e |......CL..NY.#..| +00000310 17 e0 ea 06 ae 8f 23 e6 85 f9 ca 80 39 34 78 a3 |......#.....94x.| +00000320 7b 7e 61 88 86 35 e3 8e a3 61 2d f9 24 6e e4 b1 |{~a..5...a-.$n..| +00000330 c2 7d 56 bc 9d e0 12 3d e5 90 10 b9 39 d5 64 6b |.}V....=....9.dk| +00000340 a8 91 75 d7 95 e7 e6 ce 8f 11 b0 66 87 f5 48 5d |..u........f..H]| +00000350 c9 a1 56 b1 71 e9 74 5f 48 a6 06 32 dc 66 7b 0b |..V.q.t_H..2.f{.| +00000360 85 66 36 e9 d3 13 2d d8 60 8c b2 89 c5 2a de b7 |.f6...-.`....*..| +00000370 48 63 e0 8e 27 65 3a 01 6f be 75 45 ec 2a 61 c4 |Hc..'e:.o.uE.*a.| +00000380 a8 0b cf 95 93 a2 d6 27 fa 71 82 92 3a 95 39 a7 |.......'.q..:.9.| +00000390 fc e5 33 e3 f2 0e a4 94 94 bb e6 65 25 3a 6f 6e |..3........e%:on| +000003a0 da a0 6d fc 57 2b 46 f8 ab 55 0e 5a 1e 56 92 68 |..m.W+F..U.Z.V.h| +000003b0 7e 88 f4 d0 b2 16 03 03 00 4a 08 e0 60 21 59 5d |~........J..`!Y]| +000003c0 29 3e ba b9 1d 13 3a a0 e3 b2 76 39 29 00 92 d0 |)>....:...v9)...| +000003d0 24 a6 d9 fd e2 2b c8 5d 6b 78 ea 75 ce 68 93 1b |$....+.]kx.u.h..| +000003e0 3b b8 59 e4 6b 60 5b 4a 28 7a e9 1d 04 72 a8 e0 |;.Y.k`[J(z...r..| +000003f0 64 31 e4 86 da a9 f2 00 36 55 bd 56 02 d4 b3 48 |d1......6U.V...H| +00000400 a7 21 69 11 16 03 03 00 14 44 1c 39 61 56 3d 7e |.!i......D.9aV=~| +00000410 ca dd cb 34 06 10 4f 5f 32 45 63 c1 98 |...4..O_2Ec..| >>> Flow 9 (client to server) -00000000 16 03 03 02 69 07 d0 f5 52 49 69 16 9e a0 95 ae |....i...RIi.....| -00000010 90 23 85 b7 03 e7 93 76 bc 81 8f 30 73 d3 0b 58 |.#.....v...0s..X| -00000020 cb 9a 18 00 66 cd 4c 43 a7 a7 8d e3 84 1a dc 86 |....f.LC........| -00000030 11 c2 2e 02 07 94 9f 64 2d 77 8a 60 60 07 22 be |.......d-w.``.".| -00000040 dc 36 14 b4 04 b8 94 46 f6 d4 db bc 68 82 14 7e |.6.....F....h..~| -00000050 d9 cf 60 4b a3 ff 03 d7 05 e0 a5 f4 94 1f ee 76 |..`K...........v| -00000060 4e 96 d0 70 1b cc 4e ad ef d4 4d df 71 82 a1 b5 |N..p..N...M.q...| -00000070 96 97 63 dc cc 13 75 29 bb b5 b7 46 fb b6 dd 17 |..c...u)...F....| -00000080 fd 8d be 54 14 35 a9 2b 66 c5 80 fb 41 e6 92 c1 |...T.5.+f...A...| -00000090 4b db 97 30 12 d1 4c c4 bc 4e 91 a4 17 c7 4e 22 |K..0..L..N....N"| -000000a0 bd 81 69 26 b4 8e d8 63 c8 33 0c 89 b5 12 6e af |..i&...c.3....n.| -000000b0 ea 09 10 66 5e c3 f2 9f c5 c2 0c 91 75 d5 c8 cc |...f^.......u...| -000000c0 4b dd 1f 42 22 29 fe f5 15 3f e6 96 b5 af 41 5d |K..B")...?....A]| -000000d0 06 59 33 40 da 8e c8 2f 00 9c 6b 7c fc fe 45 fe |.Y3@.../..k|..E.| -000000e0 fd 9c b4 87 18 f8 90 9c 8f 22 0d f4 d5 39 96 a0 |........."...9..| -000000f0 77 55 4e 52 f7 31 15 cb ea d6 dd 65 5c 91 f4 36 |wUNR.1.....e\..6| -00000100 a2 d3 c0 d5 c7 9c 07 38 6e 38 e2 00 c9 82 c9 d3 |.......8n8......| -00000110 e5 b0 77 11 4f 3b 82 7e 28 2c c0 69 7e 5d 76 ff |..w.O;.~(,.i~]v.| -00000120 c7 e0 f2 13 5e 5f 8d a0 51 f5 07 8c f2 4f 1c e9 |....^_..Q....O..| -00000130 eb 36 62 3e 9f db 15 11 b7 b0 c2 9f 92 84 37 81 |.6b>..........7.| -00000140 92 aa ea 5e 2a 70 74 3a 16 06 88 9a 98 1a de a9 |...^*pt:........| -00000150 08 91 01 b0 d8 f1 1f fa 54 bd 44 ef 25 49 4d 81 |........T.D.%IM.| -00000160 ec 3b 59 ec 3c b0 ba 08 d4 30 71 66 c1 46 c1 ba |.;Y.<....0qf.F..| -00000170 9d 56 8c b0 b9 b0 3d fa 35 51 7c 91 1f 3c b6 8f |.V....=.5Q|..<..| -00000180 05 fa d2 70 62 78 17 1e 27 68 3b e4 65 ca c4 dc |...pbx..'h;.e...| -00000190 b3 6b 91 27 7c 12 49 36 93 c6 62 5d d8 1f e2 de |.k.'|.I6..b]....| -000001a0 e7 2e 36 6b c5 9c 68 6d 91 29 d3 eb 8c 07 7c fa |..6k..hm.)....|.| -000001b0 42 3e 90 62 c0 0a eb 63 a5 2c b3 4b 3d 2e 5a 36 |B>.b...c.,.K=.Z6| -000001c0 78 71 c1 5a 94 a7 b9 5a b2 e2 8d dd b7 95 0d 94 |xq.Z...Z........| -000001d0 63 38 8f 60 94 c0 2a b9 d6 77 14 34 a2 ac 2c 7e |c8.`..*..w.4..,~| -000001e0 97 f4 76 87 c9 31 bf 73 97 37 9e ef a0 3e dc 49 |..v..1.s.7...>.I| -000001f0 db e1 4b 61 52 2a 1f 73 cd 76 49 28 f2 73 28 6f |..KaR*.s.vI(.s(o| -00000200 75 12 91 c6 5c 55 34 66 63 5f 79 22 9e 13 31 25 |u...\U4fc_y"..1%| -00000210 42 c0 68 59 38 37 85 dd ec 47 65 d1 9b 24 44 d2 |B.hY87...Ge..$D.| -00000220 37 d9 8f d8 f9 e4 37 7b a8 cd ad 25 65 f0 a1 27 |7.....7{...%e..'| -00000230 5e d8 8b 69 1f a7 0b 26 d1 d8 cd b2 e5 ba 31 20 |^..i...&......1 | -00000240 f0 9e 6a 39 6f 9d 04 cf 96 1f 4c 69 cc 4d 16 32 |..j9o.....Li.M.2| -00000250 59 d6 4e eb b7 c5 bc 33 c2 18 9d 58 82 73 64 c0 |Y.N....3...X.sd.| -00000260 a6 09 00 2b 04 1b 05 68 77 dd bb 73 b4 b3 16 03 |...+...hw..s....| -00000270 03 00 35 3a 50 32 09 27 fd 20 17 11 7b 7b e1 42 |..5:P2.'. ..{{.B| -00000280 9c af b2 bb 38 5a 89 c7 e5 eb c4 8e 1e 04 94 1f |....8Z..........| -00000290 40 17 4e b4 94 5b c7 fd d9 14 6e 0d f8 4c f6 cc |@.N..[....n..L..| -000002a0 76 a3 08 02 7e a7 a2 4c 16 03 03 00 98 08 77 4a |v...~..L......wJ| -000002b0 7a f0 ba 64 6e 14 8e fd d9 2f 67 57 1f 4b 05 7b |z..dn..../gW.K.{| -000002c0 99 ed 0d e9 03 de 88 60 44 0c 04 d2 5a 24 4a 9d |.......`D...Z$J.| -000002d0 9b bf fd d6 2f 60 03 63 e4 82 58 bb 69 92 41 c5 |..../`.c..X.i.A.| -000002e0 30 18 cf 9b cc c5 66 b2 b6 ef 15 5f b3 60 93 c6 |0.....f...._.`..| -000002f0 27 59 27 bc d5 dd 3b 5a 9d f7 ad 05 11 b7 9e bc |'Y'...;Z........| -00000300 ff 43 f8 0c 83 0f 6c fa d1 23 09 03 42 60 61 d4 |.C....l..#..B`a.| -00000310 ff 3b c9 ee 15 4a 02 fa d9 60 97 91 50 03 7d 6b |.;...J...`..P.}k| -00000320 c1 a2 64 00 5b b1 12 62 bd e5 c9 8a 2e 0c c1 71 |..d.[..b.......q| -00000330 a8 e2 94 45 be 8b ba a7 c0 6e e7 5e a5 bc 7a f8 |...E.....n.^..z.| -00000340 48 06 e2 27 3f 14 03 03 00 11 ef 57 1d e6 74 e2 |H..'?......W..t.| -00000350 9f 49 cd dc 7a 7d 0b 21 f7 1b e8 16 03 03 00 20 |.I..z}.!....... | -00000360 39 a4 df 59 44 4c b2 99 aa 0c c6 90 b3 a1 0d 00 |9..YDL..........| -00000370 38 ee 40 d2 b0 62 b4 cf e3 20 e7 d7 5f f8 cf aa |8.@..b... .._...| +00000000 16 03 03 02 69 68 d9 de 2a 4d 03 fe 05 cc b8 d3 |....ih..*M......| +00000010 c8 f0 3d df 1c 73 f1 bd 55 08 45 c4 2a 6b a1 c8 |..=..s..U.E.*k..| +00000020 35 7d 56 b7 b9 15 63 ba 09 31 59 8b f8 ce a0 f8 |5}V...c..1Y.....| +00000030 1b 3b 5f 5e 1c 3d bb 26 43 cb 7b f3 ba 3b a2 38 |.;_^.=.&C.{..;.8| +00000040 a3 d5 bd 0b 65 16 7c e3 79 cc ed 17 04 34 60 e7 |....e.|.y....4`.| +00000050 1e 60 52 72 13 e4 6b ef 32 99 86 94 49 30 47 df |.`Rr..k.2...I0G.| +00000060 e2 6c 6d 3f 6c 19 e4 4e b9 df 42 e3 c8 47 2c d0 |.lm?l..N..B..G,.| +00000070 be 2c 94 3b 1d 3e 3a b3 06 67 c3 25 9b 24 4e 8e |.,.;.>:..g.%.$N.| +00000080 dc c7 50 ab 72 bd b4 d1 ff f7 3f 6d 13 89 55 8c |..P.r.....?m..U.| +00000090 14 a1 ae fe ad a0 bb 8f fe 51 ac 5b eb 23 3d d0 |.........Q.[.#=.| +000000a0 9e b8 5e 34 8c dd 47 79 9c 73 f5 6b 47 ff 10 7d |..^4..Gy.s.kG..}| +000000b0 ac 1d a7 54 5e b5 0f 75 86 67 13 70 d5 66 da 55 |...T^..u.g.p.f.U| +000000c0 0b 48 a0 88 ae f9 81 92 33 0b 29 79 42 f7 c2 98 |.H......3.)yB...| +000000d0 2c 2f 32 c7 df 35 ff 4a 44 10 fa 9f 66 ce 4b 9a |,/2..5.JD...f.K.| +000000e0 3c 5b b3 7d ac 3b 9a 68 bb 40 3d 36 6b 72 98 c5 |<[.}.;.h.@=6kr..| +000000f0 85 3c b0 75 1c d6 45 0f f9 4d 26 2d ec 67 90 ed |.<.u..E..M&-.g..| +00000100 88 33 92 7d 99 22 c4 08 90 64 17 1e 06 03 d5 a3 |.3.}."...d......| +00000110 72 a6 92 99 d3 c8 46 9f e7 f9 15 bb dd ba e5 f7 |r.....F.........| +00000120 d9 06 af 5c 1c a0 03 c7 fe 51 b5 41 0c 8f 6d ad |...\.....Q.A..m.| +00000130 f2 41 23 a5 44 38 8a bb b3 d9 3c e8 5e 99 98 23 |.A#.D8....<.^..#| +00000140 9c 87 3d f8 10 df 58 c2 dd b9 2c 7e 56 a1 75 84 |..=...X...,~V.u.| +00000150 a2 e5 66 20 58 ed fe f7 04 ff 93 e0 6e 9f 1e f3 |..f X.......n...| +00000160 a9 8a 9a 37 38 d2 7c 4d 74 88 f5 bd 2b 5a 05 bc |...78.|Mt...+Z..| +00000170 53 a1 48 ab 98 ca 91 bb fa f3 62 a9 0a fa 89 e6 |S.H.......b.....| +00000180 22 06 1d 59 72 32 51 d6 f6 de e8 89 b6 eb 96 f2 |"..Yr2Q.........| +00000190 4d e0 82 0d b8 ec a7 09 84 79 18 70 3e 09 ba 9a |M........y.p>...| +000001a0 98 27 13 e8 e6 e5 9d 7c df 4d 42 a8 41 be 62 e0 |.'.....|.MB.A.b.| +000001b0 1d 48 24 5d 35 e5 a5 ff f5 67 85 cf b8 53 e1 5e |.H$]5....g...S.^| +000001c0 dd 82 40 9e d3 94 fd 7b 1b b3 13 d8 98 a8 1f 21 |..@....{.......!| +000001d0 1a 04 5a df 3c 8f 3a c0 dc 86 8b e1 39 0a 03 8e |..Z.<.:.....9...| +000001e0 8c 9a 4c d5 15 32 2d 1c 0f ad 43 25 e6 5a 77 f9 |..L..2-...C%.Zw.| +000001f0 2d e5 a0 a0 b2 32 43 0f 11 55 bb c2 e1 c6 45 2a |-....2C..U....E*| +00000200 da a0 6c 14 49 0f a7 d7 40 b1 1a c8 72 2a a8 26 |..l.I...@...r*.&| +00000210 45 f4 66 9a e0 42 aa 25 ac 28 ec 8c a2 df 48 cc |E.f..B.%.(....H.| +00000220 c3 a9 9e 9e af 38 88 82 43 8f 99 02 79 90 3e d9 |.....8..C...y.>.| +00000230 9e d0 75 a5 95 83 ec 44 2b 13 1c d8 eb 3f 2c 5d |..u....D+....?,]| +00000240 1b 7e e2 fe 47 89 08 5b 58 dc 3d ea 32 5e a1 af |.~..G..[X.=.2^..| +00000250 c5 e8 90 b8 28 4b 58 55 34 46 ef 2a d6 a0 9b 0b |....(KXU4F.*....| +00000260 73 b9 8b b4 38 63 08 92 03 4c 8c 12 be a8 16 03 |s...8c...L......| +00000270 03 00 35 f5 3c 22 cc bc cf c3 ad 84 1d dc f4 b6 |..5.<"..........| +00000280 e0 4a 1c b9 e5 d8 a6 b7 a2 8c fb 40 11 12 40 5c |.J.........@..@\| +00000290 e2 f4 ce ac 83 93 69 71 19 85 43 19 9e 30 ee 97 |......iq..C..0..| +000002a0 02 8e 69 8f 4d 1d 2c 0f 16 03 03 00 98 94 e4 82 |..i.M.,.........| +000002b0 1d 6b d2 ce 76 6d 68 55 db bb 91 73 6e e9 73 05 |.k..vmhU...sn.s.| +000002c0 6a d3 eb 48 f1 d7 f6 52 ba 49 6a f2 f7 74 c8 56 |j..H...R.Ij..t.V| +000002d0 ba f5 e5 97 cb a0 b7 ab 37 2c ff 7a a6 42 e6 78 |........7,.z.B.x| +000002e0 51 8a 9c bf fa 05 b7 66 04 6d 83 d1 0d e8 18 d0 |Q......f.m......| +000002f0 f2 b3 4d 4d 2d c0 f7 ac d1 55 b8 03 d7 dc d7 c2 |..MM-....U......| +00000300 73 72 54 c9 29 e4 98 29 a3 95 11 7e 56 52 87 09 |srT.)..)...~VR..| +00000310 05 fe 74 e2 f1 74 c7 f6 f2 28 4f 2c 24 92 ac ae |..t..t...(O,$...| +00000320 1c df 4e f9 db ce 3c db 48 60 6b 4d 12 9c f7 de |..N...<.H`kM....| +00000330 26 73 25 d2 e7 d1 2e fd b5 5e c4 66 2a 60 4a 04 |&s%......^.f*`J.| +00000340 2d b9 6c b1 d2 14 03 03 00 11 58 08 81 e4 4d c4 |-.l.......X...M.| +00000350 93 47 e2 45 e2 44 73 36 3a fe ba 16 03 03 00 20 |.G.E.Ds6:...... | +00000360 25 2d 76 2c 22 34 e9 ed 11 a5 84 ee d3 63 df 17 |%-v,"4.......c..| +00000370 88 be 86 7c 51 35 fb 7e aa a6 b9 a2 02 59 f7 00 |...|Q5.~.....Y..| >>> Flow 10 (server to client) -00000000 14 03 03 00 11 be d5 20 ab dc c2 df f6 29 bc b7 |....... .....)..| -00000010 a3 7e 70 b9 48 73 16 03 03 00 20 b2 f3 25 a9 70 |.~p.Hs.... ..%.p| -00000020 7f 99 0d f4 01 0a 58 ad b8 6d 02 e8 6f 89 7b 77 |......X..m..o.{w| -00000030 bf 22 89 b3 23 a8 02 28 00 94 f1 17 03 03 00 19 |."..#..(........| -00000040 e3 22 a6 cd a4 dd 9d 2b 6f 6c 84 08 a5 dd 97 0d |.".....+ol......| -00000050 9a 37 a7 ac e4 6b 03 1f db 16 03 03 00 14 ec d7 |.7...k..........| -00000060 d4 fd ec 94 6c 0a 46 8f ec ee 87 61 5c 0a 82 a2 |....l.F....a\...| -00000070 03 91 |..| +00000000 14 03 03 00 11 bb 91 ed b9 75 be 6c 2c b8 7c 57 |.........u.l,.|W| +00000010 0b 44 2e 6d 68 4a 16 03 03 00 20 49 17 51 ce 23 |.D.mhJ.... I.Q.#| +00000020 ff 71 ad f5 45 75 01 43 4d d2 f8 08 d8 e5 4d d7 |.q..Eu.CM.....M.| +00000030 1c 35 5e 8b 18 54 e5 f6 0c b5 2e 17 03 03 00 19 |.5^..T..........| +00000040 ec 43 1a 6d 9e fb 53 cd 55 1a 72 2e da d1 ea 58 |.C.m..S.U.r....X| +00000050 66 17 a9 1c be fc d9 72 dd 16 03 03 00 14 c2 98 |f......r........| +00000060 a4 ac d5 0c a2 10 61 8b 55 3a 69 b6 26 33 4f fe |......a.U:i.&3O.| +00000070 2d 42 |-B| >>> Flow 11 (client to server) -00000000 15 03 03 00 12 4b bc 67 b6 13 0f 0c df e1 42 46 |.....K.g......BF| -00000010 05 97 85 e5 97 bc 81 15 03 03 00 12 d7 e8 b7 5c |...............\| -00000020 a4 d8 8e fb b3 a7 1f 06 2f bb 77 f1 13 35 |......../.w..5| +00000000 15 03 03 00 12 d4 c8 e4 36 30 00 40 d1 d5 9a 9d |........60.@....| +00000010 3c 2d eb 4f e0 6e a3 15 03 03 00 12 4d b6 67 e4 |<-.O.n......M.g.| +00000020 02 d0 89 50 ef 4b 8a 1f 49 f2 f0 14 b6 7e |...P.K..I....~| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiationRejected b/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiationRejected index 57febfbc851..3502977efa6 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiationRejected +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-RenegotiationRejected @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 e0 77 db d2 ca |....Y...U...w...| -00000010 46 29 bc ce 1a ee 39 d0 58 35 74 c0 1f 17 86 c0 |F)....9.X5t.....| -00000020 a8 58 ad b6 e3 f5 e0 80 ae 71 43 20 cd a1 49 bb |.X.......qC ..I.| -00000030 94 bc fc 26 a5 56 ea dc 9d 9a b4 ee c7 70 fa 72 |...&.V.......p.r| -00000040 04 c1 d8 e2 a9 63 24 9a 07 18 a5 fa cc a8 00 00 |.....c$.........| +00000000 16 03 03 00 59 02 00 00 55 03 03 9c d0 eb d6 42 |....Y...U......B| +00000010 2e ff 6e 5a 19 33 6d 12 97 56 56 2b f5 1b 86 c8 |..nZ.3m..VV+....| +00000020 38 83 59 37 ac 17 46 ed 73 53 43 20 e4 94 9b 71 |8.Y7..F.sSC ...q| +00000030 f4 94 d9 d9 3a a1 e1 99 1e b4 a5 55 46 88 e0 0a |....:......UF...| +00000040 af 0a 0e ff 81 10 e2 e0 63 21 ae 2a cc a8 00 00 |........c!.*....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,36 +60,36 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 96 83 76 7c af 6c af |........ ..v|.l.| -000002d0 be 20 ec 79 87 9e e0 23 fa 34 78 96 91 30 3b 78 |. .y...#.4x..0;x| -000002e0 1b 3f 0f 73 b4 45 05 2f 22 08 04 00 80 38 fe 9b |.?.s.E./"....8..| -000002f0 e1 c2 82 13 ce 00 c2 0e 08 98 22 d0 4d 86 38 97 |..........".M.8.| -00000300 c1 78 b9 11 a4 9d af e0 75 d1 c9 dc a1 dc 25 03 |.x......u.....%.| -00000310 cd ba 15 2e be 0a 61 39 4f 4f d3 48 95 61 3f 2c |......a9OO.H.a?,| -00000320 fb e1 63 e7 8f 51 b4 1f c8 98 f7 3e 23 11 8c 4a |..c..Q.....>#..J| -00000330 b4 76 15 cc 83 bd dc 6f af 0c d9 f1 80 0d 9b a2 |.v.....o........| -00000340 a3 ac 2f 26 c8 d3 23 94 bc c9 3d fb 44 4e 47 3e |../&..#...=.DNG>| -00000350 3b de ce 24 b8 ab 52 f3 5f 26 96 7f e6 a4 ec 9e |;..$..R._&......| -00000360 fc 44 4a 1b 73 d1 ea 2a a9 b9 c8 ba f6 16 03 03 |.DJ.s..*........| +000002c0 ac 0c 00 00 a8 03 00 1d 20 9b 89 08 0d ea c2 d3 |........ .......| +000002d0 4f 73 77 a0 e3 0e 1a 68 13 2c 5c a5 ec 39 75 1b |Osw....h.,\..9u.| +000002e0 c2 95 fe b8 fe 58 f4 bb 16 08 04 00 80 d4 e8 d3 |.....X..........| +000002f0 d4 5b 1f ee ff 60 f5 86 b1 f4 06 c0 a8 ab 90 b0 |.[...`..........| +00000300 26 15 d5 4e 3f d6 a5 e2 a3 3a e0 0f 9a 92 bd 96 |&..N?....:......| +00000310 9d 98 15 f3 95 82 a9 5d 9f 1d 9b 4f 2e 77 58 40 |.......]...O.wX@| +00000320 58 3d fd 8f a6 09 1c fa 61 77 2e 87 df e7 76 8b |X=......aw....v.| +00000330 bf f1 dd 29 f8 70 c0 6d db e5 a0 55 92 77 44 75 |...).p.m...U.wDu| +00000340 d9 95 a6 17 67 93 47 8e 1f 61 50 65 31 94 d3 79 |....g.G..aPe1..y| +00000350 5f 25 a6 f0 3e 19 9a c8 ad b9 1a af 5b 50 2c 97 |_%..>.......[P,.| +00000360 78 1e 71 3a e0 fa 7c 44 1e d1 32 56 4e 16 03 03 |x.q:..|D..2VN...| 00000370 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 20 f3 a4 06 da e0 55 ed 41 d1 71 2a |.... .....U.A.q*| -00000040 d5 aa 00 31 eb 23 23 52 20 43 36 8f 10 70 d3 e0 |...1.##R C6..p..| -00000050 6d cc 77 f9 68 |m.w.h| +00000030 16 03 03 00 20 88 fe 97 82 bd a7 99 c6 a6 2f c1 |.... ........./.| +00000040 1a a8 54 8c e5 c6 39 0a 6b 07 9b 1a 05 f4 fb e3 |..T...9.k.......| +00000050 67 f5 c8 6e 17 |g..n.| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 20 f5 84 89 dc 37 |.......... ....7| -00000010 bf d9 75 10 c2 30 50 9e 2c 71 00 30 46 f3 af 00 |..u..0P.,q.0F...| -00000020 9c 6c fd 78 2d d1 54 88 98 c4 8a |.l.x-.T....| +00000000 14 03 03 00 01 01 16 03 03 00 20 3b 6d ac 1c 8b |.......... ;m...| +00000010 1b 46 3a 4e 03 75 51 9e 99 6e 5a a8 4f 07 91 a3 |.F:N.uQ..nZ.O...| +00000020 18 2c bf 88 92 17 e5 13 65 a3 6c |.,......e.l| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 e7 10 a8 74 64 64 01 ea af 4a f2 |........tdd...J.| -00000010 6a 09 c7 60 49 ba 59 71 bc f6 90 |j..`I.Yq...| +00000000 17 03 03 00 16 c7 94 fc be 3d 73 fd ec ce b2 f6 |.........=s.....| +00000010 bf 17 bf 52 3e b4 98 39 43 c0 0a |...R>..9C..| >>> Flow 6 (server to client) -00000000 16 03 03 00 14 4c ff 21 fb 5d ef 36 28 6f f8 7b |.....L.!.].6(o.{| -00000010 c0 08 b6 1b e3 17 c3 6e 49 |.......nI| +00000000 16 03 03 00 14 cf 01 f5 e6 eb 60 e3 49 c4 fb 84 |..........`.I...| +00000010 e1 11 69 e1 91 c0 02 d2 e3 |..i......| >>> Flow 7 (client to server) -00000000 15 03 03 00 12 ab 44 a2 47 b2 14 a3 5f 40 1b 56 |......D.G..._@.V| -00000010 d0 f0 3f ea 95 cf aa 15 03 03 00 12 28 1b e3 5f |..?.........(.._| -00000020 8c c4 87 b4 d6 28 2f c9 93 30 66 7a 35 ce |.....(/..0fz5.| +00000000 15 03 03 00 12 4d 7f de 01 23 f7 3f 0d e6 1a f1 |.....M...#.?....| +00000010 19 a2 cd 58 1a 25 f5 15 03 03 00 12 95 78 52 00 |...X.%.......xR.| +00000020 65 aa 6d 77 5a 66 d5 95 c4 5a 9b 1b 05 b2 |e.mwZf...Z....| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-SCT b/libgo/go/crypto/tls/testdata/Client-TLSv12-SCT index f817ea594fe..d12e263e153 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-SCT +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-SCT @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 01 c6 02 00 01 c2 03 03 cb c8 2f af ab |............./..| -00000010 d1 5b 34 64 8e 3f b3 6e b7 bf 0b e8 15 0f c3 97 |.[4d.?.n........| -00000020 a1 99 64 45 ac 8f 2a 60 9c 03 a3 20 41 c5 a1 11 |..dE..*`... A...| -00000030 79 cd 6b 70 27 1f 0f e8 59 ac d3 d7 ae ae 1e d4 |y.kp'...Y.......| -00000040 e2 74 81 43 26 b1 37 d1 14 87 a6 20 cc a8 00 01 |.t.C&.7.... ....| +00000000 16 03 03 01 c6 02 00 01 c2 03 03 d8 a9 75 cc 9a |.............u..| +00000010 81 df 5a a0 3b ba 51 74 52 50 72 08 35 02 35 77 |..Z.;.QtRPr.5.5w| +00000020 28 ff 44 e6 d9 c6 8b f8 54 67 b4 20 62 80 60 cc |(.D.....Tg. b.`.| +00000030 09 90 52 66 75 72 a2 c5 dc 8d 18 ce 9a d5 7e cd |..Rfur........~.| +00000040 a5 36 2a 2e 65 72 6f f0 dd b0 8c 14 cc a8 00 01 |.6*.ero.........| 00000050 7a 00 12 01 69 01 67 00 75 00 a4 b9 09 90 b4 18 |z...i.g.u.......| 00000060 58 14 87 bb 13 a2 cc 67 70 0a 3c 35 98 04 f9 1b |X......gp.<5....| 00000070 df b8 e3 77 cd 0e c8 0d dc 10 00 00 01 47 97 99 |...w.........G..| @@ -83,31 +83,31 @@ 00000400 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 |.....@.a.Lr+...F| 00000410 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 |..M...>...B...=.| 00000420 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c 00 |`.\!.;..........| -00000430 00 a8 03 00 1d 20 c5 a7 0f f6 d3 e0 dd fe c0 6f |..... .........o| -00000440 b9 d5 82 34 0f 6d e9 5c e2 38 3e 23 83 17 07 f8 |...4.m.\.8>#....| -00000450 00 1c 5e e6 6b 40 08 04 00 80 93 f8 75 72 dc 74 |..^.k@......ur.t| -00000460 68 62 98 55 f6 64 81 d1 03 9f f8 8c 17 77 d3 a6 |hb.U.d.......w..| -00000470 f9 3e 41 b8 f7 73 e6 c7 83 21 3b e8 72 cf 5f 08 |.>A..s...!;.r._.| -00000480 84 51 cf e5 f6 b0 f2 83 d9 cf b9 fc d7 3c 0d 39 |.Q...........<.9| -00000490 a2 14 ae 78 07 24 25 95 13 90 71 f9 ac 0f 64 c7 |...x.$%...q...d.| -000004a0 e9 15 35 37 83 02 10 38 be c1 d1 00 3d 4b f2 36 |..57...8....=K.6| -000004b0 f6 7f ac 3e b2 ef 51 eb df d6 8b 92 a6 8e 71 17 |...>..Q.......q.| -000004c0 63 bd 6a 92 15 b7 b1 2d 0a 4c 58 68 65 23 ff ad |c.j....-.LXhe#..| -000004d0 59 03 85 9c a2 cf 02 3b 70 d4 16 03 03 00 04 0e |Y......;p.......| +00000430 00 a8 03 00 1d 20 cd 2a 10 ee 97 4a 83 7b 0e 6d |..... .*...J.{.m| +00000440 e7 00 5a ce bc d8 1c 57 fa f6 ec 52 0d 0f be 6d |..Z....W...R...m| +00000450 c8 5d 27 3c 8c 1b 08 04 00 80 a9 4c bb 3a 0a d7 |.]'<.......L.:..| +00000460 db 72 3d 88 49 a6 0b f7 dc d5 e1 d0 07 e8 6c fa |.r=.I.........l.| +00000470 b0 5e 0b 13 27 29 6f 1f 1e b9 05 60 16 cc ea 7b |.^..')o....`...{| +00000480 46 d7 12 58 03 43 b0 fe 8e 7b 83 3b ee 11 78 8c |F..X.C...{.;..x.| +00000490 60 0f 9c 76 63 60 01 78 a0 9b 19 b9 32 99 a9 9d |`..vc`.x....2...| +000004a0 42 b8 1f f1 8b 87 07 32 fa 5e 74 d5 3e 5e ba 21 |B......2.^t.>^.!| +000004b0 ff 63 b7 c6 68 bc b3 f9 52 1a ea 23 c7 f2 ec ff |.c..h...R..#....| +000004c0 d4 10 0d f8 76 2f bc 0d e5 12 7f ee d3 8d 9e 6b |....v/.........k| +000004d0 5e 22 78 d6 fa 5e 6a 53 16 44 16 03 03 00 04 0e |^"x..^jS.D......| 000004e0 00 00 00 |...| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 20 62 1f 1a 94 94 88 9c 0c 3c ab d1 |.... b.......<..| -00000040 32 32 9f 8d be 28 a8 86 43 e6 53 d3 c4 bf 13 84 |22...(..C.S.....| -00000050 50 7f 30 84 e1 |P.0..| +00000030 16 03 03 00 20 5c 1a 1b 0e 7e 83 4f 9b f6 8e 9f |.... \...~.O....| +00000040 ca 95 86 c3 7b 60 73 d3 8d 3c 6d 18 6a eb 70 a3 |....{`s..>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 20 bf 16 ab 1a 98 |.......... .....| -00000010 d0 c1 95 b7 fe c2 45 fd 01 79 6b 8a 13 80 e4 96 |......E..yk.....| -00000020 64 15 1b 6e 31 12 19 1d 6f ba b0 |d..n1...o..| +00000000 14 03 03 00 01 01 16 03 03 00 20 1f a2 50 dd c5 |.......... ..P..| +00000010 ba 96 4a 63 e1 cc b6 45 77 09 c1 49 cb 5f eb 4b |..Jc...Ew..I._.K| +00000020 38 9b b1 40 1c af b1 a2 dc 7c ba |8..@.....|.| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 a4 27 40 7a 6a 54 03 b6 ec 5f 4a |......'@zjT..._J| -00000010 56 a5 6e cb cc 4c 49 2e 08 29 37 15 03 03 00 12 |V.n..LI..)7.....| -00000020 88 20 fe 73 46 06 a7 f0 31 1a d9 89 7a fe a8 28 |. .sF...1...z..(| -00000030 d6 e8 |..| +00000000 17 03 03 00 16 e7 54 f6 bf 56 39 57 c4 b2 ac f2 |......T..V9W....| +00000010 b1 f4 b1 2f ad ae d7 87 21 ff 1c 15 03 03 00 12 |.../....!.......| +00000020 5d b6 56 77 55 99 b6 7b a4 0b d8 8e 8d 93 b6 35 |].VwU..{.......5| +00000030 ce 9a |..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv12-X25519-ECDHE b/libgo/go/crypto/tls/testdata/Client-TLSv12-X25519-ECDHE index 178106f0dff..d58a32f2b37 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv12-X25519-ECDHE +++ b/libgo/go/crypto/tls/testdata/Client-TLSv12-X25519-ECDHE @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f2 01 00 00 ee 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 f4 01 00 00 f0 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,20 +7,20 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 73 00 05 00 05 01 00 00 00 00 00 0a 00 |...s............| -00000090 04 00 02 00 1d 00 0b 00 02 01 00 00 0d 00 18 00 |................| -000000a0 16 08 04 08 05 08 06 04 01 04 03 05 01 05 03 06 |................| -000000b0 01 06 03 02 01 02 03 ff 01 00 01 00 00 12 00 00 |................| -000000c0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| -000000d0 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 |&.$... /.}.G.bC.| -000000e0 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| -000000f0 90 99 5f 58 cb 3b 74 |.._X.;t| +00000080 01 00 00 75 00 05 00 05 01 00 00 00 00 00 0a 00 |...u............| +00000090 04 00 02 00 1d 00 0b 00 02 01 00 00 0d 00 1a 00 |................| +000000a0 18 08 04 04 03 08 07 08 05 08 06 04 01 05 01 06 |................| +000000b0 01 05 03 06 03 02 01 02 03 ff 01 00 01 00 00 12 |................| +000000c0 00 00 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 |...+............| +000000d0 33 00 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 |3.&.$... /.}.G.b| +000000e0 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| +000000f0 c2 ed 90 99 5f 58 cb 3b 74 |...._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 14 f0 64 fb 80 |....Y...U....d..| -00000010 40 49 f6 48 a5 65 9d e1 2e 37 c3 f7 b9 27 fe 6b |@I.H.e...7...'.k| -00000020 de 49 93 da 97 0d 59 c5 a8 5d 42 20 f9 10 79 a2 |.I....Y..]B ..y.| -00000030 e6 33 e8 eb 6c 7d 3b 1d e2 e9 3e df 5f 5a 40 d5 |.3..l};...>._Z@.| -00000040 a2 0d c7 35 f2 db a1 e0 1f 90 bb 6b c0 2f 00 00 |...5.......k./..| +00000000 16 03 03 00 59 02 00 00 55 03 03 e0 c7 ce be 3a |....Y...U......:| +00000010 a6 34 5f b7 c5 ec f1 f3 09 df 4d db 39 60 71 93 |.4_.......M.9`q.| +00000020 db 7c 30 e0 81 93 f0 19 57 6b 6b 20 9e 4b e2 1e |.|0.....Wkk .K..| +00000030 27 8d d3 f6 0c f3 3d bc 67 3e 79 33 fd c9 cc 55 |'.....=.g>y3...U| +00000040 36 55 a5 aa 89 94 fe b2 51 cf 24 56 c0 2f 00 00 |6U......Q.$V./..| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| 00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| @@ -60,33 +60,33 @@ 00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| 000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| 000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 45 79 ac ef 3b d5 3e |........ Ey..;.>| -000002d0 81 e1 7d 8a 9e 94 b3 d8 15 49 3c 2a 71 0a 31 74 |..}......I<*q.1t| -000002e0 2b 7a cc f7 5d 2d 72 d5 60 08 04 00 80 d1 63 69 |+z..]-r.`.....ci| -000002f0 e9 5f 99 c1 43 18 29 04 39 f2 ec 2b d8 dc e6 59 |._..C.).9..+...Y| -00000300 80 ff 27 f9 96 39 de 2c 26 9c f0 15 39 fa 42 ba |..'..9.,&...9.B.| -00000310 80 d8 1b f6 64 07 e4 2e b3 1e ce 20 51 59 82 97 |....d...... QY..| -00000320 a1 2f d5 3f 18 05 12 12 1e aa cf 29 93 34 89 18 |./.?.......).4..| -00000330 0b 19 e0 30 21 5f ce c2 75 58 a1 aa 98 44 cb c0 |...0!_..uX...D..| -00000340 08 db 6e c5 95 9c a7 f5 a2 30 c7 9d 9d 31 1d a1 |..n......0...1..| -00000350 b8 3f 05 b8 13 b6 89 a8 3c 78 fe ae e5 6f 2a 91 |.?............T.......K| +000002e0 9c ab d7 ce 2c e5 26 20 04 08 04 00 80 d8 c0 18 |....,.& ........| +000002f0 90 8e 06 d8 d6 4c af a1 ae 5e ca 4b a1 18 bb 31 |.....L...^.K...1| +00000300 f5 3a 75 c3 d7 73 69 a7 e0 0f 8e f2 c5 92 0a bd |.:u..si.........| +00000310 7f 91 36 6c 01 c3 eb 08 9a 3b 25 2c bd 86 88 05 |..6l.....;%,....| +00000320 64 e0 38 5b 75 01 10 1f 1b d5 34 09 04 2e 34 6d |d.8[u.....4...4m| +00000330 71 d2 6c b6 f3 7a 1e ed a9 9d 28 60 13 fc 02 6f |q.l..z....(`...o| +00000340 f6 17 99 52 7b 19 60 e5 a6 11 d4 b3 4c 52 03 b5 |...R{.`.....LR..| +00000350 3e 28 91 c6 66 87 25 df 10 c6 cf b9 5f 92 0e d7 |>(..f.%....._...| +00000360 b6 19 f0 19 b9 f6 e9 e9 24 74 35 3b c6 16 03 03 |........$t5;....| 00000370 00 04 0e 00 00 00 |......| >>> Flow 3 (client to server) 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| -00000030 16 03 03 00 28 00 00 00 00 00 00 00 00 b5 c1 dc |....(...........| -00000040 8e c0 bc 78 74 a7 c6 36 23 67 55 5d bc 82 db 77 |...xt..6#gU]...w| -00000050 85 d8 76 c8 98 65 63 8e f2 47 0b 5b 10 |..v..ec..G.[.| +00000030 16 03 03 00 28 00 00 00 00 00 00 00 00 01 e4 5a |....(..........Z| +00000040 e9 dc dd 98 cd 5f d2 d2 eb 84 12 c9 96 ca 91 d7 |....._..........| +00000050 ae f4 db 44 a4 37 f3 a3 b2 8d db ed 3d |...D.7......=| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 6e 20 eb fc d1 |..........(n ...| -00000010 a1 0e 6c a5 d9 6c ab fc 4d 0e f3 f0 61 84 2d 14 |..l..l..M...a.-.| -00000020 06 53 eb 69 18 b3 e3 f1 32 e8 19 00 5e 74 97 e5 |.S.i....2...^t..| -00000030 98 a7 8a |...| +00000000 14 03 03 00 01 01 16 03 03 00 28 c2 2d 32 ba 46 |..........(.-2.F| +00000010 27 8d 87 13 7f b9 49 04 64 2f 6e cc 32 81 f8 3c |'.....I.d/n.2..<| +00000020 7f 0f 19 13 5c 11 33 a1 05 5f 91 bc 97 30 64 84 |....\.3.._...0d.| +00000030 57 69 90 |Wi.| >>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 32 91 ac |.............2..| -00000010 63 b8 71 f1 26 18 ac 15 45 58 6c 60 18 77 bc 5c |c.q.&...EXl`.w.\| -00000020 ff 5b cd 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.[..............| -00000030 ad 89 71 22 f0 e0 61 3e 2b f7 d9 da 96 34 51 72 |..q"..a>+....4Qr| -00000040 c9 be |..| +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 fd 0f a5 |................| +00000010 74 98 c4 98 ee 67 74 d4 c1 d4 fe d3 c7 e2 1b 2c |t....gt........,| +00000020 e5 3c be 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.<..............| +00000030 f8 d4 60 41 13 6a 9c e3 0e 56 e2 ab 96 45 7e 06 |..`A.j...V...E~.| +00000040 87 63 |.c| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-AES128-SHA256 b/libgo/go/crypto/tls/testdata/Client-TLSv13-AES128-SHA256 index c35db9e681f..4273484ca71 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-AES128-SHA256 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-AES128-SHA256 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,84 +7,84 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 e6 6e e6 44 9a |....z...v...n.D.| -00000010 c9 e2 51 58 ac ba 02 48 ea 6f dd 09 7a 08 04 d2 |..QX...H.o..z...| -00000020 df b6 96 2f 31 d4 6b bf ab 0e 8e 20 00 00 00 00 |.../1.k.... ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 f7 30 f3 d1 e7 |....z...v...0...| +00000010 eb 94 97 a2 c6 d5 be 74 e0 6c 08 80 2f ad 11 6b |.......t.l../..k| +00000020 b3 ce 22 59 06 a9 eb 41 9c 97 a8 20 00 00 00 00 |.."Y...A... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 98 |..+.....3.$... .| -00000060 b2 16 47 4d 82 da 23 5b 2a a4 63 29 11 a8 d4 c0 |..GM..#[*.c)....| -00000070 0b 5e 2d 73 0d d6 e7 1e 15 78 1a c2 58 93 70 14 |.^-s.....x..X.p.| -00000080 03 03 00 01 01 17 03 03 00 17 c3 65 82 87 0c 61 |...........e...a| -00000090 57 28 08 d5 da fc 59 8d a3 76 49 0f d5 80 68 3d |W(....Y..vI...h=| -000000a0 03 17 03 03 02 6d c5 f1 b7 8a 61 03 06 9e 0f 3b |.....m....a....;| -000000b0 be 71 5b 29 17 c7 ed 0e 23 40 90 c6 7a 22 4e ad |.q[)....#@..z"N.| -000000c0 d5 f1 60 f6 db d9 37 73 1f b6 43 f7 7b fe 7b aa |..`...7s..C.{.{.| -000000d0 f7 16 28 e5 a8 b6 be 69 da 79 09 b5 dc ab bf d3 |..(....i.y......| -000000e0 36 ca 19 ae 8c de 27 5c 0d 44 5e 4a e2 ac ff bc |6.....'\.D^J....| -000000f0 33 4e 35 d3 8d 21 22 4d 12 38 e2 f9 73 3b 3d d1 |3N5..!"M.8..s;=.| -00000100 a7 b1 06 6a 6a 8d 25 0f 47 b1 d1 f2 da 32 cc 58 |...jj.%.G....2.X| -00000110 9e 78 b6 b4 4e c1 bc 9d 91 38 44 ff 35 71 a7 c3 |.x..N....8D.5q..| -00000120 39 67 5b 50 b1 9b 87 5d fd 6d 87 42 25 10 1a 19 |9g[P...].m.B%...| -00000130 e1 95 19 2f a1 2c 95 6e ce 6c c9 d9 92 1d e6 7f |.../.,.n.l......| -00000140 9d d0 98 60 f3 6c cf 64 8e 66 bb a4 af de 1e b6 |...`.l.d.f......| -00000150 6a 6d 7b 11 a7 ca e1 29 49 f3 57 50 73 e8 36 79 |jm{....)I.WPs.6y| -00000160 81 fe 33 f7 04 1a 04 e3 60 8e e7 11 fa 07 bb 79 |..3.....`......y| -00000170 73 c0 b7 5e 0f 61 b7 3a 50 85 a4 e1 8e 3b a3 43 |s..^.a.:P....;.C| -00000180 79 8a 14 78 0a ff 66 b4 c3 c0 fe 0a 6a c6 66 72 |y..x..f.....j.fr| -00000190 a8 8a e1 9c a6 ad ee 74 53 d9 b8 07 17 b3 9b f6 |.......tS.......| -000001a0 eb 28 1b 64 97 aa 17 fa 80 36 cb b1 35 6e ec e1 |.(.d.....6..5n..| -000001b0 16 1f ba 00 0c 26 fb 17 0e 00 8a e3 28 0d 6a 76 |.....&......(.jv| -000001c0 8c 78 ee 55 02 78 66 90 5b 87 f2 16 e2 af ef fb |.x.U.xf.[.......| -000001d0 a1 f3 8f fd b9 8e e3 16 68 7a ec c0 54 2f 88 c4 |........hz..T/..| -000001e0 08 6c 55 48 58 56 ac 3e 26 5b 67 42 18 72 6e a1 |.lUHXV.>&[gB.rn.| -000001f0 b5 86 cf 55 d1 29 c5 9b 2c 7b 7d f3 a5 26 2e 5e |...U.)..,{}..&.^| -00000200 21 3a 40 97 5a c1 c8 13 3d c3 12 4e d8 88 e1 8f |!:@.Z...=..N....| -00000210 e8 c5 d3 9b 0f 49 24 42 da 27 ac e5 5e 21 2e 2c |.....I$B.'..^!.,| -00000220 8b 27 ae c4 39 49 6f 43 69 a3 e4 0d f1 fc 62 9f |.'..9IoCi.....b.| -00000230 be 65 78 01 d8 c8 4e 0f b5 d7 12 d1 fc 73 cc 6e |.ex...N......s.n| -00000240 cc df d3 df 33 e4 f8 8e 4f 82 60 cd 1f a1 71 74 |....3...O.`...qt| -00000250 20 7a e2 46 fc 7a 83 15 dc 6c 5d b3 4f 92 de a2 | z.F.z...l].O...| -00000260 99 b5 33 4e b0 5d 19 0f 84 ae de 65 2e ee ef 40 |..3N.].....e...@| -00000270 e9 5b c6 53 86 0d 88 fc 2a b2 2c 5c 76 66 95 a7 |.[.S....*.,\vf..| -00000280 96 ad 7f ba 27 ea e4 54 5e 77 97 0d 6f 9e b8 e5 |....'..T^w..o...| -00000290 b7 2f 75 13 42 7e 61 08 e3 69 31 d4 e6 d0 c0 6d |./u.B~a..i1....m| -000002a0 e3 e2 e4 69 5d d0 7d c2 f1 48 a1 e0 23 f1 19 81 |...i].}..H..#...| -000002b0 23 ed a7 ac ed 88 70 60 c6 eb cf 11 23 39 cb 91 |#.....p`....#9..| -000002c0 35 3b 32 6c 20 fc 61 cb 49 77 9c d9 5d e2 b4 41 |5;2l .a.Iw..]..A| -000002d0 b9 c6 22 af 36 e4 a4 c4 45 47 f4 53 3f 7f b4 25 |..".6...EG.S?..%| -000002e0 a0 34 f4 40 42 04 17 63 3b fa 05 35 c3 76 ec f7 |.4.@B..c;..5.v..| -000002f0 b3 ee 62 fb 03 dc 06 22 90 4b fd 07 62 3b cd 27 |..b....".K..b;.'| -00000300 da 87 32 73 3d 46 5c e7 b6 22 f7 02 8e 43 f4 46 |..2s=F\.."...C.F| -00000310 79 cb 9b 17 03 03 00 99 81 e1 c1 b3 1d 11 4b 61 |y.............Ka| -00000320 6a 4a f2 9a 97 52 36 2a fc ef 77 54 aa 28 a7 4f |jJ...R6*..wT.(.O| -00000330 46 c5 69 2a a7 d7 da d6 ff 28 b1 21 3b 66 ac a7 |F.i*.....(.!;f..| -00000340 ff 66 0a 10 20 1d 24 9b f3 46 1a a7 04 4b b5 3d |.f.. .$..F...K.=| -00000350 e8 49 fc 3a f0 74 a8 02 b9 2d 5d e4 de 91 ef 4d |.I.:.t...-]....M| -00000360 ab 47 10 2c ba 70 c1 aa a9 79 a8 96 27 71 90 e3 |.G.,.p...y..'q..| -00000370 91 4d 4e dd 96 e0 4c ad c5 0b 44 0a c0 4d 17 42 |.MN...L...D..M.B| -00000380 65 12 8a ba fb 7c 66 7c 92 61 87 07 cd e3 a0 16 |e....|f|.a......| -00000390 8b 94 23 77 85 70 88 d2 22 64 14 16 b5 ab db 6a |..#w.p.."d.....j| -000003a0 b9 23 26 ee c8 33 6e 9b a6 e4 d1 85 d2 81 3a 5d |.#&..3n.......:]| -000003b0 33 17 03 03 00 35 b2 85 a7 fd fc 27 46 25 8f cd |3....5.....'F%..| -000003c0 ac ff 84 0a 54 cf f2 11 94 41 d0 7e 04 50 61 7d |....T....A.~.Pa}| -000003d0 71 40 df bc 48 0f c1 32 50 83 5c 05 c9 a5 02 95 |q@..H..2P.\.....| -000003e0 77 04 8c 76 ee 44 32 44 94 e3 8b |w..v.D2D...| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 c0 |..+.....3.$... .| +00000060 47 7e ad a1 41 53 e5 25 ec 74 46 bc 9e 80 08 3b |G~..AS.%.tF....;| +00000070 0b f5 7e fb 71 1f 00 d5 4b 27 51 22 4a 5e 5f 14 |..~.q...K'Q"J^_.| +00000080 03 03 00 01 01 17 03 03 00 17 e9 e8 56 00 26 9e |............V.&.| +00000090 92 60 84 6c 07 3d b1 ef e4 63 51 ba 48 ee d7 fe |.`.l.=...cQ.H...| +000000a0 57 17 03 03 02 6d 2e d4 bb bf a2 e8 3b 84 47 2e |W....m......;.G.| +000000b0 22 66 c1 98 ea 11 6b a3 4d 1b 64 c0 02 32 76 9b |"f....k.M.d..2v.| +000000c0 29 8a 4a 96 68 5b d1 fd a0 0f a6 9b 70 20 c7 08 |).J.h[......p ..| +000000d0 7b 25 07 d1 54 8c b1 bb 4e ba 32 65 2c 1e 16 29 |{%..T...N.2e,..)| +000000e0 e7 d2 df e3 84 60 e1 43 07 99 35 4d 95 7c 27 96 |.....`.C..5M.|'.| +000000f0 be f4 bf 0a e9 3b 9d 60 7a 6e 34 82 1f 03 ca 17 |.....;.`zn4.....| +00000100 ac d1 a1 b5 dc 3f 20 7b 42 f6 94 43 60 ff 3f 1b |.....? {B..C`.?.| +00000110 b1 2e 2d 71 55 07 fb 65 40 56 59 82 1e 31 83 c9 |..-qU..e@VY..1..| +00000120 35 6c 28 ad c1 bd 88 55 1b b6 1e 89 af 64 7f 11 |5l(....U.....d..| +00000130 53 80 3a 62 ef 34 a7 d0 ce 38 9b 19 d6 5f 78 0d |S.:b.4...8..._x.| +00000140 66 73 b2 bd b6 a6 f8 70 c8 40 f9 aa a2 86 f4 48 |fs.....p.@.....H| +00000150 0d 6c 54 67 c6 3c 91 97 ff 94 4d 9a 01 d5 e1 c9 |.lTg.<....M.....| +00000160 8f 27 d3 8d b3 72 cd 34 eb 7a 6d 48 84 f3 8b 84 |.'...r.4.zmH....| +00000170 34 d2 68 bd 26 bc 6d e5 46 41 cc 86 d4 7a b6 31 |4.h.&.m.FA...z.1| +00000180 05 b3 bc a4 fe e1 5c d4 eb 8b fe 64 0e be 89 c4 |......\....d....| +00000190 ce e0 49 a0 ba 7a 83 b6 fb 31 17 42 fd b4 e3 59 |..I..z...1.B...Y| +000001a0 48 df f6 a8 e4 5c d1 77 77 cb c2 31 85 8a 26 65 |H....\.ww..1..&e| +000001b0 20 fa 05 90 ae 66 95 7a 75 4b bc 93 15 dd a0 13 | ....f.zuK......| +000001c0 61 d5 99 fb b2 27 bd ec fd 10 b5 d2 c7 18 ac b9 |a....'..........| +000001d0 bd bc 35 72 d0 42 6c f7 5a e0 67 46 45 10 f7 50 |..5r.Bl.Z.gFE..P| +000001e0 e4 14 47 ac 39 5a 05 38 b9 25 4a 43 fa 57 b2 51 |..G.9Z.8.%JC.W.Q| +000001f0 b7 3e f7 ef d5 b5 de 2e 2f 5c d0 d7 00 23 ac 4b |.>....../\...#.K| +00000200 65 8d 6c f4 ab 6f ef 1e c2 66 c5 b2 cb 1a 51 4c |e.l..o...f....QL| +00000210 ef 96 8f 28 65 2f 50 9c 91 1f 73 87 fc 81 db 90 |...(e/P...s.....| +00000220 16 69 00 06 98 6b 00 33 41 e1 e6 12 89 cb c9 f3 |.i...k.3A.......| +00000230 23 2c 28 83 00 ca 4f 42 f5 26 bc 94 39 3b 18 31 |#,(...OB.&..9;.1| +00000240 41 a9 19 4a 60 e8 de 8f 1d d0 e8 96 77 c0 49 bd |A..J`.......w.I.| +00000250 a2 98 bd b1 0a 6f bd 27 79 1d c4 33 50 37 a8 eb |.....o.'y..3P7..| +00000260 a5 4e 59 87 58 cd f0 a0 34 4e 2b 9d ee 03 e4 8a |.NY.X...4N+.....| +00000270 24 94 86 11 e1 94 f0 2b 3e 27 9a 92 1c 17 d3 96 |$......+>'......| +00000280 c0 71 ab ee 75 5f 99 ca 0e 42 65 5d ed 48 0c 7a |.q..u_...Be].H.z| +00000290 95 8a d9 da f7 60 ee de 46 f2 f4 7a d6 ce 38 41 |.....`..F..z..8A| +000002a0 fa e8 1f 3e 77 be 02 53 0c 33 96 5b 0d 38 bb 08 |...>w..S.3.[.8..| +000002b0 5e 92 1a 81 f1 be c7 9a e2 02 80 09 3b b7 62 b0 |^...........;.b.| +000002c0 7c a7 85 3a d9 52 34 23 4f a3 04 e7 35 98 9e 18 ||..:.R4#O...5...| +000002d0 13 0b 71 12 6d a4 2e 11 bf 39 8c 94 ef 15 96 27 |..q.m....9.....'| +000002e0 9e be 81 d9 55 5a 8b 14 c5 49 dd 6e 6e 7b 6b c2 |....UZ...I.nn{k.| +000002f0 f3 7d ef 24 88 b9 eb a6 15 3e aa a8 3e eb 37 54 |.}.$.....>..>.7T| +00000300 fc 86 9f 51 30 5f 9c a5 fc 7a af f6 1b a5 a4 27 |...Q0_...z.....'| +00000310 51 78 f7 17 03 03 00 99 79 14 63 10 91 cd 73 f5 |Qx......y.c...s.| +00000320 a8 62 c3 92 a3 04 c2 3d 58 5e d3 6e 93 eb 9b b1 |.b.....=X^.n....| +00000330 11 f0 3c c6 96 9f c6 c8 9b de 2c d5 12 c2 bd d1 |..<.......,.....| +00000340 2a 68 89 4a 07 1e 23 d2 45 ca a1 0f 92 71 b7 f7 |*h.J..#.E....q..| +00000350 d0 2f 2a be d0 5e 0c 5d 13 8f b0 7f df b8 52 2e |./*..^.]......R.| +00000360 7a 5e c8 eb 84 06 46 81 d0 f7 09 18 52 fb ce fd |z^....F.....R...| +00000370 22 d8 74 71 e8 7d 41 5f 3a 5d e5 f9 bb e6 99 03 |".tq.}A_:]......| +00000380 32 d1 58 e8 5a 58 d8 b2 39 61 01 33 72 7d d2 11 |2.X.ZX..9a.3r}..| +00000390 8f f7 58 55 c8 f2 64 63 33 9b 78 36 bf 9b 8b 40 |..XU..dc3.x6...@| +000003a0 8c ec 7b a2 bb 51 ed b1 fe 74 c2 c9 1f b4 2b cb |..{..Q...t....+.| +000003b0 fd 17 03 03 00 35 75 46 88 74 06 9b 5e 88 c2 0d |.....5uF.t..^...| +000003c0 fc 7d 29 bd 6c 1c 23 2f 06 3f 14 b1 55 e4 98 b1 |.}).l.#/.?..U...| +000003d0 ed c3 9a ed ea be 29 60 15 ac 80 c7 a8 f7 9b ce |......)`........| +000003e0 f3 79 b3 be ad ff ab b4 a7 45 57 |.y.......EW| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 35 11 f3 e0 d9 39 |..........5....9| -00000010 43 24 33 e1 54 01 5d f2 c7 50 21 9f db 2d 31 81 |C$3.T.]..P!..-1.| -00000020 3f d5 9c cb 59 cb 24 40 2a 77 da 0a 9e 52 12 11 |?...Y.$@*w...R..| -00000030 1e a8 f8 e2 f2 9e 32 6c 06 8c 48 e8 bf 9d ef 0f |......2l..H.....| -00000040 17 03 03 00 17 bc a1 a2 8a a1 6c c3 19 d1 49 7f |..........l...I.| -00000050 57 af 58 5b ff 7b 11 b2 bb 45 3c 6f 17 03 03 00 |W.X[.{...E>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,86 +7,86 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 fa ff 71 26 f0 |....z...v....q&.| -00000010 2c ee 80 2c 1c f9 ea 4b de ad d0 61 83 7f 89 6f |,..,...K...a...o| -00000020 db e6 a9 53 ff c5 b5 ec 04 08 4c 20 00 00 00 00 |...S......L ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 dd df 8d 85 da |....z...v.......| +00000010 3c 99 a3 0c 01 90 5f ec b8 3d 28 ce e4 32 c0 e8 |<....._..=(..2..| +00000020 fe 77 03 ad 0f e1 33 1f dc 89 cb 20 00 00 00 00 |.w....3.... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 02 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 6f |..+.....3.$... o| -00000060 2a 3a fe 8e dc cf 2e 7d 26 bd 12 fb da 0a 00 16 |*:.....}&.......| -00000070 b7 12 79 72 a0 a8 95 11 81 d5 b3 ae f8 d7 26 14 |..yr..........&.| -00000080 03 03 00 01 01 17 03 03 00 17 42 95 95 65 84 db |..........B..e..| -00000090 3e dc c4 41 bb e2 21 94 27 2d 9e 27 4e dd 3e 9d |>..A..!.'-.'N.>.| -000000a0 6e 17 03 03 02 6d 71 24 bb 82 cf aa 37 52 4c 15 |n....mq$....7RL.| -000000b0 6d 5c 74 44 c5 08 21 31 ab 47 5a 75 b9 31 d6 97 |m\tD..!1.GZu.1..| -000000c0 69 64 40 b5 09 1c 2b 36 1d 54 19 52 4b ad c9 1c |id@...+6.T.RK...| -000000d0 d4 51 33 80 a4 b9 df 47 17 6a eb 7a d7 bc 12 3e |.Q3....G.j.z...>| -000000e0 7b 28 fa 15 16 aa 23 6f b5 5f a4 f6 8e 2b 00 11 |{(....#o._...+..| -000000f0 1b f2 00 e4 c8 31 38 ee 61 71 bc 7f dd a1 45 2d |.....18.aq....E-| -00000100 ac 1c 2b fd cd 40 51 29 4e 07 fd f4 04 45 09 56 |..+..@Q)N....E.V| -00000110 72 c8 83 22 3e 20 06 3a 93 16 89 21 4a 9f 3b bc |r.."> .:...!J.;.| -00000120 63 7f c0 1b 6a b2 30 d1 49 43 90 08 af 28 4a c1 |c...j.0.IC...(J.| -00000130 79 96 a1 72 0a 82 fe fb 20 1d 18 f8 b7 03 01 89 |y..r.... .......| -00000140 05 04 d7 98 1b 77 2e ad 81 56 de 08 f1 83 1e 9c |.....w...V......| -00000150 7d 2b 16 e1 15 87 12 db 5f 59 5d a3 95 75 ab f8 |}+......_Y]..u..| -00000160 54 87 91 0d 7f 80 76 6e d8 44 f3 c5 ef d6 b4 3d |T.....vn.D.....=| -00000170 6e 91 4c 65 b7 94 2d 05 d1 1e e6 49 d4 78 1c 34 |n.Le..-....I.x.4| -00000180 48 4a 5b 8c ed ad f7 cb 60 98 56 b5 98 ed 7e 88 |HJ[.....`.V...~.| -00000190 4b 98 ec aa 7d 79 71 2c f2 2f 15 5e c1 ed a6 14 |K...}yq,./.^....| -000001a0 01 df 25 df 79 35 1c f0 52 85 7b 2b 46 2c 09 14 |..%.y5..R.{+F,..| -000001b0 26 86 2c 6a d5 ec cf 24 04 49 9c d8 61 65 02 aa |&.,j...$.I..ae..| -000001c0 d6 ce 55 07 2f b6 23 f3 a7 8d 78 f9 72 fc 77 8b |..U./.#...x.r.w.| -000001d0 45 72 0e 61 c2 e8 8d 65 00 50 8b 00 42 48 d1 10 |Er.a...e.P..BH..| -000001e0 1f 3e cc ca 21 10 4c 0b 6b fc f8 c1 b7 83 3e 25 |.>..!.L.k.....>%| -000001f0 8e 40 11 55 32 34 83 0b 98 38 ad 2a ff e0 ae 71 |.@.U24...8.*...q| -00000200 86 0d 9a ef 50 e8 8a 32 53 ba c8 71 4e 96 46 95 |....P..2S..qN.F.| -00000210 c2 31 b5 64 6c 74 8e b6 be 8c e7 bd 5c 79 fd 87 |.1.dlt......\y..| -00000220 db 7e 39 82 7c 7b 38 58 42 34 a1 64 e9 15 f8 f3 |.~9.|{8XB4.d....| -00000230 56 2c ec c9 4f f3 4d e0 3d a6 ec 87 5f 48 be 75 |V,..O.M.=..._H.u| -00000240 d0 9e a6 6c ef 97 db a8 66 ff 8b 5e 34 28 bb 34 |...l....f..^4(.4| -00000250 e0 9c a0 a1 18 2a f4 98 71 e7 8b 18 2c 7c 37 a9 |.....*..q...,|7.| -00000260 c0 75 b4 24 7f ce 85 42 fe ed 7f fd 6d 7c 3d 5b |.u.$...B....m|=[| -00000270 bf d4 72 b9 2f 6d b6 09 86 cd 48 2f 69 a5 94 86 |..r./m....H/i...| -00000280 ab e9 04 b7 b3 88 3b 49 6b 28 e5 8a 30 73 60 9a |......;Ik(..0s`.| -00000290 c9 ff c5 ff 62 0b cc 3a ec 8b 4b a5 f2 2e c3 9d |....b..:..K.....| -000002a0 a1 5d 51 9d f0 2d 88 20 24 cc bf cf 79 69 aa 4d |.]Q..-. $...yi.M| -000002b0 f0 86 ba 9f 7c b4 f0 e3 97 54 7b f5 68 f8 da 26 |....|....T{.h..&| -000002c0 38 a5 5c 86 c5 0a f5 06 af 58 66 e3 40 a0 33 d4 |8.\......Xf.@.3.| -000002d0 cb 90 52 1b 81 3d 31 9d f9 8f 4f d9 38 80 f3 ea |..R..=1...O.8...| -000002e0 79 c4 2c 55 3f ea 9b 79 51 24 dc 70 6e 5c 68 ce |y.,U?..yQ$.pn\h.| -000002f0 b0 65 58 ec 3d 62 27 f3 1c 34 b4 7c b5 8e 91 1d |.eX.=b'..4.|....| -00000300 dc 6b 21 b5 3d 9c 6f 30 91 f8 39 d8 11 03 65 95 |.k!.=.o0..9...e.| -00000310 72 71 36 17 03 03 00 99 4f 82 32 b2 1c df 6d 0d |rq6.....O.2...m.| -00000320 c5 6f d7 89 39 07 42 4d d5 ae 7d 0d 6f a8 68 41 |.o..9.BM..}.o.hA| -00000330 ca 64 5c 38 5a 31 85 02 d7 99 28 ac 0d 33 1b e2 |.d\8Z1....(..3..| -00000340 d8 f7 f2 d3 13 30 50 0f e9 21 3c 9e 53 1c fb cd |.....0P..!<.S...| -00000350 96 e7 00 ef 35 5d d6 a7 64 77 fd 76 07 fa e6 e0 |....5]..dw.v....| -00000360 04 ec cf c0 76 41 a7 12 37 e0 c3 42 43 11 54 7e |....vA..7..BC.T~| -00000370 4f b8 38 3a 3e 60 0f 9c ac 65 d1 84 d3 6e b1 c2 |O.8:>`...e...n..| -00000380 fc be a7 96 59 89 87 c7 b9 d7 09 c0 ef 68 d7 10 |....Y........h..| -00000390 a5 08 8a 45 23 17 47 e3 eb f7 9f d3 ab 54 d1 4a |...E#.G......T.J| -000003a0 8c 69 1f aa a3 43 af dd ce 76 a3 9a 6f e5 4c 6a |.i...C...v..o.Lj| -000003b0 07 17 03 03 00 45 b8 72 a2 fb af 1c 5e 8f ed 0a |.....E.r....^...| -000003c0 53 85 d3 cd 32 ad 56 ba 38 82 1c 23 40 83 7e c1 |S...2.V.8..#@.~.| -000003d0 ce 0f 53 f5 74 a0 54 39 aa fb f1 13 8d 5f 3a 93 |..S.t.T9....._:.| -000003e0 fc 98 72 3f e5 70 e2 e5 97 fb 92 ca 2b 52 50 96 |..r?.p......+RP.| -000003f0 3f d0 8d 94 d5 17 2b 0d 90 4a 12 |?.....+..J.| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 03 |..+.....3.$... .| +00000060 6b 91 90 36 f0 54 da 66 8e 47 9b 26 9f 9f ae 30 |k..6.T.f.G.&...0| +00000070 69 9e a2 6a 70 fb ef b2 f1 76 2b 32 90 0e 63 14 |i..jp....v+2..c.| +00000080 03 03 00 01 01 17 03 03 00 17 46 47 2e ae ea 9b |..........FG....| +00000090 78 7b 0c d4 74 e2 b5 bf 7b 64 da c3 d3 c9 55 7f |x{..t...{d....U.| +000000a0 e3 17 03 03 02 6d a8 c1 57 27 66 9d 16 f6 4f 1b |.....m..W'f...O.| +000000b0 17 b6 5d 8c 3c fe f5 d5 4a d3 c6 8d e2 a8 2d d0 |..].<...J.....-.| +000000c0 01 8d db 18 e8 c8 69 74 eb 81 9e 97 20 01 60 d5 |......it.... .`.| +000000d0 96 d1 8f 9c de 09 ff 1d e7 45 97 97 36 fa 89 77 |.........E..6..w| +000000e0 88 20 30 c6 5b 42 d6 0e 85 9a 11 43 60 a1 86 34 |. 0.[B.....C`..4| +000000f0 22 47 25 23 a5 35 87 a9 74 5d fe eb c9 70 32 44 |"G%#.5..t]...p2D| +00000100 17 60 55 99 7a 93 b5 92 8b 66 31 ce dc e0 39 f2 |.`U.z....f1...9.| +00000110 6a b3 db 43 5d 3f ba e5 12 12 1f 0e 3c 35 3b 72 |j..C]?......<5;r| +00000120 9f 9d 69 d5 d6 cb ac b5 9e f4 af f5 74 68 67 f4 |..i.........thg.| +00000130 e9 5f a4 4a d7 27 5b a5 2a 39 b7 30 49 4d 64 bb |._.J.'[.*9.0IMd.| +00000140 5d 89 10 ff a6 2c 42 a1 4a 2a 0c 28 c6 cd 4a e8 |]....,B.J*.(..J.| +00000150 7d 24 d0 75 ff 61 08 3f 3b 05 ec f3 d6 61 ed 43 |}$.u.a.?;....a.C| +00000160 08 5e 07 1c f2 15 96 22 2a c0 3c 5f 04 d1 17 82 |.^....."*.<_....| +00000170 ea ee ee c7 49 cc 3e e4 65 15 97 6e 6f 36 24 a9 |....I.>.e..no6$.| +00000180 27 34 3a 75 dc 07 1e 4c f1 29 d1 e3 22 31 7d 84 |'4:u...L.).."1}.| +00000190 a8 2a 7f 37 03 ab 13 ae 15 e2 74 50 bd 54 5b 32 |.*.7......tP.T[2| +000001a0 ea 75 10 ed 39 5c 69 90 f6 74 09 53 c1 ce 44 49 |.u..9\i..t.S..DI| +000001b0 64 fb f2 c6 bd 93 b2 07 06 96 94 04 a5 9e ed 67 |d..............g| +000001c0 10 cb 01 fc 85 45 d7 22 76 3c c6 2f 14 4c 31 e1 |.....E."v<./.L1.| +000001d0 73 81 7b 8b 6b 54 d6 34 15 d2 eb d0 03 10 c7 3d |s.{.kT.4.......=| +000001e0 f5 07 48 cc 72 9b e9 48 ee 13 9f 80 b5 13 86 77 |..H.r..H.......w| +000001f0 33 91 79 6f f2 13 17 68 ca 72 6b 0d 93 9a 20 30 |3.yo...h.rk... 0| +00000200 70 c3 30 ab 13 7e 14 39 97 4b ce c5 3d 8b 03 7f |p.0..~.9.K..=...| +00000210 cd 4b 67 c4 c5 79 0c bb cd ba 17 c5 d5 15 51 cb |.Kg..y........Q.| +00000220 ac b7 f7 19 43 ff f5 c4 09 8c 44 67 ca e6 a1 5f |....C.....Dg..._| +00000230 1d 27 29 63 f2 0d 75 6d b7 62 52 c9 1d 8e 0e 3b |.')c..um.bR....;| +00000240 6c cb 04 3e f7 13 74 bb 03 35 2e 4e 41 9a b7 72 |l..>..t..5.NA..r| +00000250 15 ed 02 79 c7 bc 38 b3 65 75 0a 8e 82 dc d4 79 |...y..8.eu.....y| +00000260 1c 10 3f 78 8c be 78 b0 73 18 cc 52 1d 3b 91 66 |..?x..x.s..R.;.f| +00000270 33 fe 63 b2 ec 19 92 44 8f 06 4e 20 85 94 5c b4 |3.c....D..N ..\.| +00000280 ad 22 16 a0 b3 76 03 dc 62 e9 0c ac 8c e1 67 c9 |."...v..b.....g.| +00000290 d8 6f 40 51 b5 39 9a 61 b6 63 e0 d5 60 6a 27 78 |.o@Q.9.a.c..`j'x| +000002a0 62 ec 94 1c 75 2c 38 f2 a6 f2 f0 c4 8f 98 ad cc |b...u,8.........| +000002b0 2e ce 7d 13 76 f4 4f 94 78 3f 85 cf ea 52 c4 6e |..}.v.O.x?...R.n| +000002c0 16 65 f9 48 5e f9 0b 07 bc 3e 38 91 06 e1 b0 76 |.e.H^....>8....v| +000002d0 82 60 25 03 36 9c 3e 5e 54 73 8d cf df 91 19 33 |.`%.6.>^Ts.....3| +000002e0 a7 18 96 d4 86 ea 7c 00 88 e6 a3 fe ea a1 14 db |......|.........| +000002f0 ae da 07 ef 1e 6f 16 bb ad fb c0 f4 60 2f 75 5c |.....o......`/u\| +00000300 a4 43 a0 fc 3c d6 5e 89 cf 6e 1a c6 de 61 65 34 |.C..<.^..n...ae4| +00000310 03 e5 cd 17 03 03 00 99 0a f3 a2 45 fe 53 22 37 |...........E.S"7| +00000320 cd 31 9d 67 31 56 f9 99 c2 d1 bc 6d 47 de 9a e7 |.1.g1V.....mG...| +00000330 67 c0 89 84 ac bf 27 b5 32 f0 e9 a5 9d f2 e0 ad |g.....'.2.......| +00000340 fd 12 6a a4 5d 50 4c b9 ed f1 f4 0e c0 c0 6c c4 |..j.]PL.......l.| +00000350 39 9b 10 02 fa 10 64 a6 8b af 9d 6e d9 40 6d 0c |9.....d....n.@m.| +00000360 b0 6c b8 8d d5 b0 14 f0 ed 85 d6 66 8f 6f 61 43 |.l.........f.oaC| +00000370 49 dd 95 08 94 2e a8 a6 19 b9 7b 6b 99 09 af 4c |I.........{k...L| +00000380 5f 41 48 da 10 b6 cf ee 68 b6 6e 03 d7 29 93 8e |_AH.....h.n..)..| +00000390 1a ab d1 ad d4 bf 33 2a 53 87 92 05 d1 1a de c0 |......3*S.......| +000003a0 aa ef b9 9c 4d 2d f6 b1 72 60 22 80 bb 46 24 75 |....M-..r`"..F$u| +000003b0 35 17 03 03 00 45 46 9e b3 7f d0 82 b6 ef 45 1f |5....EF.......E.| +000003c0 18 6d 3b b6 23 f5 c9 f4 54 e3 08 d0 8b 30 c7 31 |.m;.#...T....0.1| +000003d0 af 98 26 69 b7 6e 08 1d 1f be 1a 7e 5b 97 91 28 |..&i.n.....~[..(| +000003e0 fa b7 78 05 ee 3f a1 9e a0 79 fc 45 51 4c 96 fb |..x..?...y.EQL..| +000003f0 03 46 24 7d fe ec a4 40 51 d6 73 |.F$}...@Q.s| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 45 f6 a2 b0 dd 25 |..........E....%| -00000010 6e 65 f4 c5 74 2b 60 e0 14 12 92 b3 fc 8c 18 06 |ne..t+`.........| -00000020 fb 5d c4 de d9 41 df 39 47 b1 d0 2f 3c 4e 90 fb |.]...A.9G../>> Flow 1 (client to server) -00000000 16 03 01 01 10 01 00 01 0c 03 03 00 00 00 00 00 |................| +00000000 16 03 01 01 12 01 00 01 0e 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,87 +7,87 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 91 33 74 00 00 00 05 00 05 01 00 00 00 |....3t..........| +00000080 01 00 00 93 33 74 00 00 00 05 00 05 01 00 00 00 |....3t..........| 00000090 00 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 |................| -000000a0 0b 00 02 01 00 00 0d 00 18 00 16 08 04 08 05 08 |................| -000000b0 06 04 01 04 03 05 01 05 03 06 01 06 03 02 01 02 |................| -000000c0 03 ff 01 00 01 00 00 10 00 10 00 0e 06 70 72 6f |.............pro| -000000d0 74 6f 32 06 70 72 6f 74 6f 31 00 12 00 00 00 2b |to2.proto1.....+| -000000e0 00 09 08 03 04 03 03 03 02 03 01 00 33 00 26 00 |............3.&.| -000000f0 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 28 da |$... /.}.G.bC.(.| -00000100 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........| -00000110 5f 58 cb 3b 74 |_X.;t| +000000a0 0b 00 02 01 00 00 0d 00 1a 00 18 08 04 04 03 08 |................| +000000b0 07 08 05 08 06 04 01 05 01 06 01 05 03 06 03 02 |................| +000000c0 01 02 03 ff 01 00 01 00 00 10 00 10 00 0e 06 70 |...............p| +000000d0 72 6f 74 6f 32 06 70 72 6f 74 6f 31 00 12 00 00 |roto2.proto1....| +000000e0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| +000000f0 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 |&.$... /.}.G.bC.| +00000100 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| +00000110 90 99 5f 58 cb 3b 74 |.._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 8b 65 4e 74 f0 |....z...v...eNt.| -00000010 c4 05 7a a1 58 a7 fd b0 55 9e d2 15 67 1f 19 f9 |..z.X...U...g...| -00000020 25 e1 3e 89 4f a6 79 90 95 5a 8c 20 00 00 00 00 |%.>.O.y..Z. ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 9a f4 f5 6b ec |....z...v.....k.| +00000010 37 69 ea a2 43 05 46 fe dd 55 27 2e 78 cb f6 cc |7i..C.F..U'.x...| +00000020 96 ea fd 68 98 bb 3e 9d 75 ad 6e 20 00 00 00 00 |...h..>.u.n ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 a5 |..+.....3.$... .| -00000060 e3 ac d0 3c 26 f8 66 41 ac b5 47 6f 63 a0 8f 0a |...<&.fA..Goc...| -00000070 6f 79 62 23 15 01 d0 57 5d 66 9c 09 50 c5 45 14 |oyb#...W]f..P.E.| -00000080 03 03 00 01 01 17 03 03 00 24 7d dc b2 50 38 8e |.........$}..P8.| -00000090 15 52 73 25 90 d3 d3 f2 19 da 76 ae 64 42 29 eb |.Rs%......v.dB).| -000000a0 21 1b 7d b1 d9 04 94 ac 71 b9 b3 e1 d7 59 17 03 |!.}.....q....Y..| -000000b0 03 02 6d cb 4e 30 d0 df 41 b8 1a 76 1d e2 a2 14 |..m.N0..A..v....| -000000c0 24 ec e4 b8 e4 5b 98 49 ed 4e 48 98 3d a7 89 d4 |$....[.I.NH.=...| -000000d0 d1 35 2f d4 12 dc 0b c3 3f e7 0c df 11 20 41 fb |.5/.....?.... A.| -000000e0 5c 24 62 82 26 ad 28 25 59 c0 c0 81 41 9d 80 b7 |\$b.&.(%Y...A...| -000000f0 db cd 41 bb 27 66 ba 55 e6 2f 52 5d 71 d4 77 6a |..A.'f.U./R]q.wj| -00000100 5c 5d 72 34 e6 83 9d c6 24 d1 be 3b 99 90 9b 22 |\]r4....$..;..."| -00000110 7f d8 81 39 d4 7b a8 f9 d7 61 82 a1 72 f9 27 0b |...9.{...a..r.'.| -00000120 b8 6a 5c 72 bd 8f 84 34 c6 d0 c8 1a b9 27 d6 7b |.j\r...4.....'.{| -00000130 12 20 37 b7 64 85 19 7e b4 37 46 df 51 77 23 be |. 7.d..~.7F.Qw#.| -00000140 c4 7a e4 7e 37 3b 53 3e 3b 86 8f 22 31 28 4b 8f |.z.~7;S>;.."1(K.| -00000150 89 0d dc 8d 67 37 53 9d 38 f2 5f 99 2c f4 76 64 |....g7S.8._.,.vd| -00000160 87 e4 ce b7 4f d0 83 99 b2 55 8c 38 8c d0 89 d1 |....O....U.8....| -00000170 2f 91 e8 ae ec b1 a6 29 65 3a 8f af 69 e0 48 00 |/......)e:..i.H.| -00000180 db 3e 30 bd 7f 4b 82 56 cf f9 5b 5e 74 d7 d5 4b |.>0..K.V..[^t..K| -00000190 47 4f 22 17 53 fc e6 98 a4 5a 25 ca 7d ca 39 e9 |GO".S....Z%.}.9.| -000001a0 fe 11 f5 ca 91 e1 25 3c 6d f2 b3 d0 9f ee 88 d2 |......%| +00000070 94 e1 51 d6 bf c7 1f 0c 4a b0 af 7f 91 a5 61 14 |..Q.....J.....a.| +00000080 03 03 00 01 01 17 03 03 00 24 3f 87 40 f6 93 e3 |.........$?.@...| +00000090 c9 cb 6e 83 75 c5 2f e3 af 0f 84 9a 3b 88 ad cc |..n.u./.....;...| +000000a0 99 c9 1b a8 26 e0 14 d4 ab fe 50 5f ad 79 17 03 |....&.....P_.y..| +000000b0 03 02 6d 67 86 8e eb e3 15 65 21 e5 2f aa 8d c7 |..mg.....e!./...| +000000c0 d5 34 6a b6 d3 ab 5f 96 f6 b2 79 b0 bc 3e f7 9c |.4j..._...y..>..| +000000d0 5d 8d 62 50 91 35 e1 7d fe 61 9b 8c 9d e1 4a 7f |].bP.5.}.a....J.| +000000e0 54 4b ad c5 35 3d c9 05 d1 b0 6c 3f b2 c4 f7 75 |TK..5=....l?...u| +000000f0 57 84 50 62 8d 50 80 be b6 71 b8 59 02 52 5d 55 |W.Pb.P...q.Y.R]U| +00000100 70 5e 76 61 77 d9 d1 f6 20 d1 d9 bf e2 03 16 1e |p^vaw... .......| +00000110 eb 1c 55 85 48 8d 43 72 56 2a d2 16 fc a3 cc 94 |..U.H.CrV*......| +00000120 08 6d a8 73 55 9d a8 0c 36 da f4 02 c9 23 7b d5 |.m.sU...6....#{.| +00000130 06 e7 63 63 a1 fa 80 1c ca 77 d3 ee 4a f8 61 31 |..cc.....w..J.a1| +00000140 4b 1c d6 8c f3 86 d3 16 ba fe 1c ff 5a f6 fa fc |K...........Z...| +00000150 d6 c7 ab b6 5a db 51 f3 cc 42 f0 65 b6 8f f3 d7 |....Z.Q..B.e....| +00000160 44 5a e7 1e a9 d4 a7 bd cd 20 bf a1 13 f1 b5 29 |DZ....... .....)| +00000170 91 a4 28 78 f5 b6 c2 09 a5 95 e5 98 ab c9 f4 4b |..(x...........K| +00000180 10 da eb 07 ff 46 44 f9 85 f6 4f 78 5c b0 fa 2d |.....FD...Ox\..-| +00000190 0b 3b 79 3f 11 a2 eb 12 96 a3 01 ac 13 d3 65 cc |.;y?..........e.| +000001a0 98 e8 c9 8c c3 c6 c9 09 aa f6 af 01 1e e5 30 40 |..............0@| +000001b0 40 88 44 26 ee 49 91 68 18 56 b9 ce 22 f6 80 ff |@.D&.I.h.V.."...| +000001c0 32 d0 ee 15 e3 8a 96 c0 e5 47 51 c1 7f 70 e1 fc |2........GQ..p..| +000001d0 3a 44 1a 36 b9 e7 ee f0 9c 4e 62 1f 78 2f cc dd |:D.6.....Nb.x/..| +000001e0 62 a3 3b 9b ae d1 34 ea 7f d7 dc b4 c5 2c d7 96 |b.;...4......,..| +000001f0 61 59 0b ed de cc 70 68 06 2c 93 3d a9 9f 0a 9b |aY....ph.,.=....| +00000200 46 0d 39 fa b0 db 7f 9b c1 80 c8 55 35 bb 10 4c |F.9........U5..L| +00000210 2d 8f 88 ae 94 bf 4a 5f 3b f5 95 e7 7a 47 e2 0e |-.....J_;...zG..| +00000220 19 b2 e7 69 f5 bb c0 08 9d e8 5e 23 f0 85 12 c0 |...i......^#....| +00000230 01 cf 7a 87 19 b1 98 97 8d 5a 19 5c 37 52 0b a7 |..z......Z.\7R..| +00000240 45 e8 8f 9b 0c 76 5f a6 5b d9 45 87 5b 6e 0e db |E....v_.[.E.[n..| +00000250 6a 6a e2 b2 1d f9 e6 31 13 09 8c 32 93 43 46 17 |jj.....1...2.CF.| +00000260 15 45 c8 26 7f f2 23 7b b1 da c4 20 56 59 4b c9 |.E.&..#{... VYK.| +00000270 3e 90 a6 77 ea 28 ea 05 74 b8 04 55 68 7a 60 91 |>..w.(..t..Uhz`.| +00000280 b7 8e 7d 96 11 ac 2d af f2 26 c5 03 99 57 80 a7 |..}...-..&...W..| +00000290 80 1f 6f ce fd 0e 81 af 2e d6 b0 6b 7c 4c 71 02 |..o........k|Lq.| +000002a0 4c 56 fc e9 0a 58 56 5e 4d fd 2d ea e8 ae d5 b7 |LV...XV^M.-.....| +000002b0 cf aa 66 48 a9 42 76 59 81 52 18 cf c4 6d d8 8c |..fH.BvY.R...m..| +000002c0 90 e3 57 28 53 43 5e ae cd 33 ac 64 e2 ff 65 17 |..W(SC^..3.d..e.| +000002d0 11 e2 6a 07 aa 57 40 63 90 51 11 43 9f 9e 6d 56 |..j..W@c.Q.C..mV| +000002e0 69 c2 44 bb f9 83 84 79 bf 98 be 62 e8 20 6e cc |i.D....y...b. n.| +000002f0 69 a9 c4 33 de 40 d5 e9 95 12 87 d5 28 24 05 62 |i..3.@......($.b| +00000300 ca b8 c2 bd d9 96 dc 16 03 c8 7d 9c 7a 83 de 55 |..........}.z..U| +00000310 3b 4f 90 7b af 36 9a a7 80 46 c5 76 14 70 6c f4 |;O.{.6...F.v.pl.| +00000320 17 03 03 00 99 6e 39 2c 0d 81 12 85 c2 1c 42 56 |.....n9,......BV| +00000330 6a 3a e2 04 60 af 78 13 20 d2 b5 b2 58 9e 2f b9 |j:..`.x. ...X./.| +00000340 f8 11 4f 52 cd 31 c3 a1 ec 83 bd 2e ea 9a 53 6b |..OR.1........Sk| +00000350 55 99 a6 8a 25 1c f7 b6 83 4e 9f 1e 5d c5 b2 b2 |U...%....N..]...| +00000360 a5 6b ea 87 96 0e 29 5b a4 24 f2 16 4c ad e1 9b |.k....)[.$..L...| +00000370 24 d2 95 7e 74 37 44 1a d7 83 f5 4c 28 3f 3d 92 |$..~t7D....L(?=.| +00000380 a7 6f 6e 70 1c 27 93 19 64 ee 61 dc 81 35 67 c8 |.onp.'..d.a..5g.| +00000390 f3 e6 de b0 8f 32 6c df b1 66 97 6b b9 4a 81 f0 |.....2l..f.k.J..| +000003a0 cd 3a b4 56 14 e3 27 50 b0 f3 9b 63 05 a5 99 3a |.:.V..'P...c...:| +000003b0 26 d6 a5 3c e4 ea 8a 5a 04 5e fb de 86 bb 17 03 |&..<...Z.^......| +000003c0 03 00 35 eb 5f 0f df 9f e0 c7 4d b4 3d a6 c8 1a |..5._.....M.=...| +000003d0 df f1 f8 1e 36 ea ae 30 32 da 78 0e 00 fe d3 54 |....6..02.x....T| +000003e0 cc 90 08 1a cb 92 1c 5f f7 0a 3c f7 19 ed a3 3b |......._..<....;| +000003f0 cb fd 56 cb 4f 30 83 07 |..V.O0..| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 35 f6 6b cb 4a 37 |..........5.k.J7| -00000010 3e e2 61 7e 5b ac c5 25 cc 54 a2 6d 4e 7c 37 19 |>.a~[..%.T.mN|7.| -00000020 ea 21 af df 7b dc 04 2d db 84 ad 06 04 bd 50 f5 |.!..{..-......P.| -00000030 05 9b 19 01 37 22 d2 6f 06 c2 63 dd 95 e6 ef 45 |....7".o..c....E| -00000040 17 03 03 00 17 6d 03 e7 38 f9 a4 3c a7 c2 ee 8d |.....m..8..<....| -00000050 07 49 bd e6 e4 be 3f a3 ec 64 6c 3a 17 03 03 00 |.I....?..dl:....| -00000060 13 cc a9 19 b1 03 56 99 c1 4c d0 f5 fd 3b e2 dd |......V..L...;..| -00000070 0e ef a0 20 |... | +00000000 14 03 03 00 01 01 17 03 03 00 35 ec 05 98 86 f9 |..........5.....| +00000010 a1 e4 14 c1 e2 85 17 62 f9 ff 5f 1f 53 8f 00 14 |.......b.._.S...| +00000020 28 dd 31 bc 9a 7e 2d 54 53 c2 57 f0 24 0f e1 ca |(.1..~-TS.W.$...| +00000030 5e 17 07 bc 32 a5 72 3f 3e 90 dd be f1 a1 cc 6b |^...2.r?>......k| +00000040 17 03 03 00 17 93 58 dd 95 9a 88 82 3d 63 41 f7 |......X.....=cA.| +00000050 ba da 0e 24 3f f2 b1 e5 db 83 2d bd 17 03 03 00 |...$?.....-.....| +00000060 13 03 a4 42 58 3b d7 c5 c2 08 45 e5 c1 bc eb 47 |...BX;....E....G| +00000070 b5 20 ea ce |. ..| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-CHACHA20-SHA256 b/libgo/go/crypto/tls/testdata/Client-TLSv13-CHACHA20-SHA256 index 98c3c52170c..6d7b508fd34 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-CHACHA20-SHA256 +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-CHACHA20-SHA256 @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,84 +7,84 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 49 41 93 3b 12 |....z...v..IA.;.| -00000010 17 ef c7 e6 29 09 70 0e 6b df f7 3d bb 01 9d 27 |....).p.k..=...'| -00000020 cb 0d 97 6b ce 4c 49 60 3e ff 18 20 00 00 00 00 |...k.LI`>.. ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 43 b1 e8 d9 c3 |....z...v..C....| +00000010 22 a0 a3 08 df 7f 37 34 7a fe 7a 47 98 ee ed 51 |".....74z.zG...Q| +00000020 c2 ae 5c c6 b1 43 3d ff f7 91 68 20 00 00 00 00 |..\..C=...h ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 a6 |..+.....3.$... .| -00000060 16 ca 24 6e e9 b1 38 c9 3c 45 0e 35 98 32 c5 7c |..$n..8...U<| -00000150 00 77 9a 72 ba fc 13 ad 7a dc 34 0f aa 26 f9 c6 |.w.r....z.4..&..| -00000160 fe b7 ef 0f e8 d7 46 d0 a7 ee e8 39 4d c1 13 a2 |......F....9M...| -00000170 5c 00 e2 3e 47 08 71 b7 53 94 38 f6 31 3a 60 a5 |\..>G.q.S.8.1:`.| -00000180 57 82 4c bc c0 f7 9b c3 4e 00 5e 5e 40 ef ae 61 |W.L.....N.^^@..a| -00000190 09 37 38 40 b7 93 12 0a 7c 02 22 b9 39 a2 43 e3 |.78@....|.".9.C.| -000001a0 f3 09 36 a7 2a c9 2b 35 fc 2c fc 1c 82 d0 3f 03 |..6.*.+5.,....?.| -000001b0 a9 fc bc 53 79 23 5a ce 2d 07 80 5c 2c aa 34 52 |...Sy#Z.-..\,.4R| -000001c0 9d 71 2d 16 4a f0 09 e6 95 94 2b dd bf d5 9c 84 |.q-.J.....+.....| -000001d0 79 fc 41 15 a6 68 81 23 7e dc 83 55 b0 a4 a4 1c |y.A..h.#~..U....| -000001e0 4e 1e 4d 78 6d 62 45 59 1d bb c3 98 d5 0b 3a 8c |N.MxmbEY......:.| -000001f0 f1 98 49 6b 0f 64 29 d5 38 ad 6a ea 8b 34 29 99 |..Ik.d).8.j..4).| -00000200 c0 04 ce 5a 4f 74 e8 ec bb 0a a5 cd 23 6d 31 7a |...ZOt......#m1z| -00000210 d6 6e 1a 74 53 57 59 76 e9 e7 b2 5d 9f 5d 9a 53 |.n.tSWYv...].].S| -00000220 b0 e6 d1 ad ba 43 b6 40 65 65 3a 04 35 12 e1 f7 |.....C.@ee:.5...| -00000230 0e 91 f6 0c 1e 74 65 e3 90 ed e6 ec fd 88 99 e8 |.....te.........| -00000240 20 64 90 33 b9 a9 d8 a2 f0 d7 e8 e0 cf 8d d4 2a | d.3...........*| -00000250 91 12 44 28 3b 99 69 93 aa 3e b2 3b 6a f0 dc 0a |..D(;.i..>.;j...| -00000260 8b 2e 7c d9 c0 c7 b7 d6 f2 07 69 81 97 7b d9 6a |..|.......i..{.j| -00000270 56 c3 6a e5 d5 6a 06 e7 60 b2 72 1c 4f cc 3f 6e |V.j..j..`.r.O.?n| -00000280 e9 fe 94 79 49 36 a6 5f 6d bf b2 87 a1 59 a3 c4 |...yI6._m....Y..| -00000290 39 ad 9a ea 57 a5 69 47 f0 9b 60 4a a6 45 e8 70 |9...W.iG..`J.E.p| -000002a0 6c 6b 1b 17 8a 4e 5e 56 89 40 de 91 c3 8a 05 06 |lk...N^V.@......| -000002b0 57 9e 68 87 1e 00 c8 08 93 1c f1 57 0f 91 dd 32 |W.h........W...2| -000002c0 b7 e8 96 99 e3 90 44 5e 7a 68 d8 e0 55 67 80 a0 |......D^zh..Ug..| -000002d0 e3 bd d5 f7 01 f4 30 58 a7 b4 62 d7 7b 9c 5b 9b |......0X..b.{.[.| -000002e0 62 20 b6 01 25 1b ff 6f b3 4f bc 41 ae 9c 88 71 |b ..%..o.O.A...q| -000002f0 51 f5 25 06 44 a1 49 6b 1b db ac 4b 37 41 78 29 |Q.%.D.Ik...K7Ax)| -00000300 1c c9 33 82 f4 fe d3 0a f9 e0 e8 ca 8c 7b 76 3d |..3..........{v=| -00000310 8b 3c 3b 17 03 03 00 99 3e 4c 63 66 48 fa 43 7a |.<;.....>LcfH.Cz| -00000320 4d 4b 8b 95 25 ca 9a e7 cf d8 d6 e2 4d e7 15 07 |MK..%.......M...| -00000330 d2 cb 07 79 66 63 b5 8f 3a 7d 00 f4 3a 05 b4 ae |...yfc..:}..:...| -00000340 e6 7e 0e b5 a2 20 ee 0e cc 85 de c2 5d d5 49 32 |.~... ......].I2| -00000350 83 d8 2a 11 36 36 86 93 46 ac ce 7e b4 4d e6 20 |..*.66..F..~.M. | -00000360 24 7d 8e c7 37 5f 05 aa 5e a7 de e6 c7 79 88 a7 |$}..7_..^....y..| -00000370 e7 f7 86 51 07 e0 80 63 76 b2 03 a9 6c c4 86 1a |...Q...cv...l...| -00000380 8d 98 e7 16 e0 a2 dc 6e 5c 19 d1 98 c4 10 2b 39 |.......n\.....+9| -00000390 f4 03 b9 0f b5 ab c3 25 18 bf 8c 59 16 7a 06 60 |.......%...Y.z.`| -000003a0 73 9a 7c 6f d1 1e e1 de 07 23 21 0e 28 c2 fb 19 |s.|o.....#!.(...| -000003b0 64 17 03 03 00 35 e0 fd 9c 49 88 45 b3 c7 da a3 |d....5...I.E....| -000003c0 02 ee 8e 0c e0 33 64 01 35 7e aa 31 aa 43 75 64 |.....3d.5~.1.Cud| -000003d0 30 fc 89 d8 f0 dc 6e 49 68 e8 4e 01 41 0d 31 07 |0.....nIh.N.A.1.| -000003e0 c4 e1 bd db 83 b1 e6 46 f0 06 56 |.......F..V| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 63 |..+.....3.$... c| +00000060 0f 66 ec 2d fa 67 d4 eb 94 47 8d 88 0b eb ed ec |.f.-.g...G......| +00000070 5b ac 22 f7 46 85 c5 1c 2b 5e e8 57 e2 d3 6f 14 |[.".F...+^.W..o.| +00000080 03 03 00 01 01 17 03 03 00 17 d0 f8 1f 06 59 8d |..............Y.| +00000090 a0 40 21 8f 3e 36 3b 1d 6a 6e f7 77 44 fb b3 8e |.@!.>6;.jn.wD...| +000000a0 e2 17 03 03 02 6d 22 6b 63 ae 47 fd 66 f9 95 f6 |.....m"kc.G.f...| +000000b0 63 ea e8 16 61 a3 64 82 39 82 76 1c 2c 04 9b 29 |c...a.d.9.v.,..)| +000000c0 0f 8a ff 77 9b e6 2c ce 04 09 5f 91 f3 b6 2e 8d |...w..,..._.....| +000000d0 be 42 94 7e 5a 28 4b 9f e9 7b 38 0a 3c de 90 77 |.B.~Z(K..{8.<..w| +000000e0 c1 bf 97 bf 35 6c 77 98 4b 38 b4 8d 7f 1f 4b c0 |....5lw.K8....K.| +000000f0 23 c5 73 08 90 fa 21 5c cd cb 84 5b 0e 89 86 ce |#.s...!\...[....| +00000100 83 78 d5 1c 2b b9 b1 24 45 ad ab 9c 68 9f c2 28 |.x..+..$E...h..(| +00000110 40 d6 c2 ac a2 0c 86 cd 75 92 43 d5 22 3f 61 9d |@.......u.C."?a.| +00000120 e8 56 b8 7c 71 db 25 cc 2e 74 52 74 da 6b d4 a1 |.V.|q.%..tRt.k..| +00000130 2c 32 d2 d8 9c 74 41 9d 78 98 94 3b 87 99 8e 17 |,2...tA.x..;....| +00000140 df df d6 c3 6d ef 58 13 5c 1e 20 2d ed 77 bd 5c |....m.X.\. -.w.\| +00000150 d6 5c 9a 6d 0f 19 77 e1 4f 79 b0 ed 9d 0b f5 e8 |.\.m..w.Oy......| +00000160 42 d0 f4 90 88 97 a9 84 af 92 3c 41 fe fd 67 6e |B.........R...| +000002d0 fc ba 9c f0 82 13 ba 25 11 c7 5d 38 00 cf 83 14 |.......%..]8....| +000002e0 30 a9 72 48 d1 e8 4e 1b ed 04 ed cf b7 5b 2e 72 |0.rH..N......[.r| +000002f0 1c a2 03 ae 60 54 d6 cf 2f fb 11 a3 b1 8d d6 47 |....`T../......G| +00000300 e8 9f 96 08 90 ae 3c 3c c0 8c d8 c4 ef 30 18 ea |......<<.....0..| +00000310 2a 1a 15 17 03 03 00 99 85 b3 e4 18 6f 8d 34 c7 |*...........o.4.| +00000320 3d 66 49 b8 f6 f5 aa 7a e1 ca ba cb 48 53 15 bb |=fI....z....HS..| +00000330 e9 ec 74 91 c3 b5 d3 6b bc 84 81 d8 e1 a4 31 62 |..t....k......1b| +00000340 d5 19 6d 2f 15 4c f3 8a 3b ec 41 12 89 be d3 cc |..m/.L..;.A.....| +00000350 ab 08 59 a7 79 5d 77 14 ce b1 98 b4 ce 71 7b ad |..Y.y]w......q{.| +00000360 ba 41 3a 7f 9a f8 23 5c c6 fb b5 7b cc eb 0e 7a |.A:...#\...{...z| +00000370 ee af 3d ff 4d 03 ba c2 2a af ac fd b5 e8 5b 43 |..=.M...*.....[C| +00000380 3e 37 ef 84 3d 66 af 3c 8e 1d 0d 36 bd df 25 dc |>7..=f.<...6..%.| +00000390 74 89 9c e6 da 18 c4 c8 b5 6c 3c 4c a6 ac 10 28 |t........l>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 35 a3 4c 7d ed 56 |..........5.L}.V| -00000010 62 f5 7a b9 39 08 02 7f 12 72 c2 de 2f dc 35 a2 |b.z.9....r../.5.| -00000020 1f d0 8e 1a 7b c2 19 17 93 df 83 84 66 9e 8d 1a |....{.......f...| -00000030 fa 8c 37 74 04 13 b5 a2 81 7f dc 85 4c 37 f0 f1 |..7t........L7..| -00000040 17 03 03 00 17 51 47 a8 1b bc 86 62 90 79 8a c7 |.....QG....b.y..| -00000050 db 2c 99 95 bf 7c d0 27 6c c3 b6 24 17 03 03 00 |.,...|.'l..$....| -00000060 13 e2 a8 b5 52 61 b0 66 54 50 60 83 78 3d 26 ef |....Ra.fTP`.x=&.| -00000070 f5 5e 36 58 |.^6X| +00000000 14 03 03 00 01 01 17 03 03 00 35 55 88 37 f3 ee |..........5U.7..| +00000010 c5 1b 20 ac fe bc a3 f8 c9 59 3f 5f c0 81 40 8f |.. ......Y?_..@.| +00000020 1e a9 44 c8 10 16 69 8a 76 45 17 51 06 9e f0 55 |..D...i.vE.Q...U| +00000030 a2 f2 56 98 7d a1 4d 95 5a c3 1f 51 cf 31 20 ca |..V.}.M.Z..Q.1 .| +00000040 17 03 03 00 17 81 2a 8e 32 29 ec 9b 92 c3 fd 98 |......*.2)......| +00000050 64 aa 47 2a a5 0c d6 77 7f b1 8f 12 17 03 03 00 |d.G*...w........| +00000060 13 60 8c fb 98 e1 03 b6 20 c8 45 4e d9 4b a8 17 |.`...... .EN.K..| +00000070 10 79 5f b6 |.y_.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-ECDSA-RSA b/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-ECDSA-RSA index 633397542c1..c8e95c85dfc 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-ECDSA-RSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-ECDSA-RSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,133 +7,133 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 9b d5 46 91 59 |....z...v....F.Y| -00000010 c3 26 be 21 ae 20 5f 26 4f 5f 19 ae 3c fe b9 df |.&.!. _&O_..<...| -00000020 16 1b 16 45 4b da 4e 08 58 e9 05 20 00 00 00 00 |...EK.N.X.. ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 98 9a 92 3f c6 |....z...v.....?.| +00000010 67 f5 96 5b 2f 5e 70 89 2d f6 1e ce 6f 6a e5 91 |g..[/^p.-...oj..| +00000020 4b 4b 6f 98 cc f7 78 4a b1 54 4a 20 00 00 00 00 |KKo...xJ.TJ ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 08 |..+.....3.$... .| -00000060 7c 10 a4 69 11 21 4e 78 e3 38 76 c1 4a c2 da 5e ||..i.!Nx.8v.J..^| -00000070 8f 82 b8 4a 32 d8 7c 48 b6 78 e2 61 1d b6 21 14 |...J2.|H.x.a..!.| -00000080 03 03 00 01 01 17 03 03 00 17 7f ac 84 c7 d4 6a |...............j| -00000090 fc 73 53 a6 ae 25 f9 ad e4 4c b9 31 71 4f ba b1 |.sS..%...L.1qO..| -000000a0 55 17 03 03 00 42 61 ac 61 81 87 40 f1 15 d1 7a |U....Ba.a..@...z| -000000b0 44 ef c0 c8 4a 79 99 f1 16 28 36 4b 31 24 95 b7 |D...Jy...(6K1$..| -000000c0 38 49 60 00 a9 aa 51 40 91 52 2f 39 20 d1 37 92 |8I`...Q@.R/9 .7.| -000000d0 cf e1 cb 42 4a 7a 83 27 d3 77 20 4c 3c 22 0b 65 |...BJz.'.w L<".e| -000000e0 8f ce 2a ec c2 5f 90 b0 17 03 03 02 6d 3a d2 ce |..*.._......m:..| -000000f0 b7 7b d3 94 d4 33 91 be 81 f1 af 80 e6 3e 28 d5 |.{...3.......>(.| -00000100 d8 2f 23 08 b6 a6 80 ec b4 bb 2e 85 31 ed 90 46 |./#.........1..F| -00000110 74 34 90 77 0d d3 51 2d 6e 67 f0 4c 36 7c f2 30 |t4.w..Q-ng.L6|.0| -00000120 08 86 6e 53 08 01 c5 06 c8 a4 c6 6a c0 32 80 d4 |..nS.......j.2..| -00000130 0f 05 ff 91 96 a6 75 5f 71 72 be 63 fb 88 dc 5c |......u_qr.c...\| -00000140 06 06 eb 06 57 94 04 61 11 b5 03 1a 96 a3 c4 10 |....W..a........| -00000150 7b b9 ee 83 3e 73 42 71 93 52 a3 44 b8 9d fb 8e |{...>sBq.R.D....| -00000160 5b 5d e4 af 22 0b dc 40 09 34 aa dc 08 d3 e9 54 |[].."..@.4.....T| -00000170 0a b6 ea 87 33 e6 f5 eb 59 e0 6e c3 24 be 81 b3 |....3...Y.n.$...| -00000180 93 89 d1 f4 dd 8f ab c9 a4 1f bf ed 58 86 f4 41 |............X..A| -00000190 de bf 87 2e 1c fb b0 99 f0 ab 4e ec 3e 22 80 78 |..........N.>".x| -000001a0 45 71 eb 6a f0 0a 89 bf fe 37 e4 1d a6 90 f4 f3 |Eq.j.....7......| -000001b0 7c 96 26 47 9d 07 53 16 7c 15 b1 8a 60 ec ad 55 ||.&G..S.|...`..U| -000001c0 e3 50 7c 1f 5f 67 bc 29 b0 c5 12 99 db d9 b2 1f |.P|._g.)........| -000001d0 6c b6 bc 7d ed 0c d3 76 a0 1d c3 f1 f3 10 9d 63 |l..}...v.......c| -000001e0 22 fd 66 f4 12 4d 4f 2e 7a 81 6e 9f 55 cb 40 26 |".f..MO.z.n.U.@&| -000001f0 77 6a 9c 44 5b c2 cf ae 2d de 7c 85 ca 3e f6 c9 |wj.D[...-.|..>..| -00000200 22 d0 34 f8 36 f2 a4 56 5d dc aa 7d f4 9d 3a e0 |".4.6..V]..}..:.| -00000210 3e 4a b8 77 be 7e 8c c1 f0 0f 42 e7 54 a3 a0 b7 |>J.w.~....B.T...| -00000220 76 33 fd 51 8c 2b e8 c3 85 de 0c d3 d7 1a 34 16 |v3.Q.+........4.| -00000230 41 fb e4 eb fb 0f 8b b2 71 45 a7 3e 8f 82 ac b9 |A.......qE.>....| -00000240 85 54 6f 5a 66 a0 16 90 00 24 e0 91 6e 7f 11 55 |.ToZf....$..n..U| -00000250 cb 1a 6f f1 89 b2 a7 23 52 a7 ec 54 cc 0c 51 71 |..o....#R..T..Qq| -00000260 e8 21 fc b2 ca 90 0d 44 ab 05 18 62 4c 01 41 44 |.!.....D...bL.AD| -00000270 eb a9 ca 97 31 a8 0f 5f b9 3a d3 18 a0 be a1 cc |....1.._.:......| -00000280 2f 88 54 b6 c3 8d e7 12 9f 2d 53 62 2e 05 ba 6e |/.T......-Sb...n| -00000290 9c 75 69 cb 4e 3d 2a 46 20 c0 92 c8 e6 e4 1a 16 |.ui.N=*F .......| -000002a0 4b 09 7d 02 ec 8e 7f a2 b9 e9 05 32 88 4b be 39 |K.}........2.K.9| -000002b0 30 c5 f9 ed ca 2a 1d a3 3b fe 18 76 2e f2 51 d4 |0....*..;..v..Q.| -000002c0 b3 aa 61 67 3b eb 90 9c bb ea 1a 6c 11 7b ba 86 |..ag;......l.{..| -000002d0 38 f1 cd c7 3c 64 56 f3 ca ff fd b2 14 bf 37 7f |8....)..t| +000000e0 d1 37 68 9b 8a b6 8d 2b 17 03 03 02 6d d1 1b 9f |.7h....+....m...| +000000f0 75 ba cf 2d 10 4b f0 4e 09 58 fa ff 06 e8 c9 d5 |u..-.K.N.X......| +00000100 a0 51 c8 d4 6f b2 c5 c1 d5 f3 ff 12 1f 43 d8 74 |.Q..o........C.t| +00000110 33 d9 9b e5 f3 34 26 0e 89 dc 00 54 67 17 d2 f3 |3....4&....Tg...| +00000120 c9 9e be f8 4c 77 8a 63 b1 64 5a b4 d7 57 d2 89 |....Lw.c.dZ..W..| +00000130 ce 68 d1 f7 93 01 6c 36 b7 c9 4d 50 d0 4b df 5e |.h....l6..MP.K.^| +00000140 8a bb 6c d9 54 57 9b b9 c9 ec d8 49 c7 51 3c e5 |..l.TW.....I.Q<.| +00000150 7b fb 48 0f fd 1b dd 0f 57 d3 a8 ee f6 51 ba 78 |{.H.....W....Q.x| +00000160 c0 60 f1 d9 c1 d2 65 b4 a7 98 99 fb 64 83 4c 2c |.`....e.....d.L,| +00000170 a6 e9 19 ef 0e 88 68 f8 21 a4 2b bd 95 e9 52 d5 |......h.!.+...R.| +00000180 fb 12 d3 36 06 a2 13 f9 e2 35 6a 06 dd 49 d9 42 |...6.....5j..I.B| +00000190 89 d9 f0 24 5c 36 b8 6d 95 35 21 b3 9c 3b ee 08 |...$\6.m.5!..;..| +000001a0 06 06 4d aa 74 eb fc 1b c1 fd cf 07 24 74 44 2d |..M.t.......$tD-| +000001b0 54 d5 c5 d3 4e c4 eb 09 6e 90 8f 3d c0 c5 1c 21 |T...N...n..=...!| +000001c0 7c 32 1b bc 4b 85 2b f0 b0 f5 cd 61 3d dd 31 03 ||2..K.+....a=.1.| +000001d0 5e e0 5e 06 1a 37 61 1a 58 fa ed e8 cf 0c 4f da |^.^..7a.X.....O.| +000001e0 73 69 42 3a f4 ed dc ad e5 e7 9b fd 54 16 77 85 |siB:........T.w.| +000001f0 ae 84 41 10 be 84 ad 28 ef e6 13 2a e9 9f 9f 2f |..A....(...*.../| +00000200 c5 d0 65 c6 f5 58 b3 39 9b 5e 07 ba 95 be 5e 75 |..e..X.9.^....^u| +00000210 68 17 ba 9d 2a 69 6d b8 ed d4 4b 6a ce 30 b1 82 |h...*im...Kj.0..| +00000220 ae ec 68 9a 26 13 6b 05 38 0f 38 c9 94 01 d0 0b |..h.&.k.8.8.....| +00000230 7b bb ca 70 86 6c e4 f1 eb 81 05 25 33 c0 3e e3 |{..p.l.....%3.>.| +00000240 2a 25 8e 32 eb d5 03 c7 c4 d8 22 22 ef 99 5a a3 |*%.2......""..Z.| +00000250 01 6a b5 65 9a 55 6e fb 84 83 aa 43 ae 4a 3e da |.j.e.Un....C.J>.| +00000260 40 7e 09 e1 3b 15 ad 33 66 5a 3d 30 62 72 86 54 |@~..;..3fZ=0br.T| +00000270 cd a2 6a bf 82 61 17 87 84 c5 3f f3 1e 86 a2 b1 |..j..a....?.....| +00000280 2c 1a f9 ba 8c a2 21 5b 93 b2 16 b4 81 ae 7d 98 |,.....![......}.| +00000290 d6 db 0a 56 14 c9 f7 48 c1 c7 3c 7e 63 8e bc 50 |...V...H..<~c..P| +000002a0 6a 64 e1 1d 04 ba d3 cc 6a 61 60 4b d2 97 d5 ba |jd......ja`K....| +000002b0 23 1a 69 76 86 db 96 39 04 f6 ec e9 96 79 6a 25 |#.iv...9.....yj%| +000002c0 ff 39 dd 19 08 34 4d c3 f6 7c 91 f2 6b 3a e1 0f |.9...4M..|..k:..| +000002d0 66 6d 14 5d 82 21 0b e3 e0 c3 f1 a1 70 e1 2c bc |fm.].!......p.,.| +000002e0 fb 54 aa 85 3c a0 7c 9a 35 00 e2 a1 4f 83 3e f1 |.T..<.|.5...O.>.| +000002f0 64 83 ab c5 e6 31 c7 00 eb 36 f1 bc 41 f3 eb d4 |d....1...6..A...| +00000300 97 30 4d 7f d2 d1 e7 1a 9e a2 53 31 35 6a 16 d1 |.0M.......S15j..| +00000310 65 be d7 d3 93 2a be d2 27 dc 1b 8c 09 16 30 d4 |e....*..'.....0.| +00000320 cb eb e0 bb 42 50 ff 59 c3 81 81 36 88 09 c2 23 |....BP.Y...6...#| +00000330 dc dd 80 63 bb 78 19 6b 6a 70 4b b5 17 bf ed 6c |...c.x.kjpK....l| +00000340 58 f1 15 a9 16 66 c8 45 f5 5f 99 05 b1 3b be e6 |X....f.E._...;..| +00000350 66 d7 45 df 19 16 9d c7 dd 4d 17 03 03 00 99 38 |f.E......M.....8| +00000360 70 9e 16 94 07 67 7c ce 90 67 99 46 5e d9 61 b5 |p....g|..g.F^.a.| +00000370 9b b8 31 fc cc 80 a3 07 30 c9 f5 f9 90 fb e2 0d |..1.....0.......| +00000380 dc 93 ab de 38 25 83 f8 77 0c 94 53 75 68 c7 71 |....8%..w..Suh.q| +00000390 72 6f 61 77 a7 d7 c7 ed 5c d3 08 18 9f 64 f4 6e |roaw....\....d.n| +000003a0 30 dc 05 b1 65 11 79 08 66 34 8c 06 99 a9 00 26 |0...e.y.f4.....&| +000003b0 86 2c e4 b5 6d cf db b1 03 f0 d0 c5 c0 f5 50 04 |.,..m.........P.| +000003c0 f7 27 97 3e 31 19 aa a8 58 c4 78 43 a9 e3 76 0d |.'.>1...X.xC..v.| +000003d0 98 88 20 07 11 4c d6 8a 66 31 72 2e ed 47 66 71 |.. ..L..f1r..Gfq| +000003e0 9a 3e 9c 0d 1c 17 df ab 6a 52 b4 43 a6 c2 64 30 |.>......jR.C..d0| +000003f0 45 08 b8 de 59 be 3a f9 17 03 03 00 35 94 9b 02 |E...Y.:.....5...| +00000400 47 a6 e3 55 9f 95 8a 8d 35 3b bb 56 ec 10 ab dd |G..U....5;.V....| +00000410 a3 ca fe ad bf 25 90 76 c4 15 a0 c0 73 d5 96 96 |.....%.v....s...| +00000420 44 bc ba e9 09 f5 8e e7 e7 7d db f2 e7 9f 99 d2 |D........}......| +00000430 dc e7 |..| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 02 1e e2 06 ae 3e 78 |..............>x| -00000010 b4 85 1b 44 b7 6d 04 4b 9f 2c ea 23 79 66 d5 7d |...D.m.K.,.#yf.}| -00000020 c5 39 57 5c 15 49 9a 6e c8 19 1b ed 5d 95 ce 6f |.9W\.I.n....]..o| -00000030 df 96 3a 16 87 88 c0 25 6a 36 fc 62 05 01 bd c1 |..:....%j6.b....| -00000040 00 a8 11 da 7f 0e a3 6c 28 26 9f 4a 18 e2 44 b9 |.......l(&.J..D.| -00000050 aa 71 b2 f6 fa 8b cc 67 c5 29 72 32 cf 78 36 6b |.q.....g.)r2.x6k| -00000060 22 67 86 ac 71 19 cb 9d 9e 36 7b 03 42 01 e5 4b |"g..q....6{.B..K| -00000070 4c c0 0d 93 22 51 a6 d3 65 00 87 ef 92 f3 08 33 |L..."Q..e......3| -00000080 4b e1 18 bc ba 2b 43 90 0f 2f d5 8e 4c 79 9f a7 |K....+C../..Ly..| -00000090 bd 00 2a b7 89 27 b3 e3 db b7 a7 26 b4 8e 48 6f |..*..'.....&..Ho| -000000a0 e7 12 55 f0 8e 02 a8 3f 30 d4 22 a4 d0 e3 89 63 |..U....?0."....c| -000000b0 7d cf c2 46 27 31 8c 10 5f 28 9f 85 fb 02 64 6a |}..F'1.._(....dj| -000000c0 8d 50 26 e6 73 57 43 53 39 c7 bb 72 4e c2 dd 07 |.P&.sWCS9..rN...| -000000d0 86 b0 96 30 f5 d8 f0 5a a0 09 1c 42 26 65 50 d1 |...0...Z...B&eP.| -000000e0 65 1f 97 fd a0 3a c2 ae d6 a4 08 af 5c 9d 30 12 |e....:......\.0.| -000000f0 fc d8 a2 cd d3 b1 7b de 4b be df 54 aa 31 48 32 |......{.K..T.1H2| -00000100 7a d2 d5 59 f1 39 bc cd 23 2b ac 17 ff e4 0e ec |z..Y.9..#+......| -00000110 55 d2 b9 6b a0 30 65 db 5b e9 b4 ab b9 1e dd 3c |U..k.0e.[......<| -00000120 fd 38 7b 19 7f ea 79 56 90 f8 41 bc 3d 64 0b df |.8{...yV..A.=d..| -00000130 05 a3 6c b8 14 5f f5 41 4f 3c 6d 46 a3 24 92 22 |..l.._.AO.....| -00000250 18 9d de 95 a3 d2 00 98 88 90 4d d0 19 a0 47 60 |..........M...G`| -00000260 6f 1b 36 e4 c0 d8 02 52 b8 0b f4 78 44 8d 72 56 |o.6....R...xD.rV| -00000270 e4 68 ce c0 cd 71 34 60 6b 6c 8f 22 cb 78 d2 d7 |.h...q4`kl.".x..| -00000280 fc 89 b9 d6 34 34 c9 f1 44 78 84 36 27 bc 73 0e |....44..Dx.6'.s.| -00000290 ae 43 72 66 07 e4 6c fd ee da ca 99 a2 25 21 a7 |.Crf..l......%!.| -000002a0 eb 63 11 21 c4 30 45 b3 82 27 7d 8c 9d 37 86 8d |.c.!.0E..'}..7..| -000002b0 35 90 5c 13 be 21 fc bd 65 af ec 65 3d c0 9a 1d |5.\..!..e..e=...| -000002c0 6b 75 38 17 8d d1 92 ba 43 c1 e8 a5 43 f5 0b ab |ku8.....C...C...| -000002d0 16 4d 17 03 03 00 35 a9 24 2a fd af f5 da 3b ed |.M....5.$*....;.| -000002e0 d7 15 86 16 c5 e8 bf 95 bc e1 90 fb 0f be f2 3c |...............<| -000002f0 75 b0 30 1b ce f9 ac f7 97 ae 7e 29 d7 17 aa a4 |u.0.......~)....| -00000300 ba c3 2a db 1a 7c 5e bc 18 84 6e e0 17 03 03 00 |..*..|^...n.....| -00000310 17 52 2f 82 87 2d ca 50 2c 51 f6 99 9d 54 5a 68 |.R/..-.P,Q...TZh| -00000320 38 61 ca 02 81 2c 62 dc 17 03 03 00 13 35 e5 58 |8a...,b......5.X| -00000330 b4 26 e0 83 2a 8e 61 e9 96 1a cd 1a 6e c9 67 c0 |.&..*.a.....n.g.| +00000000 14 03 03 00 01 01 17 03 03 02 1e 64 ba 97 ba 8d |...........d....| +00000010 3f 1b d5 5b c5 2e e5 b9 10 01 37 c9 5c e5 ed 39 |?..[......7.\..9| +00000020 7f 9c 8b f8 ef 50 64 5e 30 05 16 ac 80 51 96 78 |.....Pd^0....Q.x| +00000030 2a 50 0f 1e d8 76 ab fd bd 7f 3b 17 7e 1d e9 f5 |*P...v....;.~...| +00000040 03 76 1b 66 3d 15 dc f3 65 a2 aa a9 23 89 09 e9 |.v.f=...e...#...| +00000050 dc de a6 27 fc 21 d9 97 d4 08 05 9a 1c 49 8c ee |...'.!.......I..| +00000060 fc bd f1 9f e2 4e 3a e3 ee 07 39 d0 34 05 cb 18 |.....N:...9.4...| +00000070 83 2b 68 45 df 84 4b b2 c3 79 42 73 b9 f1 1c f2 |.+hE..K..yBs....| +00000080 5f d9 5c f5 7c 4e 86 5e 97 78 ea 0a fa e7 60 68 |_.\.|N.^.x....`h| +00000090 80 c3 17 5f e7 92 9d 6e 9a 92 37 84 92 4b 83 9c |..._...n..7..K..| +000000a0 fa 4c 2a 82 23 eb 67 d0 b2 cc 9e 59 8f 2c e7 bc |.L*.#.g....Y.,..| +000000b0 b3 4f 2a 0c 93 bf 17 b8 48 70 5e 0a 85 92 6d 2a |.O*.....Hp^...m*| +000000c0 ac 81 9e cd 2c 59 fc a7 e3 5b 82 d5 e3 f5 cd c2 |....,Y...[......| +000000d0 8a 68 b8 e9 36 e2 08 0b f7 09 9c 17 95 a3 5e 3d |.h..6.........^=| +000000e0 ef 7c c6 5c fe 32 9e 9d 31 c9 b7 76 5a 71 c3 d7 |.|.\.2..1..vZq..| +000000f0 cd e3 c6 70 e5 2f 07 df 1d b4 34 56 0b ed 52 13 |...p./....4V..R.| +00000100 bc b2 ac 66 0c 84 b0 2e 32 93 08 f2 04 91 8e e3 |...f....2.......| +00000110 7b 7f 22 2a a9 04 50 5c 78 f1 06 c5 fd 2c 4c 77 |{."*..P\x....,Lw| +00000120 a9 17 b5 a8 42 6d f2 0e 87 32 d3 7f be 9e 1d 09 |....Bm...2......| +00000130 50 10 25 9d f1 a5 25 c3 c2 be 0d 8d 8e 96 5e 1c |P.%...%.......^.| +00000140 83 06 45 bc f0 5b 6f b5 0a 02 2a cc ce ac 7e 62 |..E..[o...*...~b| +00000150 f0 b1 89 25 30 bc 12 d2 da f9 1d d0 46 55 97 4c |...%0.......FU.L| +00000160 09 39 e1 a5 1f 4d e1 aa bd 6f 1f 0d 79 4a aa 49 |.9...M...o..yJ.I| +00000170 73 25 dc a5 bd f7 2b 64 3c 84 ed b0 ef 13 c5 6c |s%....+d<......l| +00000180 16 8b 27 bf a5 3d 15 f2 4a 3b 53 ad ba e9 9e 2a |..'..=..J;S....*| +00000190 6d f2 44 5c 66 69 04 94 27 99 08 8e c2 7e c6 69 |m.D\fi..'....~.i| +000001a0 f7 65 1d 0b a5 8c 35 52 0b f1 bd 59 ca d1 bf 44 |.e....5R...Y...D| +000001b0 47 b0 7b f8 3b a0 84 55 73 c2 83 bb 9d e0 bc ed |G.{.;..Us.......| +000001c0 60 07 32 ce 71 b3 60 12 ef ca 28 bb 6c fb bb c7 |`.2.q.`...(.l...| +000001d0 3e eb 05 65 a5 26 1a 6c 40 c8 b4 4e 31 12 a0 96 |>..e.&.l@..N1...| +000001e0 19 66 86 f5 1e f8 bd 6d f4 2e 98 60 fe ff 22 1e |.f.....m...`..".| +000001f0 a9 27 49 87 77 7d b4 5d ea f8 bc 3a 10 15 84 8c |.'I.w}.]...:....| +00000200 cd aa 2c e8 94 93 a5 ee db 7a d8 96 e9 d5 68 e9 |..,......z....h.| +00000210 34 68 40 5b dd 18 dc f0 ef b7 17 72 fd 06 70 d1 |4h@[.......r..p.| +00000220 b6 89 ae 66 40 40 f7 61 0b 17 03 03 00 a4 26 c1 |...f@@.a......&.| +00000230 3c d9 6c 83 52 e3 5e 64 46 7f 12 1d 3d c7 7d 0f |<.l.R.^dF...=.}.| +00000240 a9 8f d3 45 f5 81 46 16 24 c6 c3 7e 5f e4 25 be |...E..F.$..~_.%.| +00000250 00 33 7a 1c 35 d4 5c 64 54 56 08 66 4d 2f 68 15 |.3z.5.\dTV.fM/h.| +00000260 1b 71 d9 aa c9 9e e0 cc d2 73 a9 99 41 9b 08 1f |.q.......s..A...| +00000270 d4 41 de e5 4f 1f 30 65 61 02 8e 6f 79 d7 47 86 |.A..O.0ea..oy.G.| +00000280 2f e6 0e 65 9e 06 e8 98 d1 fe bc 89 b4 bc f4 9b |/..e............| +00000290 70 02 06 e4 9d 37 dd 1b 63 b6 06 62 1a c7 45 30 |p....7..c..b..E0| +000002a0 9d 08 64 35 8b 96 88 9a 1e 58 2f d0 ef 44 39 04 |..d5.....X/..D9.| +000002b0 3c bf e2 e6 c4 73 de f9 b0 10 ed 56 eb 04 bd 4e |<....s.....V...N| +000002c0 89 38 50 3b e7 e5 12 7c 8e 74 b2 a5 79 2d 88 7b |.8P;...|.t..y-.{| +000002d0 e5 1b 17 03 03 00 35 42 b2 61 24 4c 38 b5 d1 42 |......5B.a$L8..B| +000002e0 93 12 66 c5 be 3c f0 b1 b2 6b 86 07 99 7d f3 e4 |..f..<...k...}..| +000002f0 74 2b 43 98 38 df 70 7a e5 f7 67 cf c3 08 23 19 |t+C.8.pz..g...#.| +00000300 4a cf 06 26 fe 56 4a 97 4a 82 70 09 17 03 03 00 |J..&.VJ.J.p.....| +00000310 17 9b 3f bb 09 7d 4f c9 05 42 f7 d1 a7 59 0c a7 |..?..}O..B...Y..| +00000320 c6 9b 36 e1 46 ad 9b 89 17 03 03 00 13 ae a5 51 |..6.F..........Q| +00000330 76 d8 3a 77 a8 a0 38 70 bf be c8 fb ff fe 53 09 |v.:w..8p......S.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-Ed25519 b/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-Ed25519 new file mode 100644 index 00000000000..26f76bc1b12 --- /dev/null +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-Ed25519 @@ -0,0 +1,122 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| +00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| +00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| +00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| +00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 a5 5b a0 2c f5 |....z...v...[.,.| +00000010 57 cc 49 88 64 7d ea 7c ee 61 cf fc 94 9f d4 5c |W.I.d}.|.a.....\| +00000020 bb 83 80 5a f5 7c a3 fc 0a c8 61 20 00 00 00 00 |...Z.|....a ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 fe |..+.....3.$... .| +00000060 e1 43 bd 10 b3 f6 3b 4d 7c 46 8f a3 bc 7d 08 08 |.C....;M|F...}..| +00000070 22 ed aa 9b 7b 89 f3 87 13 7e fe 6c b0 db 3f 14 |"...{....~.l..?.| +00000080 03 03 00 01 01 17 03 03 00 17 2b ce 52 22 34 c5 |..........+.R"4.| +00000090 d9 2c ae d0 23 4d 0c 6e b4 f0 c8 58 11 22 54 bb |.,..#M.n...X."T.| +000000a0 15 17 03 03 00 42 96 b4 72 be f0 6b d3 b0 82 7c |.....B..r..k...|| +000000b0 dc d2 67 69 2c d4 40 a1 7a 3d 9a 39 a5 29 ca 64 |..gi,.@.z=.9.).d| +000000c0 c5 0b d2 ba 7c c3 73 e2 93 0d 44 e3 64 ce ec b2 |....|.s...D.d...| +000000d0 90 ae e2 df 18 f8 f5 93 5f 91 80 c2 b4 00 e7 de |........_.......| +000000e0 f5 3f 4d c8 de 4c 5f f0 17 03 03 02 6d c6 df 33 |.?M..L_.....m..3| +000000f0 1e 12 40 02 7f 46 67 d8 4b 98 d7 5e f7 0a bf dc |..@..Fg.K..^....| +00000100 fe 3c 7f 00 2d 74 31 cb 10 35 e2 eb 16 11 d1 2f |.<..-t1..5...../| +00000110 10 bf 8c 4d 37 c7 1b f6 23 a3 3e 68 87 1a 50 53 |...M7...#.>h..PS| +00000120 64 7c 0d fd 0d 06 32 93 17 85 da e0 d4 86 2c 5f |d|....2.......,_| +00000130 0a 91 9a fd 00 87 f1 f4 fc 18 22 a1 2e 21 44 7d |.........."..!D}| +00000140 6c ca 2c 0d f2 38 15 d1 9d 86 9b 67 b6 b4 06 6d |l.,..8.....g...m| +00000150 30 07 a8 b1 b8 7a 5d 1d 17 d0 c5 1a 40 a3 42 b5 |0....z].....@.B.| +00000160 dc 56 c8 ec c3 c3 4e ff 5f 7c ce 27 fa a6 82 2a |.V....N._|.'...*| +00000170 b9 85 47 4e 0b d1 84 17 92 a6 42 86 9a 65 1c a9 |..GN......B..e..| +00000180 45 be af a7 95 03 0b db 84 fa 5d 1b 7e 57 72 40 |E.........].~Wr@| +00000190 ab a3 9e 46 50 3f c7 03 94 9a 4a 02 bd 9a 90 1c |...FP?....J.....| +000001a0 42 c9 98 e9 81 cd e8 73 a6 82 42 20 24 89 d5 8d |B......s..B $...| +000001b0 48 20 df d4 f4 d2 15 e4 c0 28 ee d8 2a 1b ad b8 |H .......(..*...| +000001c0 1d a4 86 e1 b4 89 97 e8 36 63 aa 9c f4 7e 65 c6 |........6c...~e.| +000001d0 12 86 41 54 b3 4a 79 9f 48 33 fc fc 0d f5 14 47 |..AT.Jy.H3.....G| +000001e0 ba ae d3 20 64 37 f1 cd 9e 1b cc b2 27 68 e6 f2 |... d7......'h..| +000001f0 95 0c 29 59 f2 15 2e 97 60 f3 8d 1b b1 65 cd 4f |..)Y....`....e.O| +00000200 0d a5 0a 34 59 63 20 f0 71 e6 d5 13 f2 4e dc 73 |...4Yc .q....N.s| +00000210 5b 1a 36 d7 6a aa b0 30 f4 ff 68 ad f5 5e f0 12 |[.6.j..0..h..^..| +00000220 0c 34 a8 4d 91 03 8e 4a 30 07 23 49 41 7a fe 19 |.4.M...J0.#IAz..| +00000230 62 5b 6a a0 4d d5 54 a1 1f 45 91 86 b3 a1 c3 32 |b[j.M.T..E.....2| +00000240 62 79 a8 93 b3 d4 43 0c a8 12 10 4f f5 53 c3 3b |by....C....O.S.;| +00000250 d9 73 ef 42 be 1d f5 70 fd 9f ca 54 20 3a 33 c9 |.s.B...p...T :3.| +00000260 f6 e8 55 13 b3 ab 45 c8 bb 5c 6b b9 39 a9 04 ac |..U...E..\k.9...| +00000270 1c 3c 5a aa b7 91 2c 0c f6 74 ea 6b 2d e2 9a 3c |..$.......| +00000360 1b f5 7a dc 63 8d 5e 75 de 72 cf 41 ca 75 ab d9 |..z.c.^u.r.A.u..| +00000370 55 b0 b5 81 a9 6c a9 f6 1d ea 66 dd dd 86 f5 03 |U....l....f.....| +00000380 12 08 9d b4 07 48 eb 8b 45 f1 35 b1 31 bd 5d f3 |.....H..E.5.1.].| +00000390 e2 34 73 9a e5 87 b7 8b 0b 8b ab 7e 05 db 56 db |.4s........~..V.| +000003a0 4f 4c 52 1a 3b 5d 4c 53 b1 49 40 81 5e 73 af 26 |OLR.;]LS.I@.^s.&| +000003b0 21 e6 e3 5c 4a a6 f6 07 56 de f5 76 5c 67 d8 d5 |!..\J...V..v\g..| +000003c0 eb f3 6a fb 6d b7 00 bc 6b 28 c9 63 4d 58 76 97 |..j.m...k(.cMXv.| +000003d0 aa 51 2b f3 03 9c 70 3b 3e b2 a4 16 a0 a0 e0 43 |.Q+...p;>......C| +000003e0 77 da 88 2d 48 3b 07 e2 8d a6 e2 80 85 68 ac dc |w..-H;.......h..| +000003f0 ce 66 2f 97 20 9e 4e 33 17 03 03 00 35 f6 ce 98 |.f/. .N3....5...| +00000400 8b 01 f5 75 8e 98 42 02 b1 b8 90 f3 08 96 e8 5a |...u..B........Z| +00000410 d4 7c ef d1 62 1e b3 36 39 d9 b2 59 1f 1f cc 74 |.|..b..69..Y...t| +00000420 f2 a8 62 11 00 28 31 fa d9 5a 27 10 7b 93 ff de |..b..(1..Z'.{...| +00000430 a0 ec |..| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 01 50 57 2a 94 d7 c1 |..........PW*...| +00000010 40 42 d3 aa e3 d8 b3 e4 13 ff 51 ee 8a 52 9d 9c |@B........Q..R..| +00000020 c4 a4 40 91 72 0f c9 4e fe 56 22 89 ea fb 6d 05 |..@.r..N.V"...m.| +00000030 a2 96 97 4b fa ef ec 13 b6 13 3b 69 6c 65 c0 74 |...K......;ile.t| +00000040 e5 54 df a4 97 50 f7 85 a1 c7 fb 52 84 56 98 16 |.T...P.....R.V..| +00000050 52 b6 eb 5a d0 72 6e 65 98 81 bb f5 2a 4c ed 1a |R..Z.rne....*L..| +00000060 90 e1 01 a6 2b eb e0 1d 06 ba 8a d4 47 45 90 f0 |....+.......GE..| +00000070 91 bd c4 d7 54 ba 44 30 78 42 15 42 74 59 1c c7 |....T.D0xB.BtY..| +00000080 56 34 39 64 8e f8 0a 0f 2b 35 0f 06 97 34 3e 5e |V49d....+5...4>^| +00000090 00 00 5a f0 07 0a f5 66 46 86 94 8c 0b 62 1c fd |..Z....fF....b..| +000000a0 cc cf fd 5d 06 96 1e 21 9e 20 d5 07 5f 5a 00 9f |...]...!. .._Z..| +000000b0 6f 80 36 5e aa 56 d0 07 00 20 08 55 48 fe 6c a1 |o.6^.V... .UH.l.| +000000c0 b1 22 f3 94 54 7e 7e d5 e9 f0 71 69 01 fc bd 14 |."..T~~...qi....| +000000d0 a1 de 38 e4 b4 02 88 3e 66 77 3b f7 aa cd 57 a3 |..8....>fw;...W.| +000000e0 cf 6a 40 7d 93 75 79 3b 95 07 33 69 b2 8d 2a 37 |.j@}.uy;..3i..*7| +000000f0 94 d3 8d d5 b5 8a f0 94 8d 1e b4 9e 02 4f 7d 83 |.............O}.| +00000100 05 c6 c7 c8 a0 74 f1 88 f7 68 bf 4b e4 18 3b 6f |.....t...h.K..;o| +00000110 0c 6c a6 e7 75 50 b9 f6 68 2e 05 67 a3 47 df 22 |.l..uP..h..g.G."| +00000120 fa ae c1 4f a8 3d f3 bb dc 66 c3 b6 98 b7 8c 5b |...O.=...f.....[| +00000130 48 51 57 d7 43 b2 13 25 9e d5 82 6c 70 5c 42 53 |HQW.C..%...lp\BS| +00000140 a9 e8 8a 12 26 cd 3a f8 f8 e5 97 84 55 89 09 d4 |....&.:.....U...| +00000150 d4 20 40 d7 2d 6f 66 36 63 f6 53 17 03 03 00 59 |. @.-of6c.S....Y| +00000160 2f f6 22 ce f3 86 f8 ee b1 f6 49 de c8 bf 91 9c |/.".......I.....| +00000170 bc 2f fa 75 af 51 bc ee b7 a5 a9 82 35 3b 83 9d |./.u.Q......5;..| +00000180 3d 9f 57 10 07 4b af 01 66 f0 39 dd f0 4a a7 90 |=.W..K..f.9..J..| +00000190 f3 6c 28 97 80 0d a5 74 2d 22 a3 81 cd 64 2b 1a |.l(....t-"...d+.| +000001a0 d1 4e 2d 9e 8e 69 38 f8 11 9c 17 1f e6 c9 01 4e |.N-..i8........N| +000001b0 48 1f 80 43 26 d4 5a 82 30 17 03 03 00 35 e9 25 |H..C&.Z.0....5.%| +000001c0 b9 01 8e 0d 51 be 9d d1 b4 2b 0a ee 36 69 85 1a |....Q....+..6i..| +000001d0 10 a8 ff 36 e7 21 b7 f2 54 75 ca 07 52 88 48 d0 |...6.!..Tu..R.H.| +000001e0 ad 67 0b 92 52 70 fa 14 bc 7e 1d 43 f0 a2 7b df |.g..Rp...~.C..{.| +000001f0 ac 0c 19 17 03 03 00 17 98 76 d7 52 06 90 ef 00 |.........v.R....| +00000200 21 5e ec ed 0e 35 77 ef 5c f1 32 58 33 0f 06 17 |!^...5w.\.2X3...| +00000210 03 03 00 13 05 fb b3 c3 4d b5 a4 9c 52 ea bc d2 |........M...R...| +00000220 86 08 26 b8 df 5c 4c |..&..\L| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-ECDSA b/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-ECDSA index 74163f0521f..09de5cca834 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-ECDSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-ECDSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,128 +7,128 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 dd 25 8d f2 41 |....z...v...%..A| -00000010 0b 2f 7b 80 24 03 af 9d 81 4e fd a8 ae e4 00 ee |./{.$....N......| -00000020 99 5f 09 05 8b 2a c2 0a 7c 92 ad 20 00 00 00 00 |._...*..|.. ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 cc a2 2d 09 42 |....z...v....-.B| +00000010 f0 11 87 04 64 83 e4 d8 80 a5 0f 88 69 ae f1 d2 |....d.......i...| +00000020 12 05 d2 08 75 15 86 b7 d8 69 e7 20 00 00 00 00 |....u....i. ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 fd |..+.....3.$... .| -00000060 03 d1 75 4e 57 ae b0 cc 43 4f 7e 2b de a8 01 46 |..uNW...CO~+...F| -00000070 98 c7 f9 8e a5 46 95 68 fa 5e 07 c3 a1 55 5e 14 |.....F.h.^...U^.| -00000080 03 03 00 01 01 17 03 03 00 17 df 30 a4 ce 8e db |...........0....| -00000090 20 0d 74 59 0a df 8e 67 23 af 3d 2f 87 8f 31 a0 | .tY...g#.=/..1.| -000000a0 bf 17 03 03 00 42 0f 0a 20 4e 21 cd d8 01 13 ea |.....B.. N!.....| -000000b0 74 29 8d e4 a0 1b 6a a5 be 89 03 8d 2b 39 c4 23 |t)....j.....+9.#| -000000c0 5e b1 f7 4f e4 1f dd ea f8 38 fe 07 89 ca f1 e6 |^..O.....8......| -000000d0 11 e9 2d 40 ca f1 63 11 ac 29 44 c2 25 18 4d 29 |..-@..c..)D.%.M)| -000000e0 30 aa cb 35 b4 33 27 8a 17 03 03 02 22 36 fb 97 |0..5.3'....."6..| -000000f0 fd ba 12 9b e5 19 14 79 2b 78 0e 6c a9 d8 13 a2 |.......y+x.l....| -00000100 51 d8 c1 4b 53 ac a4 73 cf b1 2d 2c 4d 14 b8 10 |Q..KS..s..-,M...| -00000110 de 5d 86 81 19 77 19 a0 b4 1b eb 85 f4 dc 21 2f |.]...w........!/| -00000120 c5 5c 62 44 1b ca f2 91 06 95 14 7a 07 02 1f 98 |.\bD.......z....| -00000130 0d bc a4 89 7c 96 21 6b 37 1c 47 4a 10 e8 e2 b6 |....|.!k7.GJ....| -00000140 f9 e2 97 06 a5 88 ad 5c f1 08 28 4b f5 d5 9a a0 |.......\..(K....| -00000150 51 74 30 ab 9c 52 b0 b9 2d 38 bb 25 b8 6e 71 a7 |Qt0..R..-8.%.nq.| -00000160 7b c9 76 56 13 e6 60 bf 70 15 11 0c 21 12 cd a1 |{.vV..`.p...!...| -00000170 b8 e5 3a 49 00 ad 9c 2f e5 2b 1f cc 4e 4f 0b 90 |..:I.../.+..NO..| -00000180 e1 77 64 5f b5 fc 7b 1c f3 09 cb 0e c4 94 d7 33 |.wd_..{........3| -00000190 59 5b 8f ae e1 9c e4 f6 83 10 f0 71 5f 17 4b b3 |Y[.........q_.K.| -000001a0 3f 81 2c 0a 22 c5 f4 6b bd 83 32 37 4a 2a 9a db |?.,."..k..27J*..| -000001b0 7b 42 c2 c0 7d 13 e0 e7 ea d7 58 a6 b1 20 68 bc |{B..}.....X.. h.| -000001c0 ba 4e 1a 91 6d dd 11 b9 fc 57 02 4d d4 e8 47 74 |.N..m....W.M..Gt| -000001d0 9d e1 a0 25 2f d9 7d 21 39 b9 ca 4c ff de 42 8c |...%/.}!9..L..B.| -000001e0 36 bb 46 79 d3 52 be bc 1c dc 1f e3 6e 18 b8 4e |6.Fy.R......n..N| -000001f0 b2 47 e6 74 d3 50 fa cf fd 5a c8 33 9a 17 2f 48 |.G.t.P...Z.3../H| -00000200 e6 20 29 b3 7b e3 de a1 c8 e7 74 f0 ca eb f9 6e |. ).{.....t....n| -00000210 29 2c 73 17 df 5f 8f ed dc ae 2a a6 37 f2 b7 f7 |),s.._....*.7...| -00000220 38 da 45 63 cd 2e e6 bf c7 a4 3c 15 c2 89 6f 59 |8.Ec......<...oY| -00000230 c2 19 29 19 13 4f a4 59 57 f9 da 8c 7d 5a 82 7a |..)..O.YW...}Z.z| -00000240 9f 79 01 51 94 7c 25 46 7e c2 b2 bf b4 dd c1 e8 |.y.Q.|%F~.......| -00000250 12 14 3e 77 44 8c 47 8b 9b ab 88 47 5d 12 cd 63 |..>wD.G....G]..c| -00000260 17 c2 15 29 a3 cf 8c 08 e0 12 f6 36 ff ae a6 72 |...).......6...r| -00000270 3b 71 4d c7 a2 3b 38 63 be 77 43 67 fb 78 e6 a8 |;qM..;8c.wCg.x..| -00000280 1d aa 3a 42 f5 47 f8 d4 8d 83 f7 f0 93 ba 90 6d |..:B.G.........m| -00000290 25 65 e1 49 f5 3e fe e9 76 ea fb 23 38 6f b2 8f |%e.I.>..v..#8o..| -000002a0 3c 72 d3 fc 85 92 a0 d1 11 7c 6a 0b 0f 31 5d 8b |..| -000003c0 4a ba 5a 91 7b d1 b9 0e d1 98 5e 95 4d 1c 7f 77 |J.Z.{.....^.M..w| -000003d0 6e eb b9 8c 95 ce d4 04 5c 69 8f 7e 48 89 30 2b |n.......\i.~H.0+| -000003e0 71 27 a3 54 c2 b7 f2 ad 23 7b ee 64 88 a0 0d 75 |q'.T....#{.d...u| -000003f0 76 |v| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 c9 |..+.....3.$... .| +00000060 b4 93 8b 5b b0 ae 93 4a 01 26 0c fb db 3f 53 0b |...[...J.&...?S.| +00000070 04 ca 65 63 3f d7 d9 f9 fc ca ea 4c f2 08 3c 14 |..ec?......L..<.| +00000080 03 03 00 01 01 17 03 03 00 17 85 f6 ff f8 58 7f |..............X.| +00000090 2a d9 e0 12 82 d6 31 64 29 70 05 24 0f 17 1e 9f |*.....1d)p.$....| +000000a0 dc 17 03 03 00 42 16 7b d5 fa a6 30 94 8e a0 a7 |.....B.{...0....| +000000b0 24 59 b9 3d 85 b0 2f d9 25 c6 5a b5 7f 51 ca 54 |$Y.=../.%.Z..Q.T| +000000c0 4a f7 f0 72 bb dd 5e 70 14 6d 46 3f b3 86 6f c1 |J..r..^p.mF?..o.| +000000d0 a4 5f 6d ba 97 f3 38 c0 24 4a 9f de 7b b9 49 12 |._m...8.$J..{.I.| +000000e0 71 02 f8 bc bc 65 5a ea 17 03 03 02 22 f9 92 7e |q....eZ....."..~| +000000f0 34 eb b3 a4 03 8e ec 48 30 a0 9b ac a6 7b b3 a5 |4......H0....{..| +00000100 d0 4a 89 2c 92 6a c6 04 de b2 86 72 0a f1 97 61 |.J.,.j.....r...a| +00000110 da 70 ef 25 5a a3 f1 b3 3d 78 f1 ec 2b 8f 34 2b |.p.%Z...=x..+.4+| +00000120 c9 94 e7 d2 9e 2f 09 5d 7a e3 2e fc 6e e1 ef 80 |...../.]z...n...| +00000130 e6 0c e9 3e 07 bb b7 0e 74 0c e8 19 fe 7f d8 d0 |...>....t.......| +00000140 fa 70 03 c1 31 c2 76 51 c3 d0 ed a6 a1 0d 20 74 |.p..1.vQ...... t| +00000150 86 15 99 51 71 f8 3d 8e 1c 8c a8 19 0a 9c ac 4a |...Qq.=........J| +00000160 ab 0e e6 cc 52 a0 a8 ca d9 71 54 aa 2c 8b 6f 5b |....R....qT.,.o[| +00000170 f9 46 07 0d 86 40 d9 54 33 8e de 54 a5 c2 6e 36 |.F...@.T3..T..n6| +00000180 14 0e e3 52 78 05 56 90 98 2c e1 ec 26 f6 bd 6a |...Rx.V..,..&..j| +00000190 e5 0b 31 e1 a4 2a 2a 96 1b d6 57 87 ac a8 07 71 |..1..**...W....q| +000001a0 83 d9 70 1e 5e 63 9b d1 01 83 e7 c9 c8 1c 5a 34 |..p.^c........Z4| +000001b0 05 c0 7b da 1c ca 5f 99 49 9a 04 da c9 1c 9b ed |..{..._.I.......| +000001c0 b4 af 9d ff 36 71 1b 3a 00 e8 6a c4 6e 47 d9 4a |....6q.:..j.nG.J| +000001d0 64 f5 c1 07 ab 19 c8 65 a3 33 26 99 be 53 c3 86 |d......e.3&..S..| +000001e0 97 10 ef c1 54 8e 69 6c b1 29 aa 7d c1 63 67 ba |....T.il.).}.cg.| +000001f0 d7 72 7c 74 83 58 bd 5a a8 a8 5f 49 38 ee 1e 34 |.r|t.X.Z.._I8..4| +00000200 c8 98 19 73 97 2d 76 e6 d7 0d 15 75 a0 98 1f 15 |...s.-v....u....| +00000210 c9 b8 3d 3f cb 92 a1 39 4b 91 ca e0 d2 0e 38 c2 |..=?...9K.....8.| +00000220 20 eb f2 b5 04 64 fa d8 e2 d7 2f ba 88 7e f4 37 | ....d..../..~.7| +00000230 c1 68 c4 2f c9 54 a1 21 5d 4b e7 67 3b 2e 6a 06 |.h./.T.!]K.g;.j.| +00000240 55 ba d4 8d fe 0e b1 b7 2d cf c2 82 ed 27 3d 5b |U.......-....'=[| +00000250 9b 3b 28 a9 d4 c4 3c a0 45 b1 77 37 8b f8 7e f0 |.;(...<.E.w7..~.| +00000260 51 90 fe 7a 74 14 ac f7 59 8b ed be 79 b0 4b 89 |Q..zt...Y...y.K.| +00000270 d9 0c 39 fe 45 9d 15 0c a6 96 26 0d b2 29 b0 a4 |..9.E.....&..)..| +00000280 29 62 df 4b c0 a0 05 f1 e8 8b 16 af ea 42 8b 58 |)b.K.........B.X| +00000290 5a ae f6 28 d8 40 09 d1 1e 21 b3 c7 a8 e2 30 4a |Z..(.@...!....0J| +000002a0 27 e6 c4 ba ff 62 91 7b ab 64 18 65 02 e2 10 68 |'....b.{.d.e...h| +000002b0 87 35 c2 09 5b 23 a4 eb 96 19 a7 1e 75 85 6e 17 |.5..[#......u.n.| +000002c0 0e bc 11 1a f5 49 05 92 f7 0e e4 c7 85 da 4e 26 |.....I........N&| +000002d0 5b de f2 dc 36 fb dc dd c6 42 23 0c a7 de 8d ad |[...6....B#.....| +000002e0 f5 2a 8b ff b4 5d c6 ca ec e3 83 a4 1e 23 3a 2d |.*...].......#:-| +000002f0 1a 52 51 11 f5 3b 93 47 89 c8 fc 21 b0 a3 4f b3 |.RQ..;.G...!..O.| +00000300 6e d2 83 ca 20 75 fc 43 43 e5 1d 5d 57 c9 7c 17 |n... u.CC..]W.|.| +00000310 03 03 00 a4 dc 79 73 47 d4 f5 72 c9 12 46 ed 3c |.....ysG..r..F.<| +00000320 d0 61 20 81 a9 ad 64 f3 f1 77 7f f1 74 09 67 80 |.a ...d..w..t.g.| +00000330 c1 08 07 9c 50 b8 7d f5 70 f5 c6 a1 5f ba 37 78 |....P.}.p..._.7x| +00000340 58 37 e3 f4 3f 03 1d 69 6f af 2f 2b 8b 10 95 5a |X7..?..io./+...Z| +00000350 be a1 5c b8 42 61 65 5a 27 35 f6 b4 57 3d 3a 6b |..\.BaeZ'5..W=:k| +00000360 f4 e9 90 88 7b e3 7c bf be 51 19 0e 51 53 cd 10 |....{.|..Q..QS..| +00000370 2c 70 76 9e d1 32 28 8f c4 6c 01 2c 46 8f 4d 14 |,pv..2(..l.,F.M.| +00000380 21 a2 63 39 44 b3 03 0d a3 9d a0 c8 f4 cf 5d 7e |!.c9D.........]~| +00000390 d2 17 05 ee 9c 5c 1a 2e 43 dc 3f 6d d9 f2 54 5d |.....\..C.?m..T]| +000003a0 64 ff d2 1c 21 73 66 b1 2c 21 9d 3f bf fe f8 a5 |d...!sf.,!.?....| +000003b0 79 54 fe 8a d5 3d 5f f6 17 03 03 00 35 0f 01 eb |yT...=_.....5...| +000003c0 f8 46 f8 07 7a 06 69 45 e2 47 4d b0 eb 9c 82 8b |.F..z.iE.GM.....| +000003d0 5d d0 59 66 d1 b5 a2 7b b2 f0 72 6f 34 8b 2c 05 |].Yf...{..ro4.,.| +000003e0 84 53 1c 7b 24 d8 f0 cd a3 46 d1 ed 08 22 bb e6 |.S.{$....F..."..| +000003f0 38 98 |8.| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 02 11 1d fa f6 f0 5f |..............._| -00000010 36 d9 1a b8 03 4b b5 2e ba ca 43 ea 31 c2 08 05 |6....K....C.1...| -00000020 e5 a1 55 2e 93 82 3b d5 5a b3 ca fe 11 92 9a 30 |..U...;.Z......0| -00000030 7e d8 02 b4 95 29 8f 29 ba b5 34 22 97 99 bc a9 |~....).)..4"....| -00000040 43 1f 18 5c e2 26 7e 2e 5d ff 2c 68 86 82 7c da |C..\.&~.].,h..|.| -00000050 7e da c5 46 21 69 37 3b f5 65 a4 cd 70 ed e3 c8 |~..F!i7;.e..p...| -00000060 47 21 88 8d 45 3a 0f c9 1e 37 a9 0a 6e 2e 59 0e |G!..E:...7..n.Y.| -00000070 1b 6b 08 22 10 81 74 00 0c 15 6f c6 1e a0 2d 60 |.k."..t...o...-`| -00000080 b1 c6 ec 65 ff 91 16 1a e4 18 86 1b 43 04 dc b1 |...e........C...| -00000090 a0 f2 1d e8 4e 46 72 84 20 14 75 1e 72 52 1b 46 |....NFr. .u.rR.F| -000000a0 1f 8a ed 08 c8 e0 07 1b 6d e3 44 68 ec 52 74 d5 |........m.Dh.Rt.| -000000b0 8d 7f 41 96 b4 77 01 25 0c 1f aa 50 2f 8b d7 1a |..A..w.%...P/...| -000000c0 77 1b 24 01 0b 1f 0f c2 0f e1 00 db 0a 28 e9 c5 |w.$..........(..| -000000d0 a7 22 a2 fd c2 98 c5 69 51 91 d4 55 0f 52 da 33 |.".....iQ..U.R.3| -000000e0 47 f2 34 bd 06 bb 22 53 55 8c 6c e1 95 b5 0f b8 |G.4..."SU.l.....| -000000f0 e5 8a 64 51 50 47 5d ca 5b 1a 20 22 99 b2 d4 74 |..dQPG].[. "...t| -00000100 9e 6b 01 44 6b 7c 40 a0 e3 95 eb 96 53 c0 8d c0 |.k.Dk|@.....S...| -00000110 c1 e1 2b 21 04 f1 64 03 ba 0f d9 34 57 f2 2e 62 |..+!..d....4W..b| -00000120 5e f6 69 d6 86 3e f0 00 96 ca b7 ed 7d b4 1c 79 |^.i..>......}..y| -00000130 f3 ea f4 10 79 d2 6d 6e 49 6c e4 32 c1 81 da 9d |....y.mnIl.2....| -00000140 cc 59 ea 41 3f 1e 62 34 61 6b 0e a4 07 4f ef f7 |.Y.A?.b4ak...O..| -00000150 a3 31 ee 52 14 60 4c 06 5c 69 49 8e 6a ab e9 94 |.1.R.`L.\iI.j...| -00000160 bf cc a5 12 b7 94 10 87 2f cc d8 40 b1 f3 a9 27 |......../..@...'| -00000170 97 5c 7f 85 f9 14 dd e0 66 27 9e 3d f4 eb 75 ab |.\......f'.=..u.| -00000180 1d 1a c0 c3 72 af 6e 13 bb 24 ac fe f0 fb 47 d0 |....r.n..$....G.| -00000190 1d 79 37 70 86 d3 43 9b 64 8c d0 f5 2b a8 7a 77 |.y7p..C.d...+.zw| -000001a0 4a e7 92 a3 bf 1e db 22 5a 40 39 07 76 1c 71 de |J......"Z@9.v.q.| -000001b0 9c ff 75 b7 0d 6e 3e 14 69 8d 08 e5 f3 24 ae 6a |..u..n>.i....$.j| -000001c0 61 f3 dd a7 57 52 9e da f1 de aa 07 11 65 41 64 |a...WR.......eAd| -000001d0 61 57 23 71 47 aa 8e 47 9c 5f 99 84 90 2d 9a fd |aW#qG..G._...-..| -000001e0 5b 15 27 44 41 5c a0 41 87 05 8a 53 8f ed 93 22 |[.'DA\.A...S..."| -000001f0 50 15 b4 60 55 c7 78 20 b5 d8 dd 9d 5d 8c 69 bc |P..`U.x ....].i.| -00000200 74 da d6 a6 a6 86 fe 93 e1 48 48 f2 f0 36 93 86 |t........HH..6..| -00000210 d6 62 9d 09 3a 19 f7 9d 01 9b 87 85 17 03 03 00 |.b..:...........| -00000220 99 37 bf 65 e8 18 ef 10 d7 02 e2 73 3f 13 4a 6f |.7.e.......s?.Jo| -00000230 ea f0 e2 c8 a3 fc a4 3a d2 ea 96 2d 77 cb cc b3 |.......:...-w...| -00000240 1d 8a 77 4d 97 a6 e9 6e 6e b5 af 67 d1 e4 e6 be |..wM...nn..g....| -00000250 0b 05 b1 da 15 83 ca af 19 cf 57 60 05 16 47 bd |..........W`..G.| -00000260 ce 94 f9 bf 48 5c 2c 38 57 57 c3 39 9b 84 19 59 |....H\,8WW.9...Y| -00000270 db fc 09 06 29 4d e7 71 be d4 86 12 fa 8e 54 e8 |....)M.q......T.| -00000280 b0 7e 79 56 dc b2 7a 30 08 e2 8b c7 fa 46 ce 84 |.~yV..z0.....F..| -00000290 d3 3e 6d 1c 8d 4c 5e 76 c7 d2 1d 8b 85 5d be a3 |.>m..L^v.....]..| -000002a0 1b d8 92 72 6d b1 73 d9 b4 a7 14 00 58 80 79 a9 |...rm.s.....X.y.| -000002b0 75 55 96 af d9 d2 20 92 ef ca 17 03 03 00 35 b0 |uU.... .......5.| -000002c0 fe 3f 36 6e 82 b5 d3 7c e9 7b 75 d6 b1 4d f6 7b |.?6n...|.{u..M.{| -000002d0 d0 10 68 32 9a 7b 04 69 38 bf a2 42 1b 3d 14 75 |..h2.{.i8..B.=.u| -000002e0 31 00 90 d4 1b b1 bf 5b 76 65 50 42 21 60 75 30 |1......[vePB!`u0| -000002f0 f9 b8 ee 45 17 03 03 00 17 0b b8 78 9e a2 94 45 |...E.......x...E| -00000300 47 f4 8e af 08 d0 80 75 09 7b c6 44 45 82 19 30 |G......u.{.DE..0| -00000310 17 03 03 00 13 0e fb b9 24 58 7c ab 97 b3 6e 2e |........$X|...n.| -00000320 55 50 ff 05 5d 04 dc 72 |UP..]..r| +00000000 14 03 03 00 01 01 17 03 03 02 11 ce 65 5f 9d 1a |............e_..| +00000010 c6 5f 48 ea da 02 77 1d 79 b2 82 1a da c4 75 aa |._H...w.y.....u.| +00000020 11 af ae 1f e4 7e d7 6f ed 75 48 56 de c8 36 05 |.....~.o.uHV..6.| +00000030 6a 97 5e 49 49 55 25 6f ef 3e ed 40 3f 91 9a ae |j.^IIU%o.>.@?...| +00000040 f4 a1 d3 02 d3 15 60 23 1b 7a 80 ef ef 60 bb 62 |......`#.z...`.b| +00000050 a3 8d 6b 24 1a 11 7d 8e 00 76 54 69 f1 b5 df 77 |..k$..}..vTi...w| +00000060 c0 3a a3 8d 9d a3 56 e7 4d 2d 68 fe 38 49 6d 42 |.:....V.M-h.8ImB| +00000070 3d 2c 69 fd 8c 53 44 af 13 8b 1d cb dc 04 16 6e |=,i..SD........n| +00000080 5a ab 0a 00 19 cf a0 8a ee bd 71 24 68 ee 18 2a |Z.........q$h..*| +00000090 ec 04 fe 0f 12 15 8e 09 e0 87 de 4e c4 2a a1 a5 |...........N.*..| +000000a0 6d be 79 6e 25 15 11 64 8c 35 71 97 fa a4 43 e2 |m.yn%..d.5q...C.| +000000b0 dd cd a1 da b3 75 5d d5 36 fb b4 6b 12 30 a7 f6 |.....u].6..k.0..| +000000c0 d7 7c 72 e1 f8 6a 8b 3e 38 13 9c da ee 07 3d 6a |.|r..j.>8.....=j| +000000d0 f5 1b 26 73 ff 24 03 1f ea dc f3 ed 6b c2 0d fe |..&s.$......k...| +000000e0 3e 03 c4 22 93 c9 9b fe 22 5c 1e fb 07 2b 1b 7f |>.."...."\...+..| +000000f0 34 ff c6 1b 24 32 4b b1 ee 4c 0b 08 b6 3b 1e aa |4...$2K..L...;..| +00000100 49 f3 04 b7 9a 42 e5 42 5a df a2 92 d3 2f 62 54 |I....B.BZ..../bT| +00000110 e1 21 08 ee ce 64 80 48 d3 6a 15 67 8c 5e d1 ac |.!...d.H.j.g.^..| +00000120 a2 64 f9 10 67 2c 27 7e 10 11 d7 09 13 2f 61 a7 |.d..g,'~...../a.| +00000130 d7 9d 2a 18 0f a8 93 c6 fc 75 5c 31 68 42 22 e6 |..*......u\1hB".| +00000140 5c e8 4d 7d 82 73 ba 97 5c d7 6a a2 14 37 85 93 |\.M}.s..\.j..7..| +00000150 48 a7 50 9c fc 66 7b 82 a8 b6 99 0f 8c 9e 40 b5 |H.P..f{.......@.| +00000160 e4 4f 98 01 db 56 03 44 f9 9f 52 a3 33 ac 77 2a |.O...V.D..R.3.w*| +00000170 b6 0a de d5 68 a5 df 67 41 8d 4c 53 9d c4 8d b7 |....h..gA.LS....| +00000180 2e 3d 1f 93 1c 23 e3 81 76 5a 99 7c 90 60 d8 4d |.=...#..vZ.|.`.M| +00000190 e4 a5 00 7d f9 2c c5 19 bc 3c a3 73 c3 83 ff 31 |...}.,...<.s...1| +000001a0 6a 67 88 32 d3 90 7f ab 20 19 1f 55 72 e4 08 bc |jg.2.... ..Ur...| +000001b0 c4 d6 24 e6 00 2d 85 be d4 9b 2c e5 7b ee 26 6b |..$..-....,.{.&k| +000001c0 49 ed 94 3d d6 ee fd 9d da 39 be 02 23 aa b9 78 |I..=.....9..#..x| +000001d0 f2 41 97 0a d9 66 15 1e e1 a2 49 f3 09 f0 25 91 |.A...f....I...%.| +000001e0 8a ea f5 38 87 ea 66 ae dc d2 04 d1 02 92 ab 6c |...8..f........l| +000001f0 a4 1a cc 1b ba 48 d5 8e 27 c4 c5 34 08 8f c2 c8 |.....H..'..4....| +00000200 e1 e6 a8 98 48 9c 43 6c f1 34 ba c0 ff 8e 22 14 |....H.Cl.4....".| +00000210 f7 f9 93 38 96 1e 73 57 28 5b 25 3e 17 03 03 00 |...8..sW([%>....| +00000220 99 c7 8d 1d 62 23 f3 c1 31 3d 45 bc d5 59 ff 47 |....b#..1=E..Y.G| +00000230 8e 34 3d 1d 06 cc e0 05 ea 38 87 f0 fd c3 84 53 |.4=......8.....S| +00000240 47 6b fb 7b 9b c2 a4 f2 1f e0 61 ab 17 32 d0 57 |Gk.{......a..2.W| +00000250 34 dd fb 42 9b ad 4c d7 20 ff b1 58 34 e0 0c b1 |4..B..L. ..X4...| +00000260 44 0c cf d3 05 be 3b 8e a2 d5 39 44 c8 22 64 ad |D.....;...9D."d.| +00000270 61 80 df 5d fd 40 0e c0 c2 41 4f a7 e5 4f b3 7f |a..].@...AO..O..| +00000280 0b db d6 ac fe ba c0 8b 24 8e e8 b2 d6 93 3d 12 |........$.....=.| +00000290 75 41 85 1d b5 4a e2 e0 f8 a1 23 8f 13 24 c6 b6 |uA...J....#..$..| +000002a0 e5 db 06 3f d8 d5 2f b5 e5 24 59 76 53 dd aa 0a |...?../..$YvS...| +000002b0 26 ba 72 23 63 ac 4d 5c 92 13 17 03 03 00 35 47 |&.r#c.M\......5G| +000002c0 59 18 68 11 0a 9a 0b 66 d3 c0 26 72 da 51 0e 00 |Y.h....f..&r.Q..| +000002d0 b0 78 8b 6a ef df 75 94 94 b0 aa 9b 77 e3 9c d8 |.x.j..u.....w...| +000002e0 23 9d 74 ce 85 55 c0 30 4c 96 5b 59 7a f6 03 2e |#.t..U.0L.[Yz...| +000002f0 d8 9c 0e 11 17 03 03 00 17 74 ed 13 0b 6a 15 18 |.........t...j..| +00000300 5e d4 5e 8a c6 e6 5c 0b 3c d0 1b 3d 68 86 2a 07 |^.^...\.<..=h.*.| +00000310 17 03 03 00 13 6f e2 fe a0 b8 95 d4 aa fd 11 2b |.....o.........+| +00000320 e8 6d 42 28 d1 ca 1c 5e |.mB(...^| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled b/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled deleted file mode 100644 index 98d718bab2b..00000000000 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled +++ /dev/null @@ -1,138 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| -00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| -00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| -00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| -00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| -00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| ->>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 e5 55 1c 7e bc |....z...v...U.~.| -00000010 05 a3 af 8b 02 03 6a 08 34 35 43 9f 35 c1 39 36 |......j.45C.5.96| -00000020 97 ab d9 4f 77 26 88 31 f8 1c a4 20 00 00 00 00 |...Ow&.1... ....| -00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 63 |..+.....3.$... c| -00000060 74 2f 45 26 f4 7c cd d6 cb 8d 9f b5 6b 88 41 ef |t/E&.|......k.A.| -00000070 f4 cd 00 54 91 29 98 e4 a0 6b 6d b5 2f 39 01 14 |...T.)...km./9..| -00000080 03 03 00 01 01 17 03 03 00 17 e6 81 13 75 85 fe |.............u..| -00000090 7d c6 09 24 01 bf 44 78 65 4e 5f d0 37 b9 89 15 |}..$..DxeN_.7...| -000000a0 98 17 03 03 00 42 88 5c b3 19 ee 62 c0 2d 95 51 |.....B.\...b.-.Q| -000000b0 fd 88 e0 13 aa 53 e5 5a 45 be 0f 07 6f 46 c8 1b |.....S.ZE...oF..| -000000c0 a2 b5 2a 7c 46 5f b5 90 46 95 b9 a4 ce 44 a8 a7 |..*|F_..F....D..| -000000d0 3d 8e ce d2 76 57 44 e0 0e 83 af f3 2f 00 55 cb |=...vWD...../.U.| -000000e0 1f e7 d2 42 22 6f 78 0c 17 03 03 02 6d 45 f7 95 |...B"ox.....mE..| -000000f0 68 b9 ad 32 13 34 84 c2 dd 62 a7 f5 18 0f 0b a6 |h..2.4...b......| -00000100 b8 5c dd 06 69 0d 07 ea 6b ec ad ad a7 13 ea f3 |.\..i...k.......| -00000110 87 9b 74 a9 53 49 b3 a9 ff f3 eb 71 1b 25 63 8b |..t.SI.....q.%c.| -00000120 c6 0f 6a 21 bc f1 fb 4b 8e d4 07 6e c6 8e 9f bf |..j!...K...n....| -00000130 73 eb 1e a5 d7 e4 a1 cd 6e 7e de 45 a2 b4 6f 25 |s.......n~.E..o%| -00000140 fe c2 a1 84 b8 09 d1 65 90 6d ef 07 ea d0 25 01 |.......e.m....%.| -00000150 54 f2 8e f8 53 38 1e 35 a9 af be 2a 8d 81 9b 77 |T...S8.5...*...w| -00000160 38 22 42 b8 56 ea 72 ab c3 ac 9b 17 1a 0b 65 94 |8"B.V.r.......e.| -00000170 8a 81 6d 83 c6 f4 76 32 ed f7 84 4d ec 17 0e 45 |..m...v2...M...E| -00000180 74 e8 ba b0 46 92 62 8c 73 07 a8 1f d5 d3 44 d1 |t...F.b.s.....D.| -00000190 53 21 62 8b 02 c6 20 40 1d f1 75 2b 8a 6a 60 2a |S!b... @..u+.j`*| -000001a0 ee 04 5f c0 46 6d 74 7a 18 4a e0 ca d4 a6 6a a2 |.._.Fmtz.J....j.| -000001b0 11 21 20 4a 3e 57 3c 67 ff 61 3d 15 32 14 f2 01 |.! J>W.$..@.| -00000250 10 59 17 11 6f 3c 11 8b eb b2 42 e7 d5 b7 ee d2 |.Y..o<....B.....| -00000260 ae 95 9c 21 48 34 d9 5a 20 95 7c 72 35 05 5e 6c |...!H4.Z .|r5.^l| -00000270 a2 05 46 30 e6 33 d3 91 ac c8 17 4b b1 15 cc f0 |..F0.3.....K....| -00000280 af bb 7c 56 e0 5b 25 8e 35 e0 2e 35 91 0d e0 bc |..|V.[%.5..5....| -00000290 f6 9c 3b 15 f8 96 dc 4e 6c aa 57 c9 f0 1f 55 e2 |..;....Nl.W...U.| -000002a0 d9 5d 09 71 f9 af 17 69 29 d5 94 8a 5f fa b2 ad |.].q...i)..._...| -000002b0 1b b9 ce 90 e7 bd 02 1b ad 9d 91 19 7e f3 8f 2d |............~..-| -000002c0 70 d5 af 2c e7 29 b1 f9 3c 5a 7f 04 6f 73 88 da |p..,.)...'B.| -00000320 6f 13 da a1 b2 b1 43 76 69 eb f1 c6 e2 b5 6c 57 |o.....Cvi.....lW| -00000330 e0 88 c9 0d 7d 37 1b 0b a0 b7 cd 6b ba 3a 52 55 |....}7.....k.:RU| -00000340 61 c6 5c 71 ce 1e 69 b9 ea b4 c6 a5 78 c5 b8 b6 |a.\q..i.....x...| -00000350 4e b1 94 84 a3 d4 31 d9 3b 15 17 03 03 00 99 6c |N.....1.;......l| -00000360 5d dd 43 24 9d 6e 5d 64 d3 54 30 aa 98 c3 7e 21 |].C$.n]d.T0...~!| -00000370 05 06 fc 3b eb 52 12 36 6b 2e e1 32 5a 59 30 a7 |...;.R.6k..2ZY0.| -00000380 b0 bb 52 1a 36 e6 78 20 84 8c cf 0d 90 da c7 88 |..R.6.x ........| -00000390 c4 2f bc b4 b6 03 1b 34 9b c8 12 db bc 87 95 d3 |./.....4........| -000003a0 84 4e 41 c1 de 2f 4c 66 d9 13 fc 78 31 05 6c 67 |.NA../Lf...x1.lg| -000003b0 e3 3d 28 36 0f fe 5f 45 29 d2 1b 4d a5 60 dc f7 |.=(6.._E)..M.`..| -000003c0 20 74 cf f5 7b 3f f7 58 53 0c 64 7d 3f c6 f1 ac | t..{?.XS.d}?...| -000003d0 a9 1b 60 d8 ea a5 32 11 23 6d 66 19 70 2b fa ce |..`...2.#mf.p+..| -000003e0 c8 f6 9d cc 12 83 a1 e1 4b be 98 d3 c2 56 65 34 |........K....Ve4| -000003f0 73 3a b3 6e d8 2c db 3b 17 03 03 00 35 e6 ce 17 |s:.n.,.;....5...| -00000400 e5 92 38 9e 00 2d 66 bf a9 e2 13 66 01 af 64 15 |..8..-f....f..d.| -00000410 8d da 6b f3 a7 f6 5c 76 e1 f4 c4 2f dc 93 c4 3c |..k...\v.../...<| -00000420 69 5a 30 e5 db 5a b5 0b 98 4e 43 a3 51 ba 41 9d |iZ0..Z...NC.Q.A.| -00000430 18 c0 |..| ->>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 02 11 24 0f 0c cc 6a |...........$...j| -00000010 8e 07 9c d7 f9 84 55 cc 79 a7 c1 c5 fb 6e 29 5e |......U.y....n)^| -00000020 31 e1 b1 00 c0 c9 a8 94 59 75 f4 b5 86 7c a4 8c |1.......Yu...|..| -00000030 8d 79 dd 42 45 67 69 f5 fb f0 02 54 f5 8f 1a 86 |.y.BEgi....T....| -00000040 2f a0 4e 9b 68 e2 69 36 48 cb 8e cc 26 fa 1b 60 |/.N.h.i6H...&..`| -00000050 c8 f3 b7 7c 36 dd 59 71 a3 f8 9a 7a bc 8a e1 10 |...|6.Yq...z....| -00000060 8f 6d 69 60 07 b6 62 6d d3 2b fa a4 81 eb ae 3f |.mi`..bm.+.....?| -00000070 9d 7e 1d d7 d1 89 24 4e 7e 65 4b d2 37 58 b2 56 |.~....$N~eK.7X.V| -00000080 a1 8e 10 73 44 9c f1 c7 60 97 49 99 e2 82 74 58 |...sD...`.I...tX| -00000090 e3 1f 41 ec 1d 13 85 f1 95 98 39 cb d1 51 f7 0e |..A.......9..Q..| -000000a0 fe e4 fa 04 20 1a f2 c5 ae 64 9d eb f8 ff 03 ce |.... ....d......| -000000b0 ca 12 7c dd a6 b4 2c a3 eb 8e 83 2c cf 77 6b 82 |..|...,....,.wk.| -000000c0 68 77 58 5d 3e ef 01 0b 78 e9 37 b0 36 9c 62 44 |hwX]>...x.7.6.bD| -000000d0 88 ae f1 5a d7 93 81 0a 84 cf 4f 3b db 05 41 92 |...Z......O;..A.| -000000e0 4d 31 3d 06 9e 73 11 43 de 3e ec b8 b0 48 99 84 |M1=..s.C.>...H..| -000000f0 bc 0c 7c 86 93 03 d5 5f c5 21 34 a5 cc c7 d5 42 |..|...._.!4....B| -00000100 1d 69 94 53 39 d9 56 07 40 46 44 89 e6 95 8d e9 |.i.S9.V.@FD.....| -00000110 ca 6d f0 e0 2a 22 70 bc e7 7f 8e 15 0c 56 51 e3 |.m..*"p......VQ.| -00000120 46 5c b9 66 c5 8b 07 d3 f0 bb 84 fe 71 d6 a2 90 |F\.f........q...| -00000130 d9 ec 46 00 82 10 38 9c 8f 35 e5 48 d8 82 7f 65 |..F...8..5.H...e| -00000140 68 f5 42 48 74 6b 29 79 f3 32 b6 a1 aa 42 73 e3 |h.BHtk)y.2...Bs.| -00000150 c3 f6 fc 76 9e 32 59 26 a6 75 4a dc 65 23 73 10 |...v.2Y&.uJ.e#s.| -00000160 35 79 a5 41 7b 72 d5 cd 33 1f 7d 98 b3 39 4b f6 |5y.A{r..3.}..9K.| -00000170 e8 09 ed d6 62 a0 48 b5 76 47 2e 7e 1a 5d 75 6d |....b.H.vG.~.]um| -00000180 c2 98 22 17 b1 8f 2e a5 a2 b3 b3 5e d9 89 c5 a0 |.."........^....| -00000190 46 2a ac af 20 66 e9 f3 02 84 26 51 c0 0a 2e 0c |F*.. f....&Q....| -000001a0 d3 90 3c 9f 19 3f 25 3e 7d 3a 38 6f f3 ce 2f c4 |..<..?%>}:8o../.| -000001b0 7b 84 e4 d5 c2 c8 90 54 6d 2c 59 70 34 44 53 25 |{......Tm,Yp4DS%| -000001c0 ee ee d6 7e 13 30 1e 09 ff f2 79 bd 7c a1 af a9 |...~.0....y.|...| -000001d0 a9 7b 51 6a d8 17 41 22 f5 d0 5d 84 00 a7 5f 1a |.{Qj..A"..]..._.| -000001e0 b6 15 98 de f4 bd cd fe 70 38 5c 0f 44 60 5a 7d |........p8\.D`Z}| -000001f0 be df 6e 56 bb 83 0b 10 fa 5d 3a 2c 9e 4a 00 7f |..nV.....]:,.J..| -00000200 ec f4 42 52 52 95 5e e1 bd cc cf a0 45 c2 79 2c |..BRR.^.....E.y,| -00000210 10 4d 14 35 ad bd 18 d4 b1 aa 09 65 17 03 03 00 |.M.5.......e....| -00000220 99 a4 2c 7a c2 25 ba 3b a2 84 1f e8 a0 d1 5c c4 |..,z.%.;......\.| -00000230 bb c6 f8 fc eb 19 3e f5 e6 53 9f c3 35 d3 7a 00 |......>..S..5.z.| -00000240 68 e1 e0 2f 73 75 d7 2d df 44 aa 34 43 bf 66 c1 |h../su.-.D.4C.f.| -00000250 31 0d e6 86 f8 71 6b 71 ac 89 c5 26 cf d9 1e 43 |1....qkq...&...C| -00000260 33 c3 48 68 e0 4d f5 d5 69 ff fc 02 47 cc 91 41 |3.Hh.M..i...G..A| -00000270 83 41 58 04 2a 02 53 3c 3b 0a 4c 18 16 00 fd e8 |.AX.*.S<;.L.....| -00000280 64 54 0d 34 a1 3d a5 4b bd c2 54 17 c3 5a 82 7a |dT.4.=.K..T..Z.z| -00000290 55 5d a9 57 63 62 ef 8b 3a 75 f2 cd 34 ef d6 30 |U].Wcb..:u..4..0| -000002a0 08 7f 03 0b c3 eb 29 94 88 11 38 42 40 6f bf cc |......)...8B@o..| -000002b0 d4 01 3f 8a 90 11 f9 da fd 9e 17 03 03 00 35 7d |..?...........5}| -000002c0 2d 12 d7 58 d0 76 43 25 d1 8d 5c 5c b1 7f fa 48 |-..X.vC%..\\...H| -000002d0 a9 21 48 02 64 76 91 6c 79 7e b9 22 33 f7 32 cb |.!H.dv.ly~."3.2.| -000002e0 50 22 78 02 96 4e 2d f6 09 68 06 8e 44 e6 fd 7f |P"x..N-..h..D...| -000002f0 cf 0a 7e a3 17 03 03 00 17 84 cd d8 f2 e2 38 2e |..~...........8.| -00000300 57 e5 47 76 48 50 34 9e 65 d4 c6 1d 7d b3 4e 91 |W.GvHP4.e...}.N.| -00000310 17 03 03 00 13 e5 05 98 5b 87 5d db ae 89 38 2c |........[.]...8,| -00000320 35 89 31 14 73 cd 16 54 |5.1.s..T| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS b/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS index d2092baa8c6..9488dd6b66d 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,130 +7,137 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 01 26 b2 48 f5 |....z...v...&.H.| -00000010 b7 cc 24 54 75 e5 9d cd 17 e1 02 e4 2d e1 32 28 |..$Tu.......-.2(| -00000020 4e 19 1e 6d 8a 1e 3f 0e 37 3c 5f 20 00 00 00 00 |N..m..?.7<_ ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 6d 36 ae 02 a9 |....z...v..m6...| +00000010 74 ad e5 4d 55 b6 4a 70 c6 f5 cf d5 68 d9 2a 5f |t..MU.Jp....h.*_| +00000020 9b 4b 23 ce 38 9b f3 da 44 72 7d 20 00 00 00 00 |.K#.8...Dr} ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 67 |..+.....3.$... g| -00000060 35 32 50 33 37 9b 04 46 e4 7d 40 53 9d 3b c3 53 |52P37..F.}@S.;.S| -00000070 6d 16 d3 7a 95 ec 2b 09 37 ff 01 55 60 9c 53 14 |m..z..+.7..U`.S.| -00000080 03 03 00 01 01 17 03 03 00 17 b9 d8 da 19 0a e9 |................| -00000090 37 9a 76 b8 b1 e6 38 27 83 aa 0a 3a d5 cc 9a 25 |7.v...8'...:...%| -000000a0 1c 17 03 03 00 20 17 a1 70 92 5e 78 bf 9f e3 0c |..... ..p.^x....| -000000b0 cc e8 a3 6d c9 ba 77 e1 b5 0c 4b 1e 84 08 04 33 |...m..w...K....3| -000000c0 88 a3 05 4a e2 6a 17 03 03 02 7a f0 39 57 69 59 |...J.j....z.9WiY| -000000d0 dd 3d b1 be 1a 06 fc 7b 21 a1 7a cb b9 6e f6 ce |.=.....{!.z..n..| -000000e0 62 13 c8 b6 b3 85 b2 93 22 ab 5c f2 32 a2 af 32 |b.......".\.2..2| -000000f0 42 d1 c0 94 08 f4 ba 1f bb d9 16 f7 2b 40 8d dd |B...........+@..| -00000100 43 a2 80 0e 3a e4 ff 2d a3 18 59 b4 08 88 46 bf |C...:..-..Y...F.| -00000110 bb 46 58 82 b2 db 98 c0 9f 3a f8 c4 71 f0 87 ac |.FX......:..q...| -00000120 c5 ee 30 ea c4 b2 63 ee d0 cb 17 06 5c 80 19 3a |..0...c.....\..:| -00000130 bc f8 07 a1 e8 47 b4 b2 77 e0 14 ea 5d 16 c1 31 |.....G..w...]..1| -00000140 e6 34 bc 50 92 1a e8 9f e5 e9 0d 60 af 00 ad 9b |.4.P.......`....| -00000150 e3 10 bc 64 bd d4 c0 35 e8 26 67 df fb 3d d4 e8 |...d...5.&g..=..| -00000160 11 f2 24 13 d9 fb 68 5d 69 ce 23 98 07 e8 4a 4a |..$...h]i.#...JJ| -00000170 d9 d1 a7 b1 63 e1 01 08 ae e5 d1 57 1c e6 9a 5a |....c......W...Z| -00000180 ac 4a f8 f7 9a 33 51 d1 3b 68 42 1a 0d e0 08 f3 |.J...3Q.;hB.....| -00000190 a1 ea 83 5c 8f 95 7f ee bb 45 e3 72 72 2c a0 39 |...\.....E.rr,.9| -000001a0 86 f1 e0 58 6c 82 01 b0 3c 17 09 82 f3 d9 99 0c |...Xl...<.......| -000001b0 24 33 7d 50 b0 b7 84 3e 9b 91 a8 1f 91 02 95 aa |$3}P...>........| -000001c0 44 b6 de 0e 35 e1 b7 f6 ca 73 f8 6f f4 5a 21 db |D...5....s.o.Z!.| -000001d0 d6 f8 04 88 4e d6 04 7c 67 93 22 9a ff d0 0e 79 |....N..|g."....y| -000001e0 e6 cb b2 03 b9 f2 46 27 a3 1a 89 2e 8f 46 4f c5 |......F'.....FO.| -000001f0 4a ad 09 e7 79 38 a4 84 43 19 c9 1f 62 a0 5a 4a |J...y8..C...b.ZJ| -00000200 fa e4 98 14 e7 34 a6 3f 07 93 ab 6a fb 1c 3e 1f |.....4.?...j..>.| -00000210 a2 82 0a 42 43 d7 ef e7 aa fa 42 e0 be a1 dd 4e |...BC.....B....N| -00000220 2e 9e 49 da 81 da bc 5f 40 fa f8 00 99 19 d0 13 |..I...._@.......| -00000230 50 77 8b c5 69 f0 ec 7c bd 2d 9e c5 66 16 56 ca |Pw..i..|.-..f.V.| -00000240 bd 51 67 7b 87 5e 1f 4d 21 05 30 72 ac a8 ab 13 |.Qg{.^.M!.0r....| -00000250 12 dd 4c f7 e0 cc 95 c3 3e f0 94 95 40 ea c5 f1 |..L.....>...@...| -00000260 31 f9 53 32 40 64 5f c8 29 52 7a d6 22 5c 2d e8 |1.S2@d_.)Rz."\-.| -00000270 f9 eb f8 b9 e6 66 09 48 ad ed 73 6a 42 bc a8 7c |.....f.H..sjB..|| -00000280 d6 f9 62 45 25 f6 bf 8a 56 13 b4 50 cb 1b 5e 8b |..bE%...V..P..^.| -00000290 92 f3 9d 50 fc 7d 3c e4 b1 55 ae b2 3f 6a a8 a2 |...P.}<..U..?j..| -000002a0 f1 dd 83 9a 97 0e 3f 93 a9 6d 94 e5 cc a9 53 14 |......?..m....S.| -000002b0 24 44 80 28 a2 6a 21 57 07 63 96 78 3f 05 40 7d |$D.(.j!W.c.x?.@}| -000002c0 be 83 b2 b8 b3 0a 58 a7 50 29 dc bb b1 7f c6 c7 |......X.P)......| -000002d0 4b 5a ff 95 4a c8 50 0b 8e 44 ec 9b 0f 95 ac 8f |KZ..J.P..D......| -000002e0 f9 b3 19 d0 aa a6 67 f8 ce dc 67 34 0e c9 98 98 |......g...g4....| -000002f0 82 b1 54 4a a0 0e 02 d7 02 d3 36 06 4d 51 6f e4 |..TJ......6.MQo.| -00000300 f5 68 ff 4d 8f 00 94 a6 6b 6c 33 41 31 1a 9e 2c |.h.M....kl3A1..,| -00000310 f5 df 4a 43 b7 00 01 5b 6e 59 af 9c 9f bb c5 37 |..JC...[nY.....7| -00000320 22 32 35 25 bf 69 0a 9d 75 7e aa 19 b9 4e b1 17 |"25%.i..u~...N..| -00000330 cb f8 b5 8f 0f 81 9c df b1 ce a0 5b f2 ed df 20 |...........[... | -00000340 5a bd 8a 88 b1 17 03 03 00 99 15 09 f2 8d 63 c0 |Z.............c.| -00000350 f2 00 9f e8 1a d3 0f cc 35 0b ce eb 3c 45 87 59 |........5....1".| +00000090 d3 69 bf 1d b5 2e 18 23 b3 21 00 17 23 a4 3f 9a |.i.....#.!..#.?.| +000000a0 0b 17 03 03 00 20 aa f0 51 64 b5 44 f0 28 ab 56 |..... ..Qd.D.(.V| +000000b0 da 34 2d 62 77 4d 88 07 b6 82 ad 64 df e6 59 c9 |.4-bwM.....d..Y.| +000000c0 91 e5 f8 f2 67 88 17 03 03 02 7a cf 2d 71 db 3f |....g.....z.-q.?| +000000d0 05 45 b8 68 18 1c b9 66 b6 00 f8 dc 9d ae e5 d2 |.E.h...f........| +000000e0 a3 a8 02 5f ac e4 95 a6 fc 96 78 7b fd 0a 21 62 |..._......x{..!b| +000000f0 ff 7c 15 2c fb f1 21 15 1e 8d 9e f9 71 62 43 e4 |.|.,..!.....qbC.| +00000100 c9 69 e4 fe 87 f0 9d 9e aa a4 5c d8 4e ae 3c 38 |.i........\.N.<8| +00000110 e5 76 21 7b 03 a8 70 6f e8 96 39 34 e7 3c b9 51 |.v!{..po..94.<.Q| +00000120 b4 ef ce 7d 0b 1e 57 7d 62 de 47 6a 0a b0 97 6d |...}..W}b.Gj...m| +00000130 49 fe ae 6f c9 d6 e4 4a 54 60 3d 55 53 06 aa 28 |I..o...JT`=US..(| +00000140 7a 3e 7b e0 d1 8a 60 45 87 81 bf fc 98 13 1e de |z>{...`E........| +00000150 7a 90 73 81 13 91 3a c4 da 71 74 e0 1d d5 30 55 |z.s...:..qt...0U| +00000160 46 6a 48 c2 0c 18 91 a3 79 8e c2 b9 5b 24 88 76 |FjH.....y...[$.v| +00000170 5f e6 8f 24 91 95 5b 0d 38 39 5b a4 f6 0e 1a b8 |_..$..[.89[.....| +00000180 e8 2b 0d ac a8 56 10 23 54 a5 78 c9 2a cb ed 24 |.+...V.#T.x.*..$| +00000190 58 16 1a 2f 1c b7 72 fc da ab 56 f6 27 d1 98 39 |X../..r...V.'..9| +000001a0 1f f9 dd e0 1f 1f 23 1a ff 6b af e1 17 9d ec 35 |......#..k.....5| +000001b0 de 0b 4d a4 46 5a fd 07 56 ce 72 19 76 dc 0c 06 |..M.FZ..V.r.v...| +000001c0 99 38 ce 58 3b 9f 13 9a d5 b7 d6 08 a6 05 4d e1 |.8.X;.........M.| +000001d0 75 da 59 4d ab d9 28 e8 af c4 50 f0 b1 49 f8 fd |u.YM..(...P..I..| +000001e0 c9 11 b8 01 70 bb 49 e2 0f 26 1b cb ee c2 7b bd |....p.I..&....{.| +000001f0 2f 72 78 be a1 67 1d 0c d0 bb 4e e7 40 b3 bd 8c |/rx..g....N.@...| +00000200 e2 f4 4f b2 c5 4c 82 49 51 00 44 17 c6 82 72 f5 |..O..L.IQ.D...r.| +00000210 cd 55 c1 43 28 52 85 2b 5d 91 33 9c 15 34 6e ae |.U.C(R.+].3..4n.| +00000220 77 4e 08 0c 9c d2 ae 7f e8 83 af 60 96 10 ae dc |wN.........`....| +00000230 58 6a 3b ae 15 e5 9c a8 25 f3 69 71 f7 94 9c 75 |Xj;.....%.iq...u| +00000240 e0 b5 05 16 ae ce f4 23 20 30 aa 74 a3 63 68 76 |.......# 0.t.chv| +00000250 f6 ec 64 e1 3d f6 0e b6 c4 7d a8 08 44 a9 96 1d |..d.=....}..D...| +00000260 7d c8 22 a8 df 04 2c ad 65 f1 4c 99 7d a1 cb bd |}."...,.e.L.}...| +00000270 b7 d4 d7 b5 ee 88 bd 15 2e 75 76 e2 72 bb 7d e6 |.........uv.r.}.| +00000280 5b eb fc f7 96 96 f0 3c aa b6 a8 58 92 e9 29 f6 |[......<...X..).| +00000290 40 bf 8e 14 23 7c 45 da e9 17 4b 32 16 11 ec 74 |@...#|E...K2...t| +000002a0 78 d5 8c 5a 06 46 e4 dc 90 b9 44 8e d6 8a 4e 43 |x..Z.F....D...NC| +000002b0 7f f9 60 9e a1 46 fa 16 88 ab 3c f1 1e d0 2e 00 |..`..F....<.....| +000002c0 5d 01 e6 a7 b1 27 f7 40 26 17 f3 da fb cd 06 d1 |]....'.@&.......| +000002d0 4e 27 75 9a 6f 0b 63 82 9c 40 07 4c 6e 0d d8 4b |N'u.o.c..@.Ln..K| +000002e0 f1 e6 d5 1c 41 55 72 b5 43 24 53 1e 0e a4 08 d7 |....AUr.C$S.....| +000002f0 44 93 00 c9 8b 49 ba 7a 32 0c d8 e6 46 87 5d 62 |D....I.z2...F.]b| +00000300 9d 4a 11 04 67 21 19 42 50 ad ad ab dd 62 0f f7 |.J..g!.BP....b..| +00000310 0f 57 78 82 71 f6 09 9f 41 bc 8e 34 24 7c b5 d2 |.Wx.q...A..4$|..| +00000320 5d 0c 18 fb d8 f6 62 dc 57 6a 78 2c 21 35 d8 eb |].....b.Wjx,!5..| +00000330 bb f8 7e 01 63 50 c1 98 88 a4 b5 63 1e c0 68 3c |..~.cP.....c..h<| +00000340 41 3c b8 6e 48 17 03 03 00 99 b6 09 37 a6 c2 d9 |A<.nH.......7...| +00000350 5f 39 69 e1 0b ca 40 d8 31 5b 4b 4f c1 33 bf 1f |_9i...@.1[KO.3..| +00000360 db c2 8c 9c d2 14 26 96 4e aa b2 63 30 40 fa 49 |......&.N..c0@.I| +00000370 fb 2d 66 59 70 cb c7 f8 fe 59 19 8b eb d5 5c 6c |.-fYp....Y....\l| +00000380 5c a0 c9 ba e6 4d d9 c3 e0 fe 00 c4 fb ab 8a f1 |\....M..........| +00000390 2b ab 53 86 a7 86 57 01 b8 ae c4 a6 12 6b 7d f8 |+.S...W......k}.| +000003a0 ea 2d df 37 04 01 eb 14 f4 9a d0 e7 67 46 ec 9f |.-.7........gF..| +000003b0 35 f8 d4 2e c6 95 91 10 0e dc 01 60 9a d6 f8 d8 |5..........`....| +000003c0 9e c1 fd f8 2e e2 51 8a e9 2f c3 4a 4f 01 31 52 |......Q../.JO.1R| +000003d0 af cb 4b 52 96 4c 90 57 83 1f 11 97 d6 d6 16 74 |..KR.L.W.......t| +000003e0 77 f8 c4 17 03 03 00 35 b0 61 57 8f 52 7e 93 b1 |w......5.aW.R~..| +000003f0 f0 90 a1 23 09 6e 11 ff a5 6c 38 f3 31 11 be 03 |...#.n...l8.1...| +00000400 ad 59 65 57 1b 60 2b fc 41 98 e0 79 6d 14 26 c8 |.YeW.`+.A..ym.&.| +00000410 fb d6 5f 00 e0 cc 70 46 a3 81 e4 3c ff |.._...pF...<.| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 02 11 7e e6 cb d5 bf |...........~....| -00000010 e1 5f 0a a5 6f 08 47 a4 27 a0 a0 2d 8e 6b 56 c6 |._..o.G.'..-.kV.| -00000020 2e d4 7d 3d 83 f0 25 31 59 9d e5 61 a0 95 21 2e |..}=..%1Y..a..!.| -00000030 f8 39 8c 16 4b 6e d9 e0 19 23 05 b0 6c 89 2c f2 |.9..Kn...#..l.,.| -00000040 e2 60 fb 83 99 2b 33 37 38 b0 85 67 cf 91 5f 22 |.`...+378..g.._"| -00000050 32 8b 10 f6 0b 2b 0d 4a 18 32 e7 41 fc 07 58 54 |2....+.J.2.A..XT| -00000060 d1 e2 6e da bb f7 4a 45 60 34 02 01 95 5e b3 4f |..n...JE`4...^.O| -00000070 0a df 33 d6 07 06 fc 20 5a 97 2f b8 bf 66 23 40 |..3.... Z./..f#@| -00000080 32 24 0d f5 c8 a2 aa e4 6a 85 21 d5 a3 95 a8 3b |2$......j.!....;| -00000090 8f 6a 43 5c 96 64 80 ef 04 ed a4 10 2f e4 a8 8d |.jC\.d....../...| -000000a0 ff fb 77 53 28 30 cd ca df 8e 25 08 51 ee 56 b8 |..wS(0....%.Q.V.| -000000b0 3a ae 2f 27 a4 4a 71 9e 77 cc 70 af 62 d1 a7 2f |:./'.Jq.w.p.b../| -000000c0 2b 2f 98 2f e5 62 b5 3b 65 b6 2e a5 a5 19 1f c2 |+/./.b.;e.......| -000000d0 a9 ef d8 2a 95 25 fc 10 32 31 da 29 bf 7e 58 d0 |...*.%..21.).~X.| -000000e0 b5 2f 62 bf ed 57 c8 b4 55 85 29 66 07 52 6f 25 |./b..W..U.)f.Ro%| -000000f0 02 2b 98 22 a5 e8 41 50 de f5 e3 e9 ce 60 f2 af |.+."..AP.....`..| -00000100 b3 c8 80 f1 27 2a 04 7a 1f 3b 13 0f 76 ec 6a 74 |....'*.z.;..v.jt| -00000110 ad a9 8f e9 0d 67 9d 1c a3 54 b3 14 a0 5c 36 80 |.....g...T...\6.| -00000120 a7 be 7f 2b d1 89 c0 19 3f 25 c6 7a fd 04 44 c2 |...+....?%.z..D.| -00000130 18 75 a9 44 7b cc 20 2b f3 6a 9a e1 cc 4f aa 76 |.u.D{. +.j...O.v| -00000140 e2 0a 45 75 81 0d d7 72 a1 e7 b2 82 02 77 45 e9 |..Eu...r.....wE.| -00000150 f8 07 93 8b e5 79 c2 06 65 52 a5 0e 13 73 a7 f6 |.....y..eR...s..| -00000160 be 85 5c 00 af 90 ed 83 3f b4 53 68 cf 0b b9 a6 |..\.....?.Sh....| -00000170 06 43 3c 7a 15 6a b1 74 be af 70 3b fa 70 f3 4b |.C....{E.R$| -00000310 17 03 03 00 13 3b 43 97 33 75 c2 b6 9a f7 cd 96 |.....;C.3u......| -00000320 e3 67 b7 2d cf ac d8 0a |.g.-....| +00000000 14 03 03 00 01 01 17 03 03 02 7a 22 a3 3d 18 f8 |..........z".=..| +00000010 a2 c7 8e 62 c3 07 99 b4 e6 bd 94 79 12 82 e9 e0 |...b.......y....| +00000020 96 ff 5f c3 ec 34 02 2f 8d 95 2f 40 80 99 19 a3 |.._..4./../@....| +00000030 bd 64 fd e4 0e b3 81 ad 4c 2e d9 72 d2 a3 bd 00 |.d......L..r....| +00000040 81 42 78 5d f3 70 c3 78 0b fa cd b8 96 17 5e e7 |.Bx].p.x......^.| +00000050 6e 03 b8 c6 ab 2b 2e 63 45 c7 b1 c9 98 71 c9 1d |n....+.cE....q..| +00000060 bb 7b 6e 6d c7 d5 90 b8 b2 4e 62 1a 8f cf 7d 99 |.{nm.....Nb...}.| +00000070 52 3d 70 40 0f 0f 96 1c ee a7 ff 29 2a 53 de d4 |R=p@.......)*S..| +00000080 34 f9 d9 b2 33 2c 69 5e 2d f2 a7 62 dd ec 77 b1 |4...3,i^-..b..w.| +00000090 6c 0f 61 86 8a bc 11 1f 91 ad f4 94 de 96 dd ef |l.a.............| +000000a0 d8 be 5e 45 50 fe af 1a 03 54 20 f6 05 8e a3 b0 |..^EP....T .....| +000000b0 f7 31 93 f3 78 59 4d 54 50 99 a5 a1 53 81 1b 5d |.1..xYMTP...S..]| +000000c0 6d ea 32 e9 52 ab 83 d6 18 3f 2f 43 cd 64 ac 3f |m.2.R....?/C.d.?| +000000d0 11 6c 91 0d fa 86 f8 a5 12 eb 41 ac 24 2d 79 5b |.l........A.$-y[| +000000e0 ee 8e 02 46 f0 37 0a b1 19 c7 97 ed 97 d1 11 18 |...F.7..........| +000000f0 df 80 8f f3 d7 61 a4 fe 6c ec b0 80 4e bc e4 52 |.....a..l...N..R| +00000100 10 2f b1 6f 3f d4 39 08 81 f6 01 4b b4 d4 d5 20 |./.o?.9....K... | +00000110 6b a1 be e6 cf c7 0e 95 e9 d7 00 07 63 25 1b 64 |k...........c%.d| +00000120 4b b7 c4 79 29 84 45 45 5d 0d fe 72 2a 7e c6 bf |K..y).EE]..r*~..| +00000130 5a 98 ec e2 16 26 82 57 eb a6 dc ff 73 b6 e8 4c |Z....&.W....s..L| +00000140 87 52 e5 0a c1 6a 6f 02 69 17 17 ea e0 1c c1 07 |.R...jo.i.......| +00000150 b4 f4 78 a7 99 39 8b 63 61 c2 7e 99 f4 64 16 d6 |..x..9.ca.~..d..| +00000160 0a 84 9a 0f d4 f4 bd 4d d4 4f 16 ec 19 30 a7 34 |.......M.O...0.4| +00000170 f9 b9 60 10 39 25 ee 9d bd 99 37 52 e6 32 a1 c9 |..`.9%....7R.2..| +00000180 68 9b a2 4e 16 91 0e 54 54 d5 c5 77 bb 01 ba af |h..N...TT..w....| +00000190 97 be ea 09 85 91 69 84 4f 2c 04 f0 38 50 93 49 |......i.O,..8P.I| +000001a0 e7 41 cb c1 d6 b6 77 59 09 7c 1e 0a 58 93 1e b4 |.A....wY.|..X...| +000001b0 cf ed 32 85 b0 cd 6f 86 c7 94 8c 30 9d 83 a2 a0 |..2...o....0....| +000001c0 4a de ad 8c b9 d8 58 d3 8c 34 6b 12 54 f1 28 66 |J.....X..4k.T.(f| +000001d0 ea 55 d9 95 d0 b6 b3 aa 68 c3 31 e1 8f 1b f8 43 |.U......h.1....C| +000001e0 51 b9 06 fc 53 69 9b 1c e6 2c f8 b7 f0 47 4a 5a |Q...Si...,...GJZ| +000001f0 82 ca 27 df 0f 3d f8 79 90 8d c2 bd 27 85 74 6b |..'..=.y....'.tk| +00000200 9e 8b eb 74 a8 28 ba 6a 25 16 01 2c 56 3b c0 fa |...t.(.j%..,V;..| +00000210 91 ac af a7 c5 39 8d 2c b1 f3 a2 c9 a5 72 c6 ff |.....9.,.....r..| +00000220 49 a0 78 14 5c 8c d2 71 de b9 4f 55 3a ca b6 a5 |I.x.\..q..OU:...| +00000230 df ce bb f7 c2 d5 af 2c c0 97 08 82 cc b4 02 26 |.......,.......&| +00000240 c3 0c 99 39 4a df 6c d6 59 14 c4 d6 04 9d a4 92 |...9J.l.Y.......| +00000250 d2 53 42 16 56 99 5f c2 82 a0 a8 5a 92 53 e6 b1 |.SB.V._....Z.S..| +00000260 cd fc bc 9a b9 55 0b ae 2c 50 ce a3 bf d2 7d d2 |.....U..,P....}.| +00000270 2b 58 ba 87 65 33 09 cf 74 51 0f 4b 4f a9 53 0d |+X..e3..tQ.KO.S.| +00000280 fa 60 1e ba e6 17 03 03 00 99 aa 43 d9 e2 e4 91 |.`.........C....| +00000290 cf 65 fa 35 0e b0 21 51 9d c4 33 f5 7c 09 ff e5 |.e.5..!Q..3.|...| +000002a0 db fd 6e 96 6d 13 7c 4c ec 90 72 bd 54 6a 3f d8 |..n.m.|L..r.Tj?.| +000002b0 1a a3 e2 a2 01 6b d6 50 a0 b1 d5 67 34 44 42 30 |.....k.P...g4DB0| +000002c0 97 2e 82 07 46 04 56 0a 43 4b 9d 8c 81 64 bb 0b |....F.V.CK...d..| +000002d0 21 62 ea 23 0b 1c a0 c4 b2 cc 2f 51 b5 a2 9a a3 |!b.#....../Q....| +000002e0 37 d3 0c 57 80 85 77 3b 8d 17 f1 a9 d5 ae 72 f9 |7..W..w;......r.| +000002f0 cd 8c c4 2c fb c7 e0 f0 3a 5c d5 6a f7 8f 7e 53 |...,....:\.j..~S| +00000300 c1 d0 7a b0 8d c9 b3 17 7c 99 df 54 d6 43 13 d5 |..z.....|..T.C..| +00000310 78 9c 34 7e c9 11 4e e7 1c 8c f4 0f 82 89 94 61 |x.4~..N........a| +00000320 80 d2 49 17 03 03 00 35 aa cd 97 5a a2 d3 27 78 |..I....5...Z..'x| +00000330 d4 79 28 a7 57 dc 4f b1 2d b8 bd 3c ae ec e6 be |.y(.W.O.-..<....| +00000340 33 be b9 20 3b 69 22 03 31 34 7a 8d 68 39 c7 d5 |3.. ;i".14z.h9..| +00000350 a1 a0 aa 46 15 94 93 d7 54 41 5b 6b 20 17 03 03 |...F....TA[k ...| +00000360 00 17 f2 60 ff 91 c2 85 55 ed ab 39 6f 5d 0f 22 |...`....U..9o]."| +00000370 45 3e 61 07 14 a3 05 f4 94 17 03 03 00 13 01 ea |E>a.............| +00000380 95 52 29 1c 63 71 3a 2d 73 a7 29 31 2c d0 ce 9f |.R).cq:-s.)1,...| +00000390 2b |+| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-ECDSA b/libgo/go/crypto/tls/testdata/Client-TLSv13-ECDSA index 96c8e8c1ee5..098f3ab3c98 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-ECDSA +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-ECDSA @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,80 +7,80 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 05 cf 30 74 87 |....z...v....0t.| -00000010 37 6e f2 12 86 19 bd ec 54 21 42 4c 2d 1a 71 4f |7n......T!BL-.qO| -00000020 fe de 90 2b a0 c4 73 d1 3e 57 40 20 00 00 00 00 |...+..s.>W@ ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 e8 ec ee 61 3e |....z...v.....a>| +00000010 c1 43 87 6d f1 61 ed d2 41 1f 7d d7 b7 c0 92 fd |.C.m.a..A.}.....| +00000020 34 17 85 7b c7 ff c4 56 dd 90 bd 20 00 00 00 00 |4..{...V... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 16 |..+.....3.$... .| -00000060 4c 6f 4f d1 32 2e 2e b5 4c 48 29 0f cb 65 23 b2 |LoO.2...LH)..e#.| -00000070 ab 2e 41 d8 c4 70 30 88 4f a1 d9 bb 52 e8 35 14 |..A..p0.O...R.5.| -00000080 03 03 00 01 01 17 03 03 00 17 a7 86 3a 06 dc db |............:...| -00000090 c6 bc d5 8e 55 0f 93 b5 fc f4 d4 17 40 dc 3e d7 |....U.......@.>.| -000000a0 16 17 03 03 02 22 b3 07 3f ab 52 ac c4 0d 50 75 |....."..?.R...Pu| -000000b0 18 37 a5 f5 4b ba e7 e7 c0 30 3c b4 3f e4 11 2d |.7..K....0<.?..-| -000000c0 d1 33 07 a7 9d 41 47 61 40 ec db bb dd 7c 89 7b |.3...AGa@....|.{| -000000d0 e4 3e db 5a 30 c6 a3 74 7c 7a b1 53 d2 0a 48 65 |.>.Z0..t|z.S..He| -000000e0 2c f6 d9 ca b4 f4 88 d2 d8 7e a6 ce b0 30 c6 32 |,........~...0.2| -000000f0 36 fa 73 b2 0e 39 8e d5 af 41 ab 88 8c 3d d1 56 |6.s..9...A...=.V| -00000100 2e 7b 7d 93 77 c6 51 66 d6 ed 20 52 a9 b1 98 ae |.{}.w.Qf.. R....| -00000110 c9 04 a5 1a 97 36 91 b9 38 39 7c 7c 8c bb 0f 37 |.....6..89||...7| -00000120 e2 37 9c c0 49 fb a7 59 7d f2 0f 97 ee 15 9c e9 |.7..I..Y}.......| -00000130 5a 9b 6d fd 7e 36 61 fb 30 69 ea 2f e8 37 70 b0 |Z.m.~6a.0i./.7p.| -00000140 b5 65 1c 05 25 7a 32 36 6e 24 c9 e2 ca 6c c2 82 |.e..%z26n$...l..| -00000150 d0 5b 1f 85 ba 1b f0 b2 49 71 2a bd 8d ae 16 95 |.[......Iq*.....| -00000160 2c b9 ab ce f1 05 47 59 e5 65 02 57 34 85 df 26 |,.....GY.e.W4..&| -00000170 cf 97 94 29 09 4d aa a6 dd 18 ef 9d 15 38 10 90 |...).M.......8..| -00000180 ea a3 76 b7 25 c8 9c cd b6 1e 88 a6 4e b8 b1 34 |..v.%.......N..4| -00000190 70 1f 7b a1 83 e2 2e 3f d8 e8 f2 2e 74 f1 93 bc |p.{....?....t...| -000001a0 ee 80 8a c3 d0 e0 d2 7a 16 5a 97 a5 57 1c c6 37 |.......z.Z..W..7| -000001b0 ba 8a cd 07 8f ca 93 3a d7 57 82 be 69 1d 83 5e |.......:.W..i..^| -000001c0 62 0e 65 f3 7f 3b 28 8f 51 f0 96 da 55 4c f5 55 |b.e..;(.Q...UL.U| -000001d0 60 59 7c c4 61 1f 1d 50 38 09 e0 7b 90 ed b9 35 |`Y|.a..P8..{...5| -000001e0 4d 70 37 f8 c8 59 09 9e 77 02 27 cc 5a cc 7c 8d |Mp7..Y..w.'.Z.|.| -000001f0 a8 cc 83 9d 3d dc e1 85 89 98 65 e9 aa 16 f9 e9 |....=.....e.....| -00000200 85 f9 ec 6d 28 8d 20 4b 33 01 2f df fb 7d 6c 6e |...m(. K3./..}ln| -00000210 b8 28 d4 2e 72 1d af 66 15 1a ff ba bc 68 31 cb |.(..r..f.....h1.| -00000220 3e c8 62 d3 3e fd e8 ce 90 bc 30 36 31 e2 6d 47 |>.b.>.....061.mG| -00000230 06 d4 df ad e8 51 3d 61 b7 8f b6 16 d5 e1 81 ff |.....Q=a........| -00000240 c7 ad 99 04 e1 af d0 a8 37 5e 57 44 93 7b e0 6d |........7^WD.{.m| -00000250 c2 23 f2 b7 7d 14 41 c6 ab 17 c8 3b de 48 20 73 |.#..}.A....;.H s| -00000260 78 78 78 4a c4 1f ea 55 11 6e dc 55 48 5d 9b f1 |xxxJ...U.n.UH]..| -00000270 33 84 17 35 cc b9 8d d4 6e 86 87 f1 c3 ab 31 46 |3..5....n.....1F| -00000280 79 39 5f 41 19 40 7b 54 44 79 21 25 06 a1 ca 36 |y9_A.@{TDy!%...6| -00000290 e0 9f d6 70 7c 3f 9f 5c 17 29 cc a3 ed a2 cd 6f |...p|?.\.).....o| -000002a0 12 19 d9 89 aa a1 fa 51 53 98 9f 34 d2 75 12 22 |.......QS..4.u."| -000002b0 ea 63 85 3c 32 c8 cb e2 74 15 13 55 61 a1 80 1f |.c.<2...t..Ua...| -000002c0 85 5e 45 95 9c 92 4a 8d 17 03 03 00 a4 e8 50 d5 |.^E...J.......P.| -000002d0 71 f4 21 a6 79 63 11 6a 8e 5e 3e 5d 96 63 4e 42 |q.!.yc.j.^>].cNB| -000002e0 08 27 34 b7 4c 36 8a fe b1 ed f2 f1 3c 72 00 99 |.'4.L6.......D..h.S.qA| -000003a0 61 17 e3 da 92 ff 5a 8f 21 06 f5 |a.....Z.!..| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 3f |..+.....3.$... ?| +00000060 be 50 e7 f1 b0 30 60 dc 92 50 b8 01 4a d1 3e ff |.P...0`..P..J.>.| +00000070 6e f0 bd e1 17 44 d8 19 1b c6 63 43 e5 c1 58 14 |n....D....cC..X.| +00000080 03 03 00 01 01 17 03 03 00 17 c0 b7 da 01 3e 64 |..............>d| +00000090 6b 57 ba 21 12 79 42 8c 63 1f 45 d1 f2 10 fe 98 |kW.!.yB.c.E.....| +000000a0 b6 17 03 03 02 22 90 87 e6 c3 ba 92 41 a2 96 00 |....."......A...| +000000b0 c7 92 97 ab 4b 80 02 bb 02 83 19 f3 f6 36 d5 23 |....K........6.#| +000000c0 3c c7 bd fb 97 67 86 cb 70 4c 60 9e 6c d4 7a f3 |<....g..pL`.l.z.| +000000d0 03 a5 f1 09 d5 7e 07 74 f3 c8 e4 b8 da 44 a3 94 |.....~.t.....D..| +000000e0 ee 4e 4a 7b ab 4e 92 03 49 04 4e cf 1b b3 0d 91 |.NJ{.N..I.N.....| +000000f0 0f 98 51 5c 56 4d d3 a8 75 4b e0 96 d9 9e dd c8 |..Q\VM..uK......| +00000100 81 c4 37 a0 c6 c9 ec 0f e0 f1 ed 29 ff 5a a2 d4 |..7........).Z..| +00000110 af 61 f7 b1 d5 ee e7 1d 7a e1 7f 33 8d 75 e6 9d |.a......z..3.u..| +00000120 bc 78 56 eb c5 89 d3 19 86 81 09 e1 ee 10 03 7c |.xV............|| +00000130 a4 1b 78 17 51 a3 53 b4 67 5d 29 49 21 b2 51 7b |..x.Q.S.g])I!.Q{| +00000140 f5 dc fd 60 11 ee 8f 50 ea 28 b5 db 57 04 7e 3b |...`...P.(..W.~;| +00000150 ad 6f 29 d4 22 f3 a1 4b 52 ac b8 2b 30 0c 67 16 |.o)."..KR..+0.g.| +00000160 e3 e0 7d a3 03 66 c4 39 70 8e c7 06 cf d2 6f 98 |..}..f.9p.....o.| +00000170 c1 c9 f6 a9 6a 89 b4 3e 38 97 ae e4 f2 97 a4 6f |....j..>8......o| +00000180 e2 05 f8 e9 53 c9 ae f7 87 c3 0f 68 75 9e 07 e9 |....S......hu...| +00000190 45 e9 0d 03 7e c8 79 56 30 77 e3 ea db 92 a2 f8 |E...~.yV0w......| +000001a0 5e 5b ab 77 0d 9b bc 5f 51 40 6c 1b 0d ef b4 cf |^[.w..._Q@l.....| +000001b0 4a 3d a6 8c b6 ab ce 4f 6c 08 0e 23 f0 2a 56 07 |J=.....Ol..#.*V.| +000001c0 f5 88 68 c3 0c fd 63 9b e4 56 12 a6 f5 0a ed 54 |..h...c..V.....T| +000001d0 40 30 ee 36 72 5d ca bb 5a 52 d3 84 14 c1 7e e4 |@0.6r]..ZR....~.| +000001e0 f8 fb e9 c8 10 16 54 16 1f 72 99 8c 7a 69 87 ca |......T..r..zi..| +000001f0 62 53 dc cb a4 26 73 90 fb 11 3c 3c 9f 94 65 cb |bS...&s...<<..e.| +00000200 28 94 65 ca 56 45 a8 c1 ec 08 31 dd eb bc 17 71 |(.e.VE....1....q| +00000210 cd 65 04 95 2e e7 e0 fb 73 fe 70 db 70 31 93 90 |.e......s.p.p1..| +00000220 cf 47 07 ec 92 98 c1 da fc 13 f8 8a 28 4e e8 80 |.G..........(N..| +00000230 a8 96 c2 e2 a6 cd df d4 7f 46 4a 3b e9 dd cf a5 |.........FJ;....| +00000240 75 d5 cc 67 35 81 d5 2e e4 68 c4 56 1a 46 33 5a |u..g5....h.V.F3Z| +00000250 f2 79 32 6b 4e a0 6b 76 53 53 04 73 86 fd bd e2 |.y2kN.kvSS.s....| +00000260 f7 f8 14 0f 0a a8 10 6d a1 bf f8 d0 27 8d cb e8 |.......m....'...| +00000270 a5 51 16 4b 11 a2 8a 6f 22 c5 7c bc c5 7a 0b df |.Q.K...o".|..z..| +00000280 70 1d c4 93 ec 87 78 12 77 e3 85 5a 3c 29 d8 f7 |p.....x.w..Z<)..| +00000290 ab a4 c6 10 50 ed d5 2a 3f b1 84 73 1e 7f 99 eb |....P..*?..s....| +000002a0 31 9c 2c d2 6a 80 4a 5e 7c aa 64 e7 83 df a9 17 |1.,.j.J^|.d.....| +000002b0 c3 4c 13 c8 c1 d7 1b f5 be c9 00 cf ec 7e a5 ab |.L...........~..| +000002c0 89 9c b0 72 fd f0 cb 54 17 03 03 00 a4 28 34 92 |...r...T.....(4.| +000002d0 a7 52 92 5d a0 99 6b e6 22 c5 f6 76 86 1b 0b d6 |.R.]..k."..v....| +000002e0 b7 a8 67 c1 04 b8 1c ac 7b 02 f5 0a 20 41 dd 43 |..g.....{... A.C| +000002f0 25 cc 01 f9 dc 6e c7 f7 4f 67 dd b3 54 81 80 d5 |%....n..Og..T...| +00000300 6d 45 00 42 d0 49 23 d5 12 33 e4 5f fd 58 79 81 |mE.B.I#..3._.Xy.| +00000310 e3 df 67 6d 03 44 58 0f 76 38 c3 de ed 26 90 29 |..gm.DX.v8...&.)| +00000320 45 92 ce 3b fa ea 98 da ea a2 d2 cc c6 0e a8 38 |E..;...........8| +00000330 c1 2d 92 8c 48 79 58 25 75 fd 2d 6d ef 06 32 1a |.-..HyX%u.-m..2.| +00000340 bb 09 fa 66 bc 06 9d c5 fb 46 94 5e b1 73 8d 05 |...f.....F.^.s..| +00000350 e1 90 24 c3 eb 72 7f a8 b7 12 a3 3c 11 29 ea 80 |..$..r.....<.)..| +00000360 10 4e 19 40 25 0b c9 34 70 99 e9 1a 60 17 bb 5b |.N.@%..4p...`..[| +00000370 1a 17 03 03 00 35 91 4b 45 15 d5 2e 33 a7 ba 9b |.....5.KE...3...| +00000380 64 20 bb 72 28 06 27 37 2f ac c9 c0 9e b9 d8 f3 |d .r(.'7/.......| +00000390 86 36 d2 7d df c2 4d 95 a5 a4 4b 64 5f 1a 83 67 |.6.}..M...Kd_..g| +000003a0 f6 6a 21 ff d0 b4 1c 65 23 62 ac |.j!....e#b.| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 35 a3 d4 49 e5 82 |..........5..I..| -00000010 8d 09 1b 33 8a 0d 9b 4f 8d a8 95 66 0e 50 e0 85 |...3...O...f.P..| -00000020 a7 0d f2 09 f6 05 44 f5 59 c3 48 92 9d 80 a7 db |......D.Y.H.....| -00000030 d0 18 7e 7b 5c fa 31 bf c5 94 71 60 cf 0c d1 c7 |..~{\.1...q`....| -00000040 17 03 03 00 17 f7 61 d6 c4 fa 7f 34 e7 cf cb b0 |......a....4....| -00000050 9f 5d 13 25 8c 75 6c 1a 87 91 44 84 17 03 03 00 |.].%.ul...D.....| -00000060 13 89 68 71 8d be 27 8e 31 f5 ca 7a 4e c5 b6 38 |..hq..'.1..zN..8| -00000070 b2 68 b8 0d |.h..| +00000000 14 03 03 00 01 01 17 03 03 00 35 10 bd 5d 23 36 |..........5..]#6| +00000010 58 43 f4 bb 5e 4e ee 43 fd 0e a1 d9 de 81 99 54 |XC..^N.C.......T| +00000020 de 6e 82 33 71 8a 45 a7 35 f1 cd fb 5f bf 46 20 |.n.3q.E.5..._.F | +00000030 a5 79 d6 87 aa f4 29 51 02 f5 4e 69 ef a5 d7 d6 |.y....)Q..Ni....| +00000040 17 03 03 00 17 21 1f 90 0b 01 63 89 6a af 53 72 |.....!....c.j.Sr| +00000050 51 c0 11 01 7b 09 dd 40 82 dd e1 32 17 03 03 00 |Q...{..@...2....| +00000060 13 93 5d c1 19 16 5c 17 1a 7b 92 a0 9b f5 14 57 |..]...\..{.....W| +00000070 85 39 4a ac |.9J.| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-Ed25519 b/libgo/go/crypto/tls/testdata/Client-TLSv13-Ed25519 new file mode 100644 index 00000000000..0b4a17af3a2 --- /dev/null +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-Ed25519 @@ -0,0 +1,68 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| +00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| +00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| +00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| +00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 a8 21 4e 51 6a |....z...v...!NQj| +00000010 ce ba 17 cc 2d 25 b3 31 59 6a 3f 81 eb e6 ac a0 |....-%.1Yj?.....| +00000020 91 d9 ef 76 a1 5f bb 63 ab 2c 6b 20 00 00 00 00 |...v._.c.,k ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 81 |..+.....3.$... .| +00000060 4c a8 07 aa 6b 4a f9 44 77 78 a9 57 d0 07 55 07 |L...kJ.Dwx.W..U.| +00000070 9a c2 8e 33 bf c4 09 ee 49 51 5c fe f1 7b 30 14 |...3....IQ\..{0.| +00000080 03 03 00 01 01 17 03 03 00 17 5a 22 a1 07 01 ea |..........Z"....| +00000090 97 bd 5a 59 3a 21 de 9c 45 0c 41 ff 34 45 35 ab |..ZY:!..E.A.4E5.| +000000a0 25 17 03 03 01 50 a1 8c 19 e7 0c 69 d3 e0 f6 53 |%....P.....i...S| +000000b0 95 15 13 4c e3 c3 3f 35 d9 73 c9 fe 24 b0 14 5f |...L..?5.s..$.._| +000000c0 b6 9e 94 20 cf 80 f7 88 7c 0f be 4c 70 16 00 2a |... ....|..Lp..*| +000000d0 55 02 aa a9 4b 7f a7 a5 b8 46 09 9e 18 78 78 66 |U...K....F...xxf| +000000e0 22 c2 31 19 12 f7 e4 7e f3 26 39 7d cd 5e 74 24 |".1....~.&9}.^t$| +000000f0 fb 75 7d b7 2c b5 fb e0 49 bd da 96 e1 c3 63 8f |.u}.,...I.....c.| +00000100 e3 28 43 bb 32 a7 fd 9c ab 54 ba ce 07 4a 23 35 |.(C.2....T...J#5| +00000110 a4 3a ff 43 40 19 ef 38 07 02 ba d6 c4 f0 bf 63 |.:.C@..8.......c| +00000120 aa b3 ea 55 d0 e1 a9 f3 cb 04 6b 1b 8d 35 3a f8 |...U......k..5:.| +00000130 0b 1c 40 99 fe b0 04 5f d1 5b 3f 4b be fe b5 96 |..@...._.[?K....| +00000140 f0 49 3d bf a5 92 f3 bd a6 4c 47 24 f8 b5 7c 45 |.I=......LG$..|E| +00000150 47 85 9b 08 a1 da 51 7a ce 3f 32 66 de 89 c0 c3 |G.....Qz.?2f....| +00000160 ac da 73 0d 15 14 18 e6 a0 7d 07 26 44 df 55 b7 |..s......}.&D.U.| +00000170 6e 4e fa c0 f5 5e 42 3a d9 29 d3 1d e6 cf 3c 8c |nN...^B:.)....<.| +00000180 6d c1 d9 f9 04 f0 57 dc 47 4e d1 e2 a1 f1 a1 c9 |m.....W.GN......| +00000190 2e da 97 4d 65 65 04 54 e7 80 f1 88 b2 34 26 61 |...Mee.T.....4&a| +000001a0 77 8a 1f bb 82 7f 4b ce b3 5a 55 60 e1 3a ef 95 |w.....K..ZU`.:..| +000001b0 bd 34 fc ef 2b 18 4b bb 8a cf ba 3a 69 43 f4 59 |.4..+.K....:iC.Y| +000001c0 98 a1 95 a3 22 f6 b5 1a 84 83 cf cb 90 eb 28 29 |....".........()| +000001d0 b3 84 e1 0d 37 9e 98 96 91 73 f1 7f d7 9b 71 38 |....7....s....q8| +000001e0 6e bc 2e 60 2d 27 0c 18 fd 2a b8 76 01 33 2f 95 |n..`-'...*.v.3/.| +000001f0 6e 0b bf 2b 26 5e 17 03 03 00 59 ed 43 2f e8 df |n..+&^....Y.C/..| +00000200 f3 2f 91 f3 dc 1b aa ff d3 3b 28 1f 78 21 fb e2 |./.......;(.x!..| +00000210 7d 6e 03 09 98 c1 23 09 d7 45 da b8 e0 5a e5 27 |}n....#..E...Z.'| +00000220 38 9a 2f da 9b d3 04 35 f5 b9 31 b0 c0 1f 8a 1e |8./....5..1.....| +00000230 d8 8a 19 f1 38 af a6 74 ac e5 b4 0d 45 83 b4 59 |....8..t....E..Y| +00000240 83 42 97 14 23 55 71 ef 66 8c 35 69 3f 2c 88 63 |.B..#Uq.f.5i?,.c| +00000250 8d 3b 05 fe 17 03 03 00 35 47 82 ec 22 f4 86 6a |.;......5G.."..j| +00000260 b7 c1 d8 64 3b 42 f4 ca 5c 3d ba a3 6a ea 77 6a |...d;B..\=..j.wj| +00000270 d6 52 e3 b0 42 fb c2 f1 2c b1 ef 44 ed 11 29 6d |.R..B...,..D..)m| +00000280 2b 6f 13 0f 42 48 a0 2e 5b ba a1 93 6b de |+o..BH..[...k.| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 11 45 8f b2 e0 |..........5.E...| +00000010 87 3d 09 94 93 16 19 04 3d 84 6c e5 14 5e c6 8b |.=......=.l..^..| +00000020 73 1a 53 4c d0 f4 11 27 0c 0d 05 c7 9d ba d0 04 |s.SL...'........| +00000030 37 ed 8b 8a 65 34 54 b1 07 36 92 8c 8c a8 30 b7 |7...e4T..6....0.| +00000040 17 03 03 00 17 ea fc b8 84 8d f0 9d 8e 1c 2c 65 |..............,e| +00000050 10 a8 69 7f dd 3c a4 80 45 5d c3 38 17 03 03 00 |..i..<..E].8....| +00000060 13 15 4b b7 23 2f 55 b0 ae d3 3f f6 68 c9 b2 ef |..K.#/U...?.h...| +00000070 d7 e2 18 49 |...I| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-ExportKeyingMaterial b/libgo/go/crypto/tls/testdata/Client-TLSv13-ExportKeyingMaterial index a30a26249b7..b30641131ea 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-ExportKeyingMaterial +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-ExportKeyingMaterial @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,84 +7,84 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 fe a9 2f 00 0c |....z...v..../..| -00000010 0b 91 a0 86 1d 9b 21 19 35 a1 07 9e 36 1d d2 82 |......!.5...6...| -00000020 51 b7 d2 3e a6 42 ce 6f 86 e9 69 20 00 00 00 00 |Q..>.B.o..i ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 6d fb 70 07 b4 |....z...v..m.p..| +00000010 2d 14 d1 d1 88 17 6a a3 b1 c1 e7 23 4b 06 c4 fa |-.....j....#K...| +00000020 4a 0e e1 2c ce 5a d5 c7 8c ab f2 20 00 00 00 00 |J..,.Z..... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 20 |..+.....3.$... | -00000060 8c d2 dd d7 17 cc 15 f7 0b dc 75 48 d0 82 54 36 |..........uH..T6| -00000070 b0 f6 ae fe 29 7b 0d af 9f 06 4e 58 8c 66 10 14 |....){....NX.f..| -00000080 03 03 00 01 01 17 03 03 00 17 8c ef b2 76 05 ee |.............v..| -00000090 eb e8 55 a3 56 d6 4a b7 d7 10 8e f0 f9 7e 49 eb |..U.V.J......~I.| -000000a0 fd 17 03 03 02 6d c2 33 a8 17 70 1e 66 4c b8 32 |.....m.3..p.fL.2| -000000b0 99 41 79 b8 85 98 c8 f7 f4 c6 25 41 9b 30 ea f5 |.Ay.......%A.0..| -000000c0 24 6c ad 7c b6 c1 c7 a6 d5 2c 0b d8 78 e0 ec df |$l.|.....,..x...| -000000d0 bb 8d ea 0a ff ba c9 aa ec 24 05 63 2a ff 13 37 |.........$.c*..7| -000000e0 5e fe c1 7b 6e c0 dd e1 09 c1 87 33 fc 18 90 28 |^..{n......3...(| -000000f0 5b b2 ba 7e 69 06 dc 8e ac c4 ca 08 84 aa df 0c |[..~i...........| -00000100 2a a7 74 46 e7 c8 db 23 96 67 95 f4 79 9b 6e 3d |*.tF...#.g..y.n=| -00000110 94 fc 80 07 d9 e7 cf 0d 31 27 84 08 66 23 2d 05 |........1'..f#-.| -00000120 64 2f 63 27 5c e2 1c 2e f7 6f 99 4f 59 4c f4 3d |d/c'\....o.OYL.=| -00000130 cf a9 ff 32 f4 6a 7d b4 c4 11 01 9d f2 8a ce da |...2.j}.........| -00000140 21 51 b0 99 0c a8 a6 fa 09 b1 c4 cf a9 84 96 7d |!Q.............}| -00000150 aa 80 b4 b3 c7 ed 70 08 1b 50 b9 07 a5 2c a0 21 |......p..P...,.!| -00000160 da 97 a7 5f 35 d4 55 24 8b 2d 14 85 0d 63 10 7f |..._5.U$.-...c..| -00000170 0b 22 03 a5 e3 26 e4 2b ca c4 54 39 4d 52 41 8b |."...&.+..T9MRA.| -00000180 8e b0 60 2f 61 f5 7f d2 62 2c a3 f9 f2 46 08 76 |..`/a...b,...F.v| -00000190 37 92 d0 bc 6c 0e 75 a2 f5 c1 f4 b3 7d f9 83 8e |7...l.u.....}...| -000001a0 bd 30 4f 04 77 98 b7 d0 e9 a0 19 4c 61 c1 58 09 |.0O.w......La.X.| -000001b0 04 82 60 38 55 51 c1 94 46 40 a2 12 68 0a 83 7b |..`8UQ..F@..h..{| -000001c0 30 71 a3 08 83 f7 67 86 df 44 df ea 6d 56 65 25 |0q....g..D..mVe%| -000001d0 16 55 5d cd 8a f4 03 10 86 1d 5a fd d8 2e 23 7e |.U].......Z...#~| -000001e0 34 77 b7 af 4b 2c 8a 36 ad 07 a5 5a 3b 39 c8 90 |4w..K,.6...Z;9..| -000001f0 4b 77 60 81 2e ac 51 37 09 ac c0 e7 6b 18 a5 76 |Kw`...Q7....k..v| -00000200 52 91 62 95 6d 1c 9d 8e 6c 03 f5 12 cd 80 7f 40 |R.b.m...l......@| -00000210 4e f3 e6 7d d2 f1 3d 94 a7 16 ec fc 0c c9 72 b9 |N..}..=.......r.| -00000220 ee 33 bb 76 d0 6d 27 3d 58 cd ed 34 60 f4 bb 23 |.3.v.m'=X..4`..#| -00000230 49 a8 8d 94 7c 46 85 04 65 26 c2 5e 4f 22 f6 7d |I...|F..e&.^O".}| -00000240 46 ae 1b 63 eb 6b 43 c5 64 fa 9d 43 86 e5 29 8f |F..c.kC.d..C..).| -00000250 98 20 9e 21 b2 f3 32 c9 82 75 4d 97 5e cf dd cb |. .!..2..uM.^...| -00000260 1d 6b 6e fc 8f 61 86 a9 71 12 96 e3 18 42 d3 28 |.kn..a..q....B.(| -00000270 f9 86 7e ab 90 9b f6 5c c2 46 fb 93 e6 51 7d f5 |..~....\.F...Q}.| -00000280 8a b2 e9 c6 e1 70 62 fa 08 e1 91 0b ee 89 12 01 |.....pb.........| -00000290 ca dd 25 56 8f 2d 45 0d a5 47 26 f0 a2 4d f5 4b |..%V.-E..G&..M.K| -000002a0 8b dd 6f ab 0f f1 5b 60 9c b0 dc 88 24 df 1c 5b |..o...[`....$..[| -000002b0 a9 90 66 44 e1 e1 6b 96 b5 3f e2 69 76 a7 84 d6 |..fD..k..?.iv...| -000002c0 2b 68 b0 f5 8a ba e7 83 83 88 45 78 2d e0 a4 82 |+h........Ex-...| -000002d0 74 53 4a cf 14 84 fa 49 78 ce 3b 9a 24 66 00 a9 |tSJ....Ix.;.$f..| -000002e0 5b 0b 83 20 fb 20 a8 20 45 10 53 76 7d ee b2 d6 |[.. . . E.Sv}...| -000002f0 af 33 f9 29 d0 f7 16 7e d6 59 b0 4a 06 ac d4 7d |.3.)...~.Y.J...}| -00000300 84 1d 50 64 d0 f8 67 65 54 2f a3 2c 50 9e 93 43 |..Pd..geT/.,P..C| -00000310 58 59 67 17 03 03 00 99 62 ac 15 76 89 cb 8d 67 |XYg.....b..v...g| -00000320 25 75 a7 57 b6 65 8c 73 24 a6 71 ba c4 75 ad f8 |%u.W.e.s$.q..u..| -00000330 2a a6 94 12 c2 8d ca 7e 1a 75 e4 21 da cb 1e 77 |*......~.u.!...w| -00000340 69 d0 e1 4b 25 46 ce 99 1b e0 10 9d 12 d6 16 62 |i..K%F.........b| -00000350 f9 42 3b b8 3a 7b 3a 11 1f d7 04 fe 88 0b 62 ba |.B;.:{:.......b.| -00000360 a9 d6 51 c4 f5 be d9 92 e6 d6 05 94 9b f9 76 0d |..Q...........v.| -00000370 ca da 55 45 e4 fe a9 f3 dc d5 08 db 50 7c 4a 7c |..UE........P|J|| -00000380 f1 9c a7 5d e6 0d f9 cf 32 67 c0 66 a6 85 26 8b |...]....2g.f..&.| -00000390 57 f0 2c 5e b7 7e c1 cb 3d 6c 23 e2 18 3e c2 67 |W.,^.~..=l#..>.g| -000003a0 97 23 3f 86 f2 38 b5 a7 df 98 68 57 89 a3 e4 86 |.#?..8....hW....| -000003b0 d7 17 03 03 00 35 4a d4 e1 fb d1 39 57 90 d1 19 |.....5J....9W...| -000003c0 b9 f2 1b 0b 1a 0d 8f fb 4b f3 f1 f8 31 d2 ac 3b |........K...1..;| -000003d0 25 ad e7 da 8a 78 ab 2a d6 97 9b 66 88 6a db ef |%....x.*...f.j..| -000003e0 bf b6 ed b9 8a 39 72 8c ea 8f 0d |.....9r....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 4e |..+.....3.$... N| +00000060 fe 87 d7 81 71 25 ba 33 de 10 df 19 38 d8 af 43 |....q%.3....8..C| +00000070 58 3f 41 2e b9 b8 cb 1c 65 a7 cd 8d 00 b1 0e 14 |X?A.....e.......| +00000080 03 03 00 01 01 17 03 03 00 17 b3 63 09 54 ad 41 |...........c.T.A| +00000090 24 fe 2c 81 49 c8 86 88 c2 ad ba cd 45 77 51 c0 |$.,.I.......EwQ.| +000000a0 d5 17 03 03 02 6d 74 7d de 53 70 5c 11 d0 a7 68 |.....mt}.Sp\...h| +000000b0 8e 10 c9 cb cd 0c 25 ac 88 e7 17 54 8b 32 2c ee |......%....T.2,.| +000000c0 97 9c 3d f6 ce d1 83 70 ee c0 85 0c fc 61 ba db |..=....p.....a..| +000000d0 6d e0 04 26 6f b7 4e 44 4d 1c 5c 16 9a 57 4f e6 |m..&o.NDM.\..WO.| +000000e0 52 89 27 53 88 f8 93 91 ed b2 42 b4 4c f0 58 a3 |R.'S......B.L.X.| +000000f0 50 a7 af 2c 47 ac ad 8b 14 a0 9f d4 28 2e 7b 28 |P..,G.......(.{(| +00000100 8e ec d1 bb 7d d9 78 fb 24 82 9f 2a ac 4e 85 83 |....}.x.$..*.N..| +00000110 35 25 75 8f 9e 6d 4c 8a dd 6f 9f 9a 34 93 a2 9d |5%u..mL..o..4...| +00000120 d0 26 4c 7b a8 72 a3 12 b9 ef 6b c8 d0 4f 44 5b |.&L{.r....k..OD[| +00000130 dd f1 72 3a b4 5c 7e a8 8d d4 68 bc 6d 54 2c ee |..r:.\~...h.mT,.| +00000140 c1 f7 78 f1 15 cd 57 b5 54 89 08 f0 d8 56 ef 8d |..x...W.T....V..| +00000150 14 d1 e8 fd 83 bd ab 64 c1 99 36 4e af 81 27 52 |.......d..6N..'R| +00000160 0f 5e 31 5e c0 70 21 fb 05 40 d4 d2 71 df 0c 09 |.^1^.p!..@..q...| +00000170 31 83 b0 71 82 84 d9 90 6b 25 5a 67 03 30 c4 80 |1..q....k%Zg.0..| +00000180 2c 99 41 3f fa 51 ce a8 b4 b8 98 2a bc e9 cc ce |,.A?.Q.....*....| +00000190 f7 0c 69 a3 c3 02 dc b9 4f 00 ac 4f 29 d5 e5 df |..i.....O..O)...| +000001a0 df 67 3b ed 94 8e 80 3f aa 6e a8 b7 e0 7f 4d fd |.g;....?.n....M.| +000001b0 95 80 54 89 57 ff d7 73 86 bd e8 98 11 d5 09 c6 |..T.W..s........| +000001c0 ab af 1a a4 a0 cc 30 40 bc 63 dc d0 db 92 41 f5 |......0@.c....A.| +000001d0 5c 1e f1 92 03 5b 3f 27 23 1f 9c 8e f8 8b 4f 69 |\....[?'#.....Oi| +000001e0 0c 3d 09 e5 95 d8 ba 8c 90 cd ac 53 ed 77 8d 75 |.=.........S.w.u| +000001f0 3a 56 b4 f3 21 a5 4e c2 6e 1f 87 74 56 69 32 95 |:V..!.N.n..tVi2.| +00000200 29 56 07 2c 0d b3 74 47 28 6d 8f ef 56 f6 68 7f |)V.,..tG(m..V.h.| +00000210 25 e4 76 06 7c 82 40 11 f8 eb 3c ec 62 fa be 60 |%.v.|.@...<.b..`| +00000220 d3 11 98 e2 d4 b1 d0 72 3d e6 4a da f0 d6 c0 42 |.......r=.J....B| +00000230 8e a6 63 cc a1 41 e3 18 21 00 ac cc 98 f8 8d 78 |..c..A..!......x| +00000240 ab 9b 39 16 ad 4c fd 11 15 79 0c fd 0e 87 45 d6 |..9..L...y....E.| +00000250 81 30 bb 3a 72 89 92 c1 fa e8 ad 59 3b 8b b0 38 |.0.:r......Y;..8| +00000260 2d c3 6e 87 a8 b8 1f 7d a0 b3 e6 91 83 97 78 94 |-.n....}......x.| +00000270 f0 01 66 a2 c8 89 45 8e 2e a0 7e 89 4d 7f 49 ee |..f...E...~.M.I.| +00000280 2a 69 c0 ec 77 db 85 df 01 d9 02 36 df 94 81 01 |*i..w......6....| +00000290 aa 43 a2 3d 76 8c c3 21 bf 05 c3 b2 c4 28 85 65 |.C.=v..!.....(.e| +000002a0 7b 4a ac e3 45 40 77 1d a9 ee 1e e9 97 7c 2f 45 |{J..E@w......|/E| +000002b0 45 18 58 47 ab 51 0f 26 eb d5 bb ac c2 8b a9 ae |E.XG.Q.&........| +000002c0 65 6a 91 9b 13 93 69 c6 9d bc 61 23 20 d2 ad a0 |ej....i...a# ...| +000002d0 d3 f9 2d 32 79 e3 4b 07 90 32 9e e1 f3 13 18 b0 |..-2y.K..2......| +000002e0 65 6e 89 a5 45 c6 a1 9b f0 f6 d1 66 d3 e7 49 1a |en..E......f..I.| +000002f0 b8 e2 17 cd d0 13 9c e6 e1 77 87 a4 8b 6a d3 74 |.........w...j.t| +00000300 0e 85 b1 2c f3 c8 a8 f3 65 b3 71 c2 bb f5 95 d7 |...,....e.q.....| +00000310 81 78 45 17 03 03 00 99 1e 53 96 f9 b9 97 ec 53 |.xE......S.....S| +00000320 4e 97 a9 8c 01 06 ee 6b 31 47 93 4b ac f7 b6 4a |N......k1G.K...J| +00000330 15 bb 28 d7 87 73 7c 1d 3b d3 6b 9d 48 77 df 09 |..(..s|.;.k.Hw..| +00000340 c9 97 98 b6 d6 20 94 8a ed 71 08 2d 56 af b2 b8 |..... ...q.-V...| +00000350 20 fc d7 81 e4 53 eb 57 6a bd 9b 1c 11 4f 2e fb | ....S.Wj....O..| +00000360 9a 0e 65 08 69 df 28 70 a7 50 21 62 9f 63 39 db |..e.i.(p.P!b.c9.| +00000370 9e 73 40 5d 73 77 a7 1d 2e 79 61 fa b9 50 f0 70 |.s@]sw...ya..P.p| +00000380 1e 71 d1 9e c6 2f 8c 4c 5f e0 b1 37 d7 c9 ab fc |.q.../.L_..7....| +00000390 5f 6a ca a9 9e 27 38 42 78 ba fb e6 8e c2 3f a6 |_j...'8Bx.....?.| +000003a0 a0 c6 04 b6 d8 b7 3a 68 83 15 3b 70 f9 0a 27 4a |......:h..;p..'J| +000003b0 0a 17 03 03 00 35 d0 88 b7 b8 cf 81 4e 97 76 96 |.....5......N.v.| +000003c0 c2 ed e8 15 e4 01 54 2b 1f 0e 34 08 52 6c a8 6a |......T+..4.Rl.j| +000003d0 cf 04 29 7b 27 fb e9 1e d1 6c d2 28 15 03 2a 58 |..){'....l.(..*X| +000003e0 d4 eb 67 18 83 3f d4 2a ab 9f aa |..g..?.*...| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 35 8c 85 73 71 98 |..........5..sq.| -00000010 40 37 77 e7 8c fd d1 f0 42 a8 97 f3 7c 68 f4 a7 |@7w.....B...|h..| -00000020 ac dc 7a ff 9b 2e f4 fe 2a c0 37 f9 56 a4 00 f5 |..z.....*.7.V...| -00000030 b1 40 34 53 89 48 9a a6 9d af a1 75 3f 34 53 fd |.@4S.H.....u?4S.| -00000040 17 03 03 00 17 92 cf 4a 20 2e 0c 2b 4a dc 86 2a |.......J ..+J..*| -00000050 75 cd 8f 73 b3 b3 4b 3b 3a e4 39 c3 17 03 03 00 |u..s..K;:.9.....| -00000060 13 83 08 42 b1 a8 95 2d a5 4c 8b e8 e8 35 d2 4c |...B...-.L...5.L| -00000070 23 8b 83 73 |#..s| +00000000 14 03 03 00 01 01 17 03 03 00 35 02 ed 34 8f 83 |..........5..4..| +00000010 44 27 8b 71 af c1 06 33 0b 25 aa 22 85 96 41 75 |D'.q...3.%."..Au| +00000020 4f fe 46 82 ba 95 91 4c cc a9 99 60 5c f7 72 7f |O.F....L...`\.r.| +00000030 e4 1f e4 99 6a c2 25 db d0 11 5d fc d6 28 8f 56 |....j.%...]..(.V| +00000040 17 03 03 00 17 fe e8 cf ed a0 7a ce 77 57 e6 aa |..........z.wW..| +00000050 f0 ce 6d 2f 5c e5 1f 7d 37 c8 91 cf 17 03 03 00 |..m/\..}7.......| +00000060 13 a4 a9 4c b5 33 38 4a 1e b7 65 9d 72 85 1b 79 |...L.38J..e.r..y| +00000070 79 87 e3 bf |y...| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-HelloRetryRequest b/libgo/go/crypto/tls/testdata/Client-TLSv13-HelloRetryRequest index c06837e6da2..10e13ec33d9 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-HelloRetryRequest +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-HelloRetryRequest @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f4 01 00 00 f0 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 f6 01 00 00 f2 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,14 +7,14 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 75 00 05 00 05 01 00 00 00 00 00 0a 00 |...u............| +00000080 01 00 00 77 00 05 00 05 01 00 00 00 00 00 0a 00 |...w............| 00000090 06 00 04 00 1d 00 17 00 0b 00 02 01 00 00 0d 00 |................| -000000a0 18 00 16 08 04 08 05 08 06 04 01 04 03 05 01 05 |................| -000000b0 03 06 01 06 03 02 01 02 03 ff 01 00 01 00 00 12 |................| -000000c0 00 00 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 |...+............| -000000d0 33 00 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 |3.&.$... /.}.G.b| -000000e0 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| -000000f0 c2 ed 90 99 5f 58 cb 3b 74 |...._X.;t| +000000a0 1a 00 18 08 04 04 03 08 07 08 05 08 06 04 01 05 |................| +000000b0 01 06 01 05 03 06 03 02 01 02 03 ff 01 00 01 00 |................| +000000c0 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 02 03 |.....+..........| +000000d0 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d a3 47 |..3.&.$... /.}.G| +000000e0 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +000000f0 c4 cf c2 ed 90 99 5f 58 cb 3b 74 |......_X.;t| >>> Flow 2 (server to client) 00000000 16 03 03 00 58 02 00 00 54 03 03 cf 21 ad 74 e5 |....X...T...!.t.| 00000010 9a 61 11 be 1d 8c 02 1e 65 b8 91 c2 a2 11 16 7a |.a......e......z| @@ -24,7 +24,7 @@ 00000050 0c 00 2b 00 02 03 04 00 33 00 02 00 17 14 03 03 |..+.....3.......| 00000060 00 01 01 |...| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 16 03 03 01 15 01 00 01 11 03 |................| +00000000 14 03 03 00 01 01 16 03 03 01 17 01 00 01 13 03 |................| 00000010 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000030 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |. ..............| @@ -32,87 +32,88 @@ 00000050 00 00 00 32 cc a8 cc a9 c0 2f c0 2b c0 30 c0 2c |...2...../.+.0.,| 00000060 c0 27 c0 13 c0 23 c0 09 c0 14 c0 0a 00 9c 00 9d |.'...#..........| 00000070 00 3c 00 2f 00 35 c0 12 00 0a 00 05 c0 11 c0 07 |.<./.5..........| -00000080 13 01 13 03 13 02 01 00 00 96 00 05 00 05 01 00 |................| +00000080 13 01 13 03 13 02 01 00 00 98 00 05 00 05 01 00 |................| 00000090 00 00 00 00 0a 00 06 00 04 00 1d 00 17 00 0b 00 |................| -000000a0 02 01 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 |................| -000000b0 01 04 03 05 01 05 03 06 01 06 03 02 01 02 03 ff |................| -000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| -000000d0 03 03 02 03 01 00 33 00 47 00 45 00 17 00 41 04 |......3.G.E...A.| -000000e0 1e 18 37 ef 0d 19 51 88 35 75 71 b5 e5 54 5b 12 |..7...Q.5uq..T[.| -000000f0 2e 8f 09 67 fd a7 24 20 3e b2 56 1c ce 97 28 5e |...g..$ >.V...(^| -00000100 f8 2b 2d 4f 9e f1 07 9f 6c 4b 5b 83 56 e2 32 42 |.+-O....lK[.V.2B| -00000110 e9 58 b6 d7 49 a6 b5 68 1a 41 03 56 6b dc 5a 89 |.X..I..h.A.Vk.Z.| +000000a0 02 01 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 |................| +000000b0 05 08 06 04 01 05 01 06 01 05 03 06 03 02 01 02 |................| +000000c0 03 ff 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 |...........+....| +000000d0 04 03 03 03 02 03 01 00 33 00 47 00 45 00 17 00 |........3.G.E...| +000000e0 41 04 1e 18 37 ef 0d 19 51 88 35 75 71 b5 e5 54 |A...7...Q.5uq..T| +000000f0 5b 12 2e 8f 09 67 fd a7 24 20 3e b2 56 1c ce 97 |[....g..$ >.V...| +00000100 28 5e f8 2b 2d 4f 9e f1 07 9f 6c 4b 5b 83 56 e2 |(^.+-O....lK[.V.| +00000110 32 42 e9 58 b6 d7 49 a6 b5 68 1a 41 03 56 6b dc |2B.X..I..h.A.Vk.| +00000120 5a 89 |Z.| >>> Flow 4 (server to client) -00000000 16 03 03 00 9b 02 00 00 97 03 03 84 0c ed 20 38 |.............. 8| -00000010 61 6f 28 24 e6 70 28 71 1d 3e 38 fc e2 94 da fa |ao($.p(q.>8.....| -00000020 34 04 33 99 7a 18 e2 2a cc d1 67 20 00 00 00 00 |4.3.z..*..g ....| +00000000 16 03 03 00 9b 02 00 00 97 03 03 b5 7c 4a c4 82 |............|J..| +00000010 67 2c 0d e4 cf 12 5a 8c fc 44 10 da 7e ef ec ae |g,....Z..D..~...| +00000020 bc 59 6c 7d 62 b1 d8 95 5d 9d 3b 20 00 00 00 00 |.Yl}b...].; ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| 00000050 4f 00 2b 00 02 03 04 00 33 00 45 00 17 00 41 04 |O.+.....3.E...A.| -00000060 c8 a0 2b 32 b8 d5 a7 19 a7 5e 02 f6 f1 e9 ad 34 |..+2.....^.....4| -00000070 72 59 97 9e 05 a8 46 42 21 53 06 06 81 ea b6 f1 |rY....FB!S......| -00000080 ca b6 c6 a1 b6 2e c6 b7 93 17 8e bc 92 3f ac 9c |.............?..| -00000090 7a 74 d0 f9 b2 00 68 e3 f2 1d b6 b8 66 7b 8a cd |zt....h.....f{..| -000000a0 17 03 03 00 17 69 26 9c 4e 1d ec 10 61 5f 5b ef |.....i&.N...a_[.| -000000b0 d1 ad 5d 6a c5 0c d4 ef a8 c4 8c ee 17 03 03 02 |..]j............| -000000c0 6d c1 89 98 5a 1d 09 68 1a cd 6e 75 e6 d7 9c d4 |m...Z..h..nu....| -000000d0 fb c4 70 dd c4 0d 6b 28 09 9b 59 53 81 44 80 f3 |..p...k(..YS.D..| -000000e0 9f 16 7a 04 e2 15 8a 80 58 2d 98 1e aa 1c ac dc |..z.....X-......| -000000f0 f4 60 d9 b3 ff d3 da 56 4a d4 dc 99 89 78 7b 0e |.`.....VJ....x{.| -00000100 0a 76 93 08 9f c4 a6 22 de fe 9f ad 19 19 92 20 |.v....."....... | -00000110 f3 2f ba c7 dd bc 15 54 03 8a ed 2f 5f 75 32 f2 |./.....T.../_u2.| -00000120 2b cf 0e 08 2e c6 7e 6a 4c 3f 40 4e 89 3f c5 de |+.....~jL?@N.?..| -00000130 f0 0d a2 f3 e7 b6 48 ac a6 c8 e9 78 8b ee a3 f1 |......H....x....| -00000140 7c 87 ff 5d d0 9b 4c 98 bc fc 25 1b b8 56 00 22 ||..]..L...%..V."| -00000150 e0 7e 52 24 c6 12 a3 21 39 2a 63 77 da ff de 21 |.~R$...!9*cw...!| -00000160 98 85 1d 73 57 df 21 6c e3 f8 de 06 4b 50 39 0e |...sW.!l....KP9.| -00000170 7c c9 c9 bc 7b 16 1e d7 e3 b2 e4 9e d3 a9 94 35 ||...{..........5| -00000180 fb 65 22 b9 a9 f8 ef 13 5e 54 ef 4b d7 09 b8 72 |.e".....^T.K...r| -00000190 a9 a5 30 a2 67 d3 ef 6e aa 00 7c fb fa 63 28 e7 |..0.g..n..|..c(.| -000001a0 48 18 23 9b 7e 0f dd 8b b2 13 4f f6 d2 e4 75 42 |H.#.~.....O...uB| -000001b0 27 8a 42 0c 02 d8 1e 45 82 ef 1b 65 a7 eb b5 19 |'.B....E...e....| -000001c0 26 e5 42 06 80 80 d7 84 1e 05 c5 d5 f4 ea 53 51 |&.B...........SQ| -000001d0 78 ba f3 47 47 01 7b 25 ab 34 f7 fc 52 71 ff a4 |x..GG.{%.4..Rq..| -000001e0 d5 50 2b b5 7d e2 62 6a e9 8e 9c 8d b2 6f d4 78 |.P+.}.bj.....o.x| -000001f0 07 da 3a 9c 51 a3 d4 f5 24 a6 c0 c8 39 85 5f e1 |..:.Q...$...9._.| -00000200 03 b0 65 8b 50 c4 5d 03 f6 36 d2 3d f2 36 e3 c6 |..e.P.]..6.=.6..| -00000210 26 5b 82 d1 bd 54 e7 90 50 23 a8 e3 36 d9 d9 a0 |&[...T..P#..6...| -00000220 07 df 1b 47 17 9c 2a ab 56 07 d5 ea e5 c7 71 0b |...G..*.V.....q.| -00000230 fb 0c 4e f3 5b 0e 1d d6 75 df 21 50 c3 c9 18 5f |..N.[...u.!P..._| -00000240 55 e1 84 91 5c 9c 13 68 95 15 ab 0e db 17 b1 b7 |U...\..h........| -00000250 ee 3e 89 61 0f 6f 09 8b 6a 67 b5 bc 2a 61 cd 42 |.>.a.o..jg..*a.B| -00000260 79 9a 9c a4 99 98 0d 1c 43 2c bd 8d ee ac a9 2e |y.......C,......| -00000270 6d 73 cc b3 a0 b7 b7 8f 8f 09 32 8a 9f 00 87 5f |ms........2...._| -00000280 ae b4 0f 47 22 0b ec f4 e2 be 4e 6f 13 8d 30 97 |...G".....No..0.| -00000290 5a a8 f0 38 46 dd 1a 28 10 8b a8 4a e4 e6 fb 84 |Z..8F..(...J....| -000002a0 c4 85 15 11 3d 0b 08 f7 9d fd 45 6a 6b f5 bf d4 |....=.....Ejk...| -000002b0 2b 84 e5 20 5a a8 cb df 1f a3 af 96 17 df e8 b2 |+.. Z...........| -000002c0 61 f1 d0 d1 85 91 d2 02 a5 38 a0 5e 19 ba c4 2c |a........8.^...,| -000002d0 80 64 77 13 e1 27 86 d3 d4 17 07 86 c7 11 c0 38 |.dw..'.........8| -000002e0 11 69 89 48 39 7e b2 e5 d9 72 c1 b4 29 50 ab 9b |.i.H9~...r..)P..| -000002f0 49 cd 74 b9 4a ce c5 67 46 47 73 81 b1 a1 82 8f |I.t.J..gFGs.....| -00000300 76 ee 81 28 70 66 da 94 2a 8e 20 b0 ab 2e e4 d4 |v..(pf..*. .....| -00000310 ef 26 8b 31 07 85 b6 b0 c2 5b 05 0a 32 2e e7 73 |.&.1.....[..2..s| -00000320 41 e7 a1 97 f7 5e 2f 9c 73 25 c1 f7 77 12 17 03 |A....^/.s%..w...| -00000330 03 00 99 92 0a 8c 17 e9 0d 77 a3 6f ab 1a 4f dd |.........w.o..O.| -00000340 de 1d 0f 72 39 5c 8f 9f 80 00 b2 e5 fe 28 79 a2 |...r9\.......(y.| -00000350 16 21 e3 a2 25 90 c6 cd f2 28 6d b6 08 5b 51 0d |.!..%....(m..[Q.| -00000360 58 22 a6 11 ac 29 5d 54 aa 05 35 28 87 da 54 39 |X"...)]T..5(..T9| -00000370 b6 7f ef 94 3e 1c 80 59 f1 12 06 77 66 20 a1 00 |....>..Y...wf ..| -00000380 82 ed 0b 7a 1f 5d 55 5e 31 11 85 93 69 94 2a 44 |...z.]U^1...i.*D| -00000390 96 1c 39 7b 5b 7f 5b a6 05 6a 6d 52 79 20 52 f7 |..9{[.[..jmRy R.| -000003a0 1f 79 50 36 f1 a9 00 aa 9d 46 57 fd 00 70 7b 4a |.yP6.....FW..p{J| -000003b0 7a 14 75 20 91 83 3e 1b 47 2a 90 c9 09 71 b6 95 |z.u ..>.G*...q..| -000003c0 48 53 2a 3f 22 5f 9c 46 d6 12 27 b1 17 03 03 00 |HS*?"_.F..'.....| -000003d0 35 98 15 74 4c d4 52 cf 0c 78 88 8f 82 9b c5 23 |5..tL.R..x.....#| -000003e0 14 02 71 da 63 6c 28 36 aa 91 a0 14 74 0a 47 59 |..q.cl(6....t.GY| -000003f0 ea 6f b1 46 1e a7 c4 5f 76 33 96 ae 82 eb 4b b4 |.o.F..._v3....K.| -00000400 88 6a ce 37 db fd |.j.7..| +00000060 51 c8 a4 d2 63 ec a1 b7 72 7e 42 30 8e d2 eb b0 |Q...c...r~B0....| +00000070 3c e0 06 d0 69 39 b7 55 ee 47 c3 b3 b6 56 2d df |<...i9.U.G...V-.| +00000080 3e 0c 1c 92 cf f6 c4 52 13 90 fa e6 52 13 e6 6d |>......R....R..m| +00000090 35 46 de 60 05 a1 85 a9 ec 86 dc da 19 4d 21 67 |5F.`.........M!g| +000000a0 17 03 03 00 17 d7 59 69 75 49 13 ac 27 ad 1c a9 |......YiuI..'...| +000000b0 17 68 46 77 a2 22 0a f5 6f ce 70 67 17 03 03 02 |.hFw."..o.pg....| +000000c0 6d ee 92 51 b3 07 0f 46 be 24 a1 12 02 7e d1 d4 |m..Q...F.$...~..| +000000d0 b1 2e f5 87 f5 96 ed 00 77 f1 ad 1b 8e cd 1d 01 |........w.......| +000000e0 41 78 6a ff 68 9f 6d ac fe 92 8a c5 43 d2 c9 1d |Axj.h.m.....C...| +000000f0 a8 d8 0f 00 7e c1 06 a9 16 ba 13 94 e7 d9 cd e1 |....~...........| +00000100 01 fd 52 12 be b0 04 14 85 d3 06 a2 63 d7 16 7a |..R.........c..z| +00000110 06 5f 1f c2 31 ea 27 1a a5 1d f6 39 d2 b1 99 8c |._..1.'....9....| +00000120 e0 71 32 3b ef 4e d3 1c 21 3f 30 59 5b 3e 1f 64 |.q2;.N..!?0Y[>.d| +00000130 3c 27 35 0f ee f4 75 5c 53 38 f8 43 87 55 88 28 |<'5...u\S8.C.U.(| +00000140 17 8f 4c 2d 73 d0 bd db 43 25 2f da fb f3 f7 b4 |..L-s...C%/.....| +00000150 63 90 08 24 c6 b3 ae 91 00 2d 4f bd af bc 22 82 |c..$.....-O...".| +00000160 08 ef 29 c9 49 d2 73 97 ce 6c 8d 1e a2 cb 53 ff |..).I.s..l....S.| +00000170 fe 9c b1 14 58 6f 45 bf ee 93 c0 9b 96 86 54 1a |....XoE.......T.| +00000180 fc fe 84 c3 88 13 92 d4 d7 de 00 07 d4 f7 ef 8e |................| +00000190 5e 5f b0 12 c9 6a 81 df 05 e6 c3 a1 f6 8a bc 06 |^_...j..........| +000001a0 bc 45 47 06 d4 45 70 78 f9 16 0f d2 f4 ae b5 94 |.EG..Epx........| +000001b0 e6 ac b5 bf e3 40 d1 fe 20 07 23 f8 65 fe 57 b2 |.....@.. .#.e.W.| +000001c0 63 a0 db 7b fa 12 25 2b 1f 1c df 66 ee c4 84 80 |c..{..%+...f....| +000001d0 4a 95 64 3d 9f c2 e9 eb 7c 59 72 1c 52 68 fa 5a |J.d=....|Yr.Rh.Z| +000001e0 b3 d6 9e dc 51 d6 ac 0b 34 f1 66 42 4b 99 1d cb |....Q...4.fBK...| +000001f0 94 f4 08 c6 57 f9 97 87 54 9c 3b ba 4e 21 c7 b3 |....W...T.;.N!..| +00000200 a0 d9 41 33 22 c4 3f a4 29 e4 7a 3c a1 86 e0 65 |..A3".?.).z<...e| +00000210 f4 ff 67 c5 32 ae 16 01 67 8e 16 d7 28 5e b3 19 |..g.2...g...(^..| +00000220 c6 18 c7 27 0d 01 8e 04 87 fb 6b f9 72 ee 00 ff |...'......k.r...| +00000230 25 f9 c5 dd bc 30 45 63 2d 4d 2d 9d ea 7f 54 aa |%....0Ec-M-...T.| +00000240 ac 9e d8 a2 ae c2 e3 64 b7 3d 54 56 67 39 e8 96 |.......d.=TVg9..| +00000250 a5 5d fd 1e 01 2a 0c 7d ee f1 4e fc 1b 19 f9 ef |.]...*.}..N.....| +00000260 60 dd e1 b2 94 f3 5f 54 d4 05 f7 86 83 6f 97 43 |`....._T.....o.C| +00000270 4e 30 c1 49 cc 5e 98 10 5c 4e 32 84 97 70 c8 b9 |N0.I.^..\N2..p..| +00000280 6d 0b c2 23 ab f9 e8 85 6f 0a 2a 99 e7 12 33 e8 |m..#....o.*...3.| +00000290 f2 62 6f 65 0c 3d ff 9f e6 15 eb 1d 24 0e e9 8a |.boe.=......$...| +000002a0 28 e0 09 31 23 a4 5c 2c 25 49 b4 0c 5f 18 e1 12 |(..1#.\,%I.._...| +000002b0 82 16 6e 79 68 21 fb 5a 68 73 dd f7 2f aa e2 f9 |..nyh!.Zhs../...| +000002c0 85 8d af c6 84 50 af 84 95 12 c8 32 a6 eb f0 93 |.....P.....2....| +000002d0 a2 bd 97 d3 ba 76 a8 2e a2 44 2f 98 23 ca 78 cd |.....v...D/.#.x.| +000002e0 7a 5f bf ab 19 00 72 b5 b3 e0 a7 b5 da 47 05 c8 |z_....r......G..| +000002f0 44 0b 6c 7f 0b 4c 99 79 3c 47 7e e9 25 bd a8 4d |D.l..L.yOh.'.%..| +00000390 1f 89 9e 21 34 97 b9 7e 6e 2a c2 df 47 22 7d a6 |...!4..~n*..G"}.| +000003a0 aa 7a 4a fd 11 b0 73 10 f5 16 8b 2c 3a af a6 7a |.zJ...s....,:..z| +000003b0 cc 3d 4b f0 36 43 60 db 53 2a 4e 2c 1b 2c 0a 54 |.=K.6C`.S*N,.,.T| +000003c0 01 ff ad 7e 93 a8 d0 76 da 5a 88 88 17 03 03 00 |...~...v.Z......| +000003d0 35 d0 36 70 7c 4c 6a 10 bd 43 50 2c 47 74 f9 ed |5.6p|Lj..CP,Gt..| +000003e0 9f 0b d7 33 82 74 2f fd 81 4d 08 d6 cf f4 13 4e |...3.t/..M.....N| +000003f0 de ec 84 bf 79 35 ee 72 8a a3 d0 61 29 94 ad 79 |....y5.r...a)..y| +00000400 04 42 0f 2b 65 a1 |.B.+e.| >>> Flow 5 (client to server) -00000000 17 03 03 00 35 7b c5 88 f4 a0 83 1e 6e 67 e6 05 |....5{......ng..| -00000010 05 fa b4 40 e3 7f fc f8 bc 50 11 76 93 22 92 5f |...@.....P.v."._| -00000020 9a 67 e5 65 a1 a3 af bc ae 3b c7 aa b3 fb 99 f0 |.g.e.....;......| -00000030 2a c2 65 aa 4b bd 91 20 17 22 17 03 03 00 17 1d |*.e.K.. ."......| -00000040 4f a0 06 07 65 2e 10 e7 15 c9 56 f3 2c 18 10 51 |O...e.....V.,..Q| -00000050 c7 d5 ac 09 e6 93 17 03 03 00 13 34 b2 1d 5e da |...........4..^.| -00000060 55 b2 dd 2b c1 e0 ac 65 7e a2 52 f8 a4 5b |U..+...e~.R..[| +00000000 17 03 03 00 35 4b f7 dd b6 64 32 61 42 e7 b2 93 |....5K...d2aB...| +00000010 b8 4b dd 7c 25 c6 57 5b 68 d5 f2 d9 27 85 ee cf |.K.|%.W[h...'...| +00000020 09 44 79 8d 8e 14 0f 84 44 e5 16 a9 bf d9 14 bb |.Dy.....D.......| +00000030 22 73 c7 a9 24 c1 dd 38 1e 63 17 03 03 00 17 63 |"s..$..8.c.....c| +00000040 56 45 91 62 9c 00 4b d6 ae f4 dc 17 a2 89 55 0d |VE.b..K.......U.| +00000050 c3 d4 f3 12 8b bf 17 03 03 00 13 1f ac ed f8 80 |................| +00000060 31 7f 75 9f 6c a1 48 6e 20 89 b8 45 08 33 |1.u.l.Hn ..E.3| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-KeyUpdate b/libgo/go/crypto/tls/testdata/Client-TLSv13-KeyUpdate index a613b78da58..d1efba928c5 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-KeyUpdate +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-KeyUpdate @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,96 +7,96 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| +000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 59 2c d4 a8 e3 |....z...v..Y,...| -00000010 ec 72 f1 2f 9b ff af 2f ab 13 fe 21 80 a5 c1 71 |.r./.../...!...q| -00000020 02 55 9b 06 67 0f 7b dd 27 32 66 20 00 00 00 00 |.U..g.{.'2f ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 a2 49 b5 61 fe |....z...v...I.a.| +00000010 e3 52 ca 87 58 57 0f ec bc 71 51 a9 50 7c ac 5e |.R..XW...qQ.P|.^| +00000020 af 4e 47 56 81 6c 92 d9 10 3d d0 20 00 00 00 00 |.NGV.l...=. ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 3e |..+.....3.$... >| -00000060 13 b1 51 26 01 be c0 e5 85 a7 18 aa b5 83 21 6e |..Q&..........!n| -00000070 85 48 1b ea 4c 99 13 ba b8 de 07 30 f4 9f 5b 14 |.H..L......0..[.| -00000080 03 03 00 01 01 17 03 03 00 17 9f 78 1e 98 cb 85 |...........x....| -00000090 0e 65 2b e5 20 c1 63 c1 b7 49 49 76 e3 90 0c c9 |.e+. .c..IIv....| -000000a0 b6 17 03 03 02 6d 8f 91 03 6b b7 0d 7d 79 4c 16 |.....m...k..}yL.| -000000b0 fc cb 62 11 62 12 2a 52 9a 19 7c b6 1c fc 31 d2 |..b.b.*R..|...1.| -000000c0 11 4d b4 e9 23 3c 58 3e 87 f1 9e e0 27 04 a2 fb |.M..#....'...| -000000d0 21 9a 82 59 3b ea 6b 29 ec a8 0e 1c 58 99 46 9b |!..Y;.k)....X.F.| -000000e0 2b c2 90 10 5d bc df d1 a0 71 00 8f 9b 90 10 49 |+...]....q.....I| -000000f0 97 1d b5 d2 8f e2 a6 78 b1 2a e9 2d 8d 13 38 2f |.......x.*.-..8/| -00000100 db 56 bb cd 0f 08 69 f7 04 de 53 ec 3c 90 97 ca |.V....i...S.<...| -00000110 9f 63 d0 96 7f 3a 98 98 77 21 c8 ee 0f 5c 4e 97 |.c...:..w!...\N.| -00000120 3c 72 88 13 48 82 1b 70 b2 83 b4 95 03 81 05 ef |:.....U3| -00000300 76 5f ce 26 f6 53 d0 23 3a e2 78 0f 0a fe 2f 89 |v_.&.S.#:.x.../.| -00000310 43 27 b3 17 03 03 00 99 61 da d2 f7 6d 84 f0 08 |C'......a...m...| -00000320 b0 89 f8 a4 1f b4 99 6a cf d1 08 d6 a7 03 fa f9 |.......j........| -00000330 db c2 8a 9a 74 62 0c 93 7d 7c 22 c0 2d 84 5d 96 |....tb..}|".-.].| -00000340 f8 66 05 6c c5 ab b6 5b 2d f5 10 27 c6 c3 81 13 |.f.l...[-..'....| -00000350 94 3c af 56 ca 37 ca a6 24 86 34 54 f2 60 e2 51 |.<.V.7..$.4T.`.Q| -00000360 67 5e dd 81 7f 87 81 84 15 cf b9 92 01 9c fc 90 |g^..............| -00000370 18 21 ad 6a 4a b8 4f fe 03 c8 83 08 fd 55 5a 4d |.!.jJ.O......UZM| -00000380 75 b7 e3 2d ff 9d 0a e5 61 b2 e9 82 bf 65 6a 05 |u..-....a....ej.| -00000390 d1 8d 36 82 07 8d a0 95 78 26 9e 3a c7 99 27 3f |..6.....x&.:..'?| -000003a0 54 0e a3 dd 9a 93 a6 6c 9b a3 14 46 bb cc f8 70 |T......l...F...p| -000003b0 f1 17 03 03 00 35 34 03 e6 68 dc f1 3e ae 38 69 |.....54..h..>.8i| -000003c0 87 ce 72 92 13 4a c0 4a 0d 22 28 3a 9f df 7d d5 |..r..J.J."(:..}.| -000003d0 de 5f 3c 0d 49 be b7 63 85 67 90 be 68 dc e7 88 |._<.I..c.g..h...| -000003e0 e3 58 90 43 99 0a db ee ad be 6d |.X.C......m| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 75 |..+.....3.$... u| +00000060 c4 ba b0 c4 9b a0 57 6a ca e4 9c c6 eb f8 66 5a |......Wj......fZ| +00000070 d4 64 36 34 71 9d 6d 0f 2f 34 b8 ad b7 4a 55 14 |.d64q.m./4...JU.| +00000080 03 03 00 01 01 17 03 03 00 17 ec 4c 36 aa 81 cf |...........L6...| +00000090 61 2c 2f 6c 35 e8 25 62 54 17 ae 9b 46 b0 96 f5 |a,/l5.%bT...F...| +000000a0 0f 17 03 03 02 6d 6f 6c 27 e5 53 42 db 32 b4 2c |.....mol'.SB.2.,| +000000b0 6a 70 56 a7 0d 3a 7f a3 d7 fe 04 4f 0a 3e 52 8c |jpV..:.....O.>R.| +000000c0 52 1e 3a 26 5d 47 b1 6b da 90 e2 74 50 0d 6e fa |R.:&]G.k...tP.n.| +000000d0 1b 3f 17 3b 21 f7 fa f7 c7 c3 e3 14 05 09 76 b2 |.?.;!.........v.| +000000e0 27 66 bc 42 7e 49 4b ff 3a f1 3f a3 1a d4 9e 03 |'f.B~IK.:.?.....| +000000f0 3f b6 a8 87 98 50 f3 d8 cb 8b a2 e9 2a ea ff bc |?....P......*...| +00000100 50 18 d0 57 58 c5 e9 c8 96 67 01 8b e2 a3 f4 77 |P..WX....g.....w| +00000110 5e 1d 93 89 b6 f6 57 7d 93 b6 62 86 0a 21 18 56 |^.....W}..b..!.V| +00000120 8c 14 25 df 47 1a b3 23 e6 99 d1 fc dc 07 0a 38 |..%.G..#.......8| +00000130 9a 05 c8 3f 23 5c c5 d3 c4 48 fb b2 fd 9f 83 37 |...?#\...H.....7| +00000140 1d 0c 85 9c 2b e6 ae 42 aa ad d4 5a 9e 49 89 b7 |....+..B...Z.I..| +00000150 b0 c2 c5 ec 42 89 88 87 6e 54 3d 73 b2 f1 5f 0f |....B...nT=s.._.| +00000160 4b 49 3f 6b a3 8f 5f 99 bf fe af e9 25 ac 27 b7 |KI?k.._.....%.'.| +00000170 e7 96 bb 4a c8 e8 9e f1 2c 23 c2 e7 96 ba b4 fe |...J....,#......| +00000180 d5 94 b5 72 82 bd 7f c2 e1 af b4 bd db c7 15 20 |...r........... | +00000190 85 60 bb 02 f6 4b ef 09 3e a1 4e b9 77 64 0a 4a |.`...K..>.N.wd.J| +000001a0 2c 05 82 96 91 be 23 44 50 c1 c5 6c 05 55 51 42 |,.....#DP..l.UQB| +000001b0 84 87 20 71 65 8d 09 86 66 fa 88 8b 54 21 44 34 |.. qe...f...T!D4| +000001c0 df 6f ce a3 e9 12 4a e0 90 76 bb 1a f5 00 79 cb |.o....J..v....y.| +000001d0 d8 82 3b 88 c8 6a 5b a1 49 49 a0 c0 f7 d9 8f 89 |..;..j[.II......| +000001e0 f2 04 59 2b 0c 6f e2 3f b8 a8 c9 aa bf 2e 18 74 |..Y+.o.?.......t| +000001f0 45 b5 35 34 9a bb fa 77 e8 46 b2 f8 6d 41 65 36 |E.54...w.F..mAe6| +00000200 d9 f8 64 81 a6 50 63 b4 73 3e fb f9 b3 3e 03 3d |..d..Pc.s>...>.=| +00000210 d1 f4 b5 c1 ac f8 3f 4d 73 b7 da 16 8a 37 c9 a7 |......?Ms....7..| +00000220 51 33 b1 68 69 19 0b 26 de a6 42 4d 22 a3 e8 c0 |Q3.hi..&..BM"...| +00000230 7b 1d 66 e7 70 26 44 f7 62 3f 3d 0d e2 02 50 61 |{.f.p&D.b?=...Pa| +00000240 db 9b 5e e4 49 e8 32 32 7a c0 03 37 a8 c6 85 80 |..^.I.22z..7....| +00000250 4a 7e 39 b5 ba 6c cb 6f 53 e5 90 d0 0d 9c 2e e5 |J~9..l.oS.......| +00000260 90 df 9b b1 c5 3f 16 98 a9 dd a1 b5 7a 48 04 0e |.....?......zH..| +00000270 15 f9 60 a7 35 0b 33 a1 93 4b 73 5f b3 46 a6 43 |..`.5.3..Ks_.F.C| +00000280 ea a3 6e 4c fa bb 24 44 cd 48 85 c1 9f ea c2 14 |..nL..$D.H......| +00000290 92 48 2e 35 43 30 dc e6 76 23 0b e4 2f 28 13 c1 |.H.5C0..v#../(..| +000002a0 e1 bb 2d 9f de cf 10 8f c3 8f 48 eb 64 eb 6d ef |..-.......H.d.m.| +000002b0 2a b3 c5 d6 85 db a2 05 b2 46 f8 77 aa 2c fb 14 |*........F.w.,..| +000002c0 be 09 e7 11 33 88 cb 71 1b ca 46 cb 79 c6 99 eb |....3..q..F.y...| +000002d0 43 bb 59 c6 91 3b 0f 1a 76 cb c7 3b ef 07 c9 cb |C.Y..;..v..;....| +000002e0 3a 75 ac 14 d9 53 08 ca 4d 45 48 24 4a af 4e 94 |:u...S..MEH$J.N.| +000002f0 0e 81 31 63 d1 f6 67 25 7d c0 dd 02 05 1b ce 38 |..1c..g%}......8| +00000300 69 cf e7 6a bb b5 02 85 00 82 71 a6 e3 c0 33 b8 |i..j......q...3.| +00000310 78 51 55 17 03 03 00 99 b3 5c cb a4 a3 6c e9 fa |xQU......\...l..| +00000320 33 25 04 21 28 66 e7 d4 22 02 8f d4 3e cc e1 20 |3%.!(f.."...>.. | +00000330 15 5b 5a 55 14 d3 2b a5 de 7b 95 48 3c 26 68 22 |.[ZU..+..{.H<&h"| +00000340 a3 0d c6 ac 7f ec d3 7b fa 4d 51 20 6f 32 97 bc |.......{.MQ o2..| +00000350 fa 0c d6 8e bf ee 13 ca b3 cf 00 c5 f5 87 f1 cb |................| +00000360 9b 63 22 e6 61 99 83 78 69 1d 03 f1 0b 66 c5 c4 |.c".a..xi....f..| +00000370 2e 6f d8 b5 59 93 f7 40 3c 40 4e 1a 58 af b5 37 |.o..Y..@<@N.X..7| +00000380 ce dd 83 dd b1 78 a8 ba a3 35 f8 9f 0c 47 1e fb |.....x...5...G..| +00000390 aa 9b b5 5f 11 4c b9 0c c1 a0 01 47 87 f9 e6 1f |..._.L.....G....| +000003a0 d5 e5 3f a7 15 4d c8 a5 79 9c e5 bc 62 6f cb cd |..?..M..y...bo..| +000003b0 86 17 03 03 00 35 e7 4d 67 3a 39 5b ac 13 89 cc |.....5.Mg:9[....| +000003c0 c4 dc 20 2b a4 b2 3c 5d 96 f1 45 17 52 12 ed 85 |.. +..<]..E.R...| +000003d0 00 f0 7e 73 3a 6d a2 46 b8 59 7f e8 6f 46 06 e1 |..~s:m.F.Y..oF..| +000003e0 43 c9 ca af a9 3e ca d6 42 4b 41 |C....>..BKA| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 35 ea a5 10 9a 0a |..........5.....| -00000010 57 40 9c b7 f8 e6 01 28 9e 3f ae ce ec 73 7f 2e |W@.....(.?...s..| -00000020 84 8e a9 e3 cb 03 3b b3 1b 98 3c 09 5b 23 c2 10 |......;...<.[#..| -00000030 c1 18 47 74 a8 a5 0e 33 93 5f 83 e9 e6 aa ed f5 |..Gt...3._......| -00000040 17 03 03 00 17 80 72 fb 00 25 ff 83 4c df 43 66 |......r..%..L.Cf| -00000050 cd e5 64 2e 78 44 e4 b7 58 61 fe 01 |..d.xD..Xa..| +00000000 14 03 03 00 01 01 17 03 03 00 35 4d ad c5 c7 cc |..........5M....| +00000010 5a 34 8a f8 5f 71 83 af fa 94 df 2a 94 a0 c4 8e |Z4.._q.....*....| +00000020 5e 00 f7 02 e1 30 62 a5 49 27 58 0b 1f fa 46 98 |^....0b.I'X...F.| +00000030 f0 b8 6f 42 e3 3a 7f 26 77 b6 46 8f ab c6 5d d6 |..oB.:.&w.F...].| +00000040 17 03 03 00 17 90 81 68 7a 48 8d 3b 59 9e 11 6f |.......hzH.;Y..o| +00000050 86 b5 24 e4 d9 e0 60 9f c2 4f 3d 33 |..$...`..O=3| >>> Flow 4 (server to client) -00000000 17 03 03 00 16 54 f1 cd 5a 87 da 6a e7 a6 e5 00 |.....T..Z..j....| -00000010 60 f8 cd 6b af db 1b 85 3b 40 23 |`..k....;@#| +00000000 17 03 03 00 16 94 83 fa cc 66 b4 60 c0 c7 6d b3 |.........f.`..m.| +00000010 6e 8c 84 9d 89 76 61 3d 69 fd 29 |n....va=i.)| >>> Flow 5 (client to server) -00000000 17 03 03 00 16 b2 74 fa c8 c6 6e 4f 62 4f ea 02 |......t...nObO..| -00000010 4d 10 78 f1 b3 4a e2 e5 1d 8f 33 |M.x..J....3| +00000000 17 03 03 00 16 60 cb 39 3d 7d 79 01 88 93 bd bf |.....`.9=}y.....| +00000010 23 3b d1 f3 a4 5e 78 ea cd 0f 5e |#;...^x...^| >>> Flow 6 (server to client) -00000000 17 03 03 00 1a ba bc 59 f7 ad b4 77 2f bc 3d 60 |.......Y...w/.=`| -00000010 5c bd 6c 6e 37 86 75 bd e1 41 b9 07 f6 87 47 |\.ln7.u..A....G| +00000000 17 03 03 00 1a 88 13 b4 f1 5f cc 63 1e 99 9f 85 |........._.c....| +00000010 60 ff 0e 97 13 59 64 2a c3 0d 2b ac ca a2 25 |`....Yd*..+...%| >>> Flow 7 (client to server) -00000000 17 03 03 00 1d 7d 12 1b b2 a7 b7 ae 37 fb 2d 71 |.....}......7.-q| -00000010 98 ec c2 f0 7f 16 e9 b9 f9 49 05 e2 b2 c3 c6 ec |.........I......| -00000020 38 32 17 03 03 00 13 9f c4 f4 f7 e9 c9 5f e2 70 |82..........._.p| -00000030 b4 33 9f 35 f3 2a b1 cd 01 d5 |.3.5.*....| +00000000 17 03 03 00 1d 4f f2 48 ea b8 d6 75 8e 97 ab 54 |.....O.H...u...T| +00000010 29 57 50 5b 59 40 59 d3 7a 3c 01 43 6a 33 30 bb |)WP[Y@Y.z<.Cj30.| +00000020 d4 40 17 03 03 00 13 18 fc b7 ac eb e7 52 6d f0 |.@...........Rm.| +00000030 d4 d3 03 c6 5f 4e ea e3 7b 4e |...._N..{N| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-P256-ECDHE b/libgo/go/crypto/tls/testdata/Client-TLSv13-P256-ECDHE index 20cafb45b61..e6d81184e10 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-P256-ECDHE +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-P256-ECDHE @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 01 13 01 00 01 0f 03 03 00 00 00 00 00 |................| +00000000 16 03 01 01 15 01 00 01 11 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,88 +7,88 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 94 00 05 00 05 01 00 00 00 00 00 0a 00 |................| -00000090 04 00 02 00 17 00 0b 00 02 01 00 00 0d 00 18 00 |................| -000000a0 16 08 04 08 05 08 06 04 01 04 03 05 01 05 03 06 |................| -000000b0 01 06 03 02 01 02 03 ff 01 00 01 00 00 12 00 00 |................| -000000c0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| -000000d0 47 00 45 00 17 00 41 04 1e 18 37 ef 0d 19 51 88 |G.E...A...7...Q.| -000000e0 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 24 20 |5uq..T[....g..$ | -000000f0 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 07 9f |>.V...(^.+-O....| -00000100 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 b5 68 |lK[.V.2B.X..I..h| -00000110 1a 41 03 56 6b dc 5a 89 |.A.Vk.Z.| +00000080 01 00 00 96 00 05 00 05 01 00 00 00 00 00 0a 00 |................| +00000090 04 00 02 00 17 00 0b 00 02 01 00 00 0d 00 1a 00 |................| +000000a0 18 08 04 04 03 08 07 08 05 08 06 04 01 05 01 06 |................| +000000b0 01 05 03 06 03 02 01 02 03 ff 01 00 01 00 00 12 |................| +000000c0 00 00 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 |...+............| +000000d0 33 00 47 00 45 00 17 00 41 04 1e 18 37 ef 0d 19 |3.G.E...A...7...| +000000e0 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 |Q.5uq..T[....g..| +000000f0 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 |$ >.V...(^.+-O..| +00000100 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 |..lK[.V.2B.X..I.| +00000110 b5 68 1a 41 03 56 6b dc 5a 89 |.h.A.Vk.Z.| >>> Flow 2 (server to client) -00000000 16 03 03 00 9b 02 00 00 97 03 03 42 8e 0f 88 bb |...........B....| -00000010 99 f5 32 74 2a 0a 66 98 59 da 0c 3f df 23 8c 72 |..2t*.f.Y..?.#.r| -00000020 a7 ba f5 52 78 88 22 a0 db 3d cc 20 00 00 00 00 |...Rx."..=. ....| +00000000 16 03 03 00 9b 02 00 00 97 03 03 b5 3c c8 fe 64 |............<..d| +00000010 f6 04 7d 28 a4 25 7c 1b f5 0b e6 6d 0b f5 2f ec |..}(.%|....m../.| +00000020 78 c1 bd 5a cf c8 19 d9 5c 54 72 20 00 00 00 00 |x..Z....\Tr ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| 00000050 4f 00 2b 00 02 03 04 00 33 00 45 00 17 00 41 04 |O.+.....3.E...A.| -00000060 42 55 a6 b0 22 e7 51 7f ce 3c 15 f5 ef db 69 89 |BU..".Q..<....i.| -00000070 80 e1 5a 54 37 d9 df 4c bd 83 72 43 5f b5 bf 28 |..ZT7..L..rC_..(| -00000080 21 41 0f 4c 71 a4 42 ae 90 20 8b 2e 95 88 1d a0 |!A.Lq.B.. ......| -00000090 4d 50 6f 05 3d 71 26 e2 ca 12 2b bf 5b 18 b6 16 |MPo.=q&...+.[...| -000000a0 14 03 03 00 01 01 17 03 03 00 17 fd a0 c1 f6 d6 |................| -000000b0 f5 7c 39 25 4c 67 ad fa 10 18 d1 90 b2 61 90 3f |.|9%Lg.......a.?| -000000c0 71 49 17 03 03 02 6d 28 31 4d 75 d8 9d 93 a0 ee |qI....m(1Mu.....| -000000d0 ad ef a3 dc 14 12 a8 af 17 b4 46 20 50 96 26 54 |..........F P.&T| -000000e0 78 4d d7 4f 08 e9 93 61 b6 53 da b2 e9 9c 67 54 |xM.O...a.S....gT| -000000f0 e8 87 0d 64 0c cc 14 cd d0 b5 df 1e d7 25 58 ce |...d.........%X.| -00000100 0b c9 a6 dc 38 9d 00 85 ce c3 01 29 3a 74 26 d4 |....8......):t&.| -00000110 71 db c0 92 2b 95 d2 00 d0 38 8d 85 f5 22 05 c7 |q...+....8..."..| -00000120 3b d4 d5 c7 a6 36 0d 3e 39 2c d5 0f 0d 84 80 22 |;....6.>9,....."| -00000130 e5 f0 71 24 0d 93 68 21 db 51 e2 24 84 0c 30 2a |..q$..h!.Q.$..0*| -00000140 87 e5 b5 a2 b6 b8 9c 53 a1 bb 76 7d e8 10 e4 59 |.......S..v}...Y| -00000150 f2 be 69 6f 39 75 e2 ed 70 f3 f0 fd 70 2f ce 2a |..io9u..p...p/.*| -00000160 24 d0 05 3e 13 ee 76 f5 6b b8 ed ee 34 40 cc e5 |$..>..v.k...4@..| -00000170 11 58 62 22 99 04 3c 22 43 24 46 78 66 a0 04 11 |.Xb"..<"C$Fxf...| -00000180 86 b4 b7 87 71 ff f9 ed 6f 4f 7e 9f 2d 08 ed ae |....q...oO~.-...| -00000190 cc 03 29 6f 34 9b 18 2c ae d7 d5 e9 03 51 5d 37 |..)o4..,.....Q]7| -000001a0 d5 ac 93 07 2a 78 8f 7d b0 85 ae 19 37 a5 e8 d6 |....*x.}....7...| -000001b0 e4 b3 01 14 04 fc ab 36 d6 5e 31 45 47 14 f8 d9 |.......6.^1EG...| -000001c0 c8 a0 a0 49 56 74 68 5b b4 20 f7 e0 54 34 41 45 |...IVth[. ..T4AE| -000001d0 c0 5e ed a6 1c 84 d8 3a c7 2d 17 5a 4c bd 7d d1 |.^.....:.-.ZL.}.| -000001e0 a8 9e 5e d1 31 b1 6b 48 64 11 d8 89 01 9f ed 12 |..^.1.kHd.......| -000001f0 60 73 66 80 38 13 23 8d 31 ca 94 06 22 e9 45 ff |`sf.8.#.1...".E.| -00000200 d6 a3 0b 7c 30 c8 d7 30 4f c0 62 84 ac f9 b0 3d |...|0..0O.b....=| -00000210 68 76 d2 02 27 d9 1e 7e da ae 85 47 e1 08 0f 4f |hv..'..~...G...O| -00000220 74 a9 fc ca f2 38 68 6d c6 f3 3c e9 99 c5 48 79 |t....8hm..<...Hy| -00000230 88 37 b6 5d 4f f8 8b 53 41 9a 39 a7 2f 8e 39 81 |.7.]O..SA.9./.9.| -00000240 75 cf 70 2f 28 4c 10 32 73 9b 6e 4f 58 1f ae 28 |u.p/(L.2s.nOX..(| -00000250 3f 6c 3d 60 49 48 15 10 2a af ea d7 ce 55 07 47 |?l=`IH..*....U.G| -00000260 90 3a c8 0d 6a 4a 88 c2 9c d3 08 99 02 c9 88 be |.:..jJ..........| -00000270 91 5b c9 41 46 cf b1 5e fe 28 1e 97 8a 44 5a e0 |.[.AF..^.(...DZ.| -00000280 d0 a3 a9 ea f7 51 27 87 b3 0f fd dc 7d d4 96 4a |.....Q'.....}..J| -00000290 39 2c 0a 58 9c 23 0d 41 89 42 5e fd 19 ab 19 a8 |9,.X.#.A.B^.....| -000002a0 e4 70 3f ef c6 54 fb ed 80 9b 68 d6 d9 6f 21 53 |.p?..T....h..o!S| -000002b0 89 40 06 c9 0c 56 40 8c 36 61 91 18 81 ce 76 5d |.@...V@.6a....v]| -000002c0 78 f5 01 9f 2e de 3e 89 61 d7 81 a5 f9 32 24 44 |x.....>.a....2$D| -000002d0 6b fa 0b 9c 8b a4 f6 df a1 2a 31 91 b2 40 cd 7e |k........*1..@.~| -000002e0 6c d1 75 c9 56 48 e3 36 eb 13 00 cf ea d5 d9 98 |l.u.VH.6........| -000002f0 71 4c d2 af 06 e5 f1 f7 8f ce 79 7a 93 4c 1c 99 |qL........yz.L..| -00000300 61 8f 93 76 de 1d ca ff 1b e5 c3 8f 99 ac 65 92 |a..v..........e.| -00000310 74 a9 d6 fd 9d bd a7 da f6 d5 94 7f 66 87 e1 7e |t...........f..~| -00000320 16 43 04 8a 9f 00 cc 89 1b 33 32 a2 26 e1 62 76 |.C.......32.&.bv| -00000330 30 07 5d 0e 17 03 03 00 99 22 4f 7b 1f 73 59 91 |0.]......"O{.sY.| -00000340 1e dc 62 ce 8b 32 7f 7d 99 b0 71 7a fb 79 09 5a |..b..2.}..qz.y.Z| -00000350 2e 0c b4 f2 00 13 5d ae 7d ae 80 1c 5f 8a a1 99 |......].}..._...| -00000360 c9 20 39 a9 66 36 f0 2b de 2e 1d ef 1f e1 ce 34 |. 9.f6.+.......4| -00000370 9a db f7 7b 17 52 91 ac 76 ff 22 63 8c 07 dd 7d |...{.R..v."c...}| -00000380 72 eb 9b 34 0f e9 a4 43 6b e3 fa e1 00 e3 dc 65 |r..4...Ck......e| -00000390 7a 49 bf a6 cd 97 4f e9 49 ae 91 4c be c3 3a b1 |zI....O.I..L..:.| -000003a0 a1 ee 09 55 ce 87 e7 59 58 24 cb 43 16 c9 5f d6 |...U...YX$.C.._.| -000003b0 11 32 83 47 dd 14 8d 11 c9 29 ac b8 57 7d 1e 07 |.2.G.....)..W}..| -000003c0 34 cc 79 13 22 00 62 39 4c 7e 5f 89 dc 94 b9 ca |4.y.".b9L~_.....| -000003d0 d9 ef 17 03 03 00 35 6a 70 22 84 c0 ed d6 70 b1 |......5jp"....p.| -000003e0 d5 8c 29 f9 0d 03 69 d1 0e 4c 01 79 1b 97 2f 24 |..)...i..L.y../$| -000003f0 45 08 25 4e 56 58 7c d7 d1 79 67 73 7c e2 30 54 |E.%NVX|..ygs|.0T| -00000400 54 2f c0 e2 28 e3 5a 87 47 0f f9 33 |T/..(.Z.G..3| +00000060 d7 63 55 0e 0d 7b fb 09 a9 61 92 70 2b 52 9c 38 |.cU..{...a.p+R.8| +00000070 2d e8 2a 68 27 b7 15 3e 4a 1e 92 c8 08 7b 5c c9 |-.*h'..>J....{\.| +00000080 8d d4 aa 97 63 42 a5 3e 4b e8 7d 37 98 d9 8c a6 |....cB.>K.}7....| +00000090 e7 c7 45 9f 73 48 bd c3 14 82 67 5b bb 19 bd a5 |..E.sH....g[....| +000000a0 14 03 03 00 01 01 17 03 03 00 17 67 d9 cb 2b d1 |...........g..+.| +000000b0 d2 30 7d b3 3f c1 77 5a 6c 87 41 2c 29 83 36 19 |.0}.?.wZl.A,).6.| +000000c0 74 38 17 03 03 02 6d ac 0c 4f fe b5 93 6a fa 9f |t8....m..O...j..| +000000d0 e9 76 a7 c3 8a bb 4a 64 7a 04 35 58 e6 a2 d8 7a |.v....Jdz.5X...z| +000000e0 cf 99 1c 60 13 1a ca c6 e6 10 11 7a f1 f4 be ec |...`.......z....| +000000f0 1d 2d db b1 a5 3a dd 7e 10 2b 65 ca 40 b2 5f fc |.-...:.~.+e.@._.| +00000100 3f c9 df 7d 26 c1 fc b7 2d 67 a1 2d a2 22 b3 40 |?..}&...-g.-.".@| +00000110 79 d4 c8 b6 73 f7 93 8a 97 4f b7 ab b6 0c ca 14 |y...s....O......| +00000120 3c 1e 6c 27 c0 be 01 d7 98 ef 93 78 f5 14 15 21 |<.l'.......x...!| +00000130 4c f8 8e a6 f7 72 b2 b7 bc c2 3e 9b b7 e4 0d 15 |L....r....>.....| +00000140 b5 69 75 e9 61 10 e4 d5 8e 60 44 88 bf 5f df f9 |.iu.a....`D.._..| +00000150 8d 70 54 4e f6 0f 37 70 ff b8 6b c0 4f fb 61 c1 |.pTN..7p..k.O.a.| +00000160 48 00 96 9b da 05 0f 78 7a 87 f5 b1 69 f6 4f 8e |H......xz...i.O.| +00000170 80 74 7b e0 e5 b7 0f ba 7d 9d 4c ff c9 d7 7c b9 |.t{.....}.L...|.| +00000180 f0 bd dd 34 8e 77 5f 3b 48 10 10 6f ed c7 84 15 |...4.w_;H..o....| +00000190 7a 0c 26 3e 5d 9d 58 07 02 8c e3 fa f0 6b 86 df |z.&>].X......k..| +000001a0 76 af 3c 13 c4 93 28 7a 17 04 98 91 26 72 5f aa |v.<...(z....&r_.| +000001b0 cf b2 9e 37 a9 93 12 bd 1d 92 64 b8 82 60 b0 b5 |...7......d..`..| +000001c0 1d 2c 4e 18 24 11 3b 52 33 05 f0 3b f2 27 ed a6 |.,N.$.;R3..;.'..| +000001d0 f6 4a 82 b6 df 05 a0 07 a3 9d 73 0a 3c 7f 02 47 |.J........s.<..G| +000001e0 60 c8 aa 20 b4 9c cd 48 12 a3 82 fe 99 4e 0c bb |`.. ...H.....N..| +000001f0 ec 4f 10 75 26 99 a4 ed 5e 4a 34 51 38 88 2c 3c |.O.u&...^J4Q8.,<| +00000200 0b 8d f8 65 84 38 47 c8 31 30 82 71 3f 54 e3 3f |...e.8G.10.q?T.?| +00000210 f1 e6 2c ef a3 fe 02 34 16 58 21 55 6e 0f 95 d3 |..,....4.X!Un...| +00000220 3e 18 e5 c4 fa 95 65 07 d8 4b 31 4b fa a7 85 74 |>.....e..K1K...t| +00000230 6c 1c a3 7c 7b c6 20 e0 1f 28 33 6d 61 93 d0 7d |l..|{. ..(3ma..}| +00000240 e7 c4 5c 27 c9 d9 ca f9 fe 21 6f 7f 05 34 37 54 |..\'.....!o..47T| +00000250 30 59 68 e1 04 36 60 52 d7 fc 4f 8c 67 f6 42 88 |0Yh..6`R..O.g.B.| +00000260 bc 41 5f 8e 2c 05 dd 6a b0 49 6c d8 8e 9c 9e 06 |.A_.,..j.Il.....| +00000270 35 f9 f1 33 f2 54 b0 3f 9e bd 4f c7 48 aa a3 9e |5..3.T.?..O.H...| +00000280 fe 69 79 16 e0 5a ca 48 72 fe 52 4a f1 6f f1 e0 |.iy..Z.Hr.RJ.o..| +00000290 8c fe 16 15 ce c9 87 dc 9b 66 4d 3a bb 05 21 82 |.........fM:..!.| +000002a0 21 65 cb 7b da 06 1a 0b 53 ee 60 e4 79 0f bc 5d |!e.{....S.`.y..]| +000002b0 b6 52 fd 3b 33 28 97 6c 67 d7 ab 3d b0 da bb ac |.R.;3(.lg..=....| +000002c0 0d d9 06 81 a3 6c 1f ad b8 05 20 63 2b c7 cb 4b |.....l.... c+..K| +000002d0 e2 96 6e 3d f1 9c 0a 6a c6 01 3e 3a d0 54 c8 09 |..n=...j..>:.T..| +000002e0 9b 17 a0 cc d6 d0 82 d1 02 a8 eb 9d 91 7e 30 b9 |.............~0.| +000002f0 3d 5e 6d 43 fc 50 f8 9f 80 67 7a e3 33 30 cd b7 |=^mC.P...gz.30..| +00000300 00 b3 bc 17 50 82 6c 80 67 bd c4 12 11 b1 53 22 |....P.l.g.....S"| +00000310 96 67 07 90 d4 54 5c f1 5d ca cd f8 b5 35 94 e0 |.g...T\.]....5..| +00000320 21 e6 58 d7 b0 32 ca 24 90 11 30 f5 2b 1d ca 3d |!.X..2.$..0.+..=| +00000330 6a 6d 35 fa 17 03 03 00 99 ad ab 79 79 28 a0 a9 |jm5........yy(..| +00000340 9a cd 6d 8d 8c 92 2e 83 3d d4 be c7 50 61 f5 49 |..m.....=...Pa.I| +00000350 97 6c ab 92 d4 a7 1a 6f fc 5b dd 6e 73 0d bd d2 |.l.....o.[.ns...| +00000360 09 52 9f c9 de bb 8d 09 0a 4f e0 c5 9a 08 79 4c |.R.......O....yL| +00000370 fc 01 b3 94 45 f6 1d bd 8d 23 62 14 14 65 4c 2a |....E....#b..eL*| +00000380 d9 ad 8f 76 5a 5e 9d da 68 37 c7 b1 54 1e b4 bd |...vZ^..h7..T...| +00000390 d3 15 b8 89 94 87 8b 17 17 0f 4c dc db a8 3b 2f |..........L...;/| +000003a0 e5 e2 25 d6 ec f6 f4 bb ab d0 c5 7f 2a cb c6 57 |..%.........*..W| +000003b0 84 50 3a e7 62 8b 76 ae 6a 06 6b 85 1c 23 f1 d1 |.P:.b.v.j.k..#..| +000003c0 10 e2 6f 57 8c 20 7d da 2d f8 bc c5 df 4e 7c 22 |..oW. }.-....N|"| +000003d0 d8 36 17 03 03 00 35 62 fa d4 65 7f 9a 97 5b ec |.6....5b..e...[.| +000003e0 25 4a 3a 43 18 08 08 fb 7f 9d 3b 73 64 9e f3 7a |%J:C......;sd..z| +000003f0 28 f1 a0 0e 00 7a 51 74 0e 6b 90 c6 39 7a 09 98 |(....zQt.k..9z..| +00000400 6e d8 63 cc 1f f0 8f bc 37 66 27 a0 |n.c.....7f'.| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 35 f1 7c 55 b2 e9 |..........5.|U..| -00000010 01 cd 57 d5 17 17 30 51 43 74 46 00 83 c7 d2 73 |..W...0QCtF....s| -00000020 2b ff 57 45 5c 13 d9 9e ec 56 c5 f1 d2 26 00 76 |+.WE\....V...&.v| -00000030 75 5c f0 3c 80 39 74 4e 38 72 35 39 a3 29 4d ff |u\.<.9tN8r59.)M.| -00000040 17 03 03 00 17 43 aa f1 73 de 22 92 8c 54 2c 3f |.....C..s."..T,?| -00000050 c6 f2 f1 07 27 b2 f6 0e 54 79 4d 05 17 03 03 00 |....'...TyM.....| -00000060 13 a5 64 ef ae 3f f0 52 08 71 9e 24 dc ea f1 50 |..d..?.R.q.$...P| -00000070 b5 27 20 54 |.' T| +00000000 14 03 03 00 01 01 17 03 03 00 35 ba 59 57 3e a3 |..........5.YW>.| +00000010 cd 02 7f 7c c2 16 f5 6b ec 42 66 aa a2 7a 3d 47 |...|...k.Bf..z=G| +00000020 43 c9 02 4b a3 72 d0 4d fa f8 32 28 1a 19 16 6a |C..K.r.M..2(...j| +00000030 7c 0e 4a 75 80 94 34 fe 30 7b d0 52 15 48 10 30 ||.Ju..4.0{.R.H.0| +00000040 17 03 03 00 17 5d de 53 df 00 21 ca 6d 69 ff 45 |.....].S..!.mi.E| +00000050 2e 53 57 db 3f 8d d8 6c 5a e1 f8 cc 17 03 03 00 |.SW.?..lZ.......| +00000060 13 43 d9 94 95 41 af 1d 80 a7 f2 28 2a 44 50 8d |.C...A.....(*DP.| +00000070 41 8f 82 09 |A...| diff --git a/libgo/go/crypto/tls/testdata/Client-TLSv13-X25519-ECDHE b/libgo/go/crypto/tls/testdata/Client-TLSv13-X25519-ECDHE index 7de7d279b2b..4e3eb760e69 100644 --- a/libgo/go/crypto/tls/testdata/Client-TLSv13-X25519-ECDHE +++ b/libgo/go/crypto/tls/testdata/Client-TLSv13-X25519-ECDHE @@ -1,5 +1,5 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 f2 01 00 00 ee 03 03 00 00 00 00 00 |................| +00000000 16 03 01 00 f4 01 00 00 f0 03 03 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -7,84 +7,84 @@ 00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| 00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| 00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 73 00 05 00 05 01 00 00 00 00 00 0a 00 |...s............| -00000090 04 00 02 00 1d 00 0b 00 02 01 00 00 0d 00 18 00 |................| -000000a0 16 08 04 08 05 08 06 04 01 04 03 05 01 05 03 06 |................| -000000b0 01 06 03 02 01 02 03 ff 01 00 01 00 00 12 00 00 |................| -000000c0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| -000000d0 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 |&.$... /.}.G.bC.| -000000e0 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| -000000f0 90 99 5f 58 cb 3b 74 |.._X.;t| +00000080 01 00 00 75 00 05 00 05 01 00 00 00 00 00 0a 00 |...u............| +00000090 04 00 02 00 1d 00 0b 00 02 01 00 00 0d 00 1a 00 |................| +000000a0 18 08 04 04 03 08 07 08 05 08 06 04 01 05 01 06 |................| +000000b0 01 05 03 06 03 02 01 02 03 ff 01 00 01 00 00 12 |................| +000000c0 00 00 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 |...+............| +000000d0 33 00 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 |3.&.$... /.}.G.b| +000000e0 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| +000000f0 c2 ed 90 99 5f 58 cb 3b 74 |...._X.;t| >>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 cd c7 29 34 e2 |....z...v....)4.| -00000010 96 86 e5 32 80 01 ea b9 3f d1 c5 90 da 7d 6e b9 |...2....?....}n.| -00000020 6f c2 f3 de 0f 16 7c c6 be 22 9f 20 00 00 00 00 |o.....|..". ....| +00000000 16 03 03 00 7a 02 00 00 76 03 03 5d 2e e6 ba 34 |....z...v..]...4| +00000010 6c 42 bb 48 58 fe c5 f0 95 f9 34 11 04 b5 2a f4 |lB.HX.....4...*.| +00000020 f1 16 41 db 14 a0 19 d8 43 7c 09 20 00 00 00 00 |..A.....C|. ....| 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 71 |..+.....3.$... q| -00000060 a3 1e 19 38 17 d7 fb c4 d7 c0 c5 0b 1a 4f 43 b8 |...8.........OC.| -00000070 36 73 5b ba ac 71 44 76 e5 18 a8 5f f0 e9 53 14 |6s[..qDv..._..S.| -00000080 03 03 00 01 01 17 03 03 00 17 2b d0 f2 01 36 99 |..........+...6.| -00000090 3c fe 38 af 22 1c 4f ec 1f 31 a2 48 31 a4 b9 83 |<.8.".O..1.H1...| -000000a0 74 17 03 03 02 6d 87 69 ac 88 28 88 6e 62 c8 96 |t....m.i..(.nb..| -000000b0 b9 32 1a 3d f6 a3 10 70 06 bd a6 3b d1 e4 a6 3a |.2.=...p...;...:| -000000c0 be e0 93 61 27 d4 bf 1f b0 17 f0 19 b3 30 e1 5e |...a'........0.^| -000000d0 94 18 13 78 9b 9d d5 16 b2 c7 8a 21 54 c9 f0 31 |...x.......!T..1| -000000e0 09 5b 6c 7f 22 79 9f 33 66 b7 e7 ea d4 11 63 5f |.[l."y.3f.....c_| -000000f0 05 21 e2 1a 66 96 ac 62 10 be 4b 51 73 df 29 9e |.!..f..b..KQs.).| -00000100 71 92 1a cb d2 d3 99 0c a7 35 7d 12 b4 44 d7 96 |q........5}..D..| -00000110 2b 29 9d 49 70 11 8c f8 5c 80 a4 98 56 21 66 2b |+).Ip...\...V!f+| -00000120 ac 72 1c 2e 86 e3 62 d2 e5 f1 7f 58 97 7b ac 85 |.r....b....X.{..| -00000130 a8 c1 99 62 3b 8c 7f 47 95 09 e7 dc 7d 31 ed d2 |...b;..G....}1..| -00000140 9b f8 71 fb 15 9c 80 1c cc 28 dd 4d ef 95 89 92 |..q......(.M....| -00000150 1f e8 c0 c3 78 b9 8f 92 88 e9 57 f6 2b 30 90 f1 |....x.....W.+0..| -00000160 27 b8 d8 65 0e 12 6d 51 9c e8 f2 5d b0 58 90 88 |'..e..mQ...].X..| -00000170 22 e3 fb 0e 2e 1f 6b 6b a2 8e 52 2c a7 2a 32 03 |".....kk..R,.*2.| -00000180 a4 e9 fc b7 e4 ec f5 73 37 fc bb d3 62 68 90 3d |.......s7...bh.=| -00000190 69 02 65 d5 35 6c 9b 89 68 c2 93 df 84 e3 f0 5f |i.e.5l..h......_| -000001a0 35 c7 05 d1 4d 60 93 b9 1d 5e 39 78 fd ed 85 f7 |5...M`...^9x....| -000001b0 1b 82 f6 cc 0a 02 5e f6 e0 7a 78 55 3a 12 e3 b3 |......^..zxU:...| -000001c0 45 ab 7e f0 12 2e 28 11 fd 73 7e 05 ef e1 c2 a0 |E.~...(..s~.....| -000001d0 45 ac 2e 3c 0b 00 69 ad 01 78 c7 2b 15 4e 6b eb |E..<..i..x.+.Nk.| -000001e0 65 3d d8 c2 4b e6 9d 73 35 62 4f 58 d1 ec 7f 8d |e=..K..s5bOX....| -000001f0 6e 56 66 06 cf 90 56 09 70 53 bd ed 16 ff c1 14 |nVf...V.pS......| -00000200 7f 1b 13 80 73 d2 7d f3 85 99 bd f2 f8 16 65 00 |....s.}.......e.| -00000210 97 51 12 64 7a 34 20 b1 1a d9 fb 5c 38 e6 b7 ae |.Q.dz4 ....\8...| -00000220 99 34 6d 1a 87 30 09 96 13 04 f9 4d 51 b7 f5 76 |.4m..0.....MQ..v| -00000230 30 ac 18 05 ba e4 0e 3d 28 6e 09 5e ec 52 18 d4 |0......=(n.^.R..| -00000240 1e da d3 7e b4 16 ff 76 4e 31 10 42 5a 7e 75 ea |...~...vN1.BZ~u.| -00000250 86 82 4e ad 7a 11 1d a8 6b ab 5c 7d bd 7b 07 b8 |..N.z...k.\}.{..| -00000260 aa bb 13 57 4a 24 d1 92 1d bb b9 7b 46 8b 7e 69 |...WJ$.....{F.~i| -00000270 9c a5 ea a6 9d 20 42 b1 92 4f b6 0e 48 8a 29 be |..... B..O..H.).| -00000280 67 19 b8 5b 27 7f fd c0 7e b1 01 e0 19 42 bb 19 |g..['...~....B..| -00000290 c4 91 b0 52 3e 0b 4c a6 2b 03 ff e3 e2 b9 d7 54 |...R>.L.+......T| -000002a0 77 4c 04 83 c6 41 3b 8f ee 8a 70 d8 16 e7 02 6f |wL...A;...p....o| -000002b0 13 9c a4 22 1d 1b cc 9e 6a 0e e8 96 94 54 df 2e |..."....j....T..| -000002c0 8a 60 53 e2 45 30 7b 8f 46 d2 ab 0e c1 6d 75 e2 |.`S.E0{.F....mu.| -000002d0 cf 6c fe 9e 2d 31 af 9e 51 73 a6 39 02 ff 7b c2 |.l..-1..Qs.9..{.| -000002e0 da 66 d6 27 87 9d 51 99 c9 7e 1b e7 43 8d 1e dc |.f.'..Q..~..C...| -000002f0 49 93 0e 9c 47 5c d6 97 19 ee 80 6d 4f 92 9d 25 |I...G\.....mO..%| -00000300 ff ea bf ab 9a 64 a6 d4 70 80 5e 13 42 48 75 4e |.....d..p.^.BHuN| -00000310 8c c3 9b 17 03 03 00 99 7b 4a 09 b6 85 dc 5c 10 |........{J....\.| -00000320 76 05 e8 11 e1 bc 63 ec ec b8 19 14 f3 95 16 6b |v.....c........k| -00000330 2a a6 e1 ae b9 1c e0 5c 94 20 49 62 8c fd 76 7e |*......\. Ib..v~| -00000340 0e f9 9f ec 0d 01 47 4b 86 a8 b1 9f a2 bc 83 85 |......GK........| -00000350 de e8 e0 2f c4 a4 f6 90 72 57 38 ad 2e aa 1e 4f |.../....rW8....O| -00000360 d4 8b e1 a2 b8 ba 80 99 ad 57 09 72 98 1c 5b 7b |.........W.r..[{| -00000370 a7 35 a2 c5 4a be 76 14 ee d4 63 a9 96 5e 33 7c |.5..J.v...c..^3|| -00000380 0a e0 15 0d 14 19 f1 5a 5a e4 2c 9c 22 19 db e3 |.......ZZ.,."...| -00000390 ea ee a1 c6 f8 1d 22 cc 5c 34 94 fa af 02 b0 26 |......".\4.....&| -000003a0 8d 25 67 e6 f5 74 a9 38 38 37 57 ee 11 ac 0a 73 |.%g..t.887W....s| -000003b0 01 17 03 03 00 35 bf ef 2c 2e 6c ae 90 ba d7 e0 |.....5..,.l.....| -000003c0 99 b3 ea 42 db 8e ad 03 5b af 93 1e 35 3a fb f7 |...B....[...5:..| -000003d0 87 bc 90 b6 98 ad e2 e6 1c 24 3b c1 20 8c 1a 79 |.........$;. ..y| -000003e0 97 ad e3 8b 08 7b cc 7e 2b 98 fa |.....{.~+..| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 82 |..+.....3.$... .| +00000060 de 1b d1 83 7a e1 46 cc c7 36 15 62 48 07 6b f6 |....z.F..6.bH.k.| +00000070 eb 0a 53 a3 34 cd 34 ee cc 0c d0 c9 02 d5 38 14 |..S.4.4.......8.| +00000080 03 03 00 01 01 17 03 03 00 17 3d 0c 61 12 1b 55 |..........=.a..U| +00000090 6e f4 13 59 c8 4a e7 12 63 5d bf be 34 9f d7 2a |n..Y.J..c]..4..*| +000000a0 c2 17 03 03 02 6d 82 e8 43 93 e4 80 4d a7 d2 cf |.....m..C...M...| +000000b0 43 9d 71 8d cc 78 e8 e9 58 7e 28 53 57 6d 95 1e |C.q..x..X~(SWm..| +000000c0 fb 98 05 ec 66 47 d9 a1 6a b5 f4 28 09 4a 6c 4c |....fG..j..(.JlL| +000000d0 ee a0 1a 86 e7 29 c0 0e d8 e0 ca 2d bb 50 e4 34 |.....).....-.P.4| +000000e0 8d 66 be 54 b5 df 94 fc 69 0e a6 9a 76 8b 8f f5 |.f.T....i...v...| +000000f0 a9 01 1a 1d 8d b0 ae a9 0c 10 58 13 f9 91 80 43 |..........X....C| +00000100 69 f8 3f 03 14 8e 73 1a ce 52 72 86 3d 60 8b 0f |i.?...s..Rr.=`..| +00000110 38 e7 4b 43 f0 b3 4b 12 3a a7 cd 4b ac ef 7d fb |8.KC..K.:..K..}.| +00000120 27 3a 38 36 ad a5 90 eb 57 80 47 99 bc c6 58 55 |':86....W.G...XU| +00000130 15 6f 53 f7 83 ca 2b 89 ae be 23 9a 83 3c 6b b1 |.oS...+...#..>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 35 ce 50 b5 dc 27 |..........5.P..'| -00000010 34 5b ea 1b 27 76 67 d1 9e 24 cf f9 51 4a 9a 6b |4[..'vg..$..QJ.k| -00000020 cd 57 12 b2 5a 52 03 be e8 62 e2 29 64 1e 16 f1 |.W..ZR...b.)d...| -00000030 61 af 70 a7 11 f1 41 ef e3 44 da 0e 9b 90 05 ad |a.p...A..D......| -00000040 17 03 03 00 17 b4 9d 4e de fb da 13 02 ad 51 40 |.......N......Q@| -00000050 b0 55 1d 89 ec 09 2b 52 e5 51 34 1f 17 03 03 00 |.U....+R.Q4.....| -00000060 13 52 89 42 ba d7 14 f0 53 b4 b1 5a a5 a3 37 55 |.R.B....S..Z..7U| -00000070 bd f8 e9 e5 |....| +00000000 14 03 03 00 01 01 17 03 03 00 35 7d 5e 95 38 a2 |..........5}^.8.| +00000010 d3 f4 04 59 57 2a 1a 86 ac 12 8e 17 88 fb 52 25 |...YW*........R%| +00000020 1d 19 2c c5 ac 57 c9 bf af 07 e7 c1 4d f3 dd f0 |..,..W......M...| +00000030 13 ad a1 73 07 32 a4 c5 7c 9e ad 5a 88 59 57 4b |...s.2..|..Z.YWK| +00000040 17 03 03 00 17 e2 65 4f bd 1f bb 00 a1 6b ae a4 |......eO.....k..| +00000050 9d d3 d2 6e 7b 62 b5 09 19 d6 8f 1b 17 03 03 00 |...n{b..........| +00000060 13 96 de 94 2b a7 bb c5 4b 7e 02 b2 27 07 4d 49 |....+...K~..'.MI| +00000070 32 2b 83 48 |2+.H| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN b/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN index ec9bf724362..0d9f63b0066 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 e3 01 00 00 df 03 03 2d 48 5c c5 05 |...........-H\..| -00000010 19 52 14 d8 ed 53 5d 30 50 4d 3a ae d9 58 53 96 |.R...S]0PM:..XS.| -00000020 0a ce fb 18 ed ef f1 57 fe 42 75 00 00 38 c0 2c |.......W.Bu..8.,| +00000000 16 03 01 00 e3 01 00 00 df 03 03 24 c0 b7 bd da |...........$....| +00000010 2a 23 bd 6f a0 8f 94 be 7c 14 56 ad fd a8 87 3f |*#.o....|.V....?| +00000020 c1 97 38 14 7a d4 30 28 11 c4 b5 00 00 38 c0 2c |..8.z.0(.....8.,| 00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..| 00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....| 00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<| @@ -60,37 +60,37 @@ 000002a0 d3 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 |.;..............| 000002b0 1d 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb |. /.}.G.bC.(.._.| 000002c0 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb |).0.........._X.| -000002d0 3b 74 08 04 00 80 0a 5e 25 64 2c 25 6d 9d 7d da |;t.....^%d,%m.}.| -000002e0 18 0a 9b ff c7 6a 0b 89 ed f8 96 00 70 6f ab 35 |.....j......po.5| -000002f0 d3 3b 56 cc a1 78 c8 60 4e 50 12 1a 59 02 d9 4c |.;V..x.`NP..Y..L| -00000300 07 21 03 65 62 9c a4 06 2d ce 34 68 c8 01 57 f1 |.!.eb...-.4h..W.| -00000310 b5 33 a0 00 72 9f e8 46 87 7c 18 65 e2 2a 18 5e |.3..r..F.|.e.*.^| -00000320 d3 9d 60 bc cf b8 38 10 2d 21 c0 9e 2c 5d 89 4c |..`...8.-!..,].L| -00000330 93 27 02 6b 5a 04 02 60 b0 f0 3f 7c 54 aa 9a f1 |.'.kZ..`..?|T...| -00000340 30 10 50 31 36 0e 87 0c 86 29 53 92 3b 91 24 72 |0.P16....)S.;.$r| -00000350 79 6d 5c 09 15 19 16 03 03 00 04 0e 00 00 00 |ym\............| +000002d0 3b 74 04 01 00 80 8a b8 11 46 fc 88 8d f3 7d 22 |;t.......F....}"| +000002e0 e0 1e d6 ac 45 79 e7 4d fa 46 df 6d a2 b2 67 38 |....Ey.M.F.m..g8| +000002f0 73 73 d9 20 9e 7c a1 a0 01 0c e7 e3 08 b2 f9 db |ss. .|..........| +00000300 97 82 c9 1e 27 33 f6 69 5b 8d 3c ca a8 a3 34 d5 |....'3.i[.<...4.| +00000310 70 ac f6 62 6e 80 5d 5b 6e 1e bd 2d 27 d2 6d c3 |p..bn.][n..-'.m.| +00000320 ca 08 8c fc ea 94 d2 99 49 d8 5f 30 6a a2 d9 c4 |........I._0j...| +00000330 f2 17 d9 50 9e 82 9c 95 93 6d 7c b6 18 16 84 92 |...P.....m|.....| +00000340 31 29 bd a0 df ed 09 ab bf 32 ca c5 26 67 bb 28 |1).......2..&g.(| +00000350 78 1b c6 5b 7a 21 16 03 03 00 04 0e 00 00 00 |x..[z!.........| >>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 2e 56 a8 73 0e 9c |....%...! .V.s..| -00000010 90 0d aa 07 77 a8 09 17 61 e2 11 5c 3a f6 33 6d |....w...a..\:.3m| -00000020 be 6b 08 77 8a 0d eb 68 2f 21 14 03 03 00 01 01 |.k.w...h/!......| -00000030 16 03 03 00 28 a7 07 30 a2 67 4f 2d 2f 5f 52 7c |....(..0.gO-/_R|| -00000040 11 81 d0 ea 37 51 73 8a fc 35 fc 58 b2 e6 6b b7 |....7Qs..5.X..k.| -00000050 66 a9 f0 cf 16 e7 31 b6 83 58 d3 e4 58 |f.....1..X..X| +00000000 16 03 03 00 25 10 00 00 21 20 69 44 46 d1 ad ea |....%...! iDF...| +00000010 ac b6 dc 35 6a b1 06 77 57 e8 94 58 49 15 4b 35 |...5j..wW..XI.K5| +00000020 7c c9 40 a0 75 37 f0 77 79 0c 14 03 03 00 01 01 ||.@.u7.wy.......| +00000030 16 03 03 00 28 2d 84 08 73 fc f7 b7 8d 07 63 4a |....(-..s.....cJ| +00000040 c4 42 37 b6 cd e1 87 9f 4f 3b 4e 8c a5 3f 95 67 |.B7.....O;N..?.g| +00000050 74 02 9a f1 d1 39 0c 7b 7b 8e 82 79 28 |t....9.{{..y(| >>> Flow 4 (server to client) 00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP| 00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.| 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| -00000030 6f ec 80 83 61 8a 3f 4b ad 3f 5f 7d 74 f9 cc 19 |o...a.?K.?_}t...| -00000040 2b 27 d5 b0 1b 12 9a 8c 82 0f e5 b5 99 f8 0d 10 |+'..............| -00000050 88 4a b2 65 62 bc a0 c2 2d 97 79 ad 69 58 08 fa |.J.eb...-.y.iX..| -00000060 6e 3b a7 b5 cb 33 94 de ff b6 49 87 3d d4 c7 0d |n;...3....I.=...| -00000070 65 a6 a7 66 f9 40 27 b1 e2 28 9a b2 db 82 ab 0f |e..f.@'..(......| -00000080 d8 f6 10 ab f7 d3 d9 14 03 03 00 01 01 16 03 03 |................| -00000090 00 28 00 00 00 00 00 00 00 00 09 75 fa e0 ab f5 |.(.........u....| -000000a0 d4 57 a8 a0 0d 15 d1 25 1f b4 f3 2e 39 a3 91 75 |.W.....%....9..u| -000000b0 5c 37 5e 26 61 6b 95 2f 41 8a 17 03 03 00 25 00 |\7^&ak./A.....%.| -000000c0 00 00 00 00 00 00 01 64 6b d0 f8 a2 9c 0f 95 11 |.......dk.......| -000000d0 e6 05 f2 3c 24 c0 d2 95 7f f1 cc 65 ef 5c 6d 80 |...<$......e.\m.| -000000e0 1d c9 67 f5 15 03 03 00 1a 00 00 00 00 00 00 00 |..g.............| -000000f0 02 f2 91 0d 39 58 1d 72 61 6e 60 36 96 03 1e 63 |....9X.ran`6...c| -00000100 e4 d1 4c |..L| +00000030 6f ec 80 83 61 f2 44 31 c6 93 15 b9 27 68 bc ab |o...a.D1....'h..| +00000040 b1 7f 48 8d 99 54 9c 9c 2e 36 11 6f 38 e7 3f 79 |..H..T...6.o8.?y| +00000050 f9 f1 a5 5d 36 9a 1a 4c 7c f2 ad 84 f4 13 a7 be |...]6..L|.......| +00000060 e4 79 39 c6 31 33 94 81 cf d3 85 2e 29 02 44 a8 |.y9.13......).D.| +00000070 61 4d 70 c3 dd ed b4 a2 f2 4b 44 c0 d5 af 19 8b |aMp......KD.....| +00000080 3f e5 fa fa ba dd 2d 14 03 03 00 01 01 16 03 03 |?.....-.........| +00000090 00 28 00 00 00 00 00 00 00 00 f0 16 42 20 de 60 |.(..........B .`| +000000a0 a4 a7 12 85 e5 cb b6 53 eb 76 7f 89 62 76 e8 46 |.......S.v..bv.F| +000000b0 69 a6 bd 1e f5 5e 13 18 1d d3 17 03 03 00 25 00 |i....^........%.| +000000c0 00 00 00 00 00 00 01 47 51 00 3f dd 64 0c 6f 43 |.......GQ.?.d.oC| +000000d0 d1 cb 25 22 45 af ee 64 5f a7 6e cf 6c 7e 26 b3 |..%"E..d_.n.l~&.| +000000e0 7e cd f0 71 15 03 03 00 1a 00 00 00 00 00 00 00 |~..q............| +000000f0 02 01 f4 16 18 8e 29 27 34 58 c4 9a f8 a7 58 3a |......)'4X....X:| +00000100 2e 4a 32 |.J2| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch b/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch index 90f146b5bad..ced69a2acf8 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 e3 01 00 00 df 03 03 fc a5 8d 79 5f |..............y_| -00000010 01 7f 77 df 86 0f 60 10 0a 88 ad 68 7f 7b 3b 63 |..w...`....h.{;c| -00000020 46 a9 7e c6 4e 7c 47 b5 00 2f a7 00 00 38 c0 2c |F.~.N|G../...8.,| +00000000 16 03 01 00 e3 01 00 00 df 03 03 c8 61 61 3d 4e |............aa=N| +00000010 9a 5e 9e 0c 59 3f 23 e0 d8 ac d9 28 27 41 6a a0 |.^..Y?#....('Aj.| +00000020 fb 7e d3 5f 20 aa 40 6c df cb 07 00 00 38 c0 2c |.~._ .@l.....8.,| 00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..| 00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....| 00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<| @@ -59,38 +59,38 @@ 00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c 00 00 |.\!.;...........| 000002a0 a8 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 da |.... /.}.G.bC.(.| 000002b0 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........| -000002c0 5f 58 cb 3b 74 08 04 00 80 62 db d2 f4 17 c6 f2 |_X.;t....b......| -000002d0 73 d1 63 50 1f 26 96 af 9d bd cb 11 9a 95 c4 dd |s.cP.&..........| -000002e0 49 c3 9a 06 a3 8d 2a 1e b9 74 76 22 36 2e fd 08 |I.....*..tv"6...| -000002f0 a6 d1 9d 2e 20 75 e6 50 59 49 db 3f d9 b1 0e 81 |.... u.PYI.?....| -00000300 fb 16 25 67 0d 8b 1c af 35 95 59 d4 56 b2 9f 08 |..%g....5.Y.V...| -00000310 fd 85 68 46 30 59 2b 66 9e 86 b4 35 4c 4a 9f 6f |..hF0Y+f...5LJ.o| -00000320 8f 2b 8d 9f 19 c2 9a 4e 91 6e fe 56 cc 9b 39 e7 |.+.....N.n.V..9.| -00000330 8d e2 5e 07 55 16 76 e0 7f 8b aa 0e 36 94 9f 78 |..^.U.v.....6..x| -00000340 bd 06 a2 65 a3 f5 83 04 97 16 03 03 00 04 0e 00 |...e............| +000002c0 5f 58 cb 3b 74 04 01 00 80 a6 d5 2b cf 48 32 3e |_X.;t......+.H2>| +000002d0 09 74 c1 e4 2a 69 49 d7 bc ce 5a b7 55 e5 e1 f4 |.t..*iI...Z.U...| +000002e0 cc 3f 64 90 8a 58 e6 86 58 8b d7 94 60 d4 4e a9 |.?d..X..X...`.N.| +000002f0 e4 e1 45 f1 7b 14 79 d0 9f 5c e3 17 79 61 f3 7a |..E.{.y..\..ya.z| +00000300 0e e6 cc 7c ff d8 61 29 51 eb 36 f6 f1 57 2e c0 |...|..a)Q.6..W..| +00000310 43 de 54 fd 92 c7 d7 7a 54 77 f3 3f cf 53 b1 1f |C.T....zTw.?.S..| +00000320 57 53 7c 6d a3 74 b5 de ae 0b 22 1f 2c 3e d0 41 |WS|m.t....".,>.A| +00000330 04 7f df d8 d8 44 8d 8e 97 27 71 bc ff 6c 7f b6 |.....D...'q..l..| +00000340 bd 05 17 2c 1f 84 c6 f1 64 16 03 03 00 04 0e 00 |...,....d.......| 00000350 00 00 |..| >>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 56 69 9c 58 80 3e |....%...! Vi.X.>| -00000010 72 ee ee b1 05 fd a0 a7 8d 78 9c 5a 7d e0 21 63 |r........x.Z}.!c| -00000020 d4 19 3c e2 b1 72 92 03 ed 6a 14 03 03 00 01 01 |..<..r...j......| -00000030 16 03 03 00 28 6b c0 b3 6e 77 df ef 99 2d 7a 93 |....(k..nw...-z.| -00000040 d5 9d 7f 1e 8c 36 eb 7c bb 32 f9 a1 b0 65 b3 85 |.....6.|.2...e..| -00000050 fb 33 64 9f 73 10 41 5a 01 6f d1 6b 73 |.3d.s.AZ.o.ks| +00000000 16 03 03 00 25 10 00 00 21 20 c8 8e d1 4e a9 96 |....%...! ...N..| +00000010 d4 73 45 b8 11 6e db db 00 f8 c0 c3 0e 96 62 c3 |.sE..n........b.| +00000020 7c 04 3b 4a 40 d6 f6 81 e9 0d 14 03 03 00 01 01 ||.;J@...........| +00000030 16 03 03 00 28 69 f9 fd 75 0d 63 bd ff 62 27 7b |....(i..u.c..b'{| +00000040 b2 28 b6 dc 55 c4 4b 10 f5 34 64 0d 85 a4 58 10 |.(..U.K..4d...X.| +00000050 ee d6 93 77 00 da 6e ab 5e 9f f4 62 41 |...w..n.^..bA| >>> Flow 4 (server to client) 00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP| 00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.| 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| -00000030 6f ec 80 83 61 59 7e 5a 0d 70 cc 83 b5 c8 ed d4 |o...aY~Z.p......| -00000040 79 ab 28 49 65 f8 52 5f 78 5a 83 1a d4 b6 76 fa |y.(Ie.R_xZ....v.| -00000050 b7 e3 ef 12 48 1b 73 42 18 ee 78 5a 4e 05 70 66 |....H.sB..xZN.pf| -00000060 1a 51 7b 20 e0 33 94 93 4f 86 e2 54 48 67 df 11 |.Q{ .3..O..THg..| -00000070 ca f2 6d 73 d1 06 3b 88 ef af 91 1c f0 fd 64 4f |..ms..;.......dO| -00000080 c8 d7 45 cb cc 90 14 14 03 03 00 01 01 16 03 03 |..E.............| -00000090 00 28 00 00 00 00 00 00 00 00 58 a6 55 c9 de bc |.(........X.U...| -000000a0 04 23 e7 85 cf 8c 44 d1 da ad c2 73 45 3e 42 f0 |.#....D....sE>B.| -000000b0 05 58 7e 7b 35 24 1c 86 93 1e 17 03 03 00 25 00 |.X~{5$........%.| -000000c0 00 00 00 00 00 00 01 c8 90 76 8e 60 ca b3 75 47 |.........v.`..uG| -000000d0 78 f2 5d a8 62 82 10 0f 3c b5 b6 51 d2 0b 40 40 |x.].b...<..Q..@@| -000000e0 66 b4 82 11 15 03 03 00 1a 00 00 00 00 00 00 00 |f...............| -000000f0 02 f4 16 23 56 26 87 e1 22 9f d3 30 e9 fa 99 a5 |...#V&.."..0....| -00000100 f0 5b 2c |.[,| +00000030 6f ec 80 83 61 8d 11 1d 31 eb f3 00 20 b3 0f 72 |o...a...1... ..r| +00000040 a0 7d 10 58 c8 5f da e2 cb 82 74 4d 99 0d bb 75 |.}.X._....tM...u| +00000050 f3 cb 1a 19 11 ba 70 90 82 9e ab 73 be a9 96 58 |......p....s...X| +00000060 96 b7 98 07 ba 33 94 81 e5 8e d1 39 08 10 01 df |.....3.....9....| +00000070 ba dd f7 b1 0c ce 71 96 f6 d2 8a 50 43 9a 56 b9 |......q....PC.V.| +00000080 2c 29 d7 05 5b 0d ea 14 03 03 00 01 01 16 03 03 |,)..[...........| +00000090 00 28 00 00 00 00 00 00 00 00 94 0f b0 0f 1a 43 |.(.............C| +000000a0 e1 77 b5 36 55 21 8a d5 7e ae 37 eb c5 7b dc aa |.w.6U!..~.7..{..| +000000b0 28 1b 00 2f 31 e2 5e ca 54 89 17 03 03 00 25 00 |(../1.^.T.....%.| +000000c0 00 00 00 00 00 00 01 eb 0e 33 bd 20 4f 18 db 26 |.........3. O..&| +000000d0 b3 48 21 a6 87 e2 a4 1f fe 84 ae 89 fe cf 41 20 |.H!...........A | +000000e0 f9 d4 41 67 15 03 03 00 1a 00 00 00 00 00 00 00 |..Ag............| +000000f0 02 f3 51 22 2e 4e 9e 87 4a 06 06 2f f6 88 0c cf |..Q".N..J../....| +00000100 6f 0f 9b |o..| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA b/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA index cbf7564050f..ce790fc16f1 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 cb 01 00 00 c7 03 03 7c ce 63 72 4d |...........|.crM| -00000010 0b d9 aa 2f b4 22 f4 e3 88 50 10 11 1a d9 ce 5d |.../."...P.....]| -00000020 db 14 d4 68 61 48 c1 2d 0d ad dd 00 00 38 c0 2c |...haH.-.....8.,| +00000000 16 03 01 00 cb 01 00 00 c7 03 03 44 af b1 f3 8d |...........D....| +00000010 81 78 a9 28 a4 31 99 bb 66 17 63 ed 70 88 b7 bb |.x.(.1..f.c.p...| +00000020 da ef 4d 1d a2 a6 9e 18 96 97 ec 00 00 38 c0 2c |..M..........8.,| 00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..| 00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....| 00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<| @@ -49,39 +49,39 @@ 00000210 0e bd 3f a3 8c 25 c1 33 13 83 0d 94 06 bb d4 37 |..?..%.3.......7| 00000220 7a f6 ec 7a c9 86 2e dd d7 11 69 7f 85 7c 56 de |z..z......i..|V.| 00000230 fb 31 78 2b e4 c7 78 0d ae cb be 9e 4e 36 24 31 |.1x+..x.....N6$1| -00000240 7b 6a 0f 39 95 12 07 8f 2a 16 03 03 00 b7 0c 00 |{j.9....*.......| -00000250 00 b3 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 |..... /.}.G.bC.(| +00000240 7b 6a 0f 39 95 12 07 8f 2a 16 03 03 00 b6 0c 00 |{j.9....*.......| +00000250 00 b2 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 |..... /.}.G.bC.(| 00000260 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 |.._.).0.........| -00000270 99 5f 58 cb 3b 74 04 03 00 8b 30 81 88 02 42 01 |._X.;t....0...B.| -00000280 f1 77 f4 3f e9 ed b7 55 54 25 08 68 ab b9 42 7c |.w.?...UT%.h..B|| -00000290 64 71 dc ce c0 13 23 20 f3 cd b7 68 09 23 6d c9 |dq....# ...h.#m.| -000002a0 c5 1f f3 3a 46 f1 e3 2b b4 92 6a 1c bd c8 60 7c |...:F..+..j...`|| -000002b0 da 63 0e c7 4f 4f c4 5e aa 30 b4 b1 3a d4 11 09 |.c..OO.^.0..:...| -000002c0 05 02 42 01 dd dc 50 07 2f 51 6c 75 7f 3f fd a2 |..B...P./Qlu.?..| -000002d0 68 62 1d 7a 49 78 4e 57 1b bc 3a 4d 02 84 d5 f6 |hb.zIxNW..:M....| -000002e0 2a 37 28 4e c0 30 2b a5 22 cc 28 d8 e0 66 2b 4d |*7(N.0+.".(..f+M| -000002f0 2a cd d8 01 3d 76 55 72 56 90 dc d0 99 85 ee 45 |*...=vUrV......E| -00000300 01 03 91 88 a5 16 03 03 00 04 0e 00 00 00 |..............| +00000270 99 5f 58 cb 3b 74 04 03 00 8a 30 81 87 02 42 01 |._X.;t....0...B.| +00000280 96 02 ab 3d 94 2b dc 27 07 6b 1b 59 21 f2 88 3b |...=.+.'.k.Y!..;| +00000290 de 7a ce 4e d6 a5 47 30 0d 79 ae a9 e0 cf 9c e7 |.z.N..G0.y......| +000002a0 0b 14 eb 44 bc a3 b9 5b cf 01 f0 2f be 63 3e 9f |...D...[.../.c>.| +000002b0 63 32 4e ce 4d 4c 70 86 dd 16 09 70 f7 3e 3b f6 |c2N.MLp....p.>;.| +000002c0 34 02 41 0a 0f a9 75 dd a8 21 40 8f 05 82 2f e0 |4.A...u..!@.../.| +000002d0 09 37 08 0a b6 a4 8a 1c fd 3e 4d 1b e3 19 e1 4d |.7.......>M....M| +000002e0 15 90 65 00 2f e0 15 bf 2b 23 b6 2b 44 7a 3f 1a |..e./...+#.+Dz?.| +000002f0 4c 82 3a 95 b9 ff 37 0a 1e f2 63 e3 b1 71 81 36 |L.:...7...c..q.6| +00000300 6d 23 3e 53 16 03 03 00 04 0e 00 00 00 |m#>S.........| >>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 5b 72 c3 fc 0c a5 |....%...! [r....| -00000010 a3 b1 e6 db 1d e7 f2 4a dd c8 36 97 25 f9 4c 74 |.......J..6.%.Lt| -00000020 68 04 e5 02 17 ca 67 e2 a6 59 14 03 03 00 01 01 |h.....g..Y......| -00000030 16 03 03 00 40 f0 40 1c 1a a9 d8 e7 88 c4 9d 6d |....@.@........m| -00000040 ad bd e7 5c c4 63 1a 06 5a e9 f5 39 6d 15 ac 41 |...\.c..Z..9m..A| -00000050 2f ed b9 3b f8 68 13 46 20 be 9b f9 be b6 8a cc |/..;.h.F .......| -00000060 f4 87 31 53 b3 ef 79 4e ce 73 ea a6 45 de 21 3e |..1S..yN.s..E.!>| -00000070 99 87 6a cb 4d |..j.M| +00000000 16 03 03 00 25 10 00 00 21 20 e8 92 71 c8 12 80 |....%...! ..q...| +00000010 88 d0 7f 00 71 76 83 dc e6 e3 4c b6 e2 8a d2 0d |....qv....L.....| +00000020 61 7e 36 d9 a7 1d 6c 92 75 46 14 03 03 00 01 01 |a~6...l.uF......| +00000030 16 03 03 00 40 86 48 1a 6f 89 29 b3 8b c1 b6 ad |....@.H.o.).....| +00000040 b5 6f af eb 32 44 e9 8f c2 43 58 d1 71 ad 1f 13 |.o..2D...CX.q...| +00000050 2b e3 5c bc d5 07 8a 29 9d 30 40 cd 73 2d 0a 80 |+.\....).0@.s-..| +00000060 49 82 d5 2a 79 eb a5 3c 2e 69 ee 1a 3a d8 1a 69 |I..*y..<.i..:..i| +00000070 63 a6 30 8e 3f |c.0.?| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 10 1f 05 23 89 |..............#.| -00000020 1d 50 5f cb 33 09 57 70 32 fc 01 76 f8 e9 dc ec |.P_.3.Wp2..v....| -00000030 13 b6 70 95 24 55 52 21 ed e6 5e 59 45 9f c9 c0 |..p.$UR!..^YE...| -00000040 74 6d d1 2f e6 4d 7c 6e 1e 41 4c 17 03 03 00 40 |tm./.M|n.AL....@| +00000010 00 00 00 00 00 00 00 00 00 00 00 33 ab 9b d6 4a |...........3...J| +00000020 bb e7 06 b0 d4 7e 1a 7f 78 cb d1 7a 44 26 a7 e6 |.....~..x..zD&..| +00000030 93 42 ae ec d3 44 0c dd b0 74 1b d8 99 75 a2 69 |.B...D...t...u.i| +00000040 98 d4 ed 2c b8 a0 26 69 80 1c 7f 17 03 03 00 40 |...,..&i.......@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 e8 04 12 d8 cd fc 76 19 e0 27 c1 f2 12 66 d8 86 |......v..'...f..| -00000070 a8 25 b6 3f 13 aa 5c c5 43 c5 83 a1 c0 4a 7c c6 |.%.?..\.C....J|.| -00000080 7b d4 63 86 b8 87 d1 36 af 99 f3 6f 9d 7e 86 37 |{.c....6...o.~.7| +00000060 a5 0b 57 10 11 ca 9e fb f4 8b 24 86 c7 58 b9 4c |..W.......$..X.L| +00000070 9a 1d 6a 60 2b 7c b1 21 7e 00 f2 e5 00 6f ab 04 |..j`+|.!~....o..| +00000080 2f 14 97 ae 70 05 0d 18 31 57 51 4a 0c c7 10 84 |/...p...1WQJ....| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 f0 fe 4c 32 8b c2 63 78 6c ba de |.......L2..cxl..| -000000b0 b3 55 0f e4 32 38 53 5e 2b 32 5c b9 23 4a 84 b7 |.U..28S^+2\.#J..| -000000c0 6f 2f 86 54 11 |o/.T.| +000000a0 00 00 00 00 00 d2 56 41 e1 58 30 76 2e 6e 6f 13 |......VA.X0v.no.| +000000b0 3b 72 5d bf c4 5c ef 63 2e 0a f0 6a 3a 98 ec 97 |;r]..\.c...j:...| +000000c0 07 b3 08 94 0d |.....| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA b/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA index db7199d9a9e..8959740c3bc 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 cb 01 00 00 c7 03 03 39 27 e9 a6 45 |...........9'..E| -00000010 cf a6 18 8c f0 d1 fb 71 81 b6 bf 16 d7 75 af f2 |.......q.....u..| -00000020 1e 4f 4c 72 2a ce 66 52 a6 87 32 00 00 38 c0 2c |.OLr*.fR..2..8.,| +00000000 16 03 01 00 cb 01 00 00 c7 03 03 a6 9c 71 27 48 |.............q'H| +00000010 24 f6 58 48 c8 2c 32 88 c9 01 eb f0 87 14 ba 7f |$.XH.,2.........| +00000020 f0 53 2d fd a1 b2 0a 72 e4 48 8e 00 00 38 c0 2c |.S-....r.H...8.,| 00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..| 00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....| 00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<| @@ -57,35 +57,35 @@ 00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............| 000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| 000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| -000002c0 74 08 04 00 80 41 cd 5d a0 ba 92 1f 26 47 6d 72 |t....A.]....&Gmr| -000002d0 33 44 47 a4 80 66 d8 1c 17 93 1e 25 8e c3 8e 95 |3DG..f.....%....| -000002e0 9c ae b6 99 7e f6 80 3f b1 73 cc c3 db 7a 4b 40 |....~..?.s...zK@| -000002f0 a1 0b bc ff 0e 4b c1 67 11 b2 ca 33 06 41 f9 ac |.....K.g...3.A..| -00000300 56 dc f6 26 1b a3 04 2a 28 f9 47 0f 0b 56 05 73 |V..&...*(.G..V.s| -00000310 93 cb 12 45 4f 6b 93 5d 0f 4c ca d3 f5 64 e2 4a |...EOk.].L...d.J| -00000320 eb 36 bb 87 3f 71 9b 36 08 99 79 48 fc a6 02 d6 |.6..?q.6..yH....| -00000330 38 88 09 68 cf 71 e8 d4 51 f8 b1 77 70 42 8b 18 |8..h.q..Q..wpB..| -00000340 ab cd e1 52 d9 16 03 03 00 04 0e 00 00 00 |...R..........| +000002c0 74 04 01 00 80 10 af cc 7e b1 33 b1 87 08 e9 d5 |t.......~.3.....| +000002d0 b0 fc 70 a6 b6 f9 20 92 60 b2 01 90 e3 e2 0b 71 |..p... .`......q| +000002e0 4c b9 91 4e c7 28 60 cb b5 b7 d1 91 1f 01 f3 93 |L..N.(`.........| +000002f0 56 5b 14 91 bb e4 95 18 f5 0c 23 47 e6 4e d0 9e |V[........#G.N..| +00000300 2f 1a 4a d1 f5 08 71 c0 08 70 75 78 c1 c7 89 e4 |/.J...q..pux....| +00000310 b2 3c b9 49 c8 95 c7 ba 5b b0 04 20 18 b1 5a 3e |.<.I....[.. ..Z>| +00000320 2b 9f 7b 2b 9c f8 34 69 4b c2 a8 2f d1 73 ec d1 |+.{+..4iK../.s..| +00000330 c9 22 19 6b bc aa e4 d3 89 73 5a 88 27 75 4a b6 |.".k.....sZ.'uJ.| +00000340 c3 6d 32 b0 a2 16 03 03 00 04 0e 00 00 00 |.m2...........| >>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 b5 a5 bc 9f 09 79 |....%...! .....y| -00000010 25 1a 7b af 52 0f 8a c2 16 a8 20 8d 0c 11 26 11 |%.{.R..... ...&.| -00000020 32 79 35 b9 2f ee 63 ce b7 49 14 03 03 00 01 01 |2y5./.c..I......| -00000030 16 03 03 00 40 d8 eb b7 d7 b4 a6 62 a1 8d c6 a5 |....@......b....| -00000040 5f 15 8e 1f de d9 98 90 3b d8 dd b1 13 7e 49 9b |_.......;....~I.| -00000050 d4 82 15 b9 a9 31 ac ae eb 77 21 dc 9f e0 8e 5b |.....1...w!....[| -00000060 d8 ea 09 fc a2 35 64 af 8d 1a fb a3 f1 97 0e 09 |.....5d.........| -00000070 b4 5b c9 e9 19 |.[...| +00000000 16 03 03 00 25 10 00 00 21 20 f3 07 eb 86 c5 e2 |....%...! ......| +00000010 28 7c be 7e 34 8d c5 74 19 0b b3 cc ce ce 90 3f |(|.~4..t.......?| +00000020 ac 06 c8 9f 79 3d 42 08 e2 01 14 03 03 00 01 01 |....y=B.........| +00000030 16 03 03 00 40 9b 6d a1 1e ca fb 27 67 ca 7b 57 |....@.m....'g.{W| +00000040 60 f4 60 95 b4 56 fd 97 cb 58 c5 cb bc 04 87 1d |`.`..V...X......| +00000050 74 a5 98 ec 3c 6f 25 5a ef c5 af 21 4b 2e 5c 97 |t......F.....| +00000070 08 62 88 25 1f |.b.%.| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 3b 2a 79 f1 0d |...........;*y..| -00000020 65 b8 4a 2a aa a5 87 60 69 8f 8f 87 4b 21 24 9a |e.J*...`i...K!$.| -00000030 6e 07 f0 a4 be ce 3d 67 29 85 53 98 fb cf a1 ee |n.....=g).S.....| -00000040 b0 e0 52 61 c1 16 e5 09 b9 0b 9c 17 03 03 00 40 |..Ra...........@| +00000010 00 00 00 00 00 00 00 00 00 00 00 8e a1 9a 44 d4 |..............D.| +00000020 98 c6 5f 46 2f d9 e5 ac 78 b5 91 3f 15 89 6f fb |.._F/...x..?..o.| +00000030 39 79 65 0b c7 09 c7 fc eb 40 6d 8e 6d b7 8b 94 |9ye......@m.m...| +00000040 6f 30 5a a6 4c 9d 2a 13 ed f6 f4 17 03 03 00 40 |o0Z.L.*........@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 fe d7 63 a8 10 70 b8 2c 0c 95 da 92 84 2b d3 63 |..c..p.,.....+.c| -00000070 03 d8 19 94 68 d8 d2 da f7 e2 83 5b 24 78 87 0f |....h......[$x..| -00000080 ca ce 14 3a 8a d4 da b2 90 eb 6f 0e de 14 30 96 |...:......o...0.| +00000060 5b 96 f1 fa c4 5b a3 22 74 ef 8c 34 52 50 c6 86 |[....[."t..4RP..| +00000070 32 19 40 b8 80 54 d9 c2 6a 43 a2 c2 fe 07 dd 37 |2.@..T..jC.....7| +00000080 89 62 bd 68 6a 1e e7 d9 1f ba 3a 1a 83 13 1f 7c |.b.hj.....:....|| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 ab e5 6b f9 d3 a6 07 ce 0b 64 7e |.......k......d~| -000000b0 14 42 d3 17 6a d4 89 2c 37 7d cd ee 77 23 0c 60 |.B..j..,7}..w#.`| -000000c0 e0 db 35 5e 96 |..5^.| +000000a0 00 00 00 00 00 92 f0 3e 2e 3c d2 62 ce e8 2e 12 |.......>.<.b....| +000000b0 4e 1e 77 ba ff 61 97 f9 8e e8 d1 1b a0 00 3f 2c |N.w..a........?,| +000000c0 8c 5c 10 ac 05 |.\...| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven index 07a000a7b4e..b65a7b70f41 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 f9 a8 6c 6d 8e |.............lm.| -00000010 46 32 35 bb 63 0e 00 89 d0 e2 36 04 62 73 5f 1a |F25.c.....6.bs_.| -00000020 32 39 a1 a8 0d 5d 65 e1 3d 79 43 00 00 04 00 2f |29...]e.=yC..../| +00000000 16 03 01 00 97 01 00 00 93 03 03 75 b5 bf db ae |...........u....| +00000010 ee 3a 8d d7 23 e1 22 9a 42 d9 7a de ac 41 81 60 |.:..#.".B.z..A.`| +00000020 4d 05 6e f1 11 c5 c0 de 21 46 d2 00 00 04 00 2f |M.n.....!F...../| 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| @@ -51,10 +51,9 @@ 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 21 0d 00 00 1d 02 01 40 |;.......!......@| -000002a0 00 16 08 04 08 05 08 06 04 01 04 03 05 01 05 03 |................| -000002b0 06 01 06 03 02 01 02 03 00 00 16 03 03 00 04 0e |................| -000002c0 00 00 00 |...| +00000290 3b e9 fa e7 16 03 03 00 1d 0d 00 00 19 02 01 40 |;..............@| +000002a0 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 03 |................| +000002b0 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |...............| >>> Flow 3 (client to server) 00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| 00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| @@ -89,40 +88,40 @@ 000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| 000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| 00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| -00000210 03 03 00 86 10 00 00 82 00 80 9f 2d b7 51 a0 7b |...........-.Q.{| -00000220 1f 57 7c 20 9f 8a 3a 23 19 2a 3f 29 31 c9 97 12 |.W| ..:#.*?)1...| -00000230 fd 40 92 45 eb cd bf 45 19 b1 7a 80 14 22 a4 b7 |.@.E...E..z.."..| -00000240 68 7a 6e f9 c1 a3 3d 44 ad 22 b1 e1 ae 52 2c a7 |hzn...=D."...R,.| -00000250 fe 95 30 b7 cc 94 ce 9b 9d 94 ff 80 1f ca 75 90 |..0...........u.| -00000260 7e d5 20 15 eb 46 b4 78 d8 ca e0 42 fe a0 aa d5 |~. ..F.x...B....| -00000270 a3 69 34 61 1a 14 93 4e 1b 52 81 6f ae 90 59 3b |.i4a...N.R.o..Y;| -00000280 ac 7f a1 23 75 0b 97 7f 16 6f 85 99 68 b0 57 34 |...#u....o..h.W4| -00000290 de 0e 60 62 61 6d 31 a8 46 9a 16 03 03 00 92 0f |..`bam1.F.......| -000002a0 00 00 8e 04 03 00 8a 30 81 87 02 41 74 3c e9 2d |.......0...At<.-| -000002b0 47 15 d6 a5 e8 21 b6 2c d4 a4 83 3f ca 90 35 2f |G....!.,...?..5/| -000002c0 ae 36 26 81 49 ae 6c d9 d3 13 17 7f 8f 8a a0 2f |.6&.I.l......../| -000002d0 92 a2 6d 29 fb 09 6a 4d b5 ea bc f0 05 43 bc fa |..m)..jM.....C..| -000002e0 6c ab 89 25 84 21 78 1c f8 86 36 86 1b 02 42 00 |l..%.!x...6...B.| -000002f0 98 0a bf 1e ee 62 85 43 c1 6c f0 49 9b 9a 46 96 |.....b.C.l.I..F.| -00000300 32 24 66 3d 1e 09 e1 7e 47 af 6d d1 9e 5d 6f 85 |2$f=...~G.m..]o.| -00000310 74 dc 7e ac c9 2b b7 e3 40 0a 25 45 76 6b 6e 5c |t.~..+..@.%Evkn\| -00000320 6f 42 59 5e 5e a4 b3 3d 4a c2 d7 1c 91 74 15 f9 |oBY^^..=J....t..| -00000330 e3 14 03 03 00 01 01 16 03 03 00 40 57 f7 7c d6 |...........@W.|.| -00000340 1a da 14 09 b3 8f 75 cc c7 dd fe 2b 4d 11 3e 16 |......u....+M.>.| -00000350 09 5a a0 d7 c3 05 b6 28 75 27 58 64 37 af 46 28 |.Z.....(u'Xd7.F(| -00000360 74 a8 4d 9b c4 9d 5c 6c f2 e3 be 45 65 93 be 89 |t.M...\l...Ee...| -00000370 b6 5f 24 2b 26 3c d0 43 ce 05 91 c7 |._$+&<.C....| +00000210 03 03 00 86 10 00 00 82 00 80 6c 1d a3 55 fb a0 |..........l..U..| +00000220 be 6f 49 64 67 b8 da 1c 27 91 f4 5d d9 9d 7e f0 |.oIdg...'..]..~.| +00000230 53 86 15 96 93 b2 0d 11 1a cf 3c 76 5e 76 24 ac |S.........wJ._.| +00000270 5f 51 0d 12 61 19 f6 fe 7d f7 b7 06 0d b1 de 09 |_Q..a...}.......| +00000280 45 17 4b 2a 15 97 ce 96 c5 f5 27 95 fb e8 c5 67 |E.K*......'....g| +00000290 5e cb 8c 98 c7 c5 68 41 36 99 16 03 03 00 91 0f |^.....hA6.......| +000002a0 00 00 8d 04 03 00 89 30 81 86 02 41 48 35 40 6e |.......0...AH5@n| +000002b0 03 2a 43 fe f8 a9 c5 f9 c7 05 f8 db 13 5e ee bb |.*C..........^..| +000002c0 a8 59 5b fc b4 5d 0a ec 32 18 d5 a0 01 d5 81 a5 |.Y[..]..2.......| +000002d0 f3 8e 4f 91 54 c7 8f a1 c1 77 4c 94 5c e4 68 c2 |..O.T....wL.\.h.| +000002e0 0b 22 e2 70 0c 32 e2 9d 6e 47 e4 0d f7 02 41 2d |.".p.2..nG....A-| +000002f0 0e bb 28 47 90 23 68 f2 fd 9e 7d 13 f0 ad 40 ed |..(G.#h...}...@.| +00000300 cb 32 e5 9d 5e a7 e1 12 d7 de 10 bc 93 df cb 03 |.2..^...........| +00000310 4e 16 5a cf 8f 25 1e 39 ff 7c 9f 59 55 f0 df b4 |N.Z..%.9.|.YU...| +00000320 ce 43 6d 15 8f e3 ef 76 5d 0d a9 31 a9 24 c6 58 |.Cm....v]..1.$.X| +00000330 14 03 03 00 01 01 16 03 03 00 40 71 ca 10 08 a9 |..........@q....| +00000340 1a f1 78 9d 6f 2d 76 1c b0 2a f8 26 d2 f6 89 db |..x.o-v..*.&....| +00000350 25 50 63 cc bf 12 cb fb 39 93 91 7f 7f f7 e4 fe |%Pc.....9.......| +00000360 fc 28 d0 01 3b e9 f9 1b 6a 77 db 16 14 71 3d 35 |.(..;...jw...q=5| +00000370 67 de b8 1d e3 4a 02 bc cf 0a a6 |g....J.....| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 54 54 12 18 10 |...........TT...| -00000020 cf 34 c3 2d 68 91 25 8e 2f 04 26 74 c1 bc 96 a1 |.4.-h.%./.&t....| -00000030 65 a5 4e 88 58 fe 95 81 59 57 74 bf 0a 9d f9 98 |e.N.X...YWt.....| -00000040 cb e2 7d 39 64 3e f4 09 9d e2 aa 17 03 03 00 40 |..}9d>.........@| +00000010 00 00 00 00 00 00 00 00 00 00 00 0d f1 0c 52 89 |..............R.| +00000020 61 e6 21 95 8d 6f 5d e9 07 42 23 5f 1c 74 44 57 |a.!..o]..B#_.tDW| +00000030 38 a3 98 77 f2 62 99 71 d6 fe 03 a3 82 01 7a da |8..w.b.q......z.| +00000040 a5 fd 12 62 2b d2 1d e4 e2 51 25 17 03 03 00 40 |...b+....Q%....@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 82 e5 1d 01 10 a6 dd 52 42 b6 e7 8b 3f 45 03 39 |.......RB...?E.9| -00000070 f1 3c 27 73 f0 8b a7 98 99 e9 da b8 88 34 25 49 |.<'s.........4%I| -00000080 38 4d 6b 3a 8d f8 61 c8 b7 0d 80 4b 7b 83 e3 9a |8Mk:..a....K{...| +00000060 81 82 cc a9 4e 6f 78 41 28 b3 e6 c3 44 62 48 0b |....NoxA(...DbH.| +00000070 b3 70 f9 f8 7a fc c5 be 36 45 58 41 6f 77 69 40 |.p..z...6EXAowi@| +00000080 5b 6e fc 69 84 21 eb bc 95 36 e6 48 05 02 37 f5 |[n.i.!...6.H..7.| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 4c b8 9a e7 90 56 f7 ce 20 41 bf |.....L....V.. A.| -000000b0 44 f4 b7 85 ff 97 e9 43 4a 09 9e 7d 0e 91 1d 56 |D......CJ..}...V| -000000c0 2d eb fb 44 4b |-..DK| +000000a0 00 00 00 00 00 d3 2f 45 d3 65 3b 64 67 43 ef aa |....../E.e;dgC..| +000000b0 a7 bb 98 a0 99 70 7f 56 c6 13 b2 1b 62 35 62 ea |.....p.V....b5b.| +000000c0 51 75 94 be 32 |Qu..2| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given new file mode 100644 index 00000000000..0503b9def56 --- /dev/null +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given @@ -0,0 +1,111 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 cb 01 00 00 c7 03 03 ec bb 63 30 5c |.............c0\| +00000010 ea 49 54 dc 44 f7 80 47 c9 4d ff fa d4 77 44 8a |.IT.D..G.M...wD.| +00000020 ce 4b bd ce d7 95 b2 0d f7 2e 88 00 00 38 c0 2c |.K...........8.,| +00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..| +00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....| +00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<| +00000060 00 35 00 2f 00 ff 01 00 00 66 00 00 00 0e 00 0c |.5./.....f......| +00000070 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| +00000080 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| +00000090 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 30 |...............0| +000000a0 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| +000000b0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 03 03 |................| +000000c0 02 03 03 01 02 01 03 02 02 02 04 02 05 02 06 02 |................| +>>> Flow 2 (server to client) +00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 30 00 00 |...DOWNGRD...0..| +00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| +00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| +00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| +00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| +00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| +00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| +00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| +000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| +000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| +000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| +000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| +000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| +000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| +00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| +00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| +00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| +00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| +00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| +00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| +00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| +00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| +00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| +00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| +000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| +000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| +000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| +000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| +000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| +000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| +00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| +00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| +00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| +00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| +00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| +00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| +00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| +00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| +00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| +00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............| +000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| +000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| +000002c0 74 04 01 00 80 94 e2 09 13 e0 7c e8 6d 3b 50 f1 |t.........|.m;P.| +000002d0 4f f3 58 57 da 87 f4 61 f5 04 fc ec 0d 28 f1 e9 |O.XW...a.....(..| +000002e0 be 93 20 4a 17 03 17 b1 7f 2c 32 24 2e 02 35 67 |.. J.....,2$..5g| +000002f0 9f e7 55 0a 6d 3d af ef e3 b2 27 2e ae 12 cd 2c |..U.m=....'....,| +00000300 d9 e1 60 d6 64 94 f5 f2 42 54 43 23 70 36 fe 8e |..`.d...BTC#p6..| +00000310 d2 0b a3 cf fd 04 74 6e 55 9b 7a 86 c8 dd 0d 40 |......tnU.z....@| +00000320 bc b1 4e 05 c2 7f b4 40 3a d9 66 01 af ee fb 54 |..N....@:.f....T| +00000330 b6 cc e4 5b a2 1a 39 dc 25 7d 5d 8c 37 a1 15 ae |...[..9.%}].7...| +00000340 ed 16 b5 25 14 16 03 03 00 1d 0d 00 00 19 02 01 |...%............| +00000350 40 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 |@...............| +00000360 03 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |................| +>>> Flow 3 (client to server) +00000000 16 03 03 01 3c 0b 00 01 38 00 01 35 00 01 32 30 |....<...8..5..20| +00000010 82 01 2e 30 81 e1 a0 03 02 01 02 02 10 17 d1 81 |...0............| +00000020 93 be 2a 8c 21 20 10 25 15 e8 34 23 4f 30 05 06 |..*.! .%..4#O0..| +00000030 03 2b 65 70 30 12 31 10 30 0e 06 03 55 04 0a 13 |.+ep0.1.0...U...| +00000040 07 41 63 6d 65 20 43 6f 30 1e 17 0d 31 39 30 35 |.Acme Co0...1905| +00000050 31 36 32 31 35 34 32 36 5a 17 0d 32 30 30 35 31 |16215426Z..20051| +00000060 35 32 31 35 34 32 36 5a 30 12 31 10 30 0e 06 03 |5215426Z0.1.0...| +00000070 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 2a 30 05 |U....Acme Co0*0.| +00000080 06 03 2b 65 70 03 21 00 0b e0 b5 60 b5 e2 79 30 |..+ep.!....`..y0| +00000090 3d be e3 1e e0 50 b1 04 c8 6d c7 78 6c 69 2f c5 |=....P...m.xli/.| +000000a0 14 ad 9a 63 6f 79 12 91 a3 4d 30 4b 30 0e 06 03 |...coy...M0K0...| +000000b0 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 |U...........0...| +000000c0 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 |U.%..0...+......| +000000d0 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 |.0...U.......0.0| +000000e0 16 06 03 55 1d 11 04 0f 30 0d 82 0b 65 78 61 6d |...U....0...exam| +000000f0 70 6c 65 2e 63 6f 6d 30 05 06 03 2b 65 70 03 41 |ple.com0...+ep.A| +00000100 00 fc 19 17 2a 94 a5 31 fa 29 c8 2e 7f 5b a0 5d |....*..1.)...[.]| +00000110 8a 4e 34 40 39 d6 b3 10 dc 19 fe a0 22 71 b3 f5 |.N4@9......."q..| +00000120 8f a1 58 0d cd f4 f1 85 24 bf e6 3d 14 df df ed |..X.....$..=....| +00000130 0e e1 17 d8 11 a2 60 d0 8a 37 23 2a c2 46 aa 3a |......`..7#*.F.:| +00000140 08 16 03 03 00 25 10 00 00 21 20 f1 58 f8 db 86 |.....%...! .X...| +00000150 a5 97 07 c8 fc c8 c1 fe e4 c9 35 13 44 f8 9b 7f |..........5.D...| +00000160 4a 22 6a 61 75 70 be 23 76 f4 5f 16 03 03 00 48 |J"jaup.#v._....H| +00000170 0f 00 00 44 08 07 00 40 fb ab 8f 44 f1 7b cb 95 |...D...@...D.{..| +00000180 e3 83 4b 85 d0 4f 41 a6 39 f8 ba c1 7c b5 7d f0 |..K..OA.9...|.}.| +00000190 45 5b 2d e2 90 80 27 1a b9 88 dd 4b 0d bc e8 1b |E[-...'....K....| +000001a0 d4 fc 69 d1 ac 59 d8 b3 0b b6 f7 ae 76 12 da 80 |..i..Y......v...| +000001b0 6b 39 98 5b 55 c4 c1 09 14 03 03 00 01 01 16 03 |k9.[U...........| +000001c0 03 00 28 46 3a 98 32 bf 61 b0 d2 74 f8 f4 65 ef |..(F:.2.a..t..e.| +000001d0 89 5b f5 ef 49 42 56 67 97 23 f2 18 de 06 30 86 |.[..IBVg.#....0.| +000001e0 77 66 ac 0a ac 88 98 ab 93 2b 20 |wf.......+ | +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| +00000010 00 00 00 49 81 2d e8 88 dc 52 2a 44 51 18 2e 62 |...I.-...R*DQ..b| +00000020 28 9e 91 7a 87 b5 fb 46 89 27 01 5e dc b1 12 00 |(..z...F.'.^....| +00000030 72 fe 34 17 03 03 00 25 00 00 00 00 00 00 00 01 |r.4....%........| +00000040 ab a1 6a 44 4b 80 a8 2e f4 75 ff 09 9f 11 05 74 |..jDK....u.....t| +00000050 93 ab 97 de 54 16 36 f9 0a 3c a1 89 c0 15 03 03 |....T.6..<......| +00000060 00 1a 00 00 00 00 00 00 00 02 2d 63 e8 72 ab 7b |..........-c.r.{| +00000070 20 de f4 73 05 4a 26 a1 78 7a 1c 02 | ..s.J&.xz..| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven index 37c813d559a..aa27d2c2317 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven @@ -1,11 +1,14 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 6b 01 00 00 67 03 03 e1 81 50 38 7b |....k...g....P8{| -00000010 dd e5 6f 1c 98 9e 2b 86 2d 50 95 de 00 b7 87 6e |..o...+.-P.....n| -00000020 b3 d2 20 0f 61 5c 3e 6d 19 0c 76 00 00 04 00 2f |.. .a\>m..v..../| -00000030 00 ff 01 00 00 3a 00 00 00 0e 00 0c 00 00 09 31 |.....:.........1| +00000000 16 03 01 00 97 01 00 00 93 03 03 de e6 7c 24 10 |.............|$.| +00000010 d1 3a 48 8f ba 9a cf 0f 4b 8d 81 8b 07 41 4f bd |.:H.....K....AO.| +00000020 46 9b c1 dc 24 51 aa 30 83 a2 49 00 00 04 00 2f |F...$Q.0..I..../| +00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| -00000060 00 16 00 00 00 17 00 00 00 0d 00 04 00 02 08 04 |................| +00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| +00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| +00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| +00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| >>> Flow 2 (server to client) 00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -48,77 +51,36 @@ 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 21 0d 00 00 1d 02 01 40 |;.......!......@| -000002a0 00 16 08 04 08 05 08 06 04 01 04 03 05 01 05 03 |................| -000002b0 06 01 06 03 02 01 02 03 00 00 16 03 03 00 04 0e |................| -000002c0 00 00 00 |...| +00000290 3b e9 fa e7 16 03 03 00 1d 0d 00 00 19 02 01 40 |;..............@| +000002a0 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 03 |................| +000002b0 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |...............| >>> Flow 3 (client to server) -00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| -00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| -00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| -00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| -00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| -00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| -00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| -00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| -00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| -00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| -000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| -000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| -000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| -000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| -000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| -000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| -00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| -00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| -00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| -00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| -00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| -00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| -00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| -00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| -00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| -00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| -000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| -000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| -000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| -000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| -000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| -000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| -00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 94 94 83 |.5..............| -00000210 d4 bf 82 86 72 fe 90 aa 36 eb 5a 10 df 59 58 f6 |....r...6.Z..YX.| -00000220 c9 ee 1f c8 00 d1 8d d6 6b 06 bf 73 84 ca cb ef |........k..s....| -00000230 08 ba 9f 10 94 70 0f a4 10 e1 de 62 c6 d8 ff e8 |.....p.....b....| -00000240 2f b1 9d 07 40 1f 34 d4 76 46 53 86 51 66 01 38 |/...@.4.vFS.Qf.8| -00000250 18 82 16 8c ff e7 29 83 c3 09 25 2d d9 a0 57 d0 |......)...%-..W.| -00000260 e0 6b 50 dd c2 4a 57 47 b0 1d 5c a0 a5 c3 69 14 |.kP..JWG..\...i.| -00000270 ec 10 ed 30 b4 c0 25 3c 65 d1 31 59 c1 30 9f 77 |...0..%...4%| -00000360 94 63 17 99 fc |.c...| +00000000 16 03 03 00 07 0b 00 00 03 00 00 00 16 03 03 00 |................| +00000010 86 10 00 00 82 00 80 2e 43 3b 39 9a be ef de 53 |........C;9....S| +00000020 4a 94 a3 a3 bd 92 93 44 e7 27 be f9 97 c9 1b fd |J......D.'......| +00000030 22 1b 6a 6c c3 79 87 45 01 a8 e0 ee 34 5a 23 61 |".jl.y.E....4Z#a| +00000040 25 e4 06 88 fd b5 0d a3 dc e4 64 02 14 7e 47 fb |%.........d..~G.| +00000050 3b 88 7d 7f a9 e2 63 64 1a 15 db c6 de 03 a0 ed |;.}...cd........| +00000060 3c 33 b6 2f cc 2a fe 44 8f d7 be 61 0f e5 ea 2f |<3./.*.D...a.../| +00000070 63 7f c1 fa bc de d3 fd 10 3e 89 48 2c cf ab 57 |c........>.H,..W| +00000080 ee b4 04 11 8c 2e 2d ec b9 e5 d0 ac e7 b7 4d 60 |......-.......M`| +00000090 fd fe 7f 88 f1 35 9b 14 03 03 00 01 01 16 03 03 |.....5..........| +000000a0 00 40 ae 7d 3a a0 36 5b 4c b2 fe d7 3d 8b e8 45 |.@.}:.6[L...=..E| +000000b0 f3 43 ae c4 d0 62 74 b5 44 38 3e f0 fd 68 f2 0b |.C...bt.D8>..h..| +000000c0 4a e6 b9 e8 59 4d 84 6a cd a3 83 5a 95 8f 7a a8 |J...YM.j...Z..z.| +000000d0 32 db b7 cd ef e8 5a dc 25 e5 1b 5f 02 7b e7 02 |2.....Z.%.._.{..| +000000e0 fd d1 |..| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 c6 b8 7e 65 f8 |.............~e.| -00000020 c4 d9 2c 00 11 f4 ae 2b 13 33 84 31 e6 e6 6e d5 |..,....+.3.1..n.| -00000030 b0 8c 12 c9 6d 26 c2 8c 9c d0 2e 1b 3d 68 98 27 |....m&......=h.'| -00000040 a2 f9 92 46 60 40 dc a6 12 c1 ee 17 03 03 00 40 |...F`@.........@| +00000010 00 00 00 00 00 00 00 00 00 00 00 18 1c 14 83 35 |...............5| +00000020 c3 40 2a 62 72 5d 6f 23 98 1e 1c cf 3c 1f 76 f0 |.@*br]o#....<.v.| +00000030 49 cb 62 80 32 e6 d8 6d 95 9b 58 47 2d 65 ff 25 |I.b.2..m..XG-e.%| +00000040 00 99 db 92 58 e0 e9 09 90 c3 72 17 03 03 00 40 |....X.....r....@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 70 ae c5 b1 11 36 22 4f 4b 11 cd 75 25 9c 8d 5e |p....6"OK..u%..^| -00000070 8b 3b f0 e0 fd 78 22 c7 e1 14 67 2e 12 13 53 44 |.;...x"...g...SD| -00000080 38 7b f9 53 08 90 c8 95 3a 16 b1 b0 81 ce 44 b3 |8{.S....:.....D.| +00000060 b5 9c b1 d1 30 6e 93 66 69 07 47 f6 31 ad e9 e1 |....0n.fi.G.1...| +00000070 c5 d4 5c 98 ac 00 41 cd 84 c3 56 61 b1 36 fd ad |..\...A...Va.6..| +00000080 7f c6 b1 27 1d ef b9 ba 43 a1 7e f4 71 d9 55 6e |...'....C.~.q.Un| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 a1 82 43 82 46 02 07 98 13 cc a1 |.......C.F......| -000000b0 9f bd 78 9d 7a d0 c3 cc e1 08 46 84 49 97 fb 5c |..x.z.....F.I..\| -000000c0 49 62 01 65 de |Ib.e.| +000000a0 00 00 00 00 00 3f 1a f4 80 31 9b 60 c0 28 76 79 |.....?...1.`.(vy| +000000b0 c1 8f 65 f6 d3 b6 6d 99 6d 11 fa bc a6 b8 bf 7f |..e...m.m.......| +000000c0 8b ca c5 a1 cd |.....| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled deleted file mode 100644 index cb626a11042..00000000000 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled +++ /dev/null @@ -1,126 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 9e b1 2a 26 04 |.............*&.| -00000010 8d 66 df 43 cb 0a 85 80 4f f2 99 7d 80 20 64 7e |.f.C....O..}. d~| -00000020 30 a0 bb 60 ac 0e d4 ce f0 ae 98 00 00 04 00 2f |0..`.........../| -00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| -00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| -00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| -00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| -00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| -00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| -00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| -00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| -00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| -00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| -00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| -00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| -000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| -000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| -000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| -000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| -000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| -000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| -00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| -00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| -00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| -00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| -00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| -00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| -00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| -00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| -00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| -00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| -000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| -000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| -000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| -000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| -000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| -000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| -00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| -00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| -00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| -00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| -00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| -00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| -00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| -00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| -00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 1b 0d 00 00 17 02 01 40 |;..............@| -000002a0 00 10 04 01 04 03 05 01 05 03 06 01 06 03 02 01 |................| -000002b0 02 03 00 00 16 03 03 00 04 0e 00 00 00 |.............| ->>> Flow 3 (client to server) -00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| -00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| -00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| -00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| -00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| -00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| -00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| -00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| -00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| -00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| -000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| -000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| -000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| -000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| -000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| -000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| -00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| -00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| -00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| -00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| -00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| -00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| -00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| -00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| -00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| -00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| -000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| -000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| -000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| -000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| -000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| -000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| -00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 3f 1b ee |.5...........?..| -00000210 02 ec a5 9f 6e 38 69 2c b7 03 89 65 b4 92 79 a0 |....n8i,...e..y.| -00000220 b2 0b ab 9b 44 9c 68 d1 8e 5c 40 9c b5 1c a5 70 |....D.h..\@....p| -00000230 00 a2 2e fb 98 b7 45 7b 9c 63 46 68 1d 55 9e 01 |......E{.cFh.U..| -00000240 7f 84 31 62 07 c4 2f 20 5f 1a 94 8c 1f f4 3a 6d |..1b../ _.....:m| -00000250 a8 2b b8 08 5b ec 27 e3 49 9e 51 b3 66 98 09 ba |.+..[.'.I.Q.f...| -00000260 64 65 c8 3c 11 fb 14 4a c9 ea 3c 5e 52 10 a0 0b |de.<...J..<^R...| -00000270 a9 fc 10 13 c9 99 0c a0 8b b4 40 66 0e 11 5e 1d |..........@f..^.| -00000280 8b 45 5c 4d 0d 39 39 f6 0c 59 8f 06 99 16 03 03 |.E\M.99..Y......| -00000290 00 88 0f 00 00 84 04 01 00 80 71 1c 9c fd b2 c9 |..........q.....| -000002a0 b9 7f f3 51 e2 63 96 08 56 d2 bd 19 61 9f 3f be |...Q.c..V...a.?.| -000002b0 e5 4c 22 a8 3f 81 98 2d 67 56 4e 2d 61 6e 51 e5 |.L".?..-gVN-anQ.| -000002c0 11 24 bd 1b 38 ba dc 8c 76 51 1d 3c 6e 81 50 9a |.$..8...vQ.| -00000330 8d 82 6c f3 04 55 2c 13 d9 5b 0a 73 88 4f 8b 3c |..l..U,..[.s.O.<| -00000340 cd ef 1a a7 15 7c 33 bb ff fa 01 c4 87 d7 df 47 |.....|3........G| -00000350 37 b6 fe 1d e6 82 c2 8a 33 b1 c9 ae 85 45 c8 0d |7.......3....E..| -00000360 38 47 69 2d 54 |8Gi-T| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 20 98 12 44 63 |........... ..Dc| -00000020 e7 77 e6 e8 c0 c7 d7 b6 f7 c4 4e 13 e3 79 af 33 |.w........N..y.3| -00000030 3b 6c 86 22 c5 9e dd 25 74 e5 7b 37 fb 24 c6 48 |;l."...%t.{7.$.H| -00000040 c9 74 a7 9b 9b 32 a7 c1 b9 bb e0 17 03 03 00 40 |.t...2.........@| -00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 80 d7 ec 51 cf ae d4 1a af 11 59 d1 0c 62 a6 67 |...Q......Y..b.g| -00000070 2e 6f 18 23 29 75 92 07 b1 16 09 8f 2d f8 04 fe |.o.#)u......-...| -00000080 ce 71 2c b6 00 fd 7b 53 cb 6d 97 06 06 e6 af f4 |.q,...{S.m......| -00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 73 14 3a 87 3b ca 3a 2b b2 52 30 |.....s.:.;.:+.R0| -000000b0 98 62 88 1b a7 58 66 47 66 72 fd bb b6 b7 6b 99 |.b...XfGfr....k.| -000000c0 20 ab e9 22 62 | .."b| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required deleted file mode 100644 index 86d5415cc8f..00000000000 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required +++ /dev/null @@ -1,74 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 d7 9c de f8 62 |...............b| -00000010 7e 32 5b bc d5 12 35 89 42 37 be ca 55 74 24 61 |~2[...5.B7..Ut$a| -00000020 c0 50 91 0f 1b 42 29 9f c1 6a cb 00 00 04 00 2f |.P...B)..j...../| -00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| -00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| -00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| -00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| -00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| -00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| -00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| -00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| -00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| -00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| -00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| -00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| -000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| -000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| -000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| -000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| -000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| -000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| -00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| -00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| -00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| -00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| -00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| -00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| -00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| -00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| -00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| -00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| -000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| -000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| -000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| -000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| -000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| -000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| -00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| -00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| -00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| -00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| -00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| -00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| -00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| -00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| -00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 1b 0d 00 00 17 02 01 40 |;..............@| -000002a0 00 10 04 01 04 03 05 01 05 03 06 01 06 03 02 01 |................| -000002b0 02 03 00 00 16 03 03 00 04 0e 00 00 00 |.............| ->>> Flow 3 (client to server) -00000000 16 03 03 00 07 0b 00 00 03 00 00 00 16 03 03 00 |................| -00000010 86 10 00 00 82 00 80 1d c6 6c b0 b9 b3 41 06 80 |.........l...A..| -00000020 e0 f5 df 06 ae 0f 2f 5f 72 14 44 47 16 c4 f0 a6 |....../_r.DG....| -00000030 68 be fa ee ec 9b 38 b0 e4 bd a3 e9 ca 18 5b 25 |h.....8.......[%| -00000040 33 31 57 86 63 59 0e ce 10 77 f8 42 a6 5c ad 3f |31W.cY...w.B.\.?| -00000050 80 85 a5 c1 06 4c 36 aa f3 ee 62 39 66 69 76 51 |.....L6...b9fivQ| -00000060 57 cc a0 b1 35 81 d5 38 01 2d 83 0e 2e 6b a9 84 |W...5..8.-...k..| -00000070 0d 8b 29 93 90 78 2d 0d 33 5f 85 0d 00 0c e2 5f |..)..x-.3_....._| -00000080 83 21 28 27 83 ad 9d 19 2d 01 35 6d 85 2e 8d 6b |.!('....-.5m...k| -00000090 eb 7a cd 8a 3f 42 e2 14 03 03 00 01 01 16 03 03 |.z..?B..........| -000000a0 00 40 5e 19 0f d0 4c 17 e0 25 e6 6b a1 d9 ea 59 |.@^...L..%.k...Y| -000000b0 f4 3a 55 84 2c 50 1e 53 47 78 45 b8 97 f7 7f 3d |.:U.,P.SGxE....=| -000000c0 af d9 7a ad 30 30 77 1a 93 05 19 5b 9b 13 70 e0 |..z.00w....[..p.| -000000d0 e0 f8 ba 6a bd 74 c5 71 0d 5a 2c 3f 2d 98 1a 3c |...j.t.q.Z,?-..<| -000000e0 5a 7d |Z}| ->>> Flow 4 (server to client) -00000000 15 03 03 00 02 02 2a |......*| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given index ebc16c590b8..1bb602d0787 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given @@ -1,11 +1,14 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 6b 01 00 00 67 03 03 a5 db 42 40 b5 |....k...g....B@.| -00000010 57 97 90 6f de 6e 07 7c 3d f6 ce a5 ec 37 52 2e |W..o.n.|=....7R.| -00000020 d9 cf 7c dc f9 66 34 7f ef a3 90 00 00 04 00 2f |..|..f4......../| -00000030 00 ff 01 00 00 3a 00 00 00 0e 00 0c 00 00 09 31 |.....:.........1| +00000000 16 03 01 00 97 01 00 00 93 03 03 b1 59 5d 29 7f |............Y]).| +00000010 90 9c ef 9d ae 0a 91 6c ab 05 fb 58 f7 79 9b c4 |.......l...X.y..| +00000020 22 e1 ab 55 5c ea d1 24 27 2a 63 00 00 04 00 2f |"..U\..$'*c..../| +00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| -00000060 00 16 00 00 00 17 00 00 00 0d 00 04 00 02 04 01 |................| +00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| +00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| +00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| +00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| >>> Flow 2 (server to client) 00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| @@ -48,10 +51,9 @@ 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 21 0d 00 00 1d 02 01 40 |;.......!......@| -000002a0 00 16 08 04 08 05 08 06 04 01 04 03 05 01 05 03 |................| -000002b0 06 01 06 03 02 01 02 03 00 00 16 03 03 00 04 0e |................| -000002c0 00 00 00 |...| +00000290 3b e9 fa e7 16 03 03 00 1d 0d 00 00 19 02 01 40 |;..............@| +000002a0 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 03 |................| +000002b0 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |...............| >>> Flow 3 (client to server) 00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| 00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| @@ -85,40 +87,40 @@ 000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| 000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| 000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| -00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 50 e9 35 |.5...........P.5| -00000210 02 8f b8 95 2f 2c 00 92 dd 06 c9 0b 41 13 2b 1a |..../,......A.+.| -00000220 94 3c 98 24 9e 5b 08 ba aa d2 8c 25 64 01 2c 19 |.<.$.[.....%d.,.| -00000230 2a 10 3d 85 de e6 9d 7e e3 a6 a1 ca 04 85 78 8e |*.=....~......x.| -00000240 4e ff 74 d2 0f 5f c9 6a 27 41 71 78 f9 64 e4 b9 |N.t.._.j'Aqx.d..| -00000250 27 c8 c3 f4 64 f5 e7 9c 5b 02 e5 e7 be a2 aa 5a |'...d...[......Z| -00000260 a6 77 83 7e 6a 4b 5f 18 5c a2 f8 b9 42 3d 06 21 |.w.~jK_.\...B=.!| -00000270 65 88 11 cf 0e 8a 9f c2 0b 7d c4 8e a0 aa 2d d8 |e........}....-.| -00000280 93 15 88 61 8c c4 7c a8 e0 cb 13 6b b0 16 03 03 |...a..|....k....| -00000290 00 88 0f 00 00 84 04 01 00 80 27 77 f1 9a 6e d1 |..........'w..n.| -000002a0 d0 2d e1 cc 69 85 64 67 e0 fa 54 de 93 89 ca e8 |.-..i.dg..T.....| -000002b0 a2 90 09 7b 96 22 f7 d8 f9 3e a5 c3 d0 31 9b 1e |...{."...>...1..| -000002c0 b8 e6 8b 6e 7b 46 87 c2 21 c6 40 b9 d4 ec 54 67 |...n{F..!.@...Tg| -000002d0 ce 49 5e a6 9f 14 cc 84 ea 71 dd e6 b6 f9 e1 2d |.I^......q.....-| -000002e0 d6 dc 35 fa fd ce 39 70 97 15 6e 27 33 a2 da e9 |..5...9p..n'3...| -000002f0 2c a6 5b 1b 18 57 78 a7 47 b8 04 26 35 55 5a 02 |,.[..Wx.G..&5UZ.| -00000300 9a e8 48 73 f7 8a ac e8 59 86 61 2d bd c5 02 a6 |..Hs....Y.a-....| -00000310 72 cc 37 8e ec 93 b5 53 6d f9 14 03 03 00 01 01 |r.7....Sm.......| -00000320 16 03 03 00 40 e0 2f d8 1c fd 1a d0 e1 0c 92 4a |....@./........J| -00000330 8b 2b 01 10 58 8c dc 8f c8 b3 22 42 9b 10 d1 a6 |.+..X....."B....| -00000340 3e fe 3b 94 46 2f 41 ec b6 d3 33 90 95 8c 69 fa |>.;.F/A...3...i.| -00000350 f6 1d 6c a2 45 27 1f d3 d9 6b cb 2d e4 e2 c1 39 |..l.E'...k.-...9| -00000360 5d ed fa a1 b8 |]....| +00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 aa ad 37 |.5.............7| +00000210 05 40 cc 04 19 d0 de aa 25 9f 20 4e ce 74 f5 70 |.@......%. N.t.p| +00000220 ae 17 f0 29 a4 37 ac 84 67 06 da 17 9f 26 dc ab |...).7..g....&..| +00000230 96 c4 13 d6 a5 e5 93 57 70 17 f2 f1 fb 0e a2 e4 |.......Wp.......| +00000240 85 82 ea 63 ab 6f 6e 1f 0b 12 e7 35 ce b0 79 da |...c.on....5..y.| +00000250 95 cf de 7d 8b be 5e cc d5 8e 00 02 fe 67 61 b4 |...}..^......ga.| +00000260 69 2c 09 90 ae 6c df 29 45 67 79 8e fe 91 fb 3e |i,...l.)Egy....>| +00000270 1e ec 95 11 6c 6a 15 2f 93 59 41 34 8a 35 b0 7c |....lj./.YA4.5.|| +00000280 22 ee bb 99 cc 3d 05 1f 7b 1b 96 f6 bc 16 03 03 |"....=..{.......| +00000290 00 88 0f 00 00 84 04 01 00 80 a5 b1 55 c7 8c 86 |............U...| +000002a0 c1 c2 60 2d ad 40 f1 ca 56 25 39 e7 c1 83 7f 16 |..`-.@..V%9.....| +000002b0 08 6a c9 23 6a 82 73 63 bf 1a 32 de 85 82 2a bc |.j.#j.sc..2...*.| +000002c0 a0 99 db ea 34 26 27 8f c6 36 b7 53 b5 76 75 2e |....4&'..6.S.vu.| +000002d0 48 26 bb b0 65 55 68 57 12 cb 9c 93 96 fc 88 fc |H&..eUhW........| +000002e0 73 56 c1 1e 04 ae 41 aa ad b7 f8 58 7a 55 a9 74 |sV....A....XzU.t| +000002f0 5b b5 12 08 25 ef c1 0f 4c 39 7b c5 07 d9 34 66 |[...%...L9{...4f| +00000300 15 d3 76 a2 65 8c 4c ce 9a 89 0f 1f a9 5f d0 93 |..v.e.L......_..| +00000310 3e ed 92 be 42 4c fe 23 ea 40 14 03 03 00 01 01 |>...BL.#.@......| +00000320 16 03 03 00 40 89 ff 92 80 9b 37 4b 6f 8f 3a 22 |....@.....7Ko.:"| +00000330 aa ab 60 1f 4d 49 ba 75 b2 dc 83 06 22 5a 89 5d |..`.MI.u...."Z.]| +00000340 1f 95 fa 0c 18 80 a0 5a 96 09 93 7b 06 cb 6c aa |.......Z...{..l.| +00000350 74 79 ea ae 02 e7 a7 c9 44 0b 6d f7 f7 b2 04 8f |ty......D.m.....| +00000360 6e 46 2d f1 6b |nF-.k| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 37 e0 14 c7 88 |...........7....| -00000020 ef de eb 58 7c bc 28 35 0e 5d 42 c0 45 5e 7c 50 |...X|.(5.]B.E^|P| -00000030 82 5b f6 4d 28 b6 75 7b b0 bf 01 05 b1 16 e1 d8 |.[.M(.u{........| -00000040 96 0c 4e c5 84 19 64 1e ee be 4c 17 03 03 00 40 |..N...d...L....@| +00000010 00 00 00 00 00 00 00 00 00 00 00 67 84 0f 78 e0 |...........g..x.| +00000020 91 c8 d4 4b 1c 69 95 f8 6c 30 23 55 2b 04 4b 24 |...K.i..l0#U+.K$| +00000030 58 0a 46 06 94 00 72 95 77 77 4c d7 82 87 69 0a |X.F...r.wwL...i.| +00000040 4c 78 8a 12 76 27 ae 65 c9 20 c4 17 03 03 00 40 |Lx..v'.e. .....@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 6a ca ba a3 69 e8 b8 74 19 dc 93 50 df 1c 62 71 |j...i..t...P..bq| -00000070 54 c0 55 c0 aa 40 8e b9 f6 3c fe 54 6f 36 b8 26 |T.U..@...<.To6.&| -00000080 ea 5b e8 83 fc 7b a0 a8 f6 b1 36 7d 8c db c3 8a |.[...{....6}....| +00000060 13 3b e0 4b cd 52 d3 6c 90 91 37 38 1d 9c 75 a2 |.;.K.R.l..78..u.| +00000070 02 a3 3f 1a 43 6c aa f4 17 da 4e 01 d7 8c 74 5e |..?.Cl....N...t^| +00000080 f4 d3 61 cf 3c 7f 55 73 17 e7 d1 c3 a0 da 24 c4 |..a.<.Us......$.| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 2c e0 ed 49 c6 bc 76 c4 9d 2e 1c |.....,..I..v....| -000000b0 ca f8 80 61 b8 11 4a 3f 9f ad 7e 0e 79 58 25 bf |...a..J?..~.yX%.| -000000c0 c5 3f 95 9a e9 |.?...| +000000a0 00 00 00 00 00 28 75 97 89 88 21 2e fe 9b 81 87 |.....(u...!.....| +000000b0 2a 37 f0 81 9f 76 a2 27 a4 78 69 30 87 2c 09 6e |*7...v.'.xi0.,.n| +000000c0 55 90 fb ab b6 |U....| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven index 7b38a99abb8..5711a3f6b6d 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 23 f3 fb 5f cb |...........#.._.| -00000010 3f 63 8a f2 4c c7 41 cd 64 00 4f 7c 63 66 e1 3f |?c..L.A.d.O|cf.?| -00000020 b6 8d 4e 24 20 35 9c c5 c3 96 e9 00 00 04 00 2f |..N$ 5........./| +00000000 16 03 01 00 97 01 00 00 93 03 03 67 52 bd 6c 6c |...........gR.ll| +00000010 76 8e 81 75 11 23 27 99 07 bf 64 96 13 0b 85 78 |v..u.#'...d....x| +00000020 b4 5b b9 b0 a8 b5 fc 87 ef f2 0e 00 00 04 00 2f |.[............./| 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| @@ -51,37 +51,36 @@ 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 21 0d 00 00 1d 02 01 40 |;.......!......@| -000002a0 00 16 08 04 08 05 08 06 04 01 04 03 05 01 05 03 |................| -000002b0 06 01 06 03 02 01 02 03 00 00 16 03 03 00 04 0e |................| -000002c0 00 00 00 |...| +00000290 3b e9 fa e7 16 03 03 00 1d 0d 00 00 19 02 01 40 |;..............@| +000002a0 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 03 |................| +000002b0 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |...............| >>> Flow 3 (client to server) 00000000 16 03 03 00 07 0b 00 00 03 00 00 00 16 03 03 00 |................| -00000010 86 10 00 00 82 00 80 d7 50 22 1d 9e b8 81 12 e5 |........P"......| -00000020 47 e6 65 cf 82 19 a2 43 9a 5c 7b 44 98 eb d9 ac |G.e....C.\{D....| -00000030 e1 4e f5 9d ad bd 0a 0e 17 07 81 b9 b5 4b bb b1 |.N...........K..| -00000040 95 da 0a 82 67 ba 98 1b cc 45 91 62 ee 36 eb e3 |....g....E.b.6..| -00000050 18 30 34 f6 38 ab 3d 0c a7 2b bd 90 94 49 81 af |.04.8.=..+...I..| -00000060 67 a0 f2 b4 0f c0 09 eb c3 23 24 4b 76 3f cb b9 |g........#$Kv?..| -00000070 4c a3 53 a7 f6 53 34 1b 24 24 2f cc 24 d8 fb 12 |L.S..S4.$$/.$...| -00000080 65 60 cf 06 92 c3 7c 63 18 b1 92 88 e3 a8 1d 9c |e`....|c........| -00000090 f7 c1 9a a4 af 78 7d 14 03 03 00 01 01 16 03 03 |.....x}.........| -000000a0 00 40 91 9a 6b 71 c5 3e 88 9a 26 b4 af fa 41 26 |.@..kq.>..&...A&| -000000b0 72 33 a7 72 9b 22 89 d9 a5 ed 3d 0e 0e af c8 ef |r3.r."....=.....| -000000c0 3d c8 89 e4 0d 21 df 06 37 23 0f 50 d1 3e ef af |=....!..7#.P.>..| -000000d0 d8 cd 30 cc c4 18 3a 12 49 c0 0a 21 20 cd ac 66 |..0...:.I..! ..f| -000000e0 96 c3 |..| +00000010 86 10 00 00 82 00 80 31 7f 5d 8c 38 ee d7 05 14 |.......1.].8....| +00000020 4c 0f 9d 01 2d 80 e9 71 0a 51 69 7b af 75 43 76 |L...-..q.Qi{.uCv| +00000030 d7 eb 18 14 11 00 82 df f4 e8 d1 83 5e 32 60 6e |............^2`n| +00000040 49 6d 1a 3f b2 ac 85 9f f3 3c 3c cd f2 0d a8 e0 |Im.?.....<<.....| +00000050 06 f3 6f 96 18 a0 76 06 c3 73 89 b4 de 30 ed 7b |..o...v..s...0.{| +00000060 7e 71 2d 13 88 43 ff a7 42 bb 2c 17 73 5f 67 8f |~q-..C..B.,.s_g.| +00000070 68 e7 52 84 72 34 08 69 c6 f5 1b e9 2b 42 93 90 |h.R.r4.i....+B..| +00000080 3f 76 f3 89 9f 70 65 da 9c ce 8c bf a3 38 65 e3 |?v...pe......8e.| +00000090 cf b9 f9 c6 d9 86 a5 14 03 03 00 01 01 16 03 03 |................| +000000a0 00 40 e7 dd bf f7 33 bc f2 90 a3 43 fa 43 ec 7e |.@....3....C.C.~| +000000b0 e6 06 28 c1 3f 83 c5 50 65 6d 6b e7 37 cf e7 4b |..(.?..Pemk.7..K| +000000c0 85 34 3b df 4f 48 82 30 d0 43 f7 00 c4 3f 03 dd |.4;.OH.0.C...?..| +000000d0 ef c0 d4 04 48 b4 9b ec f0 65 7c 2a bc 87 24 5f |....H....e|*..$_| +000000e0 7a d5 |z.| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 2d 70 ad 8f ed |...........-p...| -00000020 c0 cf ce 73 28 76 8f da 65 41 46 53 dd 06 0d cc |...s(v..eAFS....| -00000030 36 cb f3 b8 c7 1f df 53 1a 7d 1e 9f d6 b9 e3 9e |6......S.}......| -00000040 fe a8 d9 91 6c 3b d2 ef b6 30 55 17 03 03 00 40 |....l;...0U....@| +00000010 00 00 00 00 00 00 00 00 00 00 00 da 0a 2a 09 ef |.............*..| +00000020 39 6c c9 6d cc c3 ae 56 cd e1 a8 47 26 ec 9c b7 |9l.m...V...G&...| +00000030 50 eb 2e 10 d4 15 3e 5e cc 65 78 2e 47 bf 18 e8 |P.....>^.ex.G...| +00000040 62 59 bb 7c b7 2c 28 b1 ea 82 10 17 03 03 00 40 |bY.|.,(........@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 6a 43 95 20 f0 f9 b4 e0 12 24 ae c1 55 c2 ad ec |jC. .....$..U...| -00000070 de 42 1f 0b ff 5b e5 ab 8b aa 72 69 2f 10 12 ca |.B...[....ri/...| -00000080 8c f2 77 be 60 81 ef c9 34 dc d7 68 57 d5 17 aa |..w.`...4..hW...| +00000060 9e 53 10 86 89 0c 8f 14 0c 22 6c 32 33 34 64 83 |.S......."l234d.| +00000070 28 7c 02 b3 59 b7 b2 60 5a ec f2 a7 1a 21 04 dd |(|..Y..`Z....!..| +00000080 2a c0 ca 68 07 85 8f 7d 6b da 26 97 52 91 40 e8 |*..h...}k.&.R.@.| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 c0 4b 9e e5 6b 45 60 e1 7b 87 b1 |......K..kE`.{..| -000000b0 76 06 e4 dc d7 01 eb db 04 9c 9b d4 bd 5c e0 18 |v............\..| -000000c0 72 7a 73 93 4f |rzs.O| +000000a0 00 00 00 00 00 f4 ae 69 5a bc af 94 f9 7f 60 d1 |.......iZ.....`.| +000000b0 36 83 e7 23 13 79 ae c1 5a 3b 35 d0 ed 16 12 ac |6..#.y..Z;5.....| +000000c0 52 b5 4e eb 31 |R.N.1| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-Ed25519 b/libgo/go/crypto/tls/testdata/Server-TLSv12-Ed25519 new file mode 100644 index 00000000000..f4247915f49 --- /dev/null +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-Ed25519 @@ -0,0 +1,63 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 cb 01 00 00 c7 03 03 a6 41 b7 62 67 |............A.bg| +00000010 34 b4 48 22 67 fd e6 a9 12 29 b7 85 6a 27 c9 fc |4.H"g....)..j'..| +00000020 70 3a cc 0c 94 61 88 d1 9e 22 3d 00 00 38 c0 2c |p:...a..."=..8.,| +00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..| +00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....| +00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<| +00000060 00 35 00 2f 00 ff 01 00 00 66 00 00 00 0e 00 0c |.5./.....f......| +00000070 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| +00000080 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| +00000090 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 30 |...............0| +000000a0 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| +000000b0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 03 03 |................| +000000c0 02 03 03 01 02 01 03 02 02 02 04 02 05 02 06 02 |................| +>>> Flow 2 (server to client) +00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 2c 00 00 |...DOWNGRD...,..| +00000030 05 ff 01 00 01 00 16 03 03 01 3c 0b 00 01 38 00 |..........<...8.| +00000040 01 35 00 01 32 30 82 01 2e 30 81 e1 a0 03 02 01 |.5..20...0......| +00000050 02 02 10 0f 43 1c 42 57 93 94 1d e9 87 e4 f1 ad |....C.BW........| +00000060 15 00 5d 30 05 06 03 2b 65 70 30 12 31 10 30 0e |..]0...+ep0.1.0.| +00000070 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 1e |..U....Acme Co0.| +00000080 17 0d 31 39 30 35 31 36 32 31 33 38 30 31 5a 17 |..190516213801Z.| +00000090 0d 32 30 30 35 31 35 32 31 33 38 30 31 5a 30 12 |.200515213801Z0.| +000000a0 31 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 |1.0...U....Acme | +000000b0 43 6f 30 2a 30 05 06 03 2b 65 70 03 21 00 3f e2 |Co0*0...+ep.!.?.| +000000c0 15 2e e6 e3 ef 3f 4e 85 4a 75 77 a3 64 9e ed e0 |.....?N.Juw.d...| +000000d0 bf 84 2c cc 92 26 8f fa 6f 34 83 aa ec 8f a3 4d |..,..&..o4.....M| +000000e0 30 4b 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 |0K0...U.........| +000000f0 05 a0 30 13 06 03 55 1d 25 04 0c 30 0a 06 08 2b |..0...U.%..0...+| +00000100 06 01 05 05 07 03 01 30 0c 06 03 55 1d 13 01 01 |.......0...U....| +00000110 ff 04 02 30 00 30 16 06 03 55 1d 11 04 0f 30 0d |...0.0...U....0.| +00000120 82 0b 65 78 61 6d 70 6c 65 2e 63 6f 6d 30 05 06 |..example.com0..| +00000130 03 2b 65 70 03 41 00 63 44 ed 9c c4 be 53 24 53 |.+ep.A.cD....S$S| +00000140 9f d2 10 8d 9f e8 21 08 90 95 39 e5 0d c1 55 ff |......!...9...U.| +00000150 2c 16 b7 1d fc ab 7d 4d d4 e0 93 13 d0 a9 42 e0 |,.....}M......B.| +00000160 b6 6b fe 5d 67 48 d7 9f 50 bc 6c cd 4b 03 83 7c |.k.]gH..P.l.K..|| +00000170 f2 08 58 cd ac cf 0c 16 03 03 00 6c 0c 00 00 68 |..X........l...h| +00000180 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 da ac |... /.}.G.bC.(..| +00000190 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f |_.).0.........._| +000001a0 58 cb 3b 74 08 07 00 40 b8 a3 37 f4 74 44 64 eb |X.;t...@..7.tDd.| +000001b0 1f 4b a1 5c 6e 3b 46 a0 b8 ce ce da 79 8d 03 d8 |.K.\n;F.....y...| +000001c0 a2 c2 1d ca 25 21 d2 c3 cf 65 02 7e 4c d6 9a 5a |....%!...e.~L..Z| +000001d0 ba 60 51 71 e4 37 ab 70 18 73 f1 a0 e5 f9 e3 2d |.`Qq.7.p.s.....-| +000001e0 00 37 68 97 cf fa e4 08 16 03 03 00 04 0e 00 00 |.7h.............| +000001f0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 51 d1 53 24 ee 09 |....%...! Q.S$..| +00000010 51 02 90 7e 6f 02 a2 54 db 6e 95 a4 af f9 43 51 |Q..~o..T.n....CQ| +00000020 d2 ff 6b e6 26 d0 88 4d c1 56 14 03 03 00 01 01 |..k.&..M.V......| +00000030 16 03 03 00 28 2a 7a 63 66 3f 53 88 0a cf ef 03 |....(*zcf?S.....| +00000040 ef 21 5b b5 57 ce 9e e5 da 84 e5 a7 d3 6d 90 c9 |.![.W........m..| +00000050 6c f8 c1 9d cc a2 ff cb 97 5a 7c 1a 62 |l........Z|.b| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| +00000010 00 00 00 7a ee 1c df b7 14 c9 81 18 f3 51 de 24 |...z.........Q.$| +00000020 70 ed b7 87 b9 29 b3 f7 ef 43 d0 c9 8f 35 3e 0a |p....)...C...5>.| +00000030 a1 c4 72 17 03 03 00 25 00 00 00 00 00 00 00 01 |..r....%........| +00000040 f6 37 d9 31 d2 1f de a6 43 3b 60 a7 30 8c 76 cd |.7.1....C;`.0.v.| +00000050 47 f3 e3 a5 f3 6f e0 fe fd 93 76 1f 0a 15 03 03 |G....o....v.....| +00000060 00 1a 00 00 00 00 00 00 00 02 6d 2d 8d 6b f1 e3 |..........m-.k..| +00000070 8f 21 e4 8e af b2 90 69 5b 10 3a f9 |.!.....i[.:.| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial b/libgo/go/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial index 7d7ee638616..b777c624157 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 cf 01 00 00 cb 03 03 79 bf 0b 29 ec |...........y..).| -00000010 6a 0b 84 1e 2c d5 bf 30 b7 55 b9 7b 77 69 8f 9a |j...,..0.U.{wi..| -00000020 71 34 c9 83 d1 af de 50 d5 d6 fc 00 00 38 c0 2c |q4.....P.....8.,| +00000000 16 03 01 00 cf 01 00 00 cb 03 03 54 13 f1 1a dc |...........T....| +00000010 39 72 b7 e7 86 ac 83 df 9b 75 9e 71 40 7a 14 b3 |9r.......u.q@z..| +00000020 fc ad 99 d1 8a 4f d0 d9 a3 f0 3d 00 00 38 c0 2c |.....O....=..8.,| 00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..| 00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....| 00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<| @@ -58,38 +58,38 @@ 00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c 00 00 |.\!.;...........| 000002a0 a8 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 da |.... /.}.G.bC.(.| 000002b0 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........| -000002c0 5f 58 cb 3b 74 08 04 00 80 36 12 82 aa d1 40 60 |_X.;t....6....@`| -000002d0 6c fb da 0b 04 f6 23 94 3f 3d 8c a5 f4 fe ed 1f |l.....#.?=......| -000002e0 be 25 85 94 c9 2f 19 64 52 2b 8a 13 29 52 ae 77 |.%.../.dR+..)R.w| -000002f0 ca 24 40 f1 31 1c f3 aa 33 29 1f cc b0 a3 8b e6 |.$@.1...3)......| -00000300 c3 26 90 e4 11 48 e6 91 a6 5d 5e c6 18 8d 4f 2c |.&...H...]^...O,| -00000310 21 be bc 13 4d de bb 68 42 0b e1 29 3e 8e fc b9 |!...M..hB..)>...| -00000320 45 ed c4 87 ed 62 1d 04 c0 4f d5 f5 94 62 65 07 |E....b...O...be.| -00000330 8c f0 00 3d 47 f6 f5 93 e3 a9 69 ce 79 8a e5 24 |...=G.....i.y..$| -00000340 01 d4 28 e6 f5 f5 a9 7e ab 16 03 03 00 04 0e 00 |..(....~........| +000002c0 5f 58 cb 3b 74 04 01 00 80 8e 2b 18 d7 2c 6d 91 |_X.;t.....+..,m.| +000002d0 12 b3 ba 39 20 4f 43 60 08 d3 63 6e 55 01 50 3c |...9 OC`..cnU.P<| +000002e0 2b 6d 09 ca 27 d6 f7 42 d1 74 19 e1 6b 06 93 06 |+m..'..B.t..k...| +000002f0 6e e6 c4 23 cc 1b c8 de 8f 30 c2 4d 22 36 10 df |n..#.....0.M"6..| +00000300 32 cb f3 4e ec 9a b1 d6 63 7d 11 4e 58 d2 b7 7a |2..N....c}.NX..z| +00000310 70 31 4b 92 3e 27 ba f0 85 ca 7d 43 c7 68 04 6a |p1K.>'....}C.h.j| +00000320 fa c4 ac c1 16 8b 18 c9 2e 94 2e c2 a6 f3 f0 f3 |................| +00000330 fb 8a 21 6d 4f 3d bc 0f fa 21 fd d5 78 57 6c 38 |..!mO=...!..xWl8| +00000340 09 48 64 d6 ca b6 31 3c 39 16 03 03 00 04 0e 00 |.Hd...1<9.......| 00000350 00 00 |..| >>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 ea 09 8a 21 18 89 |....%...! ...!..| -00000010 7d 4f ee 95 8e 6c 1a 07 22 59 e7 f9 05 41 2a c2 |}O...l.."Y...A*.| -00000020 ad 51 71 9c a4 0e 08 eb 49 71 14 03 03 00 01 01 |.Qq.....Iq......| -00000030 16 03 03 00 28 6a ab 19 f6 b6 cb 70 34 ee 73 d2 |....(j.....p4.s.| -00000040 05 bf 99 37 44 b7 f9 1e b1 8a 3d f9 13 bd 0c 77 |...7D.....=....w| -00000050 02 b0 64 08 f9 d9 f2 96 b4 5b 87 ff 0b |..d......[...| +00000000 16 03 03 00 25 10 00 00 21 20 af 4c 6e 57 5e f7 |....%...! .LnW^.| +00000010 49 e2 89 33 f9 47 59 7c 81 5c 63 74 cd 27 6a 65 |I..3.GY|.\ct.'je| +00000020 b6 55 d1 72 ad 60 08 d0 c6 6a 14 03 03 00 01 01 |.U.r.`...j......| +00000030 16 03 03 00 28 69 f2 a5 05 8c a5 a7 5f 8f 8b cf |....(i......_...| +00000040 7a 18 fb f4 45 5e 1f f8 ba 60 2e fa c6 8c c6 57 |z...E^...`.....W| +00000050 89 ac 8a 85 71 00 21 65 f3 a6 99 5d 3b |....q.!e...];| >>> Flow 4 (server to client) 00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP| 00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.| 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| -00000030 6f ec 80 83 61 db f0 ce 92 57 a1 db 00 84 5e 78 |o...a....W....^x| -00000040 0e f7 97 3e f5 f0 e8 73 d6 b0 a7 28 8f bb 24 b1 |...>...s...(..$.| -00000050 a9 3f 60 a3 7a f2 c1 a6 12 0e 69 3b 72 89 dd 36 |.?`.z.....i;r..6| -00000060 d8 ff 80 5d 71 33 94 32 01 77 ce 77 5e ac b8 05 |...]q3.2.w.w^...| -00000070 69 68 e5 81 51 4d 52 f6 e9 c5 cd 70 56 23 3c aa |ih..QMR....pV#<.| -00000080 2e c6 a2 d6 e3 5f 29 14 03 03 00 01 01 16 03 03 |....._).........| -00000090 00 28 00 00 00 00 00 00 00 00 59 27 e3 e7 05 60 |.(........Y'...`| -000000a0 03 68 93 6d 28 1d 8e 7f f1 c8 a6 eb b4 57 a5 22 |.h.m(........W."| -000000b0 98 ce 7e 56 00 44 fe d5 5e 26 17 03 03 00 25 00 |..~V.D..^&....%.| -000000c0 00 00 00 00 00 00 01 9d 87 53 e9 29 e4 d7 45 29 |.........S.)..E)| -000000d0 ef 71 a6 7e b8 99 d4 4f 08 da 11 6b 9b d2 20 b9 |.q.~...O...k.. .| -000000e0 c4 ae 7f 84 15 03 03 00 1a 00 00 00 00 00 00 00 |................| -000000f0 02 06 17 a2 45 91 d0 b0 50 aa 8f a2 f1 8b 48 cf |....E...P.....H.| -00000100 40 87 a4 |@..| +00000030 6f ec 80 83 61 0d 24 39 c2 e0 e0 85 93 37 1f 40 |o...a.$9.....7.@| +00000040 0a 0e a7 45 0e 81 37 6c 7a 11 ed e6 c0 f1 69 23 |...E..7lz.....i#| +00000050 df 14 01 ff ff 52 2f ac da 15 14 5b a2 07 c8 bc |.....R/....[....| +00000060 82 4f 2b 5b 71 33 94 09 17 b4 83 76 62 b7 46 9d |.O+[q3.....vb.F.| +00000070 6f 0d de c2 8b a8 ce 6e 2e df f4 a3 59 fc af f2 |o......n....Y...| +00000080 fe 3f 1e d6 75 b5 63 14 03 03 00 01 01 16 03 03 |.?..u.c.........| +00000090 00 28 00 00 00 00 00 00 00 00 ae 8b f0 21 94 08 |.(...........!..| +000000a0 ec aa a6 f5 40 81 5a a2 42 f7 0a 9b 6b e6 8d 7a |....@.Z.B...k..z| +000000b0 44 e1 85 41 fc 83 f0 e1 c0 c2 17 03 03 00 25 00 |D..A..........%.| +000000c0 00 00 00 00 00 00 01 c4 a7 e5 72 e4 09 d0 21 b8 |..........r...!.| +000000d0 99 ae f0 6a 2c 1c a4 ca ae 44 79 92 ae 25 f8 37 |...j,....Dy..%.7| +000000e0 d8 49 f3 21 15 03 03 00 1a 00 00 00 00 00 00 00 |.I.!............| +000000f0 02 76 b5 79 33 82 76 50 e3 2b 03 e9 b8 14 2d 51 |.v.y3.vP.+....-Q| +00000100 ac f9 6d |..m| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-P256 b/libgo/go/crypto/tls/testdata/Server-TLSv12-P256 index 5295d60a8df..4e302b374cc 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-P256 +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-P256 @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 8f 01 00 00 8b 03 03 e8 ef f7 4f 44 |..............OD| -00000010 1a 63 08 10 fe aa 68 d5 75 18 f5 6c de 83 50 d2 |.c....h.u..l..P.| -00000020 bb 86 6e 48 d0 cb 97 c4 56 46 9f 00 00 04 c0 2f |..nH....VF...../| +00000000 16 03 01 00 8f 01 00 00 8b 03 03 b1 a0 04 30 1e |..............0.| +00000010 a1 09 cb 31 c4 1a 15 e7 a6 06 b5 fb 51 da d6 01 |...1........Q...| +00000020 dc c0 cc 17 85 e5 c4 c6 b1 da be 00 00 04 c0 2f |.............../| 00000030 00 ff 01 00 00 5e 00 00 00 0e 00 0c 00 00 09 31 |.....^.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 04 00 02 00 17 00 16 00 00 00 17 00 00 |................| @@ -56,30 +56,30 @@ 000002b0 5b 12 2e 8f 09 67 fd a7 24 20 3e b2 56 1c ce 97 |[....g..$ >.V...| 000002c0 28 5e f8 2b 2d 4f 9e f1 07 9f 6c 4b 5b 83 56 e2 |(^.+-O....lK[.V.| 000002d0 32 42 e9 58 b6 d7 49 a6 b5 68 1a 41 03 56 6b dc |2B.X..I..h.A.Vk.| -000002e0 5a 89 08 04 00 80 b8 fd 6d 56 36 b6 b3 8a 6c cb |Z.......mV6...l.| -000002f0 6b 52 79 28 45 97 1e 97 1b 7f 96 2e e0 b0 23 af |kRy(E.........#.| -00000300 cb 13 cf dc e6 11 2b 04 88 08 56 2d a4 3a b1 7e |......+...V-.:.~| -00000310 79 b5 de 25 35 6b 82 98 d9 9e be 99 d4 37 bf 19 |y..%5k.......7..| -00000320 bb 0e 25 86 b6 19 e8 58 de ab 63 ed 3c 09 d6 6b |..%....X..c.<..k| -00000330 f5 da 16 e6 75 5d e7 7b e5 54 1b de 03 1d cd fb |....u].{.T......| -00000340 3d 9f 24 cc ff 07 d2 cb f2 0b 4a 61 57 ec 84 dd |=.$.......JaW...| -00000350 92 44 da 71 a2 31 ba 2e 68 19 2b ee 90 19 12 a5 |.D.q.1..h.+.....| -00000360 59 53 28 9d 0a 87 16 03 03 00 04 0e 00 00 00 |YS(............| +000002e0 5a 89 04 01 00 80 bb 79 4d c9 d6 77 df 13 46 e6 |Z......yM..w..F.| +000002f0 82 30 7a 03 2e 58 a8 bf 2a 53 c4 58 0a 9a 9a 0f |.0z..X..*S.X....| +00000300 72 51 a9 91 5b f7 88 f1 de 28 1d 56 79 2c da 89 |rQ..[....(.Vy,..| +00000310 a4 de 25 65 20 f7 a1 a4 b1 ff 3c 5a cd 67 24 9b |..%e .....>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 01 9c 4d 77 6b |....F...BA...Mwk| -00000010 ce 2f a7 9e 8b ae ba 9d f2 6d c8 9e 0e 54 07 c9 |./.......m...T..| -00000020 6d e3 58 67 c6 a8 9a a5 c2 f7 27 26 84 36 e1 6f |m.Xg......'&.6.o| -00000030 e3 a1 89 50 7c e0 e6 88 06 b9 94 16 d8 23 cb 2e |...P|........#..| -00000040 ff 62 67 1e 93 cb d6 1d f5 43 79 14 03 03 00 01 |.bg......Cy.....| -00000050 01 16 03 03 00 28 83 36 85 d0 b7 23 5e 7d 0a 33 |.....(.6...#^}.3| -00000060 41 0f bd 31 4d a0 32 6a c2 67 93 cc 8f 41 f5 bd |A..1M.2j.g...A..| -00000070 b2 57 af 5c 90 d6 17 24 be 76 6b b4 13 ca |.W.\...$.vk...| +00000000 16 03 03 00 46 10 00 00 42 41 04 1b 28 eb 97 c5 |....F...BA..(...| +00000010 63 cc e1 64 31 f9 b3 5c 61 d8 d9 28 f9 1e 9a 4b |c..d1..\a..(...K| +00000020 09 2a 5a b9 64 42 15 d3 06 80 64 67 93 63 e2 c6 |.*Z.dB....dg.c..| +00000030 51 05 3c 8b 32 41 c2 a0 5a db 73 ba 77 86 7f 1b |Q.<.2A..Z.s.w...| +00000040 2e b4 33 9c 20 0a 40 3a c6 90 f1 14 03 03 00 01 |..3. .@:........| +00000050 01 16 03 03 00 28 56 75 52 fe f7 13 79 b6 c6 ba |.....(VuR...y...| +00000060 f1 6a 6d f2 3d 2c 8c c2 70 3e 19 ba 32 34 88 02 |.jm.=,..p>..24..| +00000070 73 d7 d5 db b9 52 21 32 34 fb 7e e8 17 49 |s....R!24.~..I| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 80 6a 93 5b 7d 70 3c bc 7c f8 d6 4e 51 |....j.[}p<.|..NQ| -00000020 5e 34 52 13 06 c4 aa 8c ed b5 9f aa c6 db c0 0d |^4R.............| -00000030 67 97 36 17 03 03 00 25 00 00 00 00 00 00 00 01 |g.6....%........| -00000040 d6 24 e8 21 4b 2c fb 5e 79 2d ca 7b 6d 44 dd 2d |.$.!K,.^y-.{mD.-| -00000050 aa 3a 33 ee ea 6f e3 b7 cd c5 c3 1d 4a 15 03 03 |.:3..o......J...| -00000060 00 1a 00 00 00 00 00 00 00 02 4f 71 74 9e 63 ad |..........Oqt.c.| -00000070 d7 61 b9 c7 47 d6 44 9f b3 3d 49 34 |.a..G.D..=I4| +00000010 00 00 00 41 e9 67 42 6b 79 56 59 80 41 c2 3a b9 |...A.gBkyVY.A.:.| +00000020 b2 3a 06 0e 31 76 18 ba 86 a4 2d 1a 71 19 f3 f1 |.:..1v....-.q...| +00000030 a3 bc b3 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........| +00000040 57 ee 6f 74 4b 56 28 ca 71 34 c0 85 0e 26 db 9c |W.otKV(.q4...&..| +00000050 bb 8f 3c 3f 02 a3 d4 07 61 6e 20 93 5e 15 03 03 |..>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 48 e2 22 70 f7 |...........H."p.| -00000010 9a 24 ce 92 69 d1 ff fc c0 c9 ba b2 da 8e 83 7a |.$..i..........z| -00000020 6e 8d 24 60 e2 e2 81 76 e6 72 37 00 00 04 00 0a |n.$`...v.r7.....| +00000000 16 03 01 00 97 01 00 00 93 03 03 ed c3 64 89 19 |.............d..| +00000010 3b fd 11 f4 d8 c9 2a d5 a8 8b 18 b5 92 cb ff c1 |;.....*.........| +00000020 10 9a b1 a7 e4 d5 bc 78 39 29 30 00 00 04 00 0a |.......x9)0.....| 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| @@ -53,27 +53,27 @@ 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| 00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............| >>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 20 44 e6 19 b2 |........... D...| -00000010 c5 9f 95 af 90 29 b2 5c e9 c5 29 8c a2 bd 72 49 |.....).\..)...rI| -00000020 8d c8 ea e8 cc bd 65 d9 1c fe 95 f0 60 0e ee 13 |......e.....`...| -00000030 ea 7b bf 59 3c 08 21 07 73 b7 04 16 a7 a5 98 2e |.{.Y<.!.s.......| -00000040 ab ee db c3 83 ea c8 b2 07 3e 76 a0 8f d4 8f df |.........>v.....| -00000050 70 91 b7 ed 12 54 e2 e7 68 cb ed 26 be 84 a9 24 |p....T..h..&...$| -00000060 fb 89 48 49 4e 9b 14 98 82 ab 64 0c a5 a0 ec 1d |..HIN.....d.....| -00000070 96 b7 83 c3 14 cb de a5 97 d1 86 28 b6 d4 65 5d |...........(..e]| -00000080 0b 45 04 37 02 53 8c 96 5d f8 d3 14 03 03 00 01 |.E.7.S..].......| -00000090 01 16 03 03 00 30 04 43 06 c4 96 f5 f6 23 5d 46 |.....0.C.....#]F| -000000a0 ec 3d f4 18 44 3f f8 d2 e9 74 37 22 56 df f2 35 |.=..D?...t7"V..5| -000000b0 3d a0 8d 8a 80 be 4e 40 66 28 4c 37 aa f7 43 cf |=.....N@f(L7..C.| -000000c0 9e 29 83 7b 39 28 |.).{9(| +00000000 16 03 03 00 86 10 00 00 82 00 80 a3 a7 b7 b2 3e |...............>| +00000010 ee 37 62 8e 5b b3 d5 2e e2 0e b9 24 70 95 4c 4c |.7b.[......$p.LL| +00000020 52 e5 9f a3 e2 79 7f a1 dc 93 1f 89 2e f8 a2 8e |R....y..........| +00000030 7b d8 82 6c 89 57 64 44 e9 61 66 aa 8d 42 ff d1 |{..l.WdD.af..B..| +00000040 7f 62 21 55 78 e9 da 87 18 d5 51 dc 91 39 6b b9 |.b!Ux.....Q..9k.| +00000050 8f ec 76 57 f7 03 62 fa 54 36 0c 18 ad 7c 1c 5d |..vW..b.T6...|.]| +00000060 ce fd b4 97 c3 98 15 fc b5 e5 55 6b aa d5 d5 d4 |..........Uk....| +00000070 17 9c a7 55 ee 8d d1 85 2e 92 10 32 67 72 d5 27 |...U.......2gr.'| +00000080 0d aa b3 a9 5a ec d3 8c df d4 7f 14 03 03 00 01 |....Z...........| +00000090 01 16 03 03 00 30 8a 3c 9c 7d dd 50 68 ff 79 dc |.....0.<.}.Ph.y.| +000000a0 f4 b4 a7 73 8e de 93 01 85 a4 0c 9c cb 9a 2d 4d |...s..........-M| +000000b0 34 95 63 d7 73 9f c5 89 e0 81 8f a2 bd c1 3b e4 |4.c.s.........;.| +000000c0 5a fe 5a ef 6a 75 |Z.Z.ju| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 30 00 00 00 00 00 |..........0.....| -00000010 00 00 00 27 75 8a 8d 43 68 0e af 19 6d d2 63 1c |...'u..Ch...m.c.| -00000020 44 51 0b 86 4c fc 16 1c 77 f8 96 1e 72 3d b9 45 |DQ..L...w...r=.E| -00000030 40 cc 70 bc 72 a3 d3 ff f6 e5 3f 17 03 03 00 30 |@.p.r.....?....0| -00000040 00 00 00 00 00 00 00 00 f4 cf bc 55 e6 d7 4f d2 |...........U..O.| -00000050 8f ae 52 8d 16 d0 44 9a c9 39 5b a7 69 bb 04 96 |..R...D..9[.i...| -00000060 c9 d9 0c 92 a0 da b4 52 c5 dd 20 cb 4b 8c ad 51 |.......R.. .K..Q| -00000070 15 03 03 00 20 00 00 00 00 00 00 00 00 43 52 b5 |.... ........CR.| -00000080 d2 98 37 93 69 73 49 27 08 75 76 54 e7 39 b3 4c |..7.isI'.uvT.9.L| -00000090 da 48 84 00 20 |.H.. | +00000010 00 00 00 f1 00 85 78 65 64 6e 44 50 3e 34 30 87 |......xednDP>40.| +00000020 b8 c2 b4 ed 76 e2 65 0a 4c 21 68 46 ca ae 97 ea |....v.e.L!hF....| +00000030 a2 46 38 b3 65 b8 63 45 8f aa 4c 17 03 03 00 30 |.F8.e.cE..L....0| +00000040 00 00 00 00 00 00 00 00 fd 9f bb a9 e3 72 fd 5f |.............r._| +00000050 5b b7 2d 34 e5 4c 19 f4 ef 1c ce 71 0f d3 0d a6 |[.-4.L.....q....| +00000060 5f f2 ca b4 3b f8 eb c7 20 85 e7 92 41 8c c8 08 |_...;... ...A...| +00000070 15 03 03 00 20 00 00 00 00 00 00 00 00 3b b8 8c |.... ........;..| +00000080 09 40 aa 11 20 a9 ee f7 e4 bb 80 a2 e6 5d e5 04 |.@.. ........]..| +00000090 98 65 e8 bd 85 |.e...| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES index e4d773d4c47..25f1269e3ae 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 41 7b 60 d8 f5 |...........A{`..| -00000010 1c 4a 95 f9 03 de 94 0c b6 34 94 3c 6e 82 f2 de |.J.......4....B...=.`.\!.| 00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............| >>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 15 eb 41 72 e4 |.............Ar.| -00000010 cf 0f 8b bb 9a ea aa 2a f1 dc 2e c9 db d8 cf bd |.......*........| -00000020 5e fb 86 30 98 b4 22 62 a5 32 d0 e6 3d 38 49 1a |^..0.."b.2..=8I.| -00000030 70 6f fa d3 81 c0 8d 00 c6 cd 80 b6 ed 26 8b 98 |po...........&..| -00000040 3a 26 8b 8e 88 ba 61 a6 8e 19 5a 0e 51 bb 4e 9e |:&....a...Z.Q.N.| -00000050 a9 21 09 77 cf 42 eb 26 90 3a 08 bb c5 89 88 2c |.!.w.B.&.:.....,| -00000060 19 db b3 1c 7a d0 60 76 be 9a d5 0c ec df dd 11 |....z.`v........| -00000070 9e a0 85 a5 36 3d 07 f7 36 47 52 92 cd 84 7b 2e |....6=..6GR...{.| -00000080 13 18 47 58 8a 00 4b 39 59 bb da 14 03 03 00 01 |..GX..K9Y.......| -00000090 01 16 03 03 00 40 16 0e 0a 79 db 54 11 36 73 af |.....@...y.T.6s.| -000000a0 eb cb 9d e8 b4 42 1a f8 94 f0 fb d1 60 f8 9f 9d |.....B......`...| -000000b0 ba 87 f6 27 ef 54 e4 f9 f7 1f a7 61 f5 82 1a 40 |...'.T.....a...@| -000000c0 96 81 f6 14 db 89 ec 8b 0c 37 ba 11 55 94 d3 df |.........7..U...| -000000d0 df 8d 61 ec a7 43 |..a..C| +00000000 16 03 03 00 86 10 00 00 82 00 80 c7 bb d2 ee 1a |................| +00000010 38 b1 7b 2f ad ec e6 63 d3 11 f9 69 b6 7e b9 58 |8.{/...c...i.~.X| +00000020 79 37 c9 6e e5 6b 1e ce e5 b7 1f 69 ec 2c 71 94 |y7.n.k.....i.,q.| +00000030 f7 27 16 66 14 24 bd bb ca ac 80 20 68 46 6e b8 |.'.f.$..... hFn.| +00000040 3e f4 82 07 0a b7 0c 74 a5 66 1a 86 48 52 6e 80 |>......t.f..HRn.| +00000050 a1 88 a3 12 8c c9 ef fc 5c 90 a8 f5 2f 0a 69 ba |........\.../.i.| +00000060 ce 73 48 ca 25 ea be 3c 9f 1b b6 1c e9 d7 1d bf |.sH.%..<........| +00000070 38 0d 6f a1 ed c0 22 16 40 51 2e c3 78 5b 69 8a |8.o...".@Q..x[i.| +00000080 91 30 5b 15 b1 a5 c5 ea 5f 34 38 14 03 03 00 01 |.0[....._48.....| +00000090 01 16 03 03 00 40 78 f5 31 97 86 f4 48 5c 74 8f |.....@x.1...H\t.| +000000a0 ac b9 49 42 cb 83 e6 d9 bc a4 6f cc 3f f3 54 66 |..IB......o.?.Tf| +000000b0 93 01 2c 1a e3 b4 08 09 f8 41 d4 fe 2d fa ab a9 |..,......A..-...| +000000c0 f1 47 39 13 82 11 9e 7f 04 78 08 df 13 74 97 6c |.G9......x...t.l| +000000d0 ba ac a8 26 90 2e |...&..| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 ef 1a ed 92 e1 |................| -00000020 e1 81 1e a8 e1 ff 2b 2b 64 89 17 55 2d ce eb be |......++d..U-...| -00000030 17 a6 b8 a7 55 8a c4 3b 8a 5a c7 56 7c b5 90 c9 |....U..;.Z.V|...| -00000040 19 bc 13 07 50 91 42 2a 46 13 d1 17 03 03 00 40 |....P.B*F......@| +00000010 00 00 00 00 00 00 00 00 00 00 00 53 48 ab 5a 17 |...........SH.Z.| +00000020 07 e4 14 04 4d 96 ae 33 b7 e7 6b 37 10 34 98 66 |....M..3..k7.4.f| +00000030 b8 38 6b 30 53 17 3e af 80 34 a6 29 0c 3b 8b 05 |.8k0S.>..4.).;..| +00000040 53 d6 53 fb 65 e3 ec 05 16 f2 c7 17 03 03 00 40 |S.S.e..........@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 9e fe 95 fa 67 a5 af 14 f0 80 fd 65 65 ac 0a 91 |....g......ee...| -00000070 4a 1d 4a c3 de 3f 35 a7 de 10 94 55 b0 8f be e6 |J.J..?5....U....| -00000080 76 a2 74 4c 89 47 b9 10 8f 78 a9 01 6b ac bb d9 |v.tL.G...x..k...| +00000060 46 14 e6 50 23 20 15 9f a4 cc 39 69 43 e7 35 ea |F..P# ....9iC.5.| +00000070 3c c3 71 a6 65 dc ba 66 7b 3e b8 8d bc cc 1b f5 |<.q.e..f{>......| +00000080 2b 65 55 9b 35 c7 30 08 ff 0b 7c b7 bb 75 f1 5c |+eU.5.0...|..u.\| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 36 ce 1a 97 3e e3 0e 62 74 70 10 |.....6...>..btp.| -000000b0 ec a5 30 16 1f 2d e0 5b c9 38 4d fb 61 2e 45 35 |..0..-.[.8M.a.E5| -000000c0 4b 69 da 43 39 |Ki.C9| +000000a0 00 00 00 00 00 83 b1 d6 5e 78 d8 7d 8f 22 a2 c9 |........^x.}."..| +000000b0 81 2d 47 ed 7e a5 65 10 af a0 b4 01 be b3 70 a8 |.-G.~.e.......p.| +000000c0 9f 5a 07 87 f5 |.Z...| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM index 01f961208fa..9f48c75bab2 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 d3 6a 87 ad b2 |............j...| -00000010 a0 59 86 0e 34 86 c1 b3 c9 64 17 92 aa 87 04 05 |.Y..4....d......| -00000020 32 d4 2e aa a1 48 94 87 82 a7 ab 00 00 04 c0 2f |2....H........./| +00000000 16 03 01 00 97 01 00 00 93 03 03 6d 19 64 2c f0 |...........m.d,.| +00000010 95 79 38 26 9b e3 db b3 97 ce f8 9c 46 62 08 15 |.y8&........Fb..| +00000020 a0 f0 7f 20 38 52 bb 27 f8 3b 60 00 00 04 c0 2f |... 8R.'.;`..../| 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| @@ -54,28 +54,28 @@ 00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............| 000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| 000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| -000002c0 74 08 04 00 80 65 2f 82 18 27 04 84 db 3d c6 5e |t....e/..'...=.^| -000002d0 6b 33 f9 87 59 e1 06 0c ce a7 3a f9 bd e7 54 47 |k3..Y.....:...TG| -000002e0 03 58 f7 0b a3 16 6a 47 4b 61 b6 d9 0d 04 c8 95 |.X....jGKa......| -000002f0 f5 d5 e5 0f 1b d2 26 3b c5 67 c0 87 dd a5 da a8 |......&;.g......| -00000300 e1 7e 52 a1 6a 0d 10 e8 dd 2e 09 39 21 3e a2 0f |.~R.j......9!>..| -00000310 a2 00 e4 a1 a6 df a8 3f 5d 1b d7 22 f8 b8 b5 32 |.......?].."...2| -00000320 31 3a 36 16 9e 6c ab f1 d5 25 ae 3c 4a 11 c8 ae |1:6..l...%..cuo.....| -00000340 11 40 c9 7f ca 16 03 03 00 04 0e 00 00 00 |.@............| +000002c0 74 04 01 00 80 99 cc 0d 3d 25 73 2d 21 00 0d 42 |t.......=%s-!..B| +000002d0 d1 6f 9e ba f4 04 58 30 5f a0 33 e9 b0 3a 69 6d |.o....X0_.3..:im| +000002e0 e2 a1 f2 74 f7 09 e7 ef fb cd 56 22 93 1c 56 8e |...t......V"..V.| +000002f0 8f 87 4b 1d 54 f6 34 fd e6 e0 2f 85 88 9a ab c9 |..K.T.4.../.....| +00000300 b5 38 cd f3 44 20 7a 68 fd bf 10 ea 14 7e ae 21 |.8..D zh.....~.!| +00000310 12 ad eb 91 2f 99 44 fb cf 9e fe 21 19 9f d1 a0 |..../.D....!....| +00000320 37 19 9e 48 92 0e 80 b7 51 95 45 ee 75 86 f9 52 |7..H....Q.E.u..R| +00000330 5a f8 67 65 56 af 4d f8 ca 92 8f b7 2a f5 be c1 |Z.geV.M.....*...| +00000340 04 e0 03 e1 b6 16 03 03 00 04 0e 00 00 00 |..............| >>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 d1 f3 61 78 d1 34 |....%...! ..ax.4| -00000010 36 b4 9f 5e e5 24 1e 48 02 be f0 13 c2 3d b0 ce |6..^.$.H.....=..| -00000020 fb 96 39 6b 96 76 aa 87 18 41 14 03 03 00 01 01 |..9k.v...A......| -00000030 16 03 03 00 28 27 e1 50 92 20 e1 2c 98 b6 15 8f |....('.P. .,....| -00000040 dd bd 26 98 04 12 5d cb 29 66 ab 2d 37 f3 8e eb |..&...].)f.-7...| -00000050 3e 14 3b cf 4d 99 c4 2e ea 7c 04 a5 45 |>.;.M....|..E| +00000000 16 03 03 00 25 10 00 00 21 20 20 74 90 bd 53 18 |....%...! t..S.| +00000010 33 c6 a5 bf 51 71 f7 d7 c3 0c 7f 89 ad b3 73 7b |3...Qq........s{| +00000020 48 2f c1 ef 85 32 03 73 28 3b 14 03 03 00 01 01 |H/...2.s(;......| +00000030 16 03 03 00 28 94 4f 85 68 15 57 b4 8f f4 21 a7 |....(.O.h.W...!.| +00000040 e5 be 84 7d 3a e0 29 bd 99 20 24 d0 6b 9c 72 3a |...}:.).. $.k.r:| +00000050 fc f9 5d 1c 7e cb dd 7a 3b 7c 53 e6 3a |..].~..z;|S.:| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 88 39 9d c1 8d 8c bb c4 79 ba a5 2a bd |....9......y..*.| -00000020 34 62 bf 66 85 b5 cd 2e f7 1e 6e b4 96 1c f6 b3 |4b.f......n.....| -00000030 13 ba c9 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........| -00000040 c3 ca b5 57 11 26 ec 18 be 00 6c 8b 79 a5 ed f7 |...W.&....l.y...| -00000050 7d ae 42 ff a2 8b fb 68 d0 08 0f 2e d1 15 03 03 |}.B....h........| -00000060 00 1a 00 00 00 00 00 00 00 02 58 ad 11 d2 74 5c |..........X...t\| -00000070 17 f2 60 e5 d9 fa 0e 47 5a 48 31 f7 |..`....GZH1.| +00000010 00 00 00 e3 4f 34 0e 47 ae f2 62 e3 aa 62 f3 37 |....O4.G..b..b.7| +00000020 cf 78 ba 1d 8a 3c d8 29 0c 3c 9d 0c fa ff fd 9b |.x...<.).<......| +00000030 65 1b 3f 17 03 03 00 25 00 00 00 00 00 00 00 01 |e.?....%........| +00000040 fd e1 49 0e 0d 9f a1 51 9e 19 5c 80 a5 15 dc 05 |..I....Q..\.....| +00000050 ca f0 46 b3 da 03 5a 32 da 4e 2e 3d 33 15 03 03 |..F...Z2.N.=3...| +00000060 00 1a 00 00 00 00 00 00 00 02 51 78 d9 14 6e a8 |..........Qx..n.| +00000070 f4 62 60 6d db e0 d5 8c c5 17 ac aa |.b`m........| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384 b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384 index 83a37e0587e..f6e5856f9cc 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384 +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384 @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 39 40 da f7 9f |...........9@...| -00000010 e9 66 91 25 2a d0 74 e1 71 4b 74 ff 47 41 5e f4 |.f.%*.t.qKt.GA^.| -00000020 d2 71 d0 3e 96 8e 8e 31 ee 81 8b 00 00 04 c0 30 |.q.>...1.......0| +00000000 16 03 01 00 97 01 00 00 93 03 03 5e 39 96 57 2e |...........^9.W.| +00000010 de 43 bd 55 30 40 20 95 29 a0 38 7f 69 a3 02 4d |.C.U0@ .).8.i..M| +00000020 df 59 4b 17 f1 d6 0b 2e 87 62 af 00 00 04 c0 30 |.YK......b.....0| 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| @@ -54,28 +54,28 @@ 00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............| 000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| 000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| -000002c0 74 08 04 00 80 67 b9 f4 b4 4e 00 7c 40 80 f1 77 |t....g...N.|@..w| -000002d0 2e 09 f6 04 17 bb ab f6 e1 13 03 b3 b6 71 22 0b |.............q".| -000002e0 38 49 98 65 54 db 3b e0 71 17 2a f3 d4 2a 0d 7e |8I.eT.;.q.*..*.~| -000002f0 af 56 37 ea a9 1e df 45 24 fd 90 ad 5e 3c aa 2e |.V7....E$...^<..| -00000300 98 74 b5 dc b5 22 0e 77 70 66 2f 6e d7 49 f6 a1 |.t...".wpf/n.I..| -00000310 93 c9 0a ce 45 2b 55 bb 02 a3 b1 1d 5f 45 08 cd |....E+U....._E..| -00000320 4d 34 9e ef 27 f2 f0 af a8 bd 14 60 45 df b4 54 |M4..'......`E..T| -00000330 2c 6f c8 c8 dc f1 07 9a e8 f3 f3 40 1d 29 39 9e |,o.........@.)9.| -00000340 a0 28 3a 19 de 16 03 03 00 04 0e 00 00 00 |.(:...........| +000002c0 74 04 01 00 80 c0 53 9b 58 b3 88 7a 7d 7d 0f 8c |t.....S.X..z}}..| +000002d0 c4 10 e3 13 92 ae b4 87 ae a5 e2 2f f9 f0 db a0 |.........../....| +000002e0 55 72 00 2f 29 eb 12 13 f7 bf 4b 44 be f2 85 f2 |Ur./).....KD....| +000002f0 00 2d 2c 6a 14 21 44 d5 f8 78 99 67 07 db 27 74 |.-,j.!D..x.g..'t| +00000300 32 9d 75 8d 7e f5 c2 9b 3e ce 3b aa f4 3a 1d 2d |2.u.~...>.;..:.-| +00000310 69 e3 0b 1e a0 95 d9 dc 47 73 42 14 7c 13 60 1f |i.......GsB.|.`.| +00000320 73 a9 0f 3b 64 33 18 67 b0 a3 69 f7 da 1d cd d0 |s..;d3.g..i.....| +00000330 ea 65 9d 79 af aa a6 7f ea ba 8a c7 d7 3f 80 76 |.e.y.........?.v| +00000340 73 b0 c4 41 30 16 03 03 00 04 0e 00 00 00 |s..A0.........| >>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 73 eb 70 45 10 e4 |....%...! s.pE..| -00000010 a7 a6 35 b2 51 59 1e 6d 65 9a 0e d4 5a c2 39 13 |..5.QY.me...Z.9.| -00000020 81 83 41 f8 60 0c 6b 0e 7f 4c 14 03 03 00 01 01 |..A.`.k..L......| -00000030 16 03 03 00 28 44 ed a7 2b dc 7a 00 b5 26 bd 56 |....(D..+.z..&.V| -00000040 0d b7 47 f3 2c d8 b7 c5 f6 21 3a e6 1f b8 fd 3a |..G.,....!:....:| -00000050 f8 44 65 0d 6e fd b8 32 cf dd f5 25 ce |.De.n..2...%.| +00000000 16 03 03 00 25 10 00 00 21 20 75 56 9a 51 e6 99 |....%...! uV.Q..| +00000010 e2 7f 36 c6 3e 7b e0 17 2a 28 73 77 24 6c e9 af |..6.>{..*(sw$l..| +00000020 76 68 30 6a 07 4f 49 26 45 6d 14 03 03 00 01 01 |vh0j.OI&Em......| +00000030 16 03 03 00 28 8e 42 ee 25 3a e2 8a 1a 51 f1 0c |....(.B.%:...Q..| +00000040 5b ce d2 2f 2b 86 c6 0f 10 d2 e2 44 da d8 4f 88 |[../+......D..O.| +00000050 b5 2b 9c 9f 21 06 da 76 93 06 42 43 1f |.+..!..v..BC.| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 cb e9 44 b4 25 7e a5 9d ed 8e 8b 5c 4c |.....D.%~.....\L| -00000020 b9 c4 85 5b 9b 03 02 34 2c 61 40 fe 4a 84 9d 42 |...[...4,a@.J..B| -00000030 67 67 53 17 03 03 00 25 00 00 00 00 00 00 00 01 |ggS....%........| -00000040 ec a1 21 b6 85 61 d1 35 71 50 c1 6d 4d 32 81 3f |..!..a.5qP.mM2.?| -00000050 24 38 1d 8a 45 f7 9e 14 3b be e9 ec 37 15 03 03 |$8..E...;...7...| -00000060 00 1a 00 00 00 00 00 00 00 02 f7 76 a1 1b bb 55 |...........v...U| -00000070 aa 1d 10 c2 07 61 b3 0d 54 2d 6b e4 |.....a..T-k.| +00000010 00 00 00 7c d4 b3 85 ea 5e 0c 8d 81 0c 7c 99 90 |...|....^....|..| +00000020 5f fd cc 32 b5 d8 fd 0c 0a 9c 93 a5 35 4d a8 50 |_..2........5M.P| +00000030 a8 6f 73 17 03 03 00 25 00 00 00 00 00 00 00 01 |.os....%........| +00000040 49 5c 12 84 e7 cb a4 fb b1 55 be 89 79 5c a8 df |I\.......U..y\..| +00000050 ab 0a e1 1b 98 e6 0f 40 fb f4 47 1f e1 15 03 03 |.......@..G.....| +00000060 00 1a 00 00 00 00 00 00 00 02 e7 17 b1 82 70 75 |..............pu| +00000070 42 d5 8f 2e 29 4b b3 a1 a2 3f c2 f8 |B...)K...?..| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled deleted file mode 100644 index 302e64e60f3..00000000000 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled +++ /dev/null @@ -1,84 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 cb 01 00 00 c7 03 03 ed 3d 3e 10 95 |............=>..| -00000010 8b 6f 6c be 5c b7 77 c0 79 91 f8 b3 6f 52 27 18 |.ol.\.w.y...oR'.| -00000020 0a b7 88 52 df 3c 6c 87 b4 5a 4c 00 00 38 c0 2c |...R.>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 30 00 00 |...DOWNGRD...0..| -00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| -00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| -00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| -00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| -00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| -000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| -000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| -000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| -000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| -000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| -000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| -00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| -00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| -00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| -00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| -00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| -00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| -00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| -00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| -00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| -00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| -000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| -000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| -000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| -000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| -000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| -000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| -00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| -00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| -00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| -00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| -00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| -00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| -00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| -00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| -00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............| -000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| -000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| -000002c0 74 04 01 00 80 a5 a9 75 be 51 ff dc b3 bb 77 79 |t......u.Q....wy| -000002d0 ef 5b 9f d9 27 6c 76 ea ce 5c 66 20 03 2e 94 fd |.[..'lv..\f ....| -000002e0 28 94 69 ff 06 ab bd 34 43 51 72 fb 15 42 e6 38 |(.i....4CQr..B.8| -000002f0 c5 7a 5d 7f 35 a7 3c 85 ec df 95 23 0f 28 c7 dc |.z].5.<....#.(..| -00000300 0e a6 ec fe 5e 77 3f 95 1d a7 73 1d d8 7b 68 92 |....^w?...s..{h.| -00000310 5b a5 b8 ba f5 7c a5 60 2e 43 d6 60 64 3e 33 c7 |[....|.`.C.`d>3.| -00000320 8b c2 56 68 e3 28 2b 2e 8b 9a 85 29 77 73 24 3e |..Vh.(+....)ws$>| -00000330 2b 95 b8 40 a7 f1 60 b5 9e 85 3e 1d ae ab 7f 85 |+..@..`...>.....| -00000340 63 63 d1 cf 62 16 03 03 00 04 0e 00 00 00 |cc..b.........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 43 dd 3e 28 34 9f |....%...! C.>(4.| -00000010 a9 0c 8e 14 66 01 a1 dd 15 8e 71 b4 05 83 d9 a3 |....f.....q.....| -00000020 5f 5c a3 31 ad 5c d5 5a ad 56 14 03 03 00 01 01 |_\.1.\.Z.V......| -00000030 16 03 03 00 28 f3 ad d2 ec 9e 1e 85 2d 96 5f bc |....(.......-._.| -00000040 70 cc 0a c2 22 ef 0a fe fb b0 77 f1 59 59 08 a6 |p...".....w.YY..| -00000050 57 39 16 00 82 0b 60 1e 9a 74 75 3a 8a |W9....`..tu:.| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 cf 63 14 29 73 c7 7b 6c 98 50 db 5f 8e |....c.)s.{l.P._.| -00000020 f4 de 68 bc c0 60 2c db 9e 1f d9 48 55 51 05 47 |..h..`,....HUQ.G| -00000030 7e 43 37 17 03 03 00 25 00 00 00 00 00 00 00 01 |~C7....%........| -00000040 67 0a e7 77 dd 1a 30 87 27 90 b0 42 31 42 09 53 |g..w..0.'..B1B.S| -00000050 03 bf 0c 10 3a c3 a7 95 e9 6e 63 57 ad 15 03 03 |....:....ncW....| -00000060 00 1a 00 00 00 00 00 00 00 02 d5 1a ac 66 50 93 |.............fP.| -00000070 46 0a da 98 1f cc 30 40 c1 47 c7 88 |F.....0@.G..| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required deleted file mode 100644 index 9e9570fed0c..00000000000 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required +++ /dev/null @@ -1,54 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 91 01 00 00 8d 03 03 5a 8a 66 22 31 |...........Z.f"1| -00000010 69 92 30 d5 7b 7c 17 a7 7c 14 d6 3c a9 9e ba dd |i.0.{|..|..<....| -00000020 7c 73 fe b4 b4 dd d8 28 39 32 0d 00 00 2a c0 30 ||s.....(92...*.0| -00000030 00 9f cc a8 cc aa c0 2f 00 9e c0 28 00 6b c0 27 |......./...(.k.'| -00000040 00 67 c0 14 00 39 c0 13 00 33 00 9d 00 9c 00 3d |.g...9...3.....=| -00000050 00 3c 00 35 00 2f 00 ff 01 00 00 3a 00 00 00 0e |.<.5./.....:....| -00000060 00 0c 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b |.....127.0.0.1..| -00000070 00 04 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 |................| -00000080 00 1e 00 19 00 18 00 16 00 00 00 17 00 00 00 0d |................| -00000090 00 04 00 02 08 04 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 30 00 00 |...DOWNGRD...0..| -00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| -00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| -00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| -00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| -00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| -000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| -000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| -000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| -000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| -000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| -000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| -00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| -00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| -00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| -00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| -00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| -00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| -00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| -00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| -00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| -00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| -000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| -000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| -000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| -000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| -000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| -000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| -00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| -00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| -00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| -00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| -00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| -00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| -00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| -00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| -00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 15 03 03 00 02 02 28 |;.........(| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RC4 b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RC4 index da549aa32e0..78ea1ff9293 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RC4 +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RC4 @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 c7 7f 29 46 41 |.............)FA| -00000010 08 97 7c 3f 77 e0 11 8f 14 30 23 3e fa fc ca f3 |..|?w....0#>....| -00000020 45 10 83 10 1f 8f 25 b6 9d c1 4d 00 00 04 00 05 |E.....%...M.....| +00000000 16 03 01 00 97 01 00 00 93 03 03 32 12 2b 12 44 |...........2.+.D| +00000010 4f 0c 98 c0 fc f6 44 06 3a b1 64 89 a5 8b f4 e4 |O.....D.:.d.....| +00000020 73 e1 60 1e 51 38 92 f3 83 f3 9f 00 00 04 00 05 |s.`.Q8..........| 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| @@ -53,23 +53,23 @@ 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| 00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............| >>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 d1 b0 57 28 da |.............W(.| -00000010 7a f8 46 7c c2 24 0d e0 04 48 33 d4 bc d7 f0 d0 |z.F|.$...H3.....| -00000020 85 fb ff 22 27 20 91 42 19 55 7b ef d8 fd 72 42 |..."' .B.U{...rB| -00000030 75 e6 71 e4 9f 67 30 72 68 b6 0e 00 34 d3 2f b8 |u.q..g0rh...4./.| -00000040 23 1b 00 43 17 68 fd 0f 90 ee 97 16 23 36 90 02 |#..C.h......#6..| -00000050 5c 71 10 03 80 ea 74 ef a4 5a ac e4 9f 48 f0 76 |\q....t..Z...H.v| -00000060 62 43 17 05 7c 8f 59 1d 16 b1 97 48 99 8d 66 5e |bC..|.Y....H..f^| -00000070 83 20 b3 02 e4 ac 73 52 b2 24 21 06 5a 49 89 df |. ....sR.$!.ZI..| -00000080 4b ad 4e f4 a9 7b 0c 3a b1 39 5d 14 03 03 00 01 |K.N..{.:.9].....| -00000090 01 16 03 03 00 24 8b de 7e 10 53 71 e0 0b 68 f6 |.....$..~.Sq..h.| -000000a0 36 67 66 c2 b9 0a c0 3e 39 0d ab 2e eb 5e eb 06 |6gf....>9....^..| -000000b0 a6 45 2b d7 48 8f c0 5e f3 a0 |.E+.H..^..| +00000000 16 03 03 00 86 10 00 00 82 00 80 85 ad 31 da a9 |.............1..| +00000010 fd 0f 5c ca aa 28 d1 08 7d 76 b4 5b b2 09 f4 e0 |..\..(..}v.[....| +00000020 65 3a 82 7e f8 03 5f c9 82 ae fb 04 f8 f1 dc bc |e:.~.._.........| +00000030 b9 2f e8 b4 4c b0 5a de c8 99 88 99 0b 03 ed 7f |./..L.Z.........| +00000040 e4 84 a0 6b 6d 55 1e f6 ea 9f 5a 55 1e 5c e5 f1 |...kmU....ZU.\..| +00000050 f4 8a f3 7b 7c 20 fc 4b 5d 31 98 c3 bb ce ba 6a |...{| .K]1.....j| +00000060 e8 e5 58 a1 db 5a 84 7d ef cd 17 52 2f 66 31 d2 |..X..Z.}...R/f1.| +00000070 27 e4 29 1c 9e e0 39 a9 e0 7f 5f 25 d7 49 95 28 |'.)...9..._%.I.(| +00000080 08 67 1e 25 5f 12 39 b0 a5 63 85 14 03 03 00 01 |.g.%_.9..c......| +00000090 01 16 03 03 00 24 88 e9 9e 1d 16 8f f7 6e b1 c9 |.....$.......n..| +000000a0 06 dc 50 e7 40 da 21 84 de 97 e6 a2 8d 78 96 9a |..P.@.!......x..| +000000b0 39 9d aa 91 43 15 0f cf f4 e9 |9...C.....| >>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 ee dc 70 d2 3a |..........$..p.:| -00000010 f1 9c c6 c8 01 01 84 4f 3c 95 a3 ac 7a 78 92 3d |.......O<...zx.=| -00000020 8c 05 a1 db 34 fe 92 f2 9e f3 81 a1 33 a5 7f 17 |....4.......3...| -00000030 03 03 00 21 6e a9 f8 f9 99 0b c1 f5 8a d0 ab 93 |...!n...........| -00000040 15 4d 2f 24 1c 0b 43 77 cf 14 60 87 b0 8d f7 80 |.M/$..Cw..`.....| -00000050 c0 69 ea f6 9e 15 03 03 00 16 ef 09 73 d8 06 ec |.i..........s...| -00000060 b8 02 14 9c d3 39 32 d4 3d 94 ec 17 79 1d a9 d3 |.....92.=...y...| +00000000 14 03 03 00 01 01 16 03 03 00 24 c5 34 41 0f 31 |..........$.4A.1| +00000010 5a 94 d7 4b a9 0a 4e bf b9 22 ec 76 2c 1f f5 e9 |Z..K..N..".v,...| +00000020 6b 7b 26 df 41 62 91 b6 dc db 23 2b 8d 3d 49 17 |k{&.Ab....#+.=I.| +00000030 03 03 00 21 72 31 77 51 94 c5 d4 eb 7c 18 ab 87 |...!r1wQ....|...| +00000040 29 43 3b c5 78 aa 5c 4a 06 d3 42 5c 61 39 86 12 |)C;.x.\J..B\a9..| +00000050 b1 ae f6 f7 97 15 03 03 00 16 8a 0e 1d 5c e0 18 |.............\..| +00000060 12 93 ac 6c 69 32 59 b8 15 88 82 1c 97 f3 5b 9c |...li2Y.......[.| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15 b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15 index 6d98a309ee9..2c5237153a7 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15 +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15 @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 91 01 00 00 8d 03 03 c1 6b f6 4d 77 |............k.Mw| -00000010 95 dc 8a 54 04 62 4a b4 dc e3 06 51 b8 88 4e 9f |...T.bJ....Q..N.| -00000020 9a f5 2b 87 82 51 df e9 54 c7 93 00 00 2a c0 30 |..+..Q..T....*.0| +00000000 16 03 01 00 91 01 00 00 8d 03 03 96 d3 ee ca ff |................| +00000010 77 00 8c e4 14 3a ee 2a bb 39 8c 62 72 c7 ae 46 |w....:.*.9.br..F| +00000020 8c 7e 8e 90 96 f1 c3 27 4d 37 3f 00 00 2a c0 30 |.~.....'M7?..*.0| 00000030 00 9f cc a8 cc aa c0 2f 00 9e c0 28 00 6b c0 27 |......./...(.k.'| 00000040 00 67 c0 14 00 39 c0 13 00 33 00 9d 00 9c 00 3d |.g...9...3.....=| 00000050 00 3c 00 35 00 2f 00 ff 01 00 00 3a 00 00 00 0e |.<.5./.....:....| @@ -54,28 +54,28 @@ 00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............| 000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| 000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| -000002c0 74 04 01 00 80 15 c5 ee da 37 f8 6d b8 9e 7c 68 |t........7.m..|h| -000002d0 b2 08 2a 8d 79 6c 6e 95 4e b5 6f 8e 84 24 31 d4 |..*.yln.N.o..$1.| -000002e0 e7 8c 6c 7e 9c 58 a4 fe 18 59 aa f7 0d 7d ff 7a |..l~.X...Y...}.z| -000002f0 f2 b0 eb b6 d3 4f fa 3f 36 0d 2e 43 8e d7 96 14 |.....O.?6..C....| -00000300 99 a0 34 6a 51 cf 49 48 2f 6a 69 3b e4 ec 8b 61 |..4jQ.IH/ji;...a| -00000310 a1 f4 ea 20 c5 72 90 b1 c6 54 75 42 4e f6 1f 12 |... .r...TuBN...| -00000320 da e1 98 36 01 02 30 b4 75 7b 4f 4b f1 4f ac 20 |...6..0.u{OK.O. | -00000330 ac c8 d2 0f 8f 2a 00 09 b8 2c ab 9e 5f b2 ce 25 |.....*...,.._..%| -00000340 e3 a3 27 9d 53 16 03 03 00 04 0e 00 00 00 |..'.S.........| +000002c0 74 04 01 00 80 c9 24 3c 3d dd 65 45 f8 e4 92 b9 |t.....$<=.eE....| +000002d0 2b 03 c2 9f f5 73 1f 84 dd 9b da 82 2b 44 7c f1 |+....s......+D|.| +000002e0 7c 55 d8 53 39 e9 d9 ea f1 6a 23 7f b0 aa 30 94 ||U.S9....j#...0.| +000002f0 37 b7 06 59 1a fc 09 ba d9 68 f7 c8 96 5d 80 e1 |7..Y.....h...]..| +00000300 7c f4 1b 36 0a 8a dd 2e c5 d0 27 da 4a 75 98 fb ||..6......'.Ju..| +00000310 43 51 3f 8e 95 0d 7b 42 93 8a d5 dc 55 59 ef 69 |CQ?...{B....UY.i| +00000320 91 82 a3 d8 7e 54 a4 7b 05 17 06 58 21 62 79 b7 |....~T.{...X!by.| +00000330 67 bd ac 8c 9e 23 73 01 17 49 4b 5d 24 7a 29 0b |g....#s..IK]$z).| +00000340 05 ec 24 1e cb 16 03 03 00 04 0e 00 00 00 |..$...........| >>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 fe 11 76 84 dd 42 |....%...! ..v..B| -00000010 d9 fd ad 50 81 7e 62 d4 38 cb b3 5d ec c8 5a 7a |...P.~b.8..]..Zz| -00000020 40 d9 10 23 2f e6 c7 a8 95 3b 14 03 03 00 01 01 |@..#/....;......| -00000030 16 03 03 00 28 61 18 1a 65 0c 24 59 01 fe 28 fc |....(a..e.$Y..(.| -00000040 4f 7f d9 c5 6d b7 bf 9c 5c 8b dc 91 e7 48 40 72 |O...m...\....H@r| -00000050 06 4d 49 a4 4d 32 e2 10 b9 36 a4 06 a6 |.MI.M2...6...| +00000000 16 03 03 00 25 10 00 00 21 20 8e 76 7a 64 15 47 |....%...! .vzd.G| +00000010 60 08 88 f8 3c ca 23 ce e3 f1 52 18 e0 94 6f 7a |`...<.#...R...oz| +00000020 be 7b 39 c6 42 eb 14 d9 f3 7a 14 03 03 00 01 01 |.{9.B....z......| +00000030 16 03 03 00 28 a8 16 b6 f4 4e 1e f1 5a 8a 04 a5 |....(....N..Z...| +00000040 4b a0 40 b1 9f 7e e7 42 22 45 01 03 52 5a 11 53 |K.@..~.B"E..RZ.S| +00000050 c1 1f a7 19 14 c0 9c d8 53 c3 41 ae 6f |........S.A.o| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 6c 7b 84 e6 84 d3 31 8e 6a 3e e7 7e f2 |...l{....1.j>.~.| -00000020 94 16 6c 6f 01 a9 2d f7 de 5d 94 b2 9c 4b f0 51 |..lo..-..]...K.Q| -00000030 70 9e 3c 17 03 03 00 25 00 00 00 00 00 00 00 01 |p.<....%........| -00000040 94 ca c5 e7 58 20 7d 3b 74 9d e0 97 a2 dd 63 ab |....X };t.....c.| -00000050 33 08 2f 16 69 59 ba 0e 82 52 75 98 eb 15 03 03 |3./.iY...Ru.....| -00000060 00 1a 00 00 00 00 00 00 00 02 fc 38 72 72 09 6a |...........8rr.j| -00000070 ee c0 61 39 50 71 ad d3 ec a9 d1 0e |..a9Pq......| +00000010 00 00 00 e8 93 95 10 51 dd 7c d1 07 72 73 c1 9d |.......Q.|..rs..| +00000020 6b 2a 47 ce f5 56 3f e0 2f c4 41 97 ea 6d 83 07 |k*G..V?./.A..m..| +00000030 3f 80 f5 17 03 03 00 25 00 00 00 00 00 00 00 01 |?......%........| +00000040 44 c5 ed 59 85 39 66 98 bb de 1a d3 03 f3 29 94 |D..Y.9f.......).| +00000050 4a 53 bd 25 bc 0a 23 11 10 68 c7 15 ad 15 03 03 |JS.%..#..h......| +00000060 00 1a 00 00 00 00 00 00 00 02 c8 a1 07 6c d8 6a |.............l.j| +00000070 cc f8 6a 5b d1 8c 32 93 71 23 c8 71 |..j[..2.q#.q| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS index 5ec0f25a17e..c260afe296b 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 91 01 00 00 8d 03 03 0f 06 da 7d 85 |..............}.| -00000010 33 d8 3c c3 ad c5 19 f8 06 d8 f6 02 80 9a fb 8c |3.<.............| -00000020 55 a5 6b 67 c4 6e 68 11 74 61 28 00 00 2a c0 30 |U.kg.nh.ta(..*.0| +00000000 16 03 01 00 91 01 00 00 8d 03 03 de a3 85 5b 56 |..............[V| +00000010 34 e4 d0 57 07 66 8d 3c 39 00 eb 27 02 22 c9 f3 |4..W.f.<9..'."..| +00000020 23 a6 5e 08 3a 6d 06 09 8f d9 00 00 00 2a c0 30 |#.^.:m.......*.0| 00000030 00 9f cc a8 cc aa c0 2f 00 9e c0 28 00 6b c0 27 |......./...(.k.'| 00000040 00 67 c0 14 00 39 c0 13 00 33 00 9d 00 9c 00 3d |.g...9...3.....=| 00000050 00 3c 00 35 00 2f 00 ff 01 00 00 3a 00 00 00 0e |.<.5./.....:....| @@ -51,31 +51,4 @@ 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............| -000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| -000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| -000002c0 74 08 04 00 80 49 30 b1 a5 47 19 7f a7 35 61 cb |t....I0..G...5a.| -000002d0 dc 41 47 f0 6a 96 e1 63 48 d9 4f d3 a4 ac 06 46 |.AG.j..cH.O....F| -000002e0 f2 8d 07 95 25 c6 61 59 4a df 35 2e ce dd 71 7e |....%.aYJ.5...q~| -000002f0 1e d6 f4 9f 43 93 84 35 6a 98 41 45 16 ee cb 14 |....C..5j.AE....| -00000300 dd bb 52 27 08 d5 a2 39 e7 6e f6 d6 e4 c6 bd f3 |..R'...9.n......| -00000310 b6 9b 6d 61 30 2a 07 c6 04 39 87 fd 99 00 15 78 |..ma0*...9.....x| -00000320 3d bf 20 8c b9 52 fb 5d c7 b7 77 78 fb 77 2a ac |=. ..R.]..wx.w*.| -00000330 f5 3e e5 4b 8f 4d 9b ca c2 33 1c 66 3c cb e0 1f |.>.K.M...3.f<...| -00000340 81 36 78 39 70 16 03 03 00 04 0e 00 00 00 |.6x9p.........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 79 9a e7 42 96 52 |....%...! y..B.R| -00000010 f6 52 7d 10 9a 36 9b aa a7 2f 96 be 5b 0a 3b 40 |.R}..6.../..[.;@| -00000020 d9 32 3a 0b 17 7b 8d 92 7c 7b 14 03 03 00 01 01 |.2:..{..|{......| -00000030 16 03 03 00 28 92 3e da 41 d2 87 60 b3 e1 4f f7 |....(.>.A..`..O.| -00000040 bb b7 09 50 47 2e 05 d5 fe f6 ed 94 ba 3b 60 aa |...PG........;`.| -00000050 38 2d b2 38 c7 07 64 63 dd ca 1a 8e ae |8-.8..dc.....| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 8e c6 6e 45 21 eb 35 11 7a b5 74 d7 f7 |.....nE!.5.z.t..| -00000020 67 53 15 23 9d 61 a1 bc 20 10 c8 8e 7e ee 45 fc |gS.#.a.. ...~.E.| -00000030 60 13 20 17 03 03 00 25 00 00 00 00 00 00 00 01 |`. ....%........| -00000040 bf f9 63 b5 b1 39 70 43 c7 62 38 be d1 f5 0d a5 |..c..9pC.b8.....| -00000050 87 91 95 71 ab 03 c2 08 d0 38 dc 70 9a 15 03 03 |...q.....8.p....| -00000060 00 1a 00 00 00 00 00 00 00 02 0c 6f b1 f5 45 6d |...........o..Em| -00000070 44 2c 1f ec a4 fa 5c c1 aa 23 1e 82 |D,....\..#..| +00000290 3b e9 fa e7 15 03 03 00 02 02 28 |;.........(| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI b/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI index f1c35527d20..380db2abb21 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 99 01 00 00 95 03 03 4d 04 34 4d c9 |...........M.4M.| -00000010 52 17 f0 1c 49 b6 2b d1 a0 16 a2 04 f4 d3 7c ca |R...I.+.......|.| -00000020 3d 4e 41 44 3d de 29 60 32 d6 a7 00 00 04 00 2f |=NAD=.)`2....../| +00000000 16 03 01 00 99 01 00 00 95 03 03 dd e8 cc 23 63 |..............#c| +00000010 70 38 e5 f9 db 6c 77 0b be e9 53 ad 06 97 cb 02 |p8...lw...S.....| +00000020 d4 a7 bc d2 68 80 bf b8 0c 51 bc 00 00 04 00 2f |....h....Q...../| 00000030 00 ff 01 00 00 68 00 00 00 10 00 0e 00 00 0b 73 |.....h.........s| 00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0b 00 04 03 00 |nitest.com......| 00000050 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 |................| @@ -53,31 +53,31 @@ 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| 00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............| >>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 ca 5a ef 73 b7 |............Z.s.| -00000010 e2 11 b7 9a 45 22 8f 0d 44 ca 44 77 c0 ec 67 95 |....E"..D.Dw..g.| -00000020 cc 63 2a 55 65 69 34 93 a2 64 fa f8 c0 db 56 91 |.c*Uei4..d....V.| -00000030 d2 50 d4 a8 8c 89 13 e6 c0 ce 2b 26 46 cb ea 39 |.P........+&F..9| -00000040 66 4c 89 58 8d 8a da 9c bd 16 b3 28 40 a1 6f f8 |fL.X.......(@.o.| -00000050 f7 f5 d9 9f d1 cd 44 ca b5 ed 19 ea ec fa 97 2d |......D........-| -00000060 87 a5 c2 a8 1e f0 0c 70 fd fc a7 e7 1b dc 0c 99 |.......p........| -00000070 d0 1f 6d 68 df 64 8f cb ce 7b 3e 38 ab 9d b3 ba |..mh.d...{>8....| -00000080 66 a4 17 60 d6 fd ab 1d d8 a2 b4 14 03 03 00 01 |f..`............| -00000090 01 16 03 03 00 40 31 e3 94 eb 85 21 63 5e 29 b8 |.....@1....!c^).| -000000a0 2b 9a 42 d1 4d f1 3c e8 df 66 ed 6f 61 42 aa 46 |+.B.M.<..f.oaB.F| -000000b0 c0 4b 33 27 93 94 c5 6a 6c 94 f9 ba 6a 81 11 b1 |.K3'...jl...j...| -000000c0 be 21 00 97 d9 84 9d ee fd fd 79 18 ad 07 7a a8 |.!........y...z.| -000000d0 d3 89 e3 2a b0 f0 |...*..| +00000000 16 03 03 00 86 10 00 00 82 00 80 88 3a 3f eb 46 |............:?.F| +00000010 28 cd 34 8f 95 5a 1e f8 c9 09 7d b0 97 9c 84 62 |(.4..Z....}....b| +00000020 20 fd c7 cd 2e 09 27 2e bb b7 1c b6 e1 05 7b f4 | .....'.......{.| +00000030 cc 52 14 ee 6c 9b 18 4e 31 5a 4d be 8c 84 e3 6c |.R..l..N1ZM....l| +00000040 27 ca e9 c4 e9 da 9a 84 cc 7c b5 87 27 e1 be 1c |'........|..'...| +00000050 7a 70 3b 2a 71 a4 7d c5 4b ab 28 0e 4b ff 1f c4 |zp;*q.}.K.(.K...| +00000060 d0 08 0b 9b ce e6 b8 ae a2 a9 c5 c9 0a 73 1d a0 |.............s..| +00000070 88 18 11 55 61 e1 1b 83 82 93 19 bb dc 29 f9 aa |...Ua........)..| +00000080 44 e0 b0 3b b9 dd 73 98 52 42 7b 14 03 03 00 01 |D..;..s.RB{.....| +00000090 01 16 03 03 00 40 a4 e7 a1 51 63 e2 d7 df 93 32 |.....@...Qc....2| +000000a0 01 f2 f1 14 a0 a3 1c 04 f1 c6 19 8c ab cb 51 b5 |..............Q.| +000000b0 78 12 a4 43 08 62 14 ff 5c a0 5f aa 61 d8 c3 2c |x..C.b..\._.a..,| +000000c0 c8 af 05 f8 83 ff fb 6a d9 a7 06 a9 ea b0 92 f5 |.......j........| +000000d0 75 5a bc e7 57 c3 |uZ..W.| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 98 ae 81 aa e9 |................| -00000020 4e 1f 93 59 89 05 a2 98 c3 17 dd e1 9d 9a 12 7d |N..Y...........}| -00000030 30 c6 6c b4 a6 f3 b7 b2 c5 df dc 9d 81 99 ce 29 |0.l............)| -00000040 4b 75 04 9e d3 82 06 fa 22 1f a2 17 03 03 00 40 |Ku......"......@| +00000010 00 00 00 00 00 00 00 00 00 00 00 63 e2 4a 8d 77 |...........c.J.w| +00000020 d8 d9 50 ae ba b0 44 d9 e2 7d 97 52 e6 65 07 5e |..P...D..}.R.e.^| +00000030 a1 03 19 a7 f6 a2 af 89 00 99 da 98 29 43 43 47 |............)CCG| +00000040 9b 3c 8f 03 1a 36 27 e3 d8 db b7 17 03 03 00 40 |.<...6'........@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 dc 0e 49 1a ad 28 b6 c1 f2 27 ae bf 94 45 57 15 |..I..(...'...EW.| -00000070 74 33 ae 3a f0 ee e5 76 7e 72 6c d9 56 64 88 58 |t3.:...v~rl.Vd.X| -00000080 0b 96 35 a9 83 2e 4e 82 f8 a4 f8 f5 5b 08 6f 79 |..5...N.....[.oy| +00000060 c2 6b 34 e5 79 04 14 ec cf 14 4c 71 14 02 0d b3 |.k4.y.....Lq....| +00000070 29 31 ec d8 40 81 12 15 8e 17 8a 42 33 1a 82 9a |)1..@......B3...| +00000080 be e9 6c dc dc 49 56 7a fd 13 0a 20 37 79 e4 71 |..l..IVz... 7y.q| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 63 55 cb 53 f8 b1 48 85 33 aa c6 |.....cU.S..H.3..| -000000b0 aa 60 c4 d0 b6 bb cc 85 3e a9 92 f9 be 53 8b 8b |.`......>....S..| -000000c0 3e 9c ee 8f f4 |>....| +000000a0 00 00 00 00 00 4d 29 ee b6 bf f8 71 69 4e 96 a4 |.....M)....qiN..| +000000b0 5d 06 0e ef a9 aa 3f 16 19 c9 5d 8e 89 4f d2 cb |].....?...]..O..| +000000c0 17 1a e1 b0 63 |....c| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate b/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate index f407ffd0b53..3e08bd4067f 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 99 01 00 00 95 03 03 9d e8 44 6f ac |.............Do.| -00000010 b8 f3 4e 96 5e c0 2a 81 4d 71 2e 0e 8a a0 2f 88 |..N.^.*.Mq..../.| -00000020 4a 87 39 d2 ed 94 0b 41 ad 2b bf 00 00 04 00 2f |J.9....A.+...../| +00000000 16 03 01 00 99 01 00 00 95 03 03 78 fd 27 cc 09 |...........x.'..| +00000010 5e 07 db a2 78 ba 7a 4d a9 7f 74 f5 d1 6e a7 d2 |^...x.zM..t..n..| +00000020 bc f2 ee 22 2d 68 e7 59 c4 9c bc 00 00 04 00 2f |..."-h.Y......./| 00000030 00 ff 01 00 00 68 00 00 00 10 00 0e 00 00 0b 73 |.....h.........s| 00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0b 00 04 03 00 |nitest.com......| 00000050 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 |................| @@ -53,31 +53,31 @@ 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| 00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............| >>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 a4 d5 09 e3 4c |...............L| -00000010 78 eb 7d 76 4f 7f cf c7 2b 9d d1 fe 8f 5e a2 6b |x.}vO...+....^.k| -00000020 83 82 cb 93 37 63 47 ec 38 48 42 2a 3e e1 bf 6b |....7cG.8HB*>..k| -00000030 02 0a 8c b8 07 a7 11 5d fd cc 6d dc 3b ed 26 24 |.......]..m.;.&$| -00000040 18 64 ed 2e 98 93 49 45 ea 49 be 3f 12 43 47 c0 |.d....IE.I.?.CG.| -00000050 c3 ef 25 e0 be 06 f2 e5 fe 9f 3e c7 e6 23 90 d1 |..%.......>..#..| -00000060 2e 6f fc e2 72 ba a2 c2 e9 94 ab 7e ca 59 fa 93 |.o..r......~.Y..| -00000070 40 4a 48 39 f9 5e 5f ac 60 a0 94 61 1c 6e 10 1e |@JH9.^_.`..a.n..| -00000080 30 44 1d 28 cb 2b b9 7f 00 dd 23 14 03 03 00 01 |0D.(.+....#.....| -00000090 01 16 03 03 00 40 81 02 8e b2 b5 e2 b2 0a 95 9e |.....@..........| -000000a0 1e 65 4a 63 98 5b f0 30 4b 63 0a 74 87 58 20 fb |.eJc.[.0Kc.t.X .| -000000b0 2f 58 f8 10 a5 5f 4e b9 19 21 96 5f 13 8d d6 ed |/X..._N..!._....| -000000c0 a3 39 92 e5 4c 0f 31 c3 df 51 2d bb 7c 29 54 34 |.9..L.1..Q-.|)T4| -000000d0 f6 68 fb f2 49 2d |.h..I-| +00000000 16 03 03 00 86 10 00 00 82 00 80 1f 30 ae eb ce |............0...| +00000010 57 b4 1c 5d f9 d0 5c 62 1e 89 6f b8 92 e3 c5 ef |W..]..\b..o.....| +00000020 ad cb 1b c2 86 e2 4e b5 88 4a d1 77 9d 89 07 87 |......N..J.w....| +00000030 43 a1 90 41 70 3e 5e b6 59 29 9c 05 79 8f 97 92 |C..Ap>^.Y)..y...| +00000040 77 6a 81 30 ec 30 ca e9 5e 66 10 6b 33 85 c8 c4 |wj.0.0..^f.k3...| +00000050 4f 9a 0d 8e 4b cb d2 d8 93 9c 9c b8 91 95 15 01 |O...K...........| +00000060 40 7c 61 cb bf a7 8e a9 ca dc 3e 78 ca 27 17 86 |@|a.......>x.'..| +00000070 40 50 c5 44 03 ad 87 7a dc 36 76 f5 79 6d 45 df |@P.D...z.6v.ymE.| +00000080 01 c1 d4 4f b0 d8 6a 2c fe 18 71 14 03 03 00 01 |...O..j,..q.....| +00000090 01 16 03 03 00 40 bc 90 46 f6 24 2f 68 47 7b 21 |.....@..F.$/hG{!| +000000a0 01 91 67 d4 94 39 c0 8e 9f d4 75 dc f6 3a ac 22 |..g..9....u..:."| +000000b0 4a a8 44 c9 ea 90 02 9b fa 5c d5 17 5c 3d 81 bb |J.D......\..\=..| +000000c0 90 72 29 5d 92 d8 b1 2d b7 a6 18 d1 7b 78 f4 7d |.r)]...-....{x.}| +000000d0 66 f8 2b 9c b1 90 |f.+...| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 3a 54 5f df 8a |...........:T_..| -00000020 c4 53 fb 18 31 f5 72 47 fd ef 38 84 72 80 81 88 |.S..1.rG..8.r...| -00000030 45 69 81 aa c8 0d d7 4a 95 e9 cf ea b0 0e 07 3b |Ei.....J.......;| -00000040 9c f5 b3 47 00 58 55 e3 06 e1 a3 17 03 03 00 40 |...G.XU........@| +00000010 00 00 00 00 00 00 00 00 00 00 00 c6 d9 32 9f b9 |.............2..| +00000020 e8 94 29 d3 62 fb ce 1d de 4e de be e4 bd 58 86 |..).b....N....X.| +00000030 96 07 c9 8e 34 77 b5 ca 18 67 39 d4 4c 33 c8 f0 |....4w...g9.L3..| +00000040 4f 6b a2 22 c7 c1 1e 73 a7 9f 91 17 03 03 00 40 |Ok."...s.......@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 dd c3 b2 95 87 4d fb ae ee 0e cd 78 ac f3 2d 06 |.....M.....x..-.| -00000070 f1 a1 86 91 a3 d3 8f f6 66 b6 1c 6d 3f 6b 5b ba |........f..m?k[.| -00000080 4c c8 b2 5e bf 46 2b 05 bd 17 51 29 bd 1a 91 39 |L..^.F+...Q)...9| +00000060 74 73 d2 d5 5c 5d d7 0d 83 0f c6 8b bd 7c f6 31 |ts..\].......|.1| +00000070 2e cf 9d 01 14 f8 91 59 3d 2b 2f 4b 12 3f 72 1f |.......Y=+/K.?r.| +00000080 31 05 95 c9 a6 ab a4 15 b5 f3 a3 5c 68 15 f3 2f |1..........\h../| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 17 b0 ba 69 00 94 0c 79 3f f7 39 |........i...y?.9| -000000b0 be a6 4b 52 b6 5e c7 c1 98 f5 04 b2 78 1f 92 4f |..KR.^......x..O| -000000c0 4f 50 2d 59 2d |OP-Y-| +000000a0 00 00 00 00 00 78 71 a1 35 b1 2b e1 5d 85 d7 9b |.....xq.5.+.]...| +000000b0 77 b2 39 20 a9 86 4c 99 0c 96 0d bc 50 f6 a2 ab |w.9 ..L.....P...| +000000c0 04 80 30 1b 08 |..0..| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound b/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound index 4139c92aa09..6fbad262a11 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 99 01 00 00 95 03 03 cf 60 be 69 fc |............`.i.| -00000010 d8 3d f8 5e 5a 67 1d 86 93 9a b1 58 4e ca 35 d8 |.=.^Zg.....XN.5.| -00000020 2d 92 56 f8 74 b0 9a 96 20 75 46 00 00 04 00 2f |-.V.t... uF..../| +00000000 16 03 01 00 99 01 00 00 95 03 03 d9 85 58 6e 7f |.............Xn.| +00000010 2d b4 cd f0 04 75 ef 4a 41 8a f9 2e 87 ae 63 c8 |-....u.JA.....c.| +00000020 59 4b a2 4c 4f 46 c4 15 91 2e 7c 00 00 04 00 2f |YK.LOF....|..../| 00000030 00 ff 01 00 00 68 00 00 00 10 00 0e 00 00 0b 73 |.....h.........s| 00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0b 00 04 03 00 |nitest.com......| 00000050 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 |................| @@ -53,31 +53,31 @@ 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| 00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............| >>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 aa e3 c3 d5 76 |...............v| -00000010 d7 f7 da d5 93 39 8f 6d c2 6a ed dc b1 69 c9 2e |.....9.m.j...i..| -00000020 74 55 e3 2a c8 7d 03 f5 a6 6a 4e 04 b1 7f 14 86 |tU.*.}...jN.....| -00000030 4c 5a 0d 55 00 dc 58 2b b6 34 bb 51 b0 d6 df ff |LZ.U..X+.4.Q....| -00000040 ab 0e 1a a8 df b1 58 de 73 9d 94 e4 d1 26 28 df |......X.s....&(.| -00000050 64 09 fd b0 bc d5 9e 85 0d e8 0c ff 1a 5c 87 47 |d............\.G| -00000060 57 d0 3e a8 46 c6 5d c4 57 5c 95 c1 ca 91 69 c3 |W.>.F.].W\....i.| -00000070 26 2f 93 0a f8 56 51 10 e9 ff f2 82 4f 21 54 30 |&/...VQ.....O!T0| -00000080 d3 87 fd e9 e6 a1 05 53 d0 b4 10 14 03 03 00 01 |.......S........| -00000090 01 16 03 03 00 40 1f 6b ca bc 42 19 fe c6 64 cf |.....@.k..B...d.| -000000a0 6f de ff 54 28 56 de 1a 99 fb 19 d7 4a 5e 34 97 |o..T(V......J^4.| -000000b0 f6 38 99 17 16 fb 06 ae 88 fb a6 07 2f 01 7b 54 |.8........../.{T| -000000c0 63 8a 4a c1 6b ee 4e 61 4e c1 46 b5 d6 8f 51 a9 |c.J.k.NaN.F...Q.| -000000d0 fb 07 9b 88 27 20 |....' | +00000000 16 03 03 00 86 10 00 00 82 00 80 5a 46 e5 a3 fb |...........ZF...| +00000010 1d 57 11 df 01 db d8 df 8c 2f 25 4a 23 7a 62 38 |.W......./%J#zb8| +00000020 49 b7 fa 2c 96 94 38 62 b5 9e db 5b 84 d8 8c 24 |I..,..8b...[...$| +00000030 ec 80 e8 f7 c6 bf 8f fc ba 2c 46 f6 ea e6 be 02 |.........,F.....| +00000040 fb 43 2c 97 82 6e 0e ce 1d 16 39 80 09 97 da 65 |.C,..n....9....e| +00000050 4a ad 87 02 2c f3 6a ce 44 c0 c3 16 ef 67 86 62 |J...,.j.D....g.b| +00000060 14 1a 85 7a 82 a7 b8 6f 55 8f 1e fb 5d 2d a8 cb |...z...oU...]-..| +00000070 ec 77 0d b0 b3 1b a1 99 c9 51 e8 63 98 1a 31 f4 |.w.......Q.c..1.| +00000080 b2 17 b5 bf 57 fb 23 47 ee 1e d3 14 03 03 00 01 |....W.#G........| +00000090 01 16 03 03 00 40 61 a2 82 3b 6f c3 f6 8b 1d 93 |.....@a..;o.....| +000000a0 42 f6 81 a4 e1 3b bd ab 6f d1 9d 04 a6 be f4 1b |B....;..o.......| +000000b0 c7 0b 63 c5 d2 4d 8b 69 41 5a 65 8d 8d b1 83 92 |..c..M.iAZe.....| +000000c0 2d d6 6c c5 45 c7 99 83 89 b7 d5 a1 ae 1b 33 05 |-.l.E.........3.| +000000d0 d5 00 9f cb 79 50 |....yP| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 62 37 c3 c7 5e |...........b7..^| -00000020 7a 8c 16 99 2d a4 21 cd 44 ab ae ff 52 d4 a9 6f |z...-.!.D...R..o| -00000030 fe 58 9a 61 2e ed 51 47 8b 9f f1 ca be b9 46 78 |.X.a..QG......Fx| -00000040 9a fc d0 38 45 da a9 41 fd 51 8f 17 03 03 00 40 |...8E..A.Q.....@| +00000010 00 00 00 00 00 00 00 00 00 00 00 29 51 0e ac ef |...........)Q...| +00000020 7b ef 53 95 05 d9 4f 28 97 a2 d6 ff 44 e1 0f fb |{.S...O(....D...| +00000030 ed e2 ac f4 6c 46 5f 91 07 ba f0 8f 37 37 8d 77 |....lF_.....77.w| +00000040 7d a8 32 f5 4c f8 fd fc 86 ed 02 17 03 03 00 40 |}.2.L..........@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 7d aa 32 6f 59 1c d9 83 fe 11 2f ff b7 92 fb 22 |}.2oY...../...."| -00000070 c0 9c 77 d6 73 66 da 10 f1 36 61 34 0f e6 e9 77 |..w.sf...6a4...w| -00000080 8a 5c c1 8c ba 36 9d cc 8d 3f 48 03 2c c1 a5 1e |.\...6...?H.,...| +00000060 2d 65 8c 14 51 77 fb 37 61 b0 37 2b 74 8b 9e 8d |-e..Qw.7a.7+t...| +00000070 7e 72 c9 af 46 eb 05 72 8a b4 42 dc e9 6c df 01 |~r..F..r..B..l..| +00000080 d2 c6 eb 48 f9 a9 a1 fd 6f 58 b2 76 95 13 df 29 |...H....oX.v...)| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 29 14 57 d1 dc f3 ab 63 40 92 00 |.....).W....c@..| -000000b0 31 3b d5 36 a8 3c e3 cf b5 64 ee b7 e9 36 86 75 |1;.6.<...d...6.u| -000000c0 6e d8 91 29 f0 |n..).| +000000a0 00 00 00 00 00 81 a1 ed 82 f3 3d d4 ea af 32 0d |..........=...2.| +000000b0 b2 b4 ab 7e 94 1b 88 95 8b 72 22 57 b1 35 96 12 |...~.....r"W.5..| +000000c0 45 57 68 d7 dc |EWh..| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv12-X25519 b/libgo/go/crypto/tls/testdata/Server-TLSv12-X25519 index f8e6ab38d16..ca3e49b93b7 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv12-X25519 +++ b/libgo/go/crypto/tls/testdata/Server-TLSv12-X25519 @@ -1,7 +1,7 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 8f 01 00 00 8b 03 03 77 a6 19 8a 94 |...........w....| -00000010 4a 1a d4 51 10 98 c3 22 5d 5d 76 2d 4f 27 ea e8 |J..Q..."]]v-O'..| -00000020 61 d0 10 7a 08 43 23 42 b0 e0 12 00 00 04 c0 2f |a..z.C#B......./| +00000000 16 03 01 00 8f 01 00 00 8b 03 03 48 6b c4 66 fd |...........Hk.f.| +00000010 74 9f 73 e7 c8 4c 12 5b 6a e0 3d a6 5b ed f7 78 |t.s..L.[j.=.[..x| +00000020 f1 93 b3 1b 1f ee 2e bc 85 f7 4e 00 00 04 c0 2f |..........N..../| 00000030 00 ff 01 00 00 5e 00 00 00 0e 00 0c 00 00 09 31 |.....^.........1| 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 00000050 00 0a 00 04 00 02 00 1d 00 16 00 00 00 17 00 00 |................| @@ -54,28 +54,28 @@ 00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............| 000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| 000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| -000002c0 74 08 04 00 80 0f e7 f4 b4 b9 f2 83 95 26 d7 70 |t............&.p| -000002d0 5f b2 e3 5e 42 86 b6 67 0a df 4e 60 2d d2 91 be |_..^B..g..N`-...| -000002e0 2c ba c1 24 9c 57 29 eb aa df 52 e5 8e 5f 9c ab |,..$.W)...R.._..| -000002f0 9c 88 c5 8a 92 fd b6 d5 e2 6b 0d ea 1c de 73 22 |.........k....s"| -00000300 a1 51 05 e0 b6 87 e1 e4 2b 8e 1d 06 26 53 37 4e |.Q......+...&S7N| -00000310 c7 8f 05 4a 0c 48 69 d3 7b f8 44 33 7b 2b 54 f5 |...J.Hi.{.D3{+T.| -00000320 d9 a8 70 f3 6d b5 1c e4 4d 53 5f 0d 29 76 92 d3 |..p.m...MS_.)v..| -00000330 63 19 25 b0 8c c6 31 13 e4 b5 d5 d0 b9 47 ed 54 |c.%...1......G.T| -00000340 28 82 6c 04 a9 16 03 03 00 04 0e 00 00 00 |(.l...........| +000002c0 74 04 01 00 80 6f 80 d8 15 ba df d3 5d d9 71 5f |t....o......].q_| +000002d0 25 f0 4f 03 1f 62 11 f4 33 91 34 08 6e d0 49 b9 |%.O..b..3.4.n.I.| +000002e0 45 a6 37 85 73 36 c6 e7 45 c0 63 c9 66 0f b1 ae |E.7.s6..E.c.f...| +000002f0 86 33 b6 2a 24 d3 87 39 c8 62 da 0b 5d ae b0 74 |.3.*$..9.b..]..t| +00000300 0d b9 36 6b 1b 97 86 d8 65 fa 46 75 6f ef d9 87 |..6k....e.Fuo...| +00000310 6d b9 91 bb dc 47 42 23 c8 70 2a ba 65 0b 77 df |m....GB#.p*.e.w.| +00000320 57 6d 89 22 d8 36 f5 69 14 bc e1 c7 4c 80 22 0a |Wm.".6.i....L.".| +00000330 53 11 90 e0 61 30 48 29 2d 7c cf 17 94 a8 47 77 |S...a0H)-|....Gw| +00000340 24 17 21 ec 04 16 03 03 00 04 0e 00 00 00 |$.!...........| >>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 a4 db 55 a3 5a 6f |....%...! ..U.Zo| -00000010 af bf a2 53 ad 81 4d ea ef c0 d7 02 5d 42 9f ee |...S..M.....]B..| -00000020 34 ff bf 08 c9 13 56 8c e3 26 14 03 03 00 01 01 |4.....V..&......| -00000030 16 03 03 00 28 bd 32 89 70 2a eb 54 d1 ae 60 08 |....(.2.p*.T..`.| -00000040 4e 05 c9 e8 bb a7 fc 96 56 1a ba c7 51 a5 4d 2a |N.......V...Q.M*| -00000050 de da 6e a9 97 82 aa 37 44 00 4a 1f 0a |..n....7D.J..| +00000000 16 03 03 00 25 10 00 00 21 20 a0 e5 33 b9 5e e5 |....%...! ..3.^.| +00000010 11 68 48 53 f1 06 5b ea c7 2b 21 60 d1 ec e4 aa |.hHS..[..+!`....| +00000020 15 b9 38 bb c5 4d e4 c7 cf 17 14 03 03 00 01 01 |..8..M..........| +00000030 16 03 03 00 28 41 1f 89 64 4d bb 36 48 36 97 d7 |....(A..dM.6H6..| +00000040 1c 9c 44 9b 60 77 1e 73 87 7c f5 47 e4 e2 cd f8 |..D.`w.s.|.G....| +00000050 fc 76 fe f3 38 34 4f ab 4a ce 55 66 6e |.v..84O.J.Ufn| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 7e 16 80 9b 85 03 3b 19 35 dc 22 75 4d |...~.....;.5."uM| -00000020 08 36 ad ee 24 f2 75 de fe c2 c6 ba 91 62 1d 29 |.6..$.u......b.)| -00000030 68 53 d3 17 03 03 00 25 00 00 00 00 00 00 00 01 |hS.....%........| -00000040 65 36 ef c0 52 ae be bc 94 af 01 d6 c1 a8 2c 04 |e6..R.........,.| -00000050 3c 83 a2 88 61 7f 41 c0 76 ec aa 52 8d 15 03 03 |<...a.A.v..R....| -00000060 00 1a 00 00 00 00 00 00 00 02 4a dd b0 50 cf 59 |..........J..P.Y| -00000070 01 67 74 45 f2 ae 47 f1 38 ef 51 04 |.gtE..G.8.Q.| +00000010 00 00 00 44 d3 59 7d fc 8a 85 c2 67 f6 b2 6c 43 |...D.Y}....g..lC| +00000020 5a 77 c0 96 a4 69 0f ec f6 fa 27 00 4c 04 e1 23 |Zw...i....'.L..#| +00000030 c5 1e d9 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........| +00000040 3f 7f d6 e8 bb 6c 7f 1c d2 97 38 88 15 40 9c e5 |?....l....8..@..| +00000050 1f 0b ac 83 e7 8b 57 0d 6b 62 22 0b 8e 15 03 03 |......W.kb".....| +00000060 00 1a 00 00 00 00 00 00 00 02 d8 e7 53 15 ab a7 |............S...| +00000070 e4 62 10 fd 48 be f5 c8 09 98 92 ad |.b..H.......| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndECDSAGiven b/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndECDSAGiven index c26e3c2ed57..214ae5eed8d 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndECDSAGiven +++ b/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndECDSAGiven @@ -1,9 +1,9 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 e0 01 00 00 dc 03 03 93 c7 00 24 7c |..............$|| -00000010 18 0f ec 3a 26 e2 8c 6b 54 d4 34 c0 5d 1e 0d 37 |...:&..kT.4.]..7| -00000020 d1 cd 67 7a 48 59 0a 11 c3 bf d6 20 f3 37 6c 43 |..gzHY..... .7lC| -00000030 00 91 4d e9 b4 27 39 77 6e 75 4b bf 41 68 b8 0c |..M..'9wnuK.Ah..| -00000040 31 53 bc 48 55 a6 27 71 09 30 01 36 00 08 13 02 |1S.HU.'q.0.6....| +00000000 16 03 01 00 e0 01 00 00 dc 03 03 1f e8 63 15 2c |.............c.,| +00000010 85 dc 46 b7 52 88 cf 82 24 70 b9 7b 22 01 51 ee |..F.R...$p.{".Q.| +00000020 2a ff db 20 62 ba e2 18 4e 86 3f 20 d3 f9 0f d8 |*.. b...N.? ....| +00000030 85 5c 17 5e 95 e9 7a 7e cb 56 ac 85 3e 75 8f d8 |.\.^..z~.V..>u..| +00000040 8f 25 be 59 be a7 18 db b7 5e 19 23 00 08 13 02 |.%.Y.....^.#....| 00000050 13 03 13 01 00 ff 01 00 00 8b 00 00 00 0e 00 0c |................| 00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| 00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| @@ -11,174 +11,174 @@ 00000090 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| 000000a0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 00 2b |...............+| 000000b0 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 26 00 |......-.....3.&.| -000000c0 24 00 1d 00 20 95 28 2e 63 cf 81 4b cd 4b 64 73 |$... .(.c..K.Kds| -000000d0 19 19 82 2d b7 f5 54 08 4d f4 72 70 21 3e a0 d6 |...-..T.M.rp!>..| -000000e0 7d 96 92 ac 63 |}...c| +000000c0 24 00 1d 00 20 8d 8e c0 53 e4 17 29 9f 59 9e 80 |$... ...S..).Y..| +000000d0 1f 4a 99 4b 9d 59 3f 84 93 06 68 6e 45 86 2f 4d |.J.K.Y?...hnE./M| +000000e0 04 f5 ba 3e 42 |...>B| >>> Flow 2 (server to client) 00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 f3 37 6c 43 |........... .7lC| -00000030 00 91 4d e9 b4 27 39 77 6e 75 4b bf 41 68 b8 0c |..M..'9wnuK.Ah..| -00000040 31 53 bc 48 55 a6 27 71 09 30 01 36 13 02 00 00 |1S.HU.'q.0.6....| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 d3 f9 0f d8 |........... ....| +00000030 85 5c 17 5e 95 e9 7a 7e cb 56 ac 85 3e 75 8f d8 |.\.^..z~.V..>u..| +00000040 8f 25 be 59 be a7 18 db b7 5e 19 23 13 02 00 00 |.%.Y.....^.#....| 00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| 00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| -00000080 03 03 00 01 01 17 03 03 00 17 db 3b a3 78 48 c0 |...........;.xH.| -00000090 4e d1 ad 99 4d 73 e3 84 27 ff 42 de f6 c9 c9 b5 |N...Ms..'.B.....| -000000a0 49 17 03 03 00 3c 77 b8 16 13 1d cb 0a 6b 3e 41 |I....A| -000000b0 24 8a 03 b9 88 48 6f b3 d7 61 66 f4 33 67 86 8c |$....Ho..af.3g..| -000000c0 2f ad 4f f1 40 ad 63 10 35 ee f7 15 d2 0e e9 31 |/.O.@.c.5......1| -000000d0 b8 d9 b2 32 28 05 1e 73 3d bd a2 12 26 32 5a bc |...2(..s=...&2Z.| -000000e0 0c ea 17 03 03 02 6d e0 8f 50 e0 54 85 74 f0 b8 |......m..P.T.t..| -000000f0 31 25 df 87 fd 8b 5b 52 d4 fe b0 8e 61 44 b5 28 |1%....[R....aD.(| -00000100 1d 0e 8a 07 56 bb 77 5d 60 d8 c1 a0 95 ff 5c e9 |....V.w]`.....\.| -00000110 a2 ca 17 20 3d b1 b1 8e 76 31 2f 0d c9 e3 ee b5 |... =...v1/.....| -00000120 e6 fe fd dc 2e b9 e5 44 77 d3 fe 7a d5 9f 0e ab |.......Dw..z....| -00000130 75 b0 ff 2a 7b aa 64 75 62 ec 15 bd 2e 0c a4 54 |u..*{.dub......T| -00000140 e6 12 cd 31 13 83 6c 98 e8 00 b3 b6 c6 7b cb 87 |...1..l......{..| -00000150 82 3a f9 15 50 6b 4d c2 5b 6a 91 42 ce e8 25 14 |.:..PkM.[j.B..%.| -00000160 0d 5d 17 04 c3 cf d6 23 ad 9e 0e 3b 1c aa 2e 88 |.].....#...;....| -00000170 02 dc 63 12 3e 33 29 3d f8 b2 ec f2 15 d6 13 d3 |..c.>3)=........| -00000180 c9 88 a1 ad a9 27 fd 7c c4 5e f9 73 eb 45 a7 5f |.....'.|.^.s.E._| -00000190 a1 4f be d7 0f e9 d0 da 30 67 3b 9d 63 2d ef b4 |.O......0g;.c-..| -000001a0 89 3e de 19 20 af 62 52 7c e7 80 96 93 6e ca bf |.>.. .bR|....n..| -000001b0 c3 48 e2 c5 23 8d cf b0 a2 e5 dd a8 51 21 6f 99 |.H..#.......Q!o.| -000001c0 24 03 c8 d8 e0 dd e6 d4 ef 7f 74 17 85 14 ca 81 |$.........t.....| -000001d0 91 4e c6 5d 80 86 63 6f 97 55 ab 80 1c ab 63 c8 |.N.]..co.U....c.| -000001e0 01 ca df 11 28 68 b8 75 06 22 33 ba 9c b8 14 a1 |....(h.u."3.....| -000001f0 7a 1d cb 24 7c 90 44 b1 ed 33 e7 9d 80 6d ce b7 |z..$|.D..3...m..| -00000200 0a 74 bd 29 53 a2 bb 06 67 4d 4d 53 cc 1c 66 76 |.t.)S...gMMS..fv| -00000210 a9 4f 86 be 7a da ba 35 23 b6 6f c4 7d 02 2a 9f |.O..z..5#.o.}.*.| -00000220 2d 81 3d e2 16 3d 4b 78 ba cb f3 91 c7 39 9c 3d |-.=..=Kx.....9.=| -00000230 2e 4d a0 f6 6d 3d ba 15 bd cf 60 3b 8a 4a 18 9f |.M..m=....`;.J..| -00000240 87 e4 ee 1a ac f2 b2 bc a6 9f af b2 9e ca be 60 |...............`| -00000250 3f 36 54 84 d0 cd 31 d8 60 3b 4e 7e 6c 80 d5 25 |?6T...1.`;N~l..%| -00000260 1c 1b 1e fb 0f e7 ad b0 30 0d 13 be 27 f8 c3 6a |........0...'..j| -00000270 93 d3 f0 55 cb e9 73 6b e9 72 aa bb ea 24 05 f7 |...U..sk.r...$..| -00000280 c7 51 d5 66 77 32 53 82 fb 6c 2e fc fb 83 2d f4 |.Q.fw2S..l....-.| -00000290 5d a1 cc 75 fa d1 ee c2 5b 5d 48 e5 6d 69 87 54 |]..u....[]H.mi.T| -000002a0 1c b1 03 bd 06 66 7b 6d b7 46 33 56 b9 1c 62 a1 |.....f{m.F3V..b.| -000002b0 fd d3 61 50 42 ef 66 f8 97 26 5b 17 82 52 89 09 |..aPB.f..&[..R..| -000002c0 48 b8 68 50 63 d6 d4 83 7e 1f 5d 9d ad 69 2a 3c |H.hPc...~.]..i*<| -000002d0 d6 ab b7 33 1b 07 bc 44 92 d7 23 07 00 64 3f 64 |...3...D..#..d?d| -000002e0 98 e9 52 11 69 fc 21 04 65 1d f8 0d 06 dd 54 14 |..R.i.!.e.....T.| -000002f0 93 ae ca 30 06 db 4b 70 00 0b 3a cb 11 19 1a c6 |...0..Kp..:.....| -00000300 a7 f0 1c 9f 31 f9 30 ec 5f 1c 4e 74 d0 1c 9b 49 |....1.0._.Nt...I| -00000310 ab 42 c3 72 7d 11 e0 07 3d 3f 51 7a 99 07 32 0f |.B.r}...=?Qz..2.| -00000320 d6 b7 b7 ac 83 2e 3b c4 ce 81 1d 1a e0 e8 ba d7 |......;.........| -00000330 12 d1 14 a9 62 c3 58 30 0d ac 30 6c 7d 06 be 96 |....b.X0..0l}...| -00000340 e1 e4 14 6b 56 16 17 84 52 32 4c aa ec 83 1d 6c |...kV...R2L....l| -00000350 d1 b0 1f 63 17 03 03 00 99 c9 7d 79 9c 0f 73 20 |...c......}y..s | -00000360 0b 93 09 a6 6e 46 fd 56 12 08 0a 8c 1b 9c b0 9f |....nF.V........| -00000370 0a d4 d9 33 e9 22 0e 90 d4 7c b3 4d 5a 95 e9 90 |...3."...|.MZ...| -00000380 14 69 e5 d2 ad 2e b4 f1 a0 98 7d 24 fa b2 a4 2a |.i........}$...*| -00000390 f8 af 6a e3 9d a7 64 cc ea 51 73 d1 40 23 98 df |..j...d..Qs.@#..| -000003a0 9f cc 70 bb c5 3b 8b fc 95 6f ca 04 6d 7d cd 77 |..p..;...o..m}.w| -000003b0 ba b3 d3 e1 50 38 9c 16 60 d7 2b be 82 b3 a5 70 |....P8..`.+....p| -000003c0 76 c4 fb ba 7e 78 5c 97 a3 47 fe 23 80 b7 d4 f1 |v...~x\..G.#....| -000003d0 1f a6 dc 08 68 b4 d7 bb 09 6f 45 37 e5 1d 2b 2f |....h....oE7..+/| -000003e0 e1 57 84 4e 95 c1 bc b4 14 a4 45 04 69 ae 79 01 |.W.N......E.i.y.| -000003f0 07 42 17 03 03 00 45 00 a8 d1 03 76 56 7f b3 7e |.B....E....vV..~| -00000400 ec 82 94 7f b7 66 8a 01 c3 ab 50 13 20 f3 ea 3e |.....f....P. ..>| -00000410 27 56 e7 49 14 6a d0 2e f4 04 d1 54 c0 b1 4d 5e |'V.I.j.....T..M^| -00000420 2a a5 f1 89 55 f6 b0 ee e2 15 26 13 ec a4 4c ca |*...U.....&...L.| -00000430 ef 1a c7 ff 3e 5e f3 88 15 57 47 43 |....>^...WGC| +00000080 03 03 00 01 01 17 03 03 00 17 cb a2 26 d8 e7 e0 |............&...| +00000090 72 cd 3d 39 f6 67 25 78 a3 ce bf 0e 62 bf 2e 2a |r.=9.g%x....b..*| +000000a0 b5 17 03 03 00 3e 3e b3 0c 6d 79 88 e8 74 87 a5 |.....>>..my..t..| +000000b0 ab a1 db 4b 11 d9 15 16 49 a7 ef a5 69 f0 8e 2e |...K....I...i...| +000000c0 a3 6c 38 f0 ea 6d 0b fd 4c 78 ea 55 ec e7 48 de |.l8..m..Lx.U..H.| +000000d0 87 01 3d de 13 5b 59 7f b3 15 4a 7d 40 30 d8 9c |..=..[Y...J}@0..| +000000e0 55 06 54 2d 17 03 03 02 6d 28 a4 e3 bf 71 d5 93 |U.T-....m(...q..| +000000f0 50 e1 e7 96 02 28 f1 2f 6d 78 1f b9 7f 1a 8c a4 |P....(./mx......| +00000100 65 03 15 fb a7 ef f5 91 66 44 00 28 6a 17 46 9c |e.......fD.(j.F.| +00000110 e7 90 f9 d5 78 f1 a4 fd 9b 54 09 dc 6e 83 0f 65 |....x....T..n..e| +00000120 96 51 e1 69 e0 05 7f d4 d6 04 03 fd b8 6b 9c 12 |.Q.i.........k..| +00000130 02 af 03 9b 02 42 7b ce e0 81 51 91 3a 01 be a4 |.....B{...Q.:...| +00000140 72 ef 27 c3 3e f1 8e 5d 3a 9e 46 4c 25 13 98 c2 |r.'.>..]:.FL%...| +00000150 5c 75 3f b2 30 7c de da b6 56 4e 7a 2c c3 1d 6f |\u?.0|...VNz,..o| +00000160 7a 6e 0d da d2 df a6 df 47 12 6d af 3f d7 66 ad |zn......G.m.?.f.| +00000170 54 19 b3 7f 1b 92 5c e6 79 36 ab d9 99 db 1d f9 |T.....\.y6......| +00000180 e8 13 b4 e9 85 fb ba 9a 7b f3 eb 28 e5 e3 f1 0e |........{..(....| +00000190 dc 95 b2 db f3 e4 77 6d a5 43 14 4c f4 af 0a e4 |......wm.C.L....| +000001a0 5d bf 1d f4 ef 72 9f c0 74 55 e5 93 e0 7c f0 9a |]....r..tU...|..| +000001b0 01 1d e8 43 5d c1 24 6f 75 46 44 f0 bc 15 b6 6b |...C].$ouFD....k| +000001c0 7b cd 6d cc 38 06 10 34 ae be 7c b1 24 da 71 58 |{.m.8..4..|.$.qX| +000001d0 b2 81 1f ea 28 18 73 75 79 d5 eb ef 0c 33 b8 1c |....(.suy....3..| +000001e0 14 e9 00 b8 12 f7 b2 9f b1 f3 a8 23 63 b3 29 49 |...........#c.)I| +000001f0 0e 84 b8 60 1c c2 32 c5 fd 59 de 88 e2 55 93 0f |...`..2..Y...U..| +00000200 63 e6 a7 02 3e 01 0e 5f df b4 03 f8 a9 d0 96 03 |c...>.._........| +00000210 5c ea e0 6f 5d 1d 30 41 c7 ec 6a 94 d3 6c ff b7 |\..o].0A..j..l..| +00000220 1b eb b8 0d 2f df 90 2e f8 f5 d2 3a c6 8c 47 98 |..../......:..G.| +00000230 ad 39 13 f2 4d 2f a5 9d 4b 58 f7 bc 92 d6 b1 ca |.9..M/..KX......| +00000240 6a a5 c5 64 62 1c 76 21 be b5 ca 25 04 e4 16 b3 |j..db.v!...%....| +00000250 26 90 42 b8 b8 61 4a da a3 12 5d f7 74 e6 f1 95 |&.B..aJ...].t...| +00000260 5d d4 3a 17 fc 33 b1 2a 35 eb 69 16 7e d0 8f 66 |].:..3.*5.i.~..f| +00000270 ca b1 62 0f 85 d1 b3 f9 b6 cf dc 86 61 0e 34 8a |..b.........a.4.| +00000280 a0 69 fc 59 6b fc 3d 6d 7a 19 46 6f 8a 3d 16 56 |.i.Yk.=mz.Fo.=.V| +00000290 ac 5d ed 05 57 25 2d 85 78 67 bc 50 a3 34 87 3f |.]..W%-.xg.P.4.?| +000002a0 e7 ae 0d f0 17 67 2a 08 42 92 1f 25 0e 9c 22 e3 |.....g*.B..%..".| +000002b0 3f 7f dc 91 52 9e d3 01 39 0f 47 55 26 f3 f2 ce |?...R...9.GU&...| +000002c0 75 7d 33 f2 a2 9a 03 70 c0 e7 32 90 a7 50 8c b0 |u}3....p..2..P..| +000002d0 ab fa b5 ef 25 ae e3 7e 94 99 a9 3f 83 a7 16 5e |....%..~...?...^| +000002e0 67 b4 a0 1e 5b f7 10 49 cb 33 73 4d 92 26 49 8d |g...[..I.3sM.&I.| +000002f0 63 fc 5b b5 1b a4 1a 97 10 09 5f e0 75 73 50 be |c.[......._.usP.| +00000300 d5 6a 62 80 3a 3f c7 94 89 51 f0 c6 fa 38 2e 79 |.jb.:?...Q...8.y| +00000310 3c 0b 63 bc 7e 6e 2a ed c6 c5 d5 bc bc 00 31 e3 |<.c.~n*.......1.| +00000320 5c 2b b7 88 ff 8f ef a7 34 7e c7 3e 3f 16 e6 75 |\+......4~.>?..u| +00000330 c8 1b 70 4a 2f 18 81 c3 d3 81 63 e8 31 f4 42 f8 |..pJ/.....c.1.B.| +00000340 02 2d 2e fb d5 65 60 93 df b5 d4 c8 8e 55 29 b3 |.-...e`......U).| +00000350 72 01 86 19 10 3d 17 03 03 00 99 e9 b1 32 d5 5f |r....=.......2._| +00000360 59 fb 7f 80 0e 70 2e 1a 76 ae dd 7f 84 ee 86 69 |Y....p..v......i| +00000370 37 a6 31 f2 83 78 8d 90 98 eb 43 96 22 9f ba 34 |7.1..x....C."..4| +00000380 09 e3 78 c9 5f 5a f0 0b 51 58 c9 8e 63 b7 04 88 |..x._Z..QX..c...| +00000390 74 a2 1c c9 da f3 9e 30 c0 c7 a9 da f4 43 d5 a2 |t......0.....C..| +000003a0 b7 c4 aa 33 5f be f9 e2 68 d6 73 f2 3d ae 1b e5 |...3_...h.s.=...| +000003b0 5b b5 7d ce cb 9d 72 a2 2d bc 30 35 43 a1 3f 53 |[.}...r.-.05C.?S| +000003c0 43 61 a3 4e 6e 90 8c 8a 78 b5 35 74 98 51 d2 33 |Ca.Nn...x.5t.Q.3| +000003d0 3a 9f c5 39 79 6d 5d fe ce 5e e2 dc 12 56 ac 56 |:..9ym]..^...V.V| +000003e0 0b 6c 86 3c 85 cb 12 18 46 dd ed 53 04 9a 88 34 |.l.<....F..S...4| +000003f0 84 df b0 cf 17 03 03 00 45 f6 a8 20 67 5a d1 87 |........E.. gZ..| +00000400 ac e4 d7 95 d0 8b 8f 96 cd b6 12 7d eb 3c 28 21 |...........}.<(!| +00000410 5a 7d 53 86 9e 55 cd 9b 24 1a c3 c7 6a 30 84 6f |Z}S..U..$...j0.o| +00000420 f7 96 ac 29 b5 ee 5d 66 32 c6 52 13 79 32 67 27 |...)..]f2.R.y2g'| +00000430 6b 5b bc 54 1e 28 b2 73 5f 5d 4d 6f 11 fc |k[.T.(.s_]Mo..| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 02 1e cd 5f bd ff 6b |............_..k| -00000010 f7 c8 70 4b cc c8 84 44 c2 d0 7d ea 39 78 5a 6f |..pK...D..}.9xZo| -00000020 7a 72 0e 55 d0 76 7c 48 d8 cc 32 b4 08 bf f7 a8 |zr.U.v|H..2.....| -00000030 32 99 4a c5 83 79 4d 39 ea 0d 63 33 da 89 57 30 |2.J..yM9..c3..W0| -00000040 ab 31 95 90 f4 8d 4a 63 34 13 c6 4e d6 80 37 b8 |.1....Jc4..N..7.| -00000050 9b 28 8b 8f e5 b5 2a 16 e1 82 63 6f 1b ca 3a b4 |.(....*...co..:.| -00000060 b3 0b 36 56 09 d8 1e ab b4 fb aa 07 df 76 d3 b2 |..6V.........v..| -00000070 07 8d 56 38 f9 15 c2 1b c9 97 50 6a c4 23 6f 39 |..V8......Pj.#o9| -00000080 7b b3 69 b5 c2 6e 29 b4 14 17 9c 3d b7 c5 5f 12 |{.i..n)....=.._.| -00000090 25 73 89 22 99 1f 77 9d 9c a4 f6 fc 0a 8b af 24 |%s."..w........$| -000000a0 9b fc c1 b3 c3 cd 88 55 b5 81 8a 6e 73 83 cc da |.......U...ns...| -000000b0 fa 64 fe 3b 20 31 75 9a ce 35 ad a6 4b 3f 6f 49 |.d.; 1u..5..K?oI| -000000c0 e0 ae 21 23 ac c5 86 bb ec 91 13 37 76 d9 06 40 |..!#.......7v..@| -000000d0 ce 32 84 41 3e c0 5c 6d 93 0c 2f af ac af 5e ef |.2.A>.\m../...^.| -000000e0 ab 65 fc cc 00 a4 11 94 27 0e 11 ac 2a 00 dc c3 |.e......'...*...| -000000f0 dc fc 68 ff b3 32 bf 75 ff d0 35 e1 a3 44 68 6e |..h..2.u..5..Dhn| -00000100 21 39 ab 68 93 11 50 3b 30 1c 32 2a 03 9a 2a 9c |!9.h..P;0.2*..*.| -00000110 ff 2a bf 10 b3 ae 28 33 43 3c b2 04 a3 5d 49 21 |.*....(3C<...]I!| -00000120 db c4 4e 90 2f bd 20 03 d1 99 78 48 1a fd f2 a8 |..N./. ...xH....| -00000130 1b 06 1b 4e d1 5f 7c ed ba 04 3c ad 9c 20 4f 5e |...N._|...<.. O^| -00000140 37 5b 75 8e fc 40 2a 09 1c 78 f7 b2 15 ad a6 24 |7[u..@*..x.....$| -00000150 29 98 74 42 e2 80 28 80 0b 78 22 72 75 e3 33 75 |).tB..(..x"ru.3u| -00000160 a0 57 37 00 f1 69 bd ab 22 74 2d 6c 4a 1e 46 5b |.W7..i.."t-lJ.F[| -00000170 64 e0 47 d7 77 85 18 6b 10 67 6f 83 eb 98 e4 31 |d.G.w..k.go....1| -00000180 00 35 1d c3 1f d9 7a 86 27 27 3f 2d 0d cb 53 8f |.5....z.''?-..S.| -00000190 f4 52 e7 5a ba 02 67 44 a8 19 71 1a 7b f2 b1 80 |.R.Z..gD..q.{...| -000001a0 c9 82 d0 4b 63 0e d0 e0 bd a1 cc 5e 55 80 9a 51 |...Kc......^U..Q| -000001b0 21 bf 32 ce 8f 74 ea ed a6 cd ee b4 8f 3b 8f 6c |!.2..t.......;.l| -000001c0 41 5e 3d 1f 00 0b d4 a4 09 9a 8e c3 3f b1 b7 4c |A^=.........?..L| -000001d0 7b 6b 57 3f 94 3d ed d7 60 5c d4 04 b0 7b 62 06 |{kW?.=..`\...{b.| -000001e0 f7 06 f6 f0 f8 44 80 55 97 22 60 e6 dc f3 ec 7d |.....D.U."`....}| -000001f0 d2 22 e0 07 5d 52 0c 63 4d 77 f8 c5 16 06 67 5b |."..]R.cMw....g[| -00000200 9e 96 f4 1e fa 8e dd f8 42 85 7f 1e dc f9 dc b8 |........B.......| -00000210 b1 91 b0 c3 04 0d e1 dd c9 c4 0d fb b7 74 cb e5 |.............t..| -00000220 57 38 b7 82 8c d1 20 d1 0f 17 03 03 00 a4 79 ad |W8.... .......y.| -00000230 66 39 e1 10 c9 96 2c d3 7f 11 c6 7e c4 36 56 4c |f9....,....~.6VL| -00000240 70 c3 8f a4 da c2 a5 53 9b 28 25 82 69 d8 90 f0 |p......S.(%.i...| -00000250 79 52 29 cb e1 d4 48 49 dd 00 82 37 b1 ac 3b 1c |yR)...HI...7..;.| -00000260 2c b9 a7 c4 08 ac 08 fd 42 47 79 1f 64 82 57 2a |,.......BGy.d.W*| -00000270 63 c0 78 54 55 69 f2 05 9e 8d 81 6e d9 b5 31 08 |c.xTUi.....n..1.| -00000280 d3 0d 61 61 4f 70 a4 57 67 eb 9d 09 ca 51 01 ff |..aaOp.Wg....Q..| -00000290 53 d2 6d 9e 49 ce 40 1f c9 ab a2 52 e6 56 0c d3 |S.m.I.@....R.V..| -000002a0 63 b4 44 d7 fe 97 1d d2 55 8d 13 df 23 71 68 b6 |c.D.....U...#qh.| -000002b0 79 26 a8 a6 cd ca a1 19 6b 21 e8 b6 30 34 b6 6f |y&......k!..04.o| -000002c0 66 2d ab 1d 16 7f c6 b1 53 c9 2a 40 87 9d 7d 48 |f-......S.*@..}H| -000002d0 c9 6a 17 03 03 00 45 43 bf 6e f3 e2 76 56 69 2f |.j....EC.n..vVi/| -000002e0 9b c5 d2 46 4f 24 d2 e2 61 13 2b ad b6 3e d8 89 |...FO$..a.+..>..| -000002f0 1b 31 7c ec 14 44 39 7c b4 08 44 9d 31 d9 a1 5f |.1|..D9|..D.1.._| -00000300 2e 8f a9 8e 5b 5a 91 e2 f5 61 f5 63 be 5c 14 e3 |....[Z...a.c.\..| -00000310 70 8e 2e 9e fd 6c 54 85 ba ef 85 b7 |p....lT.....| +00000000 14 03 03 00 01 01 17 03 03 02 1e 60 1c a1 8d ec |...........`....| +00000010 40 73 af df e0 a2 e8 c7 0d f5 f3 8c 5b 9e 58 f0 |@s..........[.X.| +00000020 5d 77 d8 d1 42 bd 30 e4 0d f5 5f b6 68 89 0f bb |]w..B.0..._.h...| +00000030 73 ff dc 9b 77 b6 c9 f2 3c a8 5a 95 43 f6 53 22 |s...w...<.Z.C.S"| +00000040 f3 96 7c 48 b6 df d2 ed a1 39 00 f1 c5 20 5d bd |..|H.....9... ].| +00000050 bd 27 4b d7 5f d7 7e 57 3c 22 84 cf 6f 2c 85 4f |.'K._.~W<"..o,.O| +00000060 50 8e 71 0c 70 cb e9 3b 52 31 12 ac 0e 1c d0 0c |P.q.p..;R1......| +00000070 a5 c7 20 83 77 95 b5 0d 2f b8 f9 51 83 17 d1 9b |.. .w.../..Q....| +00000080 69 ca 0a 9c e1 8e 1d 3d 95 2b 10 56 24 47 e0 6e |i......=.+.V$G.n| +00000090 ba 56 94 c9 a8 b5 62 b4 4d da 70 73 e0 a0 0b 15 |.V....b.M.ps....| +000000a0 60 22 f4 3f a3 e4 c6 86 a9 a3 dd db 5b 69 5c ce |`".?........[i\.| +000000b0 99 14 6a 93 8e c7 21 ff 99 4d da 25 3b 87 3a ae |..j...!..M.%;.:.| +000000c0 7d 9b 9a 06 6f e4 36 02 64 07 d4 43 84 5b 6f 98 |}...o.6.d..C.[o.| +000000d0 6c ec 6b 77 92 17 75 2e ea c5 02 ab ce 8c c2 9a |l.kw..u.........| +000000e0 18 e7 90 05 da 68 5a c9 d8 22 8c d2 de 17 b5 87 |.....hZ.."......| +000000f0 a1 74 e9 bc 54 07 36 ef 61 1f 3a 43 51 15 2a 98 |.t..T.6.a.:CQ.*.| +00000100 53 84 89 d4 90 a7 f0 a6 e4 35 6c 70 9b f5 a4 51 |S........5lp...Q| +00000110 b4 69 9c 58 10 df cc 50 04 46 43 0a c5 9d ca f1 |.i.X...P.FC.....| +00000120 23 2c a5 1e 6c d6 36 82 21 1f db 9a ae 55 f2 77 |#,..l.6.!....U.w| +00000130 ad 13 e8 97 24 3c c9 c1 a5 b2 18 3c a6 cf ab c6 |....$<.....<....| +00000140 05 88 06 e1 23 fb b7 85 a6 e8 57 38 6d 58 22 b8 |....#.....W8mX".| +00000150 02 c6 0d 40 22 10 cd da dc 21 ef 6b ae 6c 5d c5 |...@"....!.k.l].| +00000160 8e 62 a7 21 be 7c b7 47 60 af 55 e7 db 6f 47 59 |.b.!.|.G`.U..oGY| +00000170 62 dd f2 f6 62 9b cd 2c 46 ec b8 05 47 d4 f9 8d |b...b..,F...G...| +00000180 ee 89 09 f6 d0 ac 8d 4f 27 d1 f7 4e cb aa 55 0b |.......O'..N..U.| +00000190 be 64 ed 69 45 7c 0a b5 95 5c b3 63 c4 1c ff 12 |.d.iE|...\.c....| +000001a0 de ad 11 f9 d4 de d4 94 d7 cb 31 55 21 51 09 12 |..........1U!Q..| +000001b0 33 20 df 64 4f 57 f3 da 68 24 20 f7 df 9d b3 4c |3 .dOW..h$ ....L| +000001c0 7f b1 c4 5a 85 d2 95 bd 98 e8 05 7b 20 f1 34 97 |...Z.......{ .4.| +000001d0 6e 73 ed 5d 5f 97 56 a6 9a 6f e7 91 27 be b2 d9 |ns.]_.V..o..'...| +000001e0 ef 48 9b 3d d8 80 e1 e1 d5 46 de 6c 83 7d 16 24 |.H.=.....F.l.}.$| +000001f0 03 f0 a1 29 fd 8e a7 db 63 88 51 e3 ac 5d a6 c9 |...)....c.Q..]..| +00000200 19 e4 a4 40 0f 92 1b 4c 3b 9d 4a fc b2 cf c5 62 |...@...L;.J....b| +00000210 db 72 d2 9e f8 c0 00 ab fe af ac 66 46 8d b7 8e |.r.........fF...| +00000220 dc ab 07 c4 87 09 0e 9b 04 17 03 03 00 a4 7b 67 |..............{g| +00000230 11 bf bb 27 7d c0 ab f4 14 a8 44 a1 e1 b1 ba 0c |...'}.....D.....| +00000240 4c d0 4e 9d 74 5f dd 60 bb c9 33 ad 29 91 a7 a0 |L.N.t_.`..3.)...| +00000250 18 61 44 25 bf a1 45 e2 9b 24 93 20 45 0b 2a 09 |.aD%..E..$. E.*.| +00000260 07 75 4d ad 1a 04 34 df 7b 1b c8 f7 e7 fc 4e 99 |.uM...4.{.....N.| +00000270 27 97 d5 9a 7f 63 39 00 5c ed ba a4 5b 9b 44 72 |'....c9.\...[.Dr| +00000280 cb 3e 80 68 9a 78 e9 bc 12 35 94 9d b2 1c 34 f6 |.>.h.x...5....4.| +00000290 ce c7 cf 61 5e a9 c2 21 79 e9 e3 4c e8 e5 dc fe |...a^..!y..L....| +000002a0 e2 1d 7a 2b c3 dd 15 f8 e5 0e 20 6f 99 fd ea ef |..z+...... o....| +000002b0 a1 a4 be a9 28 1a d0 f8 3e 0a c2 76 6b 24 b1 56 |....(...>..vk$.V| +000002c0 0f 52 25 f6 56 65 96 92 4f 07 71 9d 25 25 99 2c |.R%.Ve..O.q.%%.,| +000002d0 dc 04 17 03 03 00 45 c5 e8 b3 d0 ca 89 02 da 08 |......E.........| +000002e0 73 57 9c a6 49 de da b3 e7 92 59 8e 25 29 45 8b |sW..I.....Y.%)E.| +000002f0 fb 56 b6 53 dd d1 59 6c 5f 39 7a d4 d8 e6 db e3 |.V.S..Yl_9z.....| +00000300 60 8c a4 8a 81 2b a5 26 a7 21 89 e9 8a f7 fe 39 |`....+.&.!.....9| +00000310 44 a2 bd 1c 49 18 47 b9 69 ef 1c 74 |D...I.G.i..t| >>> Flow 4 (server to client) -00000000 17 03 03 02 a8 02 f0 98 42 d8 ab 9d 92 8c 11 ac |........B.......| -00000010 16 4d b1 c0 2e 3b 0f ac 53 f8 aa 15 01 36 03 fd |.M...;..S....6..| -00000020 1b e1 0f 87 62 5f d4 4e fc 0d 88 13 30 4f 5e fc |....b_.N....0O^.| -00000030 46 1b 3a 22 cc ff a9 5e 29 24 15 67 08 1b 28 18 |F.:"...^)$.g..(.| -00000040 d3 70 46 fa 92 89 de 69 62 f1 c7 47 d1 24 a2 98 |.pF....ib..G.$..| -00000050 8d 78 d0 f2 cc 3f fb 4c 3c 5e 03 0c 4e a8 a3 b7 |.x...?.L<^..N...| -00000060 c5 69 49 19 43 da 07 b4 be 6e 7d cd 12 c3 bf d7 |.iI.C....n}.....| -00000070 74 9a 3e 30 cd 9d 8e a4 27 bb 66 d1 95 50 ad f7 |t.>0....'.f..P..| -00000080 91 52 e4 be d5 61 fc 28 fb 33 02 bc f4 fb fb 7f |.R...a.(.3......| -00000090 0c 9a dc e4 63 86 c6 f8 f6 bc 67 60 c6 ac b2 52 |....c.....g`...R| -000000a0 65 3e 0d f7 15 e0 d4 f2 7b 36 ed e2 2e c3 ab 44 |e>......{6.....D| -000000b0 e4 06 d1 09 e6 c6 9e c3 dd df e9 3b 9c 22 cb 48 |...........;.".H| -000000c0 1a 18 22 da 8c e7 11 e0 36 0b a9 73 be d8 22 db |..".....6..s..".| -000000d0 8b 95 f5 3e cc c0 11 6f db 40 57 4c 07 14 2b fc |...>...o.@WL..+.| -000000e0 9e 6b f8 07 96 9f 3d 8e cc d2 c3 b5 a8 e1 64 33 |.k....=.......d3| -000000f0 b6 ab 17 4b aa b2 e0 b6 fe b6 49 69 7d 0b 8e cd |...K......Ii}...| -00000100 19 a3 d8 5e 22 5a 02 64 c2 68 ec 69 55 2d fd aa |...^"Z.d.h.iU-..| -00000110 1f f6 35 bf b2 14 a5 f9 a0 49 59 a4 84 ff 41 a5 |..5......IY...A.| -00000120 fb a1 e4 97 72 88 00 98 dd 5a 6f 7b 00 a7 59 fa |....r....Zo{..Y.| -00000130 83 73 e7 ca 8f dd 31 e8 ca 02 13 c9 fa 2b 8c 5e |.s....1......+.^| -00000140 b5 7b 85 da 2b 1a 75 da e3 db b7 34 58 c4 da 15 |.{..+.u....4X...| -00000150 b3 3a f9 a7 b3 7f 15 d2 01 b2 26 b4 c1 fe 83 af |.:........&.....| -00000160 d6 f7 8b fb 92 3d 32 ae 4a 1b a2 50 60 70 a6 34 |.....=2.J..P`p.4| -00000170 98 3f 2d bf 27 2e d3 a0 91 d9 c8 f9 a9 27 f2 23 |.?-.'........'.#| -00000180 7c 3c 17 96 19 99 6f 09 a7 bd da 2d 94 9e f9 6b ||<....o....-...k| -00000190 bb 93 fd bb b1 c0 89 6f b4 8f 90 86 e1 85 59 98 |.......o......Y.| -000001a0 ba 98 7c 6c 26 be 98 30 5f cf 46 bf e9 c6 a4 bd |..|l&..0_.F.....| -000001b0 08 14 2a 5c 05 d8 c2 0e ba 46 af 23 e8 f0 71 77 |..*\.....F.#..qw| -000001c0 78 78 ec c2 af 4a 63 93 2e b1 ed 56 3d b7 7c a5 |xx...Jc....V=.|.| -000001d0 63 99 2f df 15 d3 ce 79 0e 49 d0 16 ac 3e f3 fa |c./....y.I...>..| -000001e0 cd e7 0e e5 ee 4a cd 49 20 f6 9f fa d1 df cb cc |.....J.I .......| -000001f0 1b 73 83 12 47 52 69 3c 93 bb 1f 65 64 1e 79 15 |.s..GRi<...ed.y.| -00000200 72 85 e8 fd fa d6 be d5 61 44 35 bb 75 a7 17 1f |r.......aD5.u...| -00000210 dd 7b 60 17 78 1f 11 72 7f ac e7 52 1e 94 13 35 |.{`.x..r...R...5| -00000220 ab 97 69 17 09 6c 4b 46 cd 34 2d 7e 55 8a 16 d3 |..i..lKF.4-~U...| -00000230 c2 59 e8 d8 67 9b 29 af bc f1 31 39 d9 ff 06 d5 |.Y..g.)...19....| -00000240 80 b8 8d 50 80 5f 2c 0a 30 84 28 32 3d 4c 45 f2 |...P._,.0.(2=LE.| -00000250 2f 8b b5 d9 3a 7a 47 05 55 22 7a a4 61 c8 8c d1 |/...:zG.U"z.a...| -00000260 1c 1b 78 e0 87 37 5e 36 88 5c 32 ca 7a d3 76 63 |..x..7^6.\2.z.vc| -00000270 ee 94 83 9c 9e 5e 9b 01 42 03 e1 e5 0f a8 43 53 |.....^..B.....CS| -00000280 cd 3d 76 01 88 ba bf 78 b8 d7 b2 e9 8f 69 d1 35 |.=v....x.....i.5| -00000290 88 44 f1 ef 20 cd 42 c6 99 99 0c a5 25 ec dc 88 |.D.. .B.....%...| -000002a0 1e b5 28 dd e4 a1 12 20 03 fa ce 38 8a 17 03 03 |..(.... ...8....| -000002b0 00 1e bc 9a e0 0d 88 a2 71 15 c3 0d 54 d3 13 d8 |........q...T...| -000002c0 d9 96 ad 95 ee 47 2c c6 ba e9 f9 50 b1 8e 1e 0b |.....G,....P....| -000002d0 17 03 03 00 13 d2 56 e3 48 c0 fa 0f 9a 95 22 e9 |......V.H.....".| -000002e0 51 c1 98 64 b4 03 09 5a |Q..d...Z| +00000000 17 03 03 02 a8 a1 f1 48 20 d7 51 ae a0 ec 04 30 |.......H .Q....0| +00000010 d3 98 bc b4 87 14 5a 73 c1 57 d9 9b b8 54 c0 cc |......Zs.W...T..| +00000020 e9 25 20 5a 1a 49 2c 3c 5d 0b a5 47 8e 58 df 3e |.% Z.I,<]..G.X.>| +00000030 44 d8 c7 68 5e e6 cd 78 41 ad 8b e2 83 5e fa 1b |D..h^..xA....^..| +00000040 05 93 18 fa c1 df 18 d0 b1 52 bc db ee f7 49 a8 |.........R....I.| +00000050 d8 fd 9c a9 f7 cd a2 b8 61 2b 09 f0 7e 03 e6 18 |........a+..~...| +00000060 7f 6b fc c8 5f 01 50 21 c9 99 94 7f 31 a8 0e 60 |.k.._.P!....1..`| +00000070 ec 21 63 b0 e7 90 0b ca 27 55 80 e2 6f 1d 6e e2 |.!c.....'U..o.n.| +00000080 47 54 a5 81 fd 65 da 31 7c 70 bf 8b 37 b7 53 fc |GT...e.1|p..7.S.| +00000090 fd 2d 46 79 69 7b aa a5 29 a2 11 ac 3c ab 20 29 |.-Fyi{..)...<. )| +000000a0 51 8d 30 da 9a 1d 0f 32 d8 3d 2a 06 0c 59 b9 5e |Q.0....2.=*..Y.^| +000000b0 fe 28 09 d6 49 7f 7c 9c 33 66 91 8e a9 b0 9c 38 |.(..I.|.3f.....8| +000000c0 94 db 68 f0 a1 60 ce 3d 95 49 3f 0a ba b1 15 f2 |..h..`.=.I?.....| +000000d0 61 e5 a0 91 72 71 28 af 43 54 0d 75 71 f9 6e 2f |a...rq(.CT.uq.n/| +000000e0 3c 6a fd 2f 96 5d a1 bc 5f 88 9f 3f 9f e3 80 94 |4..I..| +000002a0 b4 6e 11 4f 41 14 ee d8 2a 55 d9 88 1c 17 03 03 |.n.OA...*U......| +000002b0 00 1e 0b 7a 66 33 ad ae 08 ab 8e 75 dd e8 4b a1 |...zf3.....u..K.| +000002c0 ff 16 5d 43 c6 24 cc d9 0b 6e 71 a3 5e 18 03 94 |..]C.$...nq.^...| +000002d0 17 03 03 00 13 7c 2a ec 24 22 fd 49 16 b6 4f a1 |.....|*.$".I..O.| +000002e0 84 54 bf 3e a8 78 af 64 |.T.>.x.d| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndEd25519Given b/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndEd25519Given new file mode 100644 index 00000000000..7a8d6d03070 --- /dev/null +++ b/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndEd25519Given @@ -0,0 +1,154 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 e0 01 00 00 dc 03 03 f4 33 e3 f1 5d |............3..]| +00000010 94 d0 5e 26 62 41 72 76 29 ff 09 d9 ba 11 e0 f1 |..^&bArv).......| +00000020 cb 58 56 ba 7d 37 44 09 31 86 b4 20 88 9f f1 76 |.XV.}7D.1.. ...v| +00000030 f4 fe 3c 7b 4e 77 fb bb 58 76 90 f2 d7 32 21 07 |..<{Nw..Xv...2!.| +00000040 d8 bf da 67 93 ba 8f e8 e4 e2 48 c3 00 08 13 02 |...g......H.....| +00000050 13 03 13 01 00 ff 01 00 00 8b 00 00 00 0e 00 0c |................| +00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| +00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| +00000080 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 1e |................| +00000090 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| +000000a0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 00 2b |...............+| +000000b0 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 26 00 |......-.....3.&.| +000000c0 24 00 1d 00 20 72 9a 7f b9 89 71 2f ab 7d 09 a7 |$... r....q/.}..| +000000d0 8e eb 17 07 21 41 01 3f d0 3e eb ae 5e 6a 05 4c |....!A.?.>..^j.L| +000000e0 74 c3 bb a2 35 |t...5| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 88 9f f1 76 |........... ...v| +00000030 f4 fe 3c 7b 4e 77 fb bb 58 76 90 f2 d7 32 21 07 |..<{Nw..Xv...2!.| +00000040 d8 bf da 67 93 ba 8f e8 e4 e2 48 c3 13 02 00 00 |...g......H.....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| +00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| +00000080 03 03 00 01 01 17 03 03 00 17 5c 89 3f 32 3d 88 |..........\.?2=.| +00000090 9e 8a a3 d1 ae 90 75 c1 20 15 cf 41 9d 95 94 76 |......u. ..A...v| +000000a0 08 17 03 03 00 3e 7c a9 ca b7 2f 71 e0 4c b9 0d |.....>|.../q.L..| +000000b0 82 cd be 73 2f fe d2 21 d9 b3 63 fc 53 e0 ff 13 |...s/..!..c.S...| +000000c0 39 40 98 a5 7a ee ae 0b c2 bc 90 ca b6 69 8f 48 |9@..z........i.H| +000000d0 b8 5d 8f 41 62 d6 ad 92 c5 cd 40 bd 77 1c 6c 23 |.].Ab.....@.w.l#| +000000e0 5d 20 ce 87 17 03 03 02 6d cc 94 31 f8 57 e9 18 |] ......m..1.W..| +000000f0 04 31 82 f4 53 17 8d 2d 1d f9 58 15 ad 1b 5c bd |.1..S..-..X...\.| +00000100 39 85 02 37 87 c7 00 5f 0f df fd 2c cc b3 be ce |9..7..._...,....| +00000110 d1 4d 08 7f a7 5c 12 3f e7 99 67 48 0f c4 11 9e |.M...\.?..gH....| +00000120 52 06 a1 ae 8e 6c 9a 80 02 9e 88 1c 70 59 19 40 |R....l......pY.@| +00000130 d8 9b 01 35 76 f1 2f cf ba 2a ba 8c 56 90 d2 98 |...5v./..*..V...| +00000140 e9 f2 53 60 71 55 ef ca 96 8a 45 ee 6f 6e 99 e6 |..S`qU....E.on..| +00000150 57 a4 9e c4 b6 fa c4 41 fe 72 b0 2b 69 8c f0 d7 |W......A.r.+i...| +00000160 ea 27 73 b6 a6 8a bc 3c 5f c9 a3 e3 78 ae 04 4c |.'s....<_...x..L| +00000170 a5 2f b5 ac 58 63 06 a2 c5 44 99 2f 97 d7 c5 d7 |./..Xc...D./....| +00000180 4c ea 01 cb c7 f9 11 0e 6d 27 33 13 57 97 b1 7b |L.......m'3.W..{| +00000190 50 48 b2 89 f6 ee 67 36 87 22 3e cb 61 2e d7 ff |PH....g6.">.a...| +000001a0 99 c7 19 79 ff d8 af 66 95 f3 19 01 f7 67 67 47 |...y...f.....ggG| +000001b0 a8 c1 c5 56 78 4f 7d 54 63 53 7f ad 2d 35 57 91 |...VxO}TcS..-5W.| +000001c0 17 3f b3 b4 ce 69 9f d3 8e 50 eb 2d f4 dc c8 87 |.?...i...P.-....| +000001d0 49 4a 45 88 55 ab e3 8b 75 ac d2 7d 39 d0 ea a9 |IJE.U...u..}9...| +000001e0 32 9c 44 9e 81 2c 9e fc 2c 4f 2d b2 b1 30 de 2a |2.D..,..,O-..0.*| +000001f0 40 22 da d0 f3 3f d6 9e 51 14 d2 84 41 20 d3 f0 |@"...?..Q...A ..| +00000200 58 b5 ba 68 62 12 d1 4a ab 37 72 4e 56 8e 80 0f |X..hb..J.7rNV...| +00000210 0d 85 e7 1c 91 d3 1e ee 73 d0 9e 1b 6f 1b 53 1b |........s...o.S.| +00000220 c2 28 5b 9b ef 20 e3 c2 aa 4b 87 26 d9 5e 52 ef |.([.. ...K.&.^R.| +00000230 79 9d c8 4b b1 38 eb 46 73 85 ac 0b 96 34 22 61 |y..K.8.Fs....4"a| +00000240 cc cd 11 9e fb 30 b9 b7 4f 09 17 79 98 83 09 65 |.....0..O..y...e| +00000250 81 de af b1 2e f1 15 0c 4a bd fd 65 da 7b 7c 00 |........J..e.{|.| +00000260 98 fd 2f 97 de 1c e9 05 16 de b2 50 d2 5c e1 cd |../........P.\..| +00000270 19 ef d3 48 5c 03 dd ca b5 62 ce 17 b4 3c 2d e9 |...H\....b...<-.| +00000280 a8 78 6c b9 10 9c d9 2f 89 b1 7e 32 05 f7 6d d3 |.xl..../..~2..m.| +00000290 1c 30 10 1b 30 dc 17 7c c7 52 cf 93 18 b9 4f b1 |.0..0..|.R....O.| +000002a0 cd 05 e5 73 e6 00 b5 d0 42 98 cd cd 14 54 b0 01 |...s....B....T..| +000002b0 92 49 a9 e4 12 27 f9 67 df 3b b3 e9 08 d3 f6 53 |.I...'.g.;.....S| +000002c0 a7 5b 71 9f 96 3b 7e ca ac c6 81 a2 14 66 64 bf |.[q..;~......fd.| +000002d0 ff 0f 8d 5f 23 63 6e 39 7e 9c 83 3f e8 4c db d6 |..._#cn9~..?.L..| +000002e0 91 6d 47 8d 54 f3 bd 44 de e8 13 9b fd 84 5c 97 |.mG.T..D......\.| +000002f0 81 a2 c6 33 d8 d9 4e ce 8d b6 35 2f e3 a2 3a 52 |...3..N...5/..:R| +00000300 2f 6a fa 1a 22 42 07 19 41 55 5a 20 ac 12 d8 13 |/j.."B..AUZ ....| +00000310 4c 2e 41 34 81 c7 0d 83 d1 5d 3f f9 02 e6 43 69 |L.A4.....]?...Ci| +00000320 b6 08 95 fb 8a fc 27 cc d7 61 52 82 89 a3 bb 84 |......'..aR.....| +00000330 e4 53 a4 b8 96 cb 8c 53 c0 4d 16 95 a9 d1 70 23 |.S.....S.M....p#| +00000340 52 5e 7e f6 01 a3 1e 45 28 53 18 23 a0 df ab ee |R^~....E(S.#....| +00000350 2f 09 4c 02 8e dc 17 03 03 00 99 b4 38 62 ca 65 |/.L.........8b.e| +00000360 1c cf 0a ed d7 d9 65 f4 db d2 53 7b f2 bf 2a 98 |......e...S{..*.| +00000370 72 e8 2d 51 41 c2 b7 af 5e 84 40 23 64 51 16 bc |r.-QA...^.@#dQ..| +00000380 cd 3a f4 78 c2 01 c1 4f ba 6f 4a 60 c4 06 76 df |.:.x...O.oJ`..v.| +00000390 f7 19 7a aa b0 22 91 95 11 b0 07 32 50 30 be 6a |..z..".....2P0.j| +000003a0 ec 6b 94 49 8b b7 04 35 32 8f b2 71 42 9e d8 e3 |.k.I...52..qB...| +000003b0 c8 33 32 27 63 d1 fb 6f 21 9b f6 08 aa 6f be 56 |.32'c..o!....o.V| +000003c0 3c a0 77 af 7c b9 e2 a6 51 27 12 fc b3 81 c0 d7 |<.w.|...Q'......| +000003d0 53 58 94 b5 2b 34 ff 06 59 42 2e c4 aa 44 07 46 |SX..+4..YB...D.F| +000003e0 8e af 4d d8 11 d8 56 f1 4c cb 2f aa 87 99 2e 08 |..M...V.L./.....| +000003f0 9a 4a e5 11 17 03 03 00 45 a6 e5 85 12 20 f0 6d |.J......E.... .m| +00000400 2a d0 45 c0 8a f2 12 f9 61 20 ed 30 91 2d a1 a9 |*.E.....a .0.-..| +00000410 33 6f 2a 70 46 64 b0 2c 79 19 f4 11 0b 7e 3b c0 |3o*pFd.,y....~;.| +00000420 bb e8 21 bc f6 ab 09 de ef 16 17 65 32 0a 80 47 |..!........e2..G| +00000430 25 cd 0b 93 8c 14 e2 1e 1e ff 24 61 6d 4a |%.........$amJ| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 01 50 ff 2c 08 a6 b9 |..........P.,...| +00000010 a0 6d 5f 39 45 8f 85 d5 95 80 60 2c 9c 13 3f f3 |.m_9E.....`,..?.| +00000020 e4 e8 c4 34 4d 2f 58 78 a6 51 57 5b 12 85 95 57 |...4M/Xx.QW[...W| +00000030 a3 04 01 5c f1 01 a0 ae 4f 46 1d c9 ab 92 c3 43 |...\....OF.....C| +00000040 89 a9 e8 8a 5b e4 eb d9 29 4a bd 80 4a b7 bb 63 |....[...)J..J..c| +00000050 07 ca 14 47 af 5f 21 dc 85 6b 04 64 aa d3 61 4b |...G._!..k.d..aK| +00000060 5b 76 c9 ec 37 71 d8 fe 86 5a 12 a7 0d c3 a3 98 |[v..7q...Z......| +00000070 09 a9 6f 03 2b a1 e2 43 35 be 9c 34 b5 4e 0c 05 |..o.+..C5..4.N..| +00000080 fa 64 d8 9e 37 36 83 08 be ba 4d 30 2a d5 9f 43 |.d..76....M0*..C| +00000090 38 92 af 63 56 1e df 03 51 86 e9 26 5e 28 97 ff |8..cV...Q..&^(..| +000000a0 cf 91 6d fe cc a1 02 1a 34 a7 5d d2 25 20 5b ae |..m.....4.].% [.| +000000b0 ef 9e fe 0f ef 5d 74 f4 f5 14 54 47 33 f9 15 5d |.....]t...TG3..]| +000000c0 6f 85 d8 16 ed 3b 1e 3e c5 72 2f 17 65 98 5c 4c |o....;.>.r/.e.\L| +000000d0 84 c2 f4 44 6b c2 3d 04 5c 81 ef ec b8 40 e6 cb |...Dk.=.\....@..| +000000e0 20 87 3c 3b b9 38 92 5e 48 dd 20 fe e9 a8 e6 9b | .<;.8.^H. .....| +000000f0 14 2b e7 d3 77 b7 44 ed c7 eb cb 0c c8 d6 db 06 |.+..w.D.........| +00000100 3c c7 7f a3 09 b4 00 5c 93 10 79 76 0e 45 f6 d2 |<......\..yv.E..| +00000110 8b c0 91 91 7a 2d 17 e6 10 95 a2 9a df c4 da 85 |....z-..........| +00000120 88 66 f4 bb 9b d5 0f 32 f2 f2 dc a6 16 b5 e9 4d |.f.....2.......M| +00000130 f3 43 17 77 f5 51 ca 57 b8 db d1 f4 8a 22 b2 ec |.C.w.Q.W....."..| +00000140 22 27 cb 22 b8 c1 9a 17 63 01 e7 5d 2a 2b ad 03 |"'."....c..]*+..| +00000150 65 be 0d 55 c5 aa 46 31 95 df 47 17 03 03 00 59 |e..U..F1..G....Y| +00000160 d1 98 94 ed e8 1e fb 74 04 5c 11 9b eb 11 29 20 |.......t.\....) | +00000170 05 39 94 9f c8 e1 2f a5 2d 91 23 69 ca 15 34 8b |.9..../.-.#i..4.| +00000180 d7 3c 60 62 3e ae 7f fc 15 14 f1 51 a0 0d 06 30 |.<`b>......Q...0| +00000190 e7 09 8a ca 60 51 77 6d 31 b5 ac fe a1 40 ca 0c |....`Qwm1....@..| +000001a0 78 13 69 18 eb 65 41 72 c1 e9 7c dd 31 db fd 53 |x.i..eAr..|.1..S| +000001b0 16 b8 82 9e 9f b9 46 68 1c 17 03 03 00 45 46 f7 |......Fh.....EF.| +000001c0 f1 53 9c 4b 79 76 09 10 00 b6 c0 4c c4 b2 cc 4a |.S.Kyv.....L...J| +000001d0 55 41 29 28 bd b6 54 1c 56 ec 85 75 c0 52 11 ce |UA)(..T.V..u.R..| +000001e0 93 67 61 a8 52 2c 77 5d b0 b1 6b e2 02 93 65 f4 |.ga.R,w]..k...e.| +000001f0 3b d9 65 c5 5f 2b 13 c2 09 c1 c1 5d 83 8a cb 6b |;.e._+.....]...k| +00000200 db 40 e3 |.@.| +>>> Flow 4 (server to client) +00000000 17 03 03 01 da 0d f9 80 98 7a 44 ce b5 d0 2d 10 |.........zD...-.| +00000010 54 40 c8 5a e4 28 ba df 18 61 f5 d7 84 a5 38 d2 |T@.Z.(...a....8.| +00000020 d5 81 76 0e 81 d1 da 9e 99 24 81 7b 5a d0 d5 44 |..v......$.{Z..D| +00000030 df db 71 ee 84 67 f8 74 db 60 77 17 41 1f 90 1e |..q..g.t.`w.A...| +00000040 53 1c e2 bf dc d1 b9 4e 50 5b 13 76 93 e5 9b 7a |S......NP[.v...z| +00000050 98 48 36 7d fa a8 76 69 49 e4 e9 c4 00 ad 85 c3 |.H6}..viI.......| +00000060 cf 02 3e 57 90 9b 38 e0 d8 0e 23 c9 f9 34 15 6f |..>W..8...#..4.o| +00000070 9f b5 fe 5b 08 f9 87 11 36 7e d6 29 f0 99 ee e0 |...[....6~.)....| +00000080 4a ec 6a ff 6d 57 26 6d 8c 73 3f f6 1e 25 49 38 |J.j.mW&m.s?..%I8| +00000090 0c f1 dd 6a 32 90 2f 72 74 fd 33 6e 6a cb f3 b4 |...j2./rt.3nj...| +000000a0 35 ed 54 44 10 8c 2e 4d 9a 9d 83 e9 27 3e 03 d4 |5.TD...M....'>..| +000000b0 8c 10 c2 54 99 5c ab 59 ab b6 cd 39 10 4e 74 ba |...T.\.Y...9.Nt.| +000000c0 84 96 6f be 53 44 27 16 9f 64 36 63 61 75 ab 56 |..o.SD'..d6cau.V| +000000d0 c8 27 4c 31 ed cb 46 32 f6 50 f0 00 1c e3 57 40 |.'L1..F2.P....W@| +000000e0 d5 68 6e 4a 4b 9b 8e 57 ab d3 a4 c5 f5 f5 92 7e |.hnJK..W.......~| +000000f0 ac 67 a7 67 e9 e0 74 66 d9 00 53 0f 4f 96 73 4d |.g.g..tf..S.O.sM| +00000100 74 7e 47 9b fa 17 72 55 7e f3 a2 88 ad 07 dc 18 |t~G...rU~.......| +00000110 b2 26 29 6f 70 cc 35 72 af 81 c2 65 5c 88 3a c7 |.&)op.5r...e\.:.| +00000120 d1 45 73 91 9d 1f f8 85 ee 89 dc af 6e 80 97 a0 |.Es.........n...| +00000130 d9 32 19 dc 15 2a d5 86 46 ae 7d ba b3 e6 3d 81 |.2...*..F.}...=.| +00000140 65 b4 69 82 a8 9c 0f 26 63 a6 9c f2 3d ce 0f 79 |e.i....&c...=..y| +00000150 a8 08 d3 2b c0 e1 9e c7 ef 1a ca 98 95 d6 c3 d5 |...+............| +00000160 9c d6 ee 0b 12 98 4f 82 2f 98 df 47 6e 7a 04 94 |......O./..Gnz..| +00000170 5d ae c5 51 a5 d5 21 d4 a6 f7 e7 3a bd 51 53 24 |]..Q..!....:.QS$| +00000180 b8 a6 ed 5b 34 30 1d 4a 19 40 c1 cf 5f 21 3a 95 |...[40.J.@.._!:.| +00000190 ee 82 db 5f c8 54 87 da 45 df ff f3 51 b5 43 03 |..._.T..E...Q.C.| +000001a0 ee c5 84 27 c2 51 1c 23 8c 87 c4 d3 79 e7 5b 44 |...'.Q.#....y.[D| +000001b0 8f 2e be 2a 86 22 9a 7c 50 c4 09 c7 2f d6 cd d8 |...*.".|P.../...| +000001c0 b3 d5 d2 e3 33 89 89 04 5f f3 46 34 40 60 91 c2 |....3..._.F4@`..| +000001d0 35 e1 3c 39 17 62 fb 99 32 b9 9a be 66 3a 36 17 |5.<9.b..2...f:6.| +000001e0 03 03 00 1e 2a 22 40 15 e6 80 93 5f 27 1a a1 39 |....*"@...._'..9| +000001f0 d4 b1 a0 b0 e8 d6 46 1d d7 91 06 67 2a 81 a8 65 |......F....g*..e| +00000200 57 ad 17 03 03 00 13 11 e9 c2 d1 66 5e 3f 41 14 |W..........f^?A.| +00000210 82 14 88 58 57 82 2d 0e ba 8b |...XW.-...| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven b/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven index cbd8c75e9fb..97fd482c32c 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven +++ b/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven @@ -1,180 +1,180 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 c6 01 00 00 c2 03 03 9f dd 5a e8 c2 |.............Z..| -00000010 fa 2f 38 45 33 8d f2 ab 67 03 f6 cc ba 9d 8b 33 |./8E3...g......3| -00000020 69 c8 c6 50 f4 2e 1b 2b dc 2b 2d 20 ab eb f9 db |i..P...+.+- ....| -00000030 71 a7 b4 eb 9a e0 17 04 2e a8 d2 c7 65 51 71 a3 |q...........eQq.| -00000040 9a a3 5a 64 38 45 49 dc e9 e9 e2 96 00 08 13 02 |..Zd8EI.........| +00000000 16 03 01 00 c6 01 00 00 c2 03 03 51 9e 53 ed 5f |...........Q.S._| +00000010 cd 05 55 f2 c7 47 8c e9 90 25 c7 71 4f 73 45 3b |..U..G...%.qOsE;| +00000020 03 bf 42 bd 5a 4a b9 56 ef ba e0 20 04 08 64 e1 |..B.ZJ.V... ..d.| +00000030 9d db 92 a5 4e 0c 6e 90 71 c3 ed 51 c6 23 f5 6e |....N.n.q..Q.#.n| +00000040 64 55 94 28 37 54 58 00 23 a0 53 56 00 08 13 02 |dU.(7TX.#.SV....| 00000050 13 03 13 01 00 ff 01 00 00 71 00 00 00 0e 00 0c |.........q......| 00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| 00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| 00000080 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 04 |................| 00000090 00 02 08 04 00 2b 00 03 02 03 04 00 2d 00 02 01 |.....+......-...| -000000a0 01 00 33 00 26 00 24 00 1d 00 20 08 a9 6d 37 e7 |..3.&.$... ..m7.| -000000b0 3b e8 ab 4c d3 81 41 6e ac 3d dc 45 94 72 9c 9d |;..L..An.=.E.r..| -000000c0 43 32 f7 d0 de 5a e0 6b b3 11 23 |C2...Z.k..#| +000000a0 01 00 33 00 26 00 24 00 1d 00 20 2b 33 eb 7b ec |..3.&.$... +3.{.| +000000b0 b5 04 57 a0 f4 f8 3c 19 f2 8f 81 11 b0 2e 91 88 |..W...<.........| +000000c0 d8 be ba f3 6f 5a 80 db a3 e6 1e |....oZ.....| >>> Flow 2 (server to client) 00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 ab eb f9 db |........... ....| -00000030 71 a7 b4 eb 9a e0 17 04 2e a8 d2 c7 65 51 71 a3 |q...........eQq.| -00000040 9a a3 5a 64 38 45 49 dc e9 e9 e2 96 13 02 00 00 |..Zd8EI.........| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 04 08 64 e1 |........... ..d.| +00000030 9d db 92 a5 4e 0c 6e 90 71 c3 ed 51 c6 23 f5 6e |....N.n.q..Q.#.n| +00000040 64 55 94 28 37 54 58 00 23 a0 53 56 13 02 00 00 |dU.(7TX.#.SV....| 00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| 00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| -00000080 03 03 00 01 01 17 03 03 00 17 0f f6 f3 45 0e 04 |.............E..| -00000090 df 70 96 7c 7a a6 a7 31 7a 7f b8 43 53 ab 02 32 |.p.|z..1z..CS..2| -000000a0 23 17 03 03 00 3c bc 1f 27 c5 81 3d d3 25 22 34 |#....<..'..=.%"4| -000000b0 af e3 a4 6f 22 14 e0 e8 2b 9e 91 6b b5 a5 19 b7 |...o"...+..k....| -000000c0 32 5d a9 2a 7a ff 30 71 7b a8 32 01 00 b8 52 cc |2].*z.0q{.2...R.| -000000d0 5e 46 ab 4d c0 10 a6 8d 0d 04 8a 26 5c d1 3a 62 |^F.M.......&\.:b| -000000e0 67 07 17 03 03 02 6d 54 af e4 20 90 dd 21 b4 04 |g.....mT.. ..!..| -000000f0 46 0c 01 7f 5c c4 4b 08 87 4f f0 fd 9f 64 34 55 |F...\.K..O...d4U| -00000100 3e 30 81 52 3a c7 a6 3c 7a 0d 3e e8 b0 9c 38 df |>0.R:.....8.| -00000110 2a bf 29 e0 cb 13 04 0a d0 ab 65 fc d1 0c 6a ae |*.).......e...j.| -00000120 36 03 81 56 7b dd 1d 15 a8 81 de e2 85 25 5c e5 |6..V{........%\.| -00000130 a8 38 44 dd 04 d7 52 18 0e 27 8c a3 be c3 54 f7 |.8D...R..'....T.| -00000140 54 a2 ec df 6d cb ae cf dd 77 78 01 e0 0c 02 76 |T...m....wx....v| -00000150 65 e3 da da 5b 96 2c 57 fa c5 a2 6e 3f 9f 93 f5 |e...[.,W...n?...| -00000160 af b3 fa 27 d5 46 94 c1 8c 4e 0b d5 c7 f8 21 07 |...'.F...N....!.| -00000170 08 09 27 87 a6 19 5c b1 a8 d5 c1 66 3d 0a d9 bb |..'...\....f=...| -00000180 80 77 2b 24 cf 2e 7a 51 84 37 e1 e7 05 cb e9 90 |.w+$..zQ.7......| -00000190 47 0e 5f 32 25 60 81 2c 93 43 a5 1a f5 b0 84 13 |G._2%`.,.C......| -000001a0 2f e8 37 d6 b6 4b bc 4a ad 23 41 77 b0 b7 7e a7 |/.7..K.J.#Aw..~.| -000001b0 74 db d2 13 e5 12 ab 43 51 68 da 9a d6 68 f2 82 |t......CQh...h..| -000001c0 aa 73 49 6e e4 2e 24 41 e3 5c 22 c4 88 8b 03 8b |.sIn..$A.\".....| -000001d0 2d 14 b9 55 12 60 50 a2 d3 8a a9 8f 7c c5 d9 f6 |-..U.`P.....|...| -000001e0 f2 23 93 a2 a6 55 eb 27 3a c5 f5 f8 82 0e 23 43 |.#...U.':.....#C| -000001f0 bd 3a 2d b5 e3 e3 8f d3 a6 eb 30 56 a4 7f 1c 08 |.:-.......0V....| -00000200 72 85 77 22 36 f5 7a b8 d4 b8 9c e2 1f 47 f6 81 |r.w"6.z......G..| -00000210 d6 c7 76 4e 97 51 dd 1e 89 b5 b5 12 88 f9 2d ca |..vN.Q........-.| -00000220 2e 85 c8 cc cc 95 0d 7e a8 7e c3 59 85 b2 ca 14 |.......~.~.Y....| -00000230 d7 cc 50 3b 5e 03 52 77 d3 50 8d e4 50 76 e2 36 |..P;^.Rw.P..Pv.6| -00000240 82 df b2 69 a2 cf ee 1b fb 1d 5c a1 83 8b c9 97 |...i......\.....| -00000250 23 a6 7f 85 87 df d5 59 fc d5 ad 86 c7 2c 9a 92 |#......Y.....,..| -00000260 b6 1d d1 ee 92 83 92 f9 d8 9e dd e7 d7 05 c5 c8 |................| -00000270 a5 c2 10 b3 2f 99 4a 4b fb 8a 5b c7 26 06 18 7a |..../.JK..[.&..z| -00000280 1b d4 c1 f4 d4 2c cf a1 5e d2 f0 90 3d a4 2c b7 |.....,..^...=.,.| -00000290 d4 0a 7b e4 7f 16 29 1a ad d1 45 d5 b8 9b 07 4a |..{...)...E....J| -000002a0 ab 61 32 bb 27 ac 61 c6 74 56 ec fd 93 01 a0 53 |.a2.'.a.tV.....S| -000002b0 6b 0c 8b 3f 55 3d 53 fd cf f6 da d7 5a c6 8e 8f |k..?U=S.....Z...| -000002c0 c9 e1 fd 79 6c 85 22 08 2a a4 bc 82 ea f6 53 d6 |...yl.".*.....S.| -000002d0 80 02 a7 f5 49 0c 1f c3 4c 44 f2 7f 56 3a 5f 65 |....I...LD..V:_e| -000002e0 d1 4e 62 17 61 6b f9 75 94 e7 f9 5b da 8f 65 dd |.Nb.ak.u...[..e.| -000002f0 d0 98 99 72 35 b7 0e 79 3c b5 94 2b a2 19 94 e3 |...r5..y<..+....| -00000300 7b 31 cb 74 e4 41 c6 c3 92 0b 7a 2e 48 b5 50 2b |{1.t.A....z.H.P+| -00000310 23 b6 c1 de 6c 5e 57 c9 36 e8 a1 07 4d d1 73 a8 |#...l^W.6...M.s.| -00000320 c0 7b 67 1f fb 70 01 da 86 fb e0 73 ad 79 8c 9f |.{g..p.....s.y..| -00000330 7f 28 61 e9 2c d5 f0 d5 85 e4 e9 db 87 26 f9 dc |.(a.,........&..| -00000340 af e1 ed 4d 79 f0 5d 14 10 08 70 70 66 6d 5b 32 |...My.]...ppfm[2| -00000350 22 09 7f 78 17 03 03 00 99 16 32 bb fc 9a 38 88 |"..x......2...8.| -00000360 17 0f d1 03 15 b2 70 f3 ee d7 86 ec 67 f0 f6 aa |......p.....g...| -00000370 df 63 cf 4e 4c e3 f5 7f 67 3f ef 80 b0 68 b3 d2 |.c.NL...g?...h..| -00000380 a6 91 59 1a dd 9c 9b 26 7a 4e f1 e4 cb df cf 9f |..Y....&zN......| -00000390 51 26 76 88 02 73 e7 99 15 58 06 af cb 14 52 1e |Q&v..s...X....R.| -000003a0 18 4f 81 f9 62 2b 4b bd dc e6 3b fc 5f ff e6 4b |.O..b+K...;._..K| -000003b0 b7 4b 47 39 70 69 69 89 2b ca 9a 5e 32 91 7d e9 |.KG9pii.+..^2.}.| -000003c0 2f ae d4 b2 f8 13 89 57 4c 59 55 1e e5 41 66 34 |/......WLYU..Af4| -000003d0 b3 1e c3 e9 b0 79 7b 14 f8 c0 b5 16 c9 e3 7e ce |.....y{.......~.| -000003e0 3a 2c 38 85 ea ca 91 3f cf c0 fb 61 4d 24 b4 c5 |:,8....?...aM$..| -000003f0 b5 6a 17 03 03 00 45 3a 7a af a4 51 1c f9 07 39 |.j....E:z..Q...9| -00000400 73 d5 ca e2 6f ab 7c f3 ef b0 16 ea 17 0d 03 cb |s...o.|.........| -00000410 07 fb 40 1b ae 9a 5c e9 1f c1 aa c9 e5 f5 1b 4d |..@...\........M| -00000420 1b 4b 2c 0b 8d 86 24 06 9a 64 ba a5 fd e3 69 dd |.K,...$..d....i.| -00000430 53 e5 ac 9a 2f 37 fc fd e3 c1 b4 b7 |S.../7......| +00000080 03 03 00 01 01 17 03 03 00 17 69 01 91 62 e2 e7 |..........i..b..| +00000090 ee 89 ea b5 55 95 a2 3e 69 09 0a 11 85 42 e8 fd |....U..>i....B..| +000000a0 c5 17 03 03 00 3e 2d 4a 1f 1b 45 7a f5 bf f8 50 |.....>-J..Ez...P| +000000b0 b7 90 b7 19 24 8c c6 da 49 79 83 f4 52 10 ed 5d |....$...Iy..R..]| +000000c0 fa 26 91 28 13 bc a9 c2 f9 6b 4c e9 f7 79 cb 87 |.&.(.....kL..y..| +000000d0 1d ac a4 7a d9 84 25 e8 68 27 67 7f 85 f9 e1 3e |...z..%.h'g....>| +000000e0 04 2c fe aa 17 03 03 02 6d ca f8 97 e5 6f f8 f7 |.,......m....o..| +000000f0 1a 8b a1 c2 81 b5 a4 f3 6d d9 83 30 00 6b 4a 92 |........m..0.kJ.| +00000100 99 0c c1 71 69 c6 57 0b c6 09 8c dd 17 19 14 4f |...qi.W........O| +00000110 7f 22 f1 d1 28 13 6c b7 e7 89 d7 4b b2 cd 56 e4 |."..(.l....K..V.| +00000120 b6 b8 7c ca 18 41 43 e7 74 ef 39 c6 b9 dd 3f 23 |..|..AC.t.9...?#| +00000130 62 fa 59 70 1c 7c ff e9 41 d0 04 fe ae f4 25 75 |b.Yp.|..A.....%u| +00000140 0f b1 cf b9 b0 bb 95 50 be 9a be 9a 7a 1c 03 3b |.......P....z..;| +00000150 ae 01 ee 91 aa f6 7a 47 40 67 f4 1b 5b 86 36 58 |......zG@g..[.6X| +00000160 88 0f 68 1a 9d cd 1a e1 aa 3e 61 77 67 fd 5a aa |..h......>awg.Z.| +00000170 96 b9 8f cd fe 28 68 ed 25 0f 7f 8a a1 31 24 44 |.....(h.%....1$D| +00000180 bd 4a 03 e8 f8 cc 63 d1 fc 12 eb c0 47 4c 30 1e |.J....c.....GL0.| +00000190 82 77 4d 45 50 03 d4 2c 0b a3 d7 af 0c 7e 61 68 |.wMEP..,.....~ah| +000001a0 98 c0 5f cf b9 54 75 be 76 08 9e 68 07 62 96 8c |.._..Tu.v..h.b..| +000001b0 b8 24 0e b9 c4 2a 27 72 72 de 00 d1 38 a5 42 8b |.$...*'rr...8.B.| +000001c0 38 23 78 9e 68 c2 d6 62 db 82 5a 46 5b 57 19 a4 |8#x.h..b..ZF[W..| +000001d0 11 00 7c e9 14 56 79 ea ac 24 26 c0 d4 16 45 8c |..|..Vy..$&...E.| +000001e0 28 ca 88 6f 72 f3 f8 18 26 3f 00 e5 62 c2 9f 67 |(..or...&?..b..g| +000001f0 46 9f 99 f1 61 af b7 b0 05 42 59 13 5b 0f 0d a7 |F...a....BY.[...| +00000200 bc 9e 7e 3f 6e 24 74 bf 93 a0 9d 09 89 a8 a6 4d |..~?n$t........M| +00000210 07 5d aa 24 2c 86 e5 80 7f 4b a3 c3 02 41 8b e5 |.].$,....K...A..| +00000220 56 7a be 9f 5f b0 9d 41 51 e6 b8 d8 67 66 df 89 |Vz.._..AQ...gf..| +00000230 00 07 83 06 8b 5b 84 e6 8a 92 3c de 1f 4c 2b bc |.....[....<..L+.| +00000240 9d 7f ec e8 c3 0e ee 4a 80 2c e4 f0 d7 84 b3 a8 |.......J.,......| +00000250 7d c7 f5 91 b9 91 43 14 45 77 a4 84 f7 a6 72 f0 |}.....C.Ew....r.| +00000260 cd a2 7f 12 b6 e2 6f d3 93 5a d9 c8 39 4b 95 29 |......o..Z..9K.)| +00000270 2a be 4c dd a5 82 ec da ee 98 c9 0f 10 18 e4 da |*.L.............| +00000280 f4 3f 33 86 11 e4 5c 36 05 07 02 d1 21 5d 48 5f |.?3...\6....!]H_| +00000290 8b ec b1 33 25 65 ef 33 d4 87 6e f9 cf f8 e4 79 |...3%e.3..n....y| +000002a0 f8 23 82 10 1e 5e c5 e7 60 82 6d b5 57 3c 54 f3 |.#...^..`.m.W.Oq.n| +00000370 b0 04 89 76 d0 4e be 85 cc b1 dc c6 f0 ba 0c a8 |...v.N..........| +00000380 81 86 0d 8d bf d0 93 c5 3a 28 a8 ac df f9 7c eb |........:(....|.| +00000390 10 4b bc dc 1b a7 4d f9 25 b3 09 9a 80 6f 83 0e |.K....M.%....o..| +000003a0 9d 62 a9 6e 33 d8 85 96 78 3d f1 1f b7 6b 87 f7 |.b.n3...x=...k..| +000003b0 30 dd 09 ea 06 f3 cc 7a 82 96 e8 f7 cd f2 99 7f |0......z........| +000003c0 53 da dd ab b6 f2 da 94 94 cf b1 6f 21 e2 7b 9f |S..........o!.{.| +000003d0 90 ab 18 fc 61 84 d6 97 87 a0 14 2e cf 02 42 74 |....a.........Bt| +000003e0 68 a0 5b cc 1a 63 fc 4e e0 a9 ca 59 89 ae fc ef |h.[..c.N...Y....| +000003f0 41 54 65 cf 17 03 03 00 45 ba bb ae e4 a3 04 5c |ATe.....E......\| +00000400 30 19 79 ff 6a b5 0c dc ab c8 cd e5 bf 2d 9c 3e |0.y.j........-.>| +00000410 44 98 1b cd bb 2a 08 10 75 ab b9 d1 62 a5 e1 21 |D....*..u...b..!| +00000420 51 32 75 38 89 67 83 3b 3f f5 e7 71 53 8f 2f d0 |Q2u8.g.;?..qS./.| +00000430 81 98 cb 75 b2 99 40 bf 01 a0 bb 0b b0 0e |...u..@.......| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 02 11 1c af 9f 29 61 |..............)a| -00000010 e3 1f bf c8 44 89 cf 28 10 cb e5 63 05 0c fa cf |....D..(...c....| -00000020 38 79 7c 63 5d 1d 6b 40 68 ea 54 41 3d 3a 39 83 |8y|c].k@h.TA=:9.| -00000030 8b e2 29 e9 f6 4d 4e e4 14 33 36 78 b2 bb 01 e1 |..)..MN..36x....| -00000040 84 c4 59 30 01 65 9b 6b b1 35 2d 3e 02 fa 9b db |..Y0.e.k.5->....| -00000050 51 d1 25 bc 4d fa a1 e8 24 e9 7e cc 97 b0 f2 40 |Q.%.M...$.~....@| -00000060 92 0f b0 1c 0a 0a 24 3e 77 d5 4f 0f c0 54 e7 f5 |......$>w.O..T..| -00000070 56 87 ff 46 0a 12 7f 49 18 76 40 3d ce 64 53 a8 |V..F...I.v@=.dS.| -00000080 f8 1a 95 70 dc 8f 1c b0 2d ba 55 42 89 1d fa 9a |...p....-.UB....| -00000090 cf d5 ba f0 fb f8 fe ad c8 5f e0 47 28 ce 48 2f |........._.G(.H/| -000000a0 a3 6c 7c 05 04 5f 3f 0a 95 ca 04 2f 6a b3 02 9c |.l|.._?..../j...| -000000b0 f3 23 d9 fd 13 75 45 5d a6 22 3f 72 6d 7e 35 60 |.#...uE]."?rm~5`| -000000c0 bd c1 b3 8d d4 42 4a b8 69 31 82 0c 83 94 84 76 |.....BJ.i1.....v| -000000d0 77 5e ca 19 8c d2 4f b1 94 71 2d 3d e9 34 3b 39 |w^....O..q-=.4;9| -000000e0 7f f0 b1 0b 8c e7 18 7e 37 89 c9 98 38 31 21 39 |.......~7...81!9| -000000f0 a4 52 b8 d0 0e 09 fb eb c1 e2 ef f1 37 4f d2 29 |.R..........7O.)| -00000100 13 4b 87 f9 88 19 71 bd d7 48 c9 8f 94 a3 51 4e |.K....q..H....QN| -00000110 65 4b 66 8a 48 9b 33 bf 14 70 24 24 e3 1c b3 6c |eKf.H.3..p$$...l| -00000120 0d f3 b1 74 5a bd a6 a4 f3 e9 1f 95 81 88 6d cb |...tZ.........m.| -00000130 19 44 67 b6 ee f7 65 af bf ec 0a 55 13 a6 65 41 |.Dg...e....U..eA| -00000140 49 4f be 8f c5 f2 a7 7c 27 ac ad fa 02 a5 75 54 |IO.....|'.....uT| -00000150 53 a5 a9 b5 7f b9 7d 70 2e 2d 48 27 fe 63 e6 ab |S.....}p.-H'.c..| -00000160 ea 13 47 0e 8f a5 8d 19 42 0f 8c 26 ba cd a2 98 |..G.....B..&....| -00000170 f5 e3 28 a7 a1 6d 56 95 0b 7f a1 c2 5e 77 56 81 |..(..mV.....^wV.| -00000180 5d c8 7f a8 00 4c a4 09 c1 ed 43 0e a2 65 8f 66 |]....L....C..e.f| -00000190 47 02 0f 0d 46 d5 42 d8 f5 e8 a7 f2 50 1b 09 02 |G...F.B.....P...| -000001a0 4d a9 39 78 6b fc 24 23 4b 2a 49 ef b7 60 70 78 |M.9xk.$#K*I..`px| -000001b0 f3 6f a0 2e 8f e3 20 b6 b9 76 ce 4d e4 56 e0 f3 |.o.... ..v.M.V..| -000001c0 b8 9f d2 02 f7 63 e9 80 ed 43 16 49 c9 3a c2 41 |.....c...C.I.:.A| -000001d0 8c f9 98 b7 3a 31 cb e6 78 3b ad ee 5f 52 c3 0a |....:1..x;.._R..| -000001e0 d7 dc 5f 67 89 6a 0a db 1f 7f 4b fc 08 0e a2 e1 |.._g.j....K.....| -000001f0 23 4b d6 a0 36 10 c7 e5 95 71 86 cb 1a 70 89 55 |#K..6....q...p.U| -00000200 2c 58 8a 55 f8 26 89 b1 40 1e 11 b0 b5 3e 0d eb |,X.U.&..@....>..| -00000210 33 cb 37 1c 80 6c b7 0e 84 96 a0 67 17 03 03 00 |3.7..l.....g....| -00000220 99 ae 4c b5 06 1e 69 cb 7d 28 42 7f 47 c8 1b bf |..L...i.}(B.G...| -00000230 8c 0a af 18 fc 5a 4d db 2c c5 b3 7d cc e5 28 be |.....ZM.,..}..(.| -00000240 ec 3a f7 e4 ec b1 11 01 67 f6 3b 0e a6 55 03 67 |.:......g.;..U.g| -00000250 76 8c 3f d3 0a cc 97 90 f2 51 d4 ee 58 3e 9c 78 |v.?......Q..X>.x| -00000260 e1 b4 57 4d 42 c1 fd e1 4c c5 6e 1f 5e 8e d9 fd |..WMB...L.n.^...| -00000270 f9 71 86 c9 63 7c 42 df 53 b0 99 06 3d 21 3e 06 |.q..c|B.S...=!>.| -00000280 d7 56 2f 90 b8 09 f5 77 8b 8a 4b 7e f5 78 05 73 |.V/....w..K~.x.s| -00000290 85 10 e7 b4 71 02 77 a0 2c cb db 76 53 0b b4 34 |....q.w.,..vS..4| -000002a0 56 37 7f 45 13 b4 72 f0 24 24 e4 47 1b ce b2 78 |V7.E..r.$$.G...x| -000002b0 44 82 73 f6 3a 77 68 5c ce 02 17 03 03 00 45 17 |D.s.:wh\......E.| -000002c0 d8 40 a5 44 fe 96 82 bc 27 1c 2f c6 c5 6e 0c 47 |.@.D....'./..n.G| -000002d0 52 9d 90 cd f6 43 03 d5 f0 1b 4a 11 38 56 f3 0b |R....C....J.8V..| -000002e0 73 cb 01 d3 69 33 1a 95 4b 5e 75 55 99 a9 a2 fe |s...i3..K^uU....| -000002f0 28 58 4e 54 92 5e 08 71 4b 40 42 a1 e6 94 ec c0 |(XNT.^.qK@B.....| -00000300 bc ac 82 8e |....| +00000000 14 03 03 00 01 01 17 03 03 02 11 25 5d 22 6c 20 |...........%]"l | +00000010 8a 8e d3 aa 97 5a 96 46 a0 69 a3 5c 0f d4 ad c0 |.....Z.F.i.\....| +00000020 6f e4 6f df 99 28 d3 e1 bd ce a5 8c 69 6a c4 9b |o.o..(......ij..| +00000030 a5 eb e2 d8 db a4 1d ea 55 ff be c2 14 dc 63 74 |........U.....ct| +00000040 b8 4d 44 aa 87 65 5c 1e a2 10 8c 0f ae 0c 0e 76 |.MD..e\........v| +00000050 89 4c 05 65 c5 19 e3 d4 d1 eb 9e e5 2d 8a 62 ae |.L.e........-.b.| +00000060 55 d6 a3 37 46 9b 3c 4c ad d0 82 7e 0a 36 48 38 |U..7F.4a.| +00000130 a6 1e 18 45 1a c5 1c 8a aa ad cd 67 bf 37 30 46 |...E.......g.70F| +00000140 37 eb 13 1f c2 6a 7f 39 47 b8 91 a4 c9 9e 70 7c |7....j.9G.....p|| +00000150 73 62 69 7b c1 30 99 97 d3 34 2f 83 84 3d de a8 |sbi{.0...4/..=..| +00000160 dc b5 ce d4 69 ff 5e a8 b8 31 05 e0 6b 3b 14 93 |....i.^..1..k;..| +00000170 10 11 51 ae e6 29 df 54 34 30 01 6c 46 24 76 3a |..Q..).T40.lF$v:| +00000180 dd 24 f1 84 d3 27 a7 45 9a 19 4a 09 63 7b 00 6d |.$...'.E..J.c{.m| +00000190 b8 11 72 06 e4 8a aa b2 3b 08 eb 17 ae 88 18 18 |..r.....;.......| +000001a0 51 8f fb 80 5f 01 2a 2c bc 47 10 cf da d1 ec 11 |Q..._.*,.G......| +000001b0 34 6d fd d0 c1 c0 a7 26 f3 3a 2e 43 7f 3a 63 eb |4m.....&.:.C.:c.| +000001c0 7b e4 a5 c8 23 ff 6b 7a e9 8e 70 c4 9d 39 b4 3c |{...#.kz..p..9.<| +000001d0 4d 40 bc 1e ff e4 7d 47 13 54 64 e7 98 7f cd df |M@....}G.Td.....| +000001e0 90 89 19 89 92 8c 39 1b 5c 53 4b c2 7b 38 5c 5a |......9.\SK.{8\Z| +000001f0 01 e3 2f f9 a3 f5 a2 c0 79 ff 99 a9 89 40 91 40 |../.....y....@.@| +00000200 4e 96 73 15 f5 16 bd ac be e3 ef fa 8a b8 df bf |N.s.............| +00000210 ec 86 3b 67 93 59 45 6a b8 ce a1 04 17 03 03 00 |..;g.YEj........| +00000220 99 21 d2 f9 b5 d7 ca 07 c4 b9 f7 80 87 c4 ce 95 |.!..............| +00000230 8f fa f0 a9 c6 99 89 93 18 50 b6 1b 4c ae ff e7 |.........P..L...| +00000240 2b 29 81 14 20 6a 13 bc 7f 6c b2 6f e4 09 b7 96 |+).. j...l.o....| +00000250 49 93 37 2b 1d 7e 16 3f b0 bd 22 dd 0f 04 71 29 |I.7+.~.?.."...q)| +00000260 38 eb dc a8 85 48 68 17 59 72 0b f2 4f 78 4c 30 |8....Hh.Yr..OxL0| +00000270 db bf 60 a0 56 80 be aa 80 fd ab 87 55 2e 49 6d |..`.V.......U.Im| +00000280 47 38 b9 b1 b4 c2 05 09 16 28 e5 89 dd f1 3d 32 |G8.......(....=2| +00000290 83 66 fb ca de 37 9c ed 74 2a 7b a1 3a 50 0c 4d |.f...7..t*{.:P.M| +000002a0 4c 44 bd 3b 3a 76 33 1c e1 46 91 95 02 a7 b7 a3 |LD.;:v3..F......| +000002b0 9b 3b 9c 19 0a b5 5d 81 32 66 17 03 03 00 45 b6 |.;....].2f....E.| +000002c0 a2 53 eb aa 3c 74 29 1c 36 1e 9f fb 30 c9 48 5c |.S...|| >>> Flow 4 (server to client) -00000000 17 03 03 02 9b bf 6f 39 51 ff 9a ee ff 16 51 98 |......o9Q.....Q.| -00000010 49 e5 88 3d b3 ea b4 14 1d a7 8c ae 11 da 7b 08 |I..=..........{.| -00000020 99 ad 7d 23 e7 3a 78 8f b1 ca c1 2c b5 f7 84 bf |..}#.:x....,....| -00000030 0d 48 0b 1e 3f 6d 56 d7 7c 84 df f0 39 ee 77 ff |.H..?mV.|...9.w.| -00000040 af 7b f5 f2 6e 59 dc 4e 92 a8 b5 d0 64 03 5a 87 |.{..nY.N....d.Z.| -00000050 9d 4b 0c d7 00 0c e7 7e 2d 4a e0 da 63 10 cc a6 |.K.....~-J..c...| -00000060 a0 8e 8b ff 04 e2 49 75 01 4f b9 6a cd 5c 90 82 |......Iu.O.j.\..| -00000070 3c e3 67 d0 a0 93 b7 9b 4d f3 f8 b6 67 d3 fd f6 |<.g.....M...g...| -00000080 e3 d2 d0 dd 0f 6c 89 92 95 4f b6 74 56 5c f8 f5 |.....l...O.tV\..| -00000090 a1 33 3d e6 31 05 93 d8 09 d8 3c 0b e3 a7 9f b9 |.3=.1.....<.....| -000000a0 4b c7 0a de 1c 71 8a d6 63 44 b8 7d 11 6f 1e 8d |K....q..cD.}.o..| -000000b0 d8 7f 3f 9f 39 77 8b 2d 7a fd 01 e1 9e 45 58 b6 |..?.9w.-z....EX.| -000000c0 f8 eb f6 48 9b f2 fc 95 ba 75 56 42 5c 01 22 39 |...H.....uVB\."9| -000000d0 ab df c2 2d 32 9c de f6 fa 51 00 d0 77 a8 47 34 |...-2....Q..w.G4| -000000e0 b2 cf dd 9e d5 d6 c2 fd 0e db 98 71 6a 30 82 4e |...........qj0.N| -000000f0 4a 36 ce 6c c8 27 a0 92 77 ec 04 e8 ed 20 0d f4 |J6.l.'..w.... ..| -00000100 1e 9a 5c ae 71 db 06 6a ed ba 18 0e 65 94 dc f1 |..\.q..j....e...| -00000110 60 67 34 d4 6a 9d 4b ed 4b 80 69 2e 52 8b e2 ba |`g4.j.K.K.i.R...| -00000120 17 aa b7 75 0f 02 bf b9 95 f1 05 83 2c 2a e8 7d |...u........,*.}| -00000130 62 17 0e 89 c5 40 fb bb 98 14 98 f4 68 09 af 73 |b....@......h..s| -00000140 e2 f9 35 68 19 d7 56 66 dd 36 1f 8e 6e 1c 73 e4 |..5h..Vf.6..n.s.| -00000150 98 ef b0 f3 31 ae 58 de 91 56 a6 eb ee 4c f6 57 |....1.X..V...L.W| -00000160 5b 6c e7 f9 c3 51 c7 2c 78 40 c0 37 14 0d c4 12 |[l...Q.,x@.7....| -00000170 18 4c 96 24 69 19 53 de 07 a3 50 b4 00 fa cd 47 |.L.$i.S...P....G| -00000180 e4 a3 4f 3a 0c 44 82 b7 90 7d 55 6d 6f b1 68 04 |..O:.D...}Umo.h.| -00000190 02 3d 60 14 80 8b 4b 7d 13 55 5c 1b d2 73 f2 03 |.=`...K}.U\..s..| -000001a0 31 a1 12 f3 cc df 5f 2e 14 5d 15 7b 6c a8 66 10 |1....._..].{l.f.| -000001b0 3d ee 11 e0 bd 0f ff b6 d9 9d 2b b8 59 0c b5 f5 |=.........+.Y...| -000001c0 ec 78 80 bd 11 85 6b b7 67 01 25 5d 1f 14 26 4c |.x....k.g.%]..&L| -000001d0 60 48 0e 40 7f 2e a5 d9 09 25 e9 45 87 6e b3 a9 |`H.@.....%.E.n..| -000001e0 e2 19 5a 58 4c 3e 53 0e 1f d1 55 42 3f bc d0 26 |..ZXL>S...UB?..&| -000001f0 4e 9a dc 00 ac 2e 8b ac 4d e2 76 d0 80 80 09 87 |N.......M.v.....| -00000200 8b fe c6 9b c5 43 2d 56 b6 13 e2 eb 91 94 d9 0c |.....C-V........| -00000210 40 4f e6 96 af b2 c5 fb 75 9d 51 24 09 b0 8d 4f |@O......u.Q$...O| -00000220 68 c5 b1 7a 0e 22 03 84 21 14 b5 db f7 97 d4 60 |h..z."..!......`| -00000230 c9 ee 49 a0 9a 14 d4 bb 3c 54 91 61 ac 78 40 0f |..I......j.c9| -000002c0 64 e8 05 17 03 03 00 13 3b b0 06 df 04 01 7a 90 |d.......;.....z.| -000002d0 46 4a 2e 57 1c 66 26 f0 d8 4c ea |FJ.W.f&..L.| +00000000 17 03 03 02 9b fe 23 52 d0 ff dd ef e2 10 c1 70 |......#R.......p| +00000010 a1 c1 ac d6 e7 30 63 41 07 d5 04 ef 11 ee e7 57 |.....0cA.......W| +00000020 81 14 5b 81 9d 35 3f 73 be 44 15 6b ed 8c b7 e0 |..[..5?s.D.k....| +00000030 59 2c d7 0b 0c aa 7a 18 6a da d6 90 19 64 54 d5 |Y,....z.j....dT.| +00000040 30 73 cf 0e c8 d1 8a 69 a6 68 a4 ce 61 2f c8 4a |0s.....i.h..a/.J| +00000050 58 81 42 1c 5f ee b3 fc 05 66 bf d0 14 45 8f ab |X.B._....f...E..| +00000060 da 82 fe 86 da 1f b0 f6 d5 12 14 1e 78 d0 1c e8 |............x...| +00000070 e7 a3 5e af e6 71 42 45 70 4c 95 4a 16 a0 0e a4 |..^..qBEpL.J....| +00000080 27 6b c4 53 35 63 2a 19 76 d7 e0 7c 92 a2 89 df |'k.S5c*.v..|....| +00000090 be 1f 5d 03 24 06 de 3e d9 c0 12 91 d4 3d 86 a7 |..].$..>.....=..| +000000a0 b6 8b ed 31 e5 81 cc 5e 76 72 25 15 ba 78 54 ab |...1...^vr%..xT.| +000000b0 5b a1 a7 68 e6 44 3f a3 f5 e9 3d 10 ed b5 21 f5 |[..h.D?...=...!.| +000000c0 02 fd 48 cc 9f 1a 2c 4e 47 4b 37 39 5a 8b 42 32 |..H...,NGK79Z.B2| +000000d0 69 52 e6 ae ba 80 80 af 8d 67 d1 38 bb bb 97 55 |iR.......g.8...U| +000000e0 2a 69 28 ef c5 8e 49 fc 87 7a 45 64 57 cf 76 01 |*i(...I..zEdW.v.| +000000f0 94 57 a2 11 13 5e 99 05 6c 7c 52 97 fb 4c 81 09 |.W...^..l|R..L..| +00000100 68 5d c6 91 ef cc 0f 77 71 ac 55 53 d8 2d cb 26 |h].....wq.US.-.&| +00000110 d5 0e c9 36 70 83 85 dd 7d 7e 0d 22 24 26 91 ec |...6p...}~."$&..| +00000120 3d b0 e1 c3 62 22 a9 09 a2 e4 ba e4 4d 53 ec c1 |=...b"......MS..| +00000130 56 c5 b5 92 9a 33 00 f6 21 2c a3 9e 78 85 8e 65 |V....3..!,..x..e| +00000140 24 e5 ad b6 02 26 4d 03 8d 02 62 3c b0 16 3c 2e |$....&M...b<..<.| +00000150 c2 4a 10 11 45 93 2b 96 87 d0 8e 22 43 ca ad 7f |.J..E.+...."C...| +00000160 fe ac db 12 e1 9d e0 ff 03 93 d1 90 cc 9c 27 19 |..............'.| +00000170 1b c5 ba 62 39 55 38 17 44 76 d4 2a 63 54 47 c9 |...b9U8.Dv.*cTG.| +00000180 de db f0 59 ee 6e ed 26 11 93 07 15 eb 03 98 87 |...Y.n.&........| +00000190 bd 15 98 29 14 8b 7a 6c b2 08 6d 86 35 64 0f 4e |...)..zl..m.5d.N| +000001a0 73 e3 60 86 8a 3a 68 0f e8 74 07 78 1d c2 96 fe |s.`..:h..t.x....| +000001b0 b9 0c 4b 0b 31 39 8b 9e 9d 86 57 5e 5c f6 fc 7b |..K.19....W^\..{| +000001c0 fc bd 9b 01 6e a2 33 c4 0a 00 89 22 13 45 2b e2 |....n.3....".E+.| +000001d0 6b 9c 1e 35 b7 df 9e 27 3b 38 26 e4 60 c7 ee a5 |k..5...';8&.`...| +000001e0 9e c2 24 38 ee 3d 44 79 07 77 bc a9 bc 4a 4c 7d |..$8.=Dy.w...JL}| +000001f0 9f d9 e8 9c 91 88 75 92 98 74 a0 e1 ef be 66 3c |......u..t....f<| +00000200 77 be 3f 1c 24 4d 96 49 23 a3 cd 80 60 9a b0 5b |w.?.$M.I#...`..[| +00000210 fa f2 79 54 0d cb 08 7b 52 93 1c 8d ba 18 f3 ce |..yT...{R.......| +00000220 5b 3f c8 c4 4c 12 00 9f 1f 9c 57 d9 16 d5 a2 05 |[?..L.....W.....| +00000230 c3 fa 4e 6d 7e 78 d5 99 33 0f 07 60 1a e9 58 aa |..Nm~x..3..`..X.| +00000240 37 57 4b a4 1c 20 99 29 4c 52 af 1f 02 64 01 87 |7WK.. .)LR...d..| +00000250 a1 fe 73 09 fa ff 04 f6 91 23 0c 56 16 08 16 ba |..s......#.V....| +00000260 3c bb a9 c4 b2 a1 f6 93 45 c0 1a b7 43 9d e2 d5 |<.......E...C...| +00000270 ea dc d1 03 ec 32 83 55 00 59 40 2e 41 8f 52 0e |.....2.U.Y@.A.R.| +00000280 51 22 e9 39 07 04 40 82 ee e8 f9 4a a3 83 63 b6 |Q".9..@....J..c.| +00000290 2e 9a e8 d2 21 04 dd c0 8f a0 e8 33 55 87 3c f3 |....!......3U.<.| +000002a0 17 03 03 00 1e 17 c1 06 2e 7b c7 3e a7 12 4f e2 |.........{.>..O.| +000002b0 96 ac 58 bc 0b 22 95 47 19 5e e0 35 f2 53 0f 78 |..X..".G.^.5.S.x| +000002c0 1d db 93 17 03 03 00 13 9a da 86 87 00 57 0a a0 |.............W..| +000002d0 e6 4f 26 1a e8 9c 5a 5d 89 19 9a |.O&...Z]...| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled b/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled deleted file mode 100644 index 89361f15577..00000000000 --- a/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled +++ /dev/null @@ -1,182 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 e0 01 00 00 dc 03 03 32 03 2a b3 ed |...........2.*..| -00000010 c2 1a 71 f2 ff ea 0b 1c fa f9 c6 88 03 7c 84 89 |..q..........|..| -00000020 4e 45 60 81 d9 58 dc 9f 0a 60 d1 20 ce 4d 59 a5 |NE`..X...`. .MY.| -00000030 10 b1 76 53 f5 77 26 fd 17 08 f9 e5 14 03 c4 0a |..vS.w&.........| -00000040 65 fd 83 bb a9 3b 24 05 24 1b ef 00 00 08 13 02 |e....;$.$.......| -00000050 13 03 13 01 00 ff 01 00 00 8b 00 00 00 0e 00 0c |................| -00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| -00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| -00000080 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 1e |................| -00000090 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| -000000a0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 00 2b |...............+| -000000b0 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 26 00 |......-.....3.&.| -000000c0 24 00 1d 00 20 06 b0 03 80 81 d6 e7 f4 31 85 4c |$... ........1.L| -000000d0 e3 50 35 c1 df 6e 28 9f 38 ce c0 7b fc 71 00 8c |.P5..n(.8..{.q..| -000000e0 9a 25 07 95 57 |.%..W| ->>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 ce 4d 59 a5 |........... .MY.| -00000030 10 b1 76 53 f5 77 26 fd 17 08 f9 e5 14 03 c4 0a |..vS.w&.........| -00000040 65 fd 83 bb a9 3b 24 05 24 1b ef 00 13 02 00 00 |e....;$.$.......| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| -00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| -00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| -00000080 03 03 00 01 01 17 03 03 00 17 ad ce ff 21 b8 39 |.............!.9| -00000090 16 f6 10 6e 8d 6c 0f 46 2f 58 55 b3 e4 4f 2d 5c |...n.l.F/XU..O-\| -000000a0 26 17 03 03 00 3c fd 24 07 75 28 2b f2 ec d9 74 |&....<.$.u(+...t| -000000b0 f0 76 e4 02 e6 02 bd 47 58 0f 68 60 ac 6c 59 a8 |.v.....GX.h`.lY.| -000000c0 87 94 b9 cb c3 fa 41 15 4c 95 b8 58 da 8c d9 ea |......A.L..X....| -000000d0 3a ab 0c 06 83 a5 2b d1 39 6f 32 92 bf e1 c0 f4 |:.....+.9o2.....| -000000e0 49 51 17 03 03 02 6d 22 dc 8c fc ae 21 96 41 17 |IQ....m"....!.A.| -000000f0 45 93 6e 08 61 6b 46 b9 9a cf 2e 79 a8 1a 46 30 |E.n.akF....y..F0| -00000100 a4 de 3d 53 87 bf 57 3a 44 4f 5b 3f c9 b2 f0 0e |..=S..W:DO[?....| -00000110 56 5f 5a ee 5a 1f df cc fe f3 54 ab 87 d7 bb 00 |V_Z.Z.....T.....| -00000120 2c 61 de ad 31 9c d4 cf 43 bf e7 84 d1 1d 3c cb |,a..1...C.....<.| -00000130 82 d1 81 9d 13 90 6b c8 fd 01 53 4f 13 a5 91 a4 |......k...SO....| -00000140 fe 20 ce 2c 34 96 62 b7 6f f0 f0 65 f0 01 18 99 |. .,4.b.o..e....| -00000150 31 3d cb c6 72 6f 54 d6 ec fa a3 dd 94 67 6b b9 |1=..roT......gk.| -00000160 ff 2c 41 ba 00 d5 25 ba b1 7a e5 d2 1c 0b 37 ad |.,A...%..z....7.| -00000170 df 0b 62 be b3 69 5b 84 39 2d 72 c2 b9 ec 68 87 |..b..i[.9-r...h.| -00000180 32 23 92 4b a8 f0 17 25 0f d7 86 97 45 65 73 e1 |2#.K...%....Ees.| -00000190 49 c4 3c 8d 26 43 34 06 4c be 50 76 ae 63 6f 1d |I.<.&C4.L.Pv.co.| -000001a0 ed 57 93 5a 7f 98 e2 1e 5f 94 74 a2 54 59 63 12 |.W.Z...._.t.TYc.| -000001b0 bb 8b df 77 20 3a 9c ea c7 40 b0 cf 8e 7f f8 98 |...w :...@......| -000001c0 06 92 38 be 77 11 17 03 c2 ac af fc 8d 7d d5 6b |..8.w........}.k| -000001d0 f7 2b 7a f3 b8 dc b0 cf 3e f7 c5 f4 b3 34 4b 06 |.+z.....>....4K.| -000001e0 c6 ed b5 dc 0c 2d 4e bc 03 94 cc 03 f2 9f 5d c6 |.....-N.......].| -000001f0 57 36 5a 01 81 65 27 75 1d 4f 22 9f b5 da 7f e2 |W6Z..e'u.O".....| -00000200 7d 36 f3 4b 05 3f 40 47 c6 1b af e6 99 c0 ca 35 |}6.K.?@G.......5| -00000210 98 c8 30 60 7b 42 4e e7 5c 90 28 d7 4e db f3 78 |..0`{BN.\.(.N..x| -00000220 22 e2 a3 86 0c 9e 19 43 0e 89 d4 f6 78 38 21 16 |"......C....x8!.| -00000230 84 38 36 6a 2d a5 94 2c 52 2b 00 de 67 16 e8 89 |.86j-..,R+..g...| -00000240 32 21 0e fd b0 23 91 06 8b fa 82 70 21 bc 1f 29 |2!...#.....p!..)| -00000250 32 af f4 b9 15 7f aa 22 c1 e8 e3 2c 92 b4 d8 2a |2......"...,...*| -00000260 64 58 f4 f1 85 85 14 92 f3 16 8e 2d 5b a6 7e ef |dX.........-[.~.| -00000270 22 5a 58 bb 4c f1 36 70 2f ca 03 df fb 0a d0 03 |"ZX.L.6p/.......| -00000280 55 5d d9 6b 63 48 d2 75 82 d4 56 af 17 5a 60 4f |U].kcH.u..V..Z`O| -00000290 af 8b 17 d6 fd 96 be 3d 82 25 0e 73 2e 58 0e 0a |.......=.%.s.X..| -000002a0 5c 2d c8 f5 17 b0 ae 7d 39 90 cb 75 bb 4b 33 22 |\-.....}9..u.K3"| -000002b0 bd a2 02 00 70 43 a8 54 ee 7c 25 d5 d7 88 08 f6 |....pC.T.|%.....| -000002c0 3f 34 61 55 f5 d3 53 0c 8c b1 9b fd 4e d9 65 7a |?4aU..S.....N.ez| -000002d0 2b 6e b4 d5 37 34 18 f3 14 00 9f 56 40 d9 15 ea |+n..74.....V@...| -000002e0 59 5a 4b 4a bb f7 19 72 60 4a 08 8f 75 d6 7b a4 |YZKJ...r`J..u.{.| -000002f0 de 79 c5 21 1a cb 82 97 b3 88 d8 ae 65 30 cc 56 |.y.!........e0.V| -00000300 da a3 04 5c 63 f4 44 a5 eb 05 55 ad 78 46 44 ac |...\c.D...U.xFD.| -00000310 56 2e f6 f7 eb 47 f6 f1 62 8d df 27 7d 86 5e 58 |V....G..b..'}.^X| -00000320 5f 4c 34 6e f6 c0 fd 56 7d 46 82 5d 53 db 2a 84 |_L4n...V}F.]S.*.| -00000330 45 db e7 9c b9 23 32 59 cf 85 f7 12 c5 e8 9e 3c |E....#2Y.......<| -00000340 2d 3f 81 a5 24 cf 36 ad d6 65 02 35 84 de 43 f8 |-?..$.6..e.5..C.| -00000350 04 e2 8b ae 17 03 03 00 99 ce e8 48 a3 34 5e fb |...........H.4^.| -00000360 76 f1 e4 3b da 94 0a 25 ee 78 f6 31 24 10 05 25 |v..;...%.x.1$..%| -00000370 9c e5 ca fc ef c5 66 86 08 15 d8 69 75 d8 49 e9 |......f....iu.I.| -00000380 9b 86 71 3f 1f 41 ee f0 bc 8d 4e aa bc 30 f0 8f |..q?.A....N..0..| -00000390 7b b1 94 7e aa 74 3f eb 23 c5 c9 aa 9a c3 f7 12 |{..~.t?.#.......| -000003a0 23 30 95 2e e1 1b 9c fe 8b 50 b1 d9 17 cf af a1 |#0.......P......| -000003b0 ff ce 8d fa 7e bd 23 59 d0 7a fb 30 12 f4 8d 86 |....~.#Y.z.0....| -000003c0 0c 3c fd 03 50 d4 7f bb f6 fa ba 1d fc 32 cc 7e |.<..P........2.~| -000003d0 12 3a 33 90 c6 82 5d 6a 90 23 6d b8 e6 60 7d d3 |.:3...]j.#m..`}.| -000003e0 a8 f0 0c 75 bc b5 67 68 ed 58 ef 4d ac 91 47 c9 |...u..gh.X.M..G.| -000003f0 c4 bc 17 03 03 00 45 ae 0d 8d 76 8d 28 34 1b 09 |......E...v.(4..| -00000400 4d d5 df 2e aa f8 ff 71 b2 0e 60 a1 ce 8a 58 9c |M......q..`...X.| -00000410 45 64 31 6c 9b 46 66 64 27 98 e6 f3 93 e8 92 81 |Ed1l.Ffd'.......| -00000420 3d 4f db da 98 72 0d b7 71 27 ac 2b 61 81 97 0b |=O...r..q'.+a...| -00000430 e7 ae 32 d7 e2 66 4d 5d f7 01 d0 77 |..2..fM]...w| ->>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 02 11 f6 03 90 9e bc |................| -00000010 dc 00 9b f9 dd 7b 65 dd b0 69 b4 b5 42 fc 25 f2 |.....{e..i..B.%.| -00000020 2b 7e be 52 1a 4b f1 e4 21 94 0d 88 4a 58 07 37 |+~.R.K..!...JX.7| -00000030 67 c7 e3 c4 62 eb 17 57 5d 52 d4 a9 03 39 0e 7d |g...b..W]R...9.}| -00000040 d0 c3 1a 8d ef ec b7 a8 9b 93 50 0d 7f fd a1 10 |..........P.....| -00000050 b6 82 99 21 3f e3 3d 3d 47 04 c3 cd a7 b3 ab e0 |...!?.==G.......| -00000060 f6 33 47 0e 1c 30 36 45 21 32 34 c2 2c 72 20 72 |.3G..06E!24.,r r| -00000070 b6 c7 5b 95 8a 97 84 54 2e d0 5f d5 80 e7 8f 7a |..[....T.._....z| -00000080 6f 50 96 8a 33 13 c6 97 85 25 47 6b 8a b2 a0 29 |oP..3....%Gk...)| -00000090 cd 7f 0e 38 94 53 08 8b c3 2f 89 a2 10 c2 22 5a |...8.S.../...."Z| -000000a0 95 42 a3 45 73 a8 d0 ac 6d ba 95 a4 51 63 b9 b4 |.B.Es...m...Qc..| -000000b0 79 61 be dd c6 ab 97 72 38 30 63 55 a7 7d 9a eb |ya.....r80cU.}..| -000000c0 bb 5a f6 d0 3d 05 81 5d 0e e5 7a 8b ae fe d2 3b |.Z..=..]..z....;| -000000d0 db 85 3a 13 81 ee 36 b3 ff 41 47 d1 67 bf 17 5e |..:...6..AG.g..^| -000000e0 9d a3 4c 92 51 a9 1b 4b ca 13 f6 ee 8a e5 b3 01 |..L.Q..K........| -000000f0 e7 87 ee 1e 2a 9e 56 3d 01 7e 0f cb e5 d6 ea 13 |....*.V=.~......| -00000100 05 3e 8c 5a 24 d0 36 6b 54 9f 8e 3f 07 73 a0 bf |.>.Z$.6kT..?.s..| -00000110 84 c2 90 72 ce 48 50 49 47 27 b3 14 56 5c c7 63 |...r.HPIG'..V\.c| -00000120 7e 7e b5 8f 9d 6d 70 32 6f 3f 4d 53 80 ae f6 2b |~~...mp2o?MS...+| -00000130 fb c9 7a de 76 aa 68 a3 9b a9 a7 47 55 d0 cb f8 |..z.v.h....GU...| -00000140 e8 c4 1c f5 0f 54 82 5b c5 45 18 41 05 da 72 ce |.....T.[.E.A..r.| -00000150 84 d1 8b 00 40 e9 f9 cf b5 d5 3e 71 ee 25 dc 7d |....@.....>q.%.}| -00000160 3b 00 67 68 9d 78 d2 c0 7b cb 5d 9e 79 2c b5 f4 |;.gh.x..{.].y,..| -00000170 1b ea b8 d8 de bd 36 71 2a 26 49 44 1b 5b 92 ad |......6q*&ID.[..| -00000180 1c 2d 2f ab 8e 15 d7 b3 96 89 da 58 77 75 42 32 |.-/........XwuB2| -00000190 c3 6b f1 5e 0b da 91 71 1e d5 f1 dd 32 d8 b6 a5 |.k.^...q....2...| -000001a0 21 a1 1d 5e b1 df 01 37 33 ac 93 11 94 6d b8 e6 |!..^...73....m..| -000001b0 3b be 86 31 da cf b6 ab cd f5 12 4f 85 45 24 06 |;..1.......O.E$.| -000001c0 34 40 7b c5 f8 5f c3 f9 3b cf 9d 2a b3 2e 65 e4 |4@{.._..;..*..e.| -000001d0 0e ed fc 7c b4 2b 32 bf 0e 8f b3 85 93 74 8b e8 |...|.+2......t..| -000001e0 25 e0 47 c0 d8 52 8e c9 ed 7f 16 41 3f b3 79 d8 |%.G..R.....A?.y.| -000001f0 d1 47 19 ae fb ab 97 a5 b2 42 7c a0 73 ad 4f 62 |.G.......B|.s.Ob| -00000200 cf 35 52 7c d6 47 b8 1f e9 65 b0 99 f7 67 e7 64 |.5R|.G...e...g.d| -00000210 14 83 46 c7 90 6e 4d 01 3a c2 e6 19 17 03 03 00 |..F..nM.:.......| -00000220 99 a5 e0 38 3a 91 4a 1d 87 9a eb a6 95 87 35 fc |...8:.J.......5.| -00000230 ae 42 8d 3a fe f6 39 f3 c2 c2 f0 9a f5 8f b5 75 |.B.:..9........u| -00000240 18 6b 84 c0 5b 96 6a 9c 0c aa 81 fc 9a 2e 01 f7 |.k..[.j.........| -00000250 d8 b1 5d 4a 54 cf 79 90 fb 79 57 ff d9 d1 46 59 |..]JT.y..yW...FY| -00000260 02 84 3d ee cc 68 ea 05 1d a2 79 fb 1d 1e d6 ad |..=..h....y.....| -00000270 5b 95 3b 6b 9a c9 07 e5 e4 20 07 6a a0 74 c8 1a |[.;k..... .j.t..| -00000280 31 53 a4 e6 bb bb 28 61 47 41 d5 f3 45 38 71 86 |1S....(aGA..E8q.| -00000290 35 12 f4 8a f2 e4 e9 ae 96 a9 14 ce 8a 1c 5d 59 |5.............]Y| -000002a0 3c d7 3a e7 93 35 c2 53 9f d8 4d cb 98 bd e1 72 |<.:..5.S..M....r| -000002b0 a8 80 55 a6 cd 9c 50 41 ec 50 17 03 03 00 45 2d |..U...PA.P....E-| -000002c0 90 3b 73 cc 24 52 ad 22 90 0e 7d bf 2a a2 44 09 |.;s.$R."..}.*.D.| -000002d0 e2 43 61 f2 48 9b 73 85 00 05 8b 0a 51 ad a0 c0 |.Ca.H.s.....Q...| -000002e0 64 ef 5e 11 86 37 b0 32 af 11 f7 98 7b 74 39 90 |d.^..7.2....{t9.| -000002f0 fa d0 32 f3 fe 4d 01 6b 78 75 31 7e 67 4f 61 0f |..2..M.kxu1~gOa.| -00000300 bb c6 3e c0 |..>.| ->>> Flow 4 (server to client) -00000000 17 03 03 02 9b f5 b2 d6 62 fe e0 c8 8d cc 7a cd |........b.....z.| -00000010 29 51 b2 77 0d 9a 54 fb 43 6d f6 9c e1 ff 28 be |)Q.w..T.Cm....(.| -00000020 fc 50 68 80 2f 1c 4f 50 44 95 64 49 0a 66 fe 79 |.Ph./.OPD.dI.f.y| -00000030 46 ba 88 e9 03 be 5c 91 60 84 78 03 a8 c6 21 90 |F.....\.`.x...!.| -00000040 cd 79 de 2d 2f 81 dd 08 1f 52 1a 0e d8 69 16 22 |.y.-/....R...i."| -00000050 a6 59 5b 2b 85 08 00 16 e7 85 bd 43 9a cc ce e6 |.Y[+.......C....| -00000060 3a ee 70 25 0b 95 90 4b c0 42 4a 48 25 d3 50 92 |:.p%...K.BJH%.P.| -00000070 19 e1 3e b8 72 c5 a1 e8 dd 9f a4 57 2d b0 a6 24 |..>.r......W-..$| -00000080 8b 8c 55 41 f3 26 45 dd dd 2b d3 15 8d d9 ca e4 |..UA.&E..+......| -00000090 15 6e b5 6d 99 79 ba 46 00 e6 5e 75 52 fd f9 26 |.n.m.y.F..^uR..&| -000000a0 cf cd 69 cf be 29 a7 b9 7d 1b 1d 6b ab 17 ee 4e |..i..)..}..k...N| -000000b0 f5 24 b0 89 0f b5 c7 41 4e ea cd 32 98 47 23 bc |.$.....AN..2.G#.| -000000c0 91 03 b1 23 e0 5c 5e 37 40 95 da 90 ef eb 95 81 |...#.\^7@.......| -000000d0 7b 2d c7 15 8f f8 2d ba 69 41 0e a9 eb 19 6c 6c |{-....-.iA....ll| -000000e0 73 b0 05 fc b9 f4 76 91 2b 6a 72 fa d6 e5 87 a9 |s.....v.+jr.....| -000000f0 90 49 81 8c d5 fa 78 a2 a1 8f 77 c7 35 78 1b ba |.I....x...w.5x..| -00000100 ac 3c 41 51 ce 4e 99 c9 74 a0 bc 51 12 b5 15 2c |..G| -00000280 71 63 2f 0c 94 c9 42 ac bc 4c 0a 16 fe 9a 90 eb |qc/...B..L......| -00000290 02 75 16 1a 10 23 b2 75 67 c7 c5 17 55 9b cf 69 |.u...#.ug...U..i| -000002a0 17 03 03 00 1e 45 8c ed 99 0f 8a 83 d8 89 70 49 |.....E........pI| -000002b0 17 a8 fd 2b 6e ef ff 53 fa 99 52 89 ee 8b 19 f1 |...+n..S..R.....| -000002c0 41 09 30 17 03 03 00 13 14 f0 f6 ef c5 f9 52 15 |A.0...........R.| -000002d0 77 de 5e 46 63 8d 3b 2f 07 84 aa |w.^Fc.;/...| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedNotGiven b/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedNotGiven index c9c8728b6e3..5c9675feb49 100644 --- a/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedNotGiven +++ b/libgo/go/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedNotGiven @@ -1,9 +1,9 @@ >>> Flow 1 (client to server) -00000000 16 03 01 00 e0 01 00 00 dc 03 03 d7 9c 79 99 50 |.............y.P| -00000010 c9 4b 3a e0 a1 36 a8 fc 40 bb 51 a9 71 a6 ba 2f |.K:..6..@.Q.q../| -00000020 1b ba 13 f3 b6 8b 2b 77 f1 60 27 20 a6 a3 e8 5a |......+w.`' ...Z| -00000030 4b cb 7c 64 05 b4 77 3b af 66 4b e3 5a b3 cb 57 |K.|d..w;.fK.Z..W| -00000040 84 d3 fa 5d 7f 5a cd 94 62 79 31 4a 00 08 13 02 |...].Z..by1J....| +00000000 16 03 01 00 e0 01 00 00 dc 03 03 a7 91 25 cb c3 |.............%..| +00000010 c2 53 ec 92 0f e7 4c 06 3a 35 ee c9 09 f1 6a 94 |.S....L.:5....j.| +00000020 27 bf 12 7d f8 e5 c3 1a 45 dc a0 20 c8 75 ac df |'..}....E.. .u..| +00000030 fc 9f f5 43 eb ee 5a d8 94 3a f8 10 2d 42 d4 fd |...C..Z..:..-B..| +00000040 2c 80 9f 13 73 c9 02 77 32 c0 50 59 00 08 13 02 |,...s..w2.PY....| 00000050 13 03 13 01 00 ff 01 00 00 8b 00 00 00 0e 00 0c |................| 00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| 00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| @@ -11,99 +11,99 @@ 00000090 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| 000000a0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 00 2b |...............+| 000000b0 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 26 00 |......-.....3.&.| -000000c0 24 00 1d 00 20 c6 c0 3a af 99 9f ef 6d 59 6b bd |$... ..:....mYk.| -000000d0 c3 b0 8a 94 02 c8 fb 13 7d cb a8 3a f4 f1 e0 40 |........}..:...@| -000000e0 03 15 7a 95 06 |..z..| +000000c0 24 00 1d 00 20 ab 7a fe 9c a7 15 e8 53 6d 6e be |$... .z.....Smn.| +000000d0 8b 1f 25 bb f9 6c 15 4c ca 78 c0 b6 b1 20 ab 03 |..%..l.L.x... ..| +000000e0 3d 09 06 cc 49 |=...I| >>> Flow 2 (server to client) 00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 a6 a3 e8 5a |........... ...Z| -00000030 4b cb 7c 64 05 b4 77 3b af 66 4b e3 5a b3 cb 57 |K.|d..w;.fK.Z..W| -00000040 84 d3 fa 5d 7f 5a cd 94 62 79 31 4a 13 02 00 00 |...].Z..by1J....| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 c8 75 ac df |........... .u..| +00000030 fc 9f f5 43 eb ee 5a d8 94 3a f8 10 2d 42 d4 fd |...C..Z..:..-B..| +00000040 2c 80 9f 13 73 c9 02 77 32 c0 50 59 13 02 00 00 |,...s..w2.PY....| 00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| 00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| -00000080 03 03 00 01 01 17 03 03 00 17 d8 15 a1 e7 a9 00 |................| -00000090 bf 9d 8d 63 5d ba b1 5a 08 c2 de 57 7e 73 61 5d |...c]..Z...W~sa]| -000000a0 2f 17 03 03 00 3c 59 ed f4 2a 62 56 2a 02 73 4f |/.......r....4| -00000350 2f 45 81 fe 17 03 03 00 99 ef 4a 43 25 8d dd 0d |/E........JC%...| -00000360 e5 af 9e e3 46 e1 84 de f1 68 5f 9b f6 70 17 6f |....F....h_..p.o| -00000370 7e 86 33 45 b6 13 f0 a8 a2 fd 08 1b 4a 4f 92 3f |~.3E........JO.?| -00000380 45 ef db 03 ff 1f 54 55 28 cc de 0e f5 6c af 5c |E.....TU(....l.\| -00000390 86 cc b1 e2 c7 0e ea 24 47 fb e0 37 e8 a2 e7 47 |.......$G..7...G| -000003a0 cd 9e da 02 e5 37 1f a9 b2 ea 57 f8 6f 63 be 5e |.....7....W.oc.^| -000003b0 38 be 1a 09 38 23 46 52 df cf 79 bc ce c1 da 23 |8...8#FR..y....#| -000003c0 34 97 c8 ce 81 74 d5 03 f4 71 ff 4b 17 e0 99 7c |4....t...q.K...|| -000003d0 31 bd c9 1e d5 2b d3 d4 ff dc 56 82 07 f5 a6 57 |1....+....V....W| -000003e0 0e ab 18 cf db 38 26 ff d9 51 c2 8f 70 b8 5b 84 |.....8&..Q..p.[.| -000003f0 80 27 17 03 03 00 45 95 7b 2b 46 29 0a 03 4f c6 |.'....E.{+F)..O.| -00000400 37 0c 31 e8 72 8a aa 00 db 90 e8 d3 1f c1 e1 eb |7.1.r...........| -00000410 03 02 bc ae dd 03 a7 28 55 7e 19 0d 5f 76 e6 fa |.......(U~.._v..| -00000420 03 91 c2 5a 10 1d c0 a0 85 3d d2 32 ec 65 af 83 |...Z.....=.2.e..| -00000430 25 d1 77 0f 41 d9 e7 43 56 04 4e fe |%.w.A..CV.N.| +00000080 03 03 00 01 01 17 03 03 00 17 c2 3f e2 45 30 ec |...........?.E0.| +00000090 10 bf f7 4e 69 42 22 e6 80 64 0a a2 29 07 c6 92 |...NiB"..d..)...| +000000a0 4c 17 03 03 00 3e d1 75 9b 8c a1 3f 5d b3 11 da |L....>.u...?]...| +000000b0 27 79 d3 9c 7f 54 9b 37 ce 02 b4 60 f6 44 0e cb |'y...T.7...`.D..| +000000c0 c3 07 b9 bf 4e 77 7c 4b ba f7 2c e3 4c 43 a4 f1 |....Nw|K..,.LC..| +000000d0 ba ec 0f 7b e5 7a 59 ef 8e e6 68 1e 1c ce d3 11 |...{.zY...h.....| +000000e0 f9 b1 69 32 17 03 03 02 6d aa e1 b7 df 0e 6a 54 |..i2....m.....jT| +000000f0 41 c5 aa 05 24 fd 4a 1b 8a 05 4f e7 48 29 48 35 |A...$.J...O.H)H5| +00000100 66 42 f8 1d 23 9b 68 f4 b6 cf 94 16 af e1 82 93 |fB..#.h.........| +00000110 30 d5 02 3b e4 aa a9 d7 b2 9c 7f 7f 3c a2 be 0d |0..;........<...| +00000120 85 96 14 64 1a 6d ff 95 ab 36 1c d1 2b ed a9 89 |...d.m...6..+...| +00000130 c8 b8 a3 e5 45 e7 18 5a 18 00 c4 d8 96 64 d1 74 |....E..Z.....d.t| +00000140 1a cb ba ec 9a f4 2d 81 8b 3a 77 e6 57 cc 3a 2b |......-..:w.W.:+| +00000150 b8 05 82 bf 59 92 3b 92 04 e8 a6 f2 6a 94 c1 46 |....Y.;.....j..F| +00000160 bd 79 2e 99 7f 7b ea 32 f9 ac b6 90 78 b9 db c8 |.y...{.2....x...| +00000170 ce 9a e4 88 65 11 8a 03 79 43 d2 81 ce d0 f8 0d |....e...yC......| +00000180 64 8e 8b ef bc 2f 34 87 cf 4e e5 22 44 1f 55 82 |d..../4..N."D.U.| +00000190 ab 25 61 df 0f bd e2 ad 73 06 ae e6 08 8d f3 23 |.%a.....s......#| +000001a0 d6 c6 d4 ea e2 22 b9 eb 75 bd 49 58 8f f4 f6 3b |....."..u.IX...;| +000001b0 92 e6 a4 18 ba 6d 50 77 65 69 27 ee 82 0f ca 57 |.....mPwei'....W| +000001c0 db c7 69 e9 7d 6a ff 30 66 e9 8b 6f 10 20 05 fb |..i.}j.0f..o. ..| +000001d0 53 a7 01 5f d9 8d 11 e5 c2 cb 37 6a 93 a5 26 a3 |S.._......7j..&.| +000001e0 e2 1b 45 b3 7f 6f e5 32 52 8e 26 f7 88 d6 de b6 |..E..o.2R.&.....| +000001f0 75 32 a1 95 54 e8 65 38 9d ee 80 e7 7f 6f d8 2d |u2..T.e8.....o.-| +00000200 5f 29 60 c8 89 00 e6 05 06 b4 c0 b0 e5 ad ed 74 |_)`............t| +00000210 77 93 30 92 82 06 45 b9 0e e3 1e 09 12 bb f8 16 |w.0...E.........| +00000220 59 31 a8 51 17 e7 a8 d8 82 44 a0 d6 31 d2 a7 d1 |Y1.Q.....D..1...| +00000230 54 97 c0 49 62 60 82 79 6a 3c 5a b5 92 aa aa f0 |T..Ib`.yj...v.#.A| +000002d0 0f 9e 99 7d eb 73 a2 4d 46 49 71 8e fe ab 5c 3d |...}.s.MFIq...\=| +000002e0 ae fb 1d c8 f0 d1 fc 93 99 96 35 f8 7c 8e ab ea |..........5.|...| +000002f0 96 eb ea ab f1 e5 71 4e ce fc 4d 38 23 31 86 57 |......qN..M8#1.W| +00000300 ac e6 31 55 97 f5 57 b3 58 e9 5a 62 d6 5a 61 a0 |..1U..W.X.Zb.Za.| +00000310 3b a8 0c a5 66 df dc 62 27 e1 5b 10 80 5a 6a 39 |;...f..b'.[..Zj9| +00000320 7f 83 5c 27 84 6e 95 d4 b6 c4 3e aa 06 a5 bf 81 |..\'.n....>.....| +00000330 9d 69 05 c1 c0 e6 b4 e1 81 ff 0d 30 9a 7a 00 a3 |.i.........0.z..| +00000340 ac a0 e8 f0 54 1d bf 53 9c 4b 10 50 0a 6f c9 a1 |....T..S.K.P.o..| +00000350 9b e2 15 e4 e8 3a 17 03 03 00 99 8a 93 9f 65 05 |.....:........e.| +00000360 9d e6 76 d8 25 0d 1a 6f bc 4c 9f f3 97 23 f3 5b |..v.%..o.L...#.[| +00000370 bf 18 13 35 75 de a6 84 d4 d8 b1 ef 5c d4 f0 17 |...5u.......\...| +00000380 8a 3c c7 f4 00 67 ae ec 65 fa 63 4d 23 86 bf ee |.<...g..e.cM#...| +00000390 73 0a 84 d8 32 d6 cd 6d da 02 64 77 16 f8 96 4b |s...2..m..dw...K| +000003a0 ab a8 9f cd 0d ad be de 66 bf 24 24 26 47 38 d3 |........f.$$&G8.| +000003b0 7e 28 1c 87 98 26 ca d3 ec e6 3a a8 0c 89 19 b5 |~(...&....:.....| +000003c0 71 8d f3 f8 d5 07 c5 f4 75 f2 c5 17 11 3d d3 d6 |q.......u....=..| +000003d0 16 e2 ee e9 c9 4c 43 c0 bf 10 fa a2 ff a1 fa 07 |.....LC.........| +000003e0 db 17 d2 d0 6f 56 cf 67 6c 20 32 42 43 ad 18 a2 |....oV.gl 2BC...| +000003f0 9d 39 d9 e2 17 03 03 00 45 ba 62 93 44 21 7f 7b |.9......E.b.D!.{| +00000400 8c 16 13 4a fe b3 e8 dc 13 70 d7 b4 36 8d 2d e1 |...J.....p..6.-.| +00000410 aa 64 37 b9 8c 15 b4 f4 e7 00 12 94 f1 11 a5 04 |.d7.............| +00000420 71 5c d6 ec ab e3 62 15 53 95 8e da f1 a1 c8 22 |q\....b.S......"| +00000430 cf 02 e5 15 85 b2 35 48 a1 11 67 aa 70 1a |......5H..g.p.| >>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 19 6c b2 53 5f 6e |...........l.S_n| -00000010 a9 6a b2 48 da d7 d5 b2 56 81 47 a9 7d a8 5c 6d |.j.H....V.G.}.\m| -00000020 7a a8 23 db 17 03 03 00 45 88 80 32 38 19 22 fd |z.#.....E..28.".| -00000030 09 5c a2 40 50 ba 9c 34 ad 4e 4c 70 7c 4d f0 0e |.\.@P..4.NLp|M..| -00000040 68 3f da d6 c0 6e 6e 29 fa ec d8 11 2e 20 94 38 |h?...nn)..... .8| -00000050 12 b9 08 27 3c e3 0a 8f 9a da cb 1f ab c9 f5 0e |...'<...........| -00000060 da a9 8c 66 24 de 2f b2 92 22 68 53 2f 68 |...f$./.."hS/h| +00000000 14 03 03 00 01 01 17 03 03 00 19 44 2e d9 de 51 |...........D...Q| +00000010 eb 6f 4d a5 6e f7 ca 7e e2 54 88 5c 10 82 95 25 |.oM.n..~.T.\...%| +00000020 ef 79 ab ae 17 03 03 00 45 a6 6e 3e 2c b9 c6 97 |.y......E.n>,...| +00000030 6d 91 e5 a9 05 d8 d9 aa 69 b9 26 8c 51 24 37 4a |m.......i.&.Q$7J| +00000040 b7 80 c5 4f 8f bc f5 34 c2 e6 e0 e6 56 c7 af 0a |...O...4....V...| +00000050 4a d0 6d 98 76 c3 92 02 c3 82 58 44 fb f8 91 76 |J.m.v.....XD...v| +00000060 df 57 6f 28 3e 84 6e 61 be 74 53 2c 9a 8e |.Wo(>.na.tS,..| >>> Flow 4 (server to client) -00000000 17 03 03 00 a3 38 95 dc 12 b1 b8 df 96 ef 91 88 |.....8..........| -00000010 d4 d5 dc 35 ec 19 32 a3 2d 90 0b d5 03 f4 b2 b9 |...5..2.-.......| -00000020 4e 5f 4d b2 18 ae 44 d6 21 f1 7f ef a2 ab 3a 60 |N_M...D.!.....:`| -00000030 df a3 f3 6c 90 68 66 12 8c 3c c2 25 13 36 6c 1d |...l.hf..<.%.6l.| -00000040 51 e7 7e 75 f1 ac 54 fd ae 1b e0 b3 03 6f 0e 96 |Q.~u..T......o..| -00000050 91 5e 88 f5 a7 b6 f0 c5 3c ec a4 e1 3a 46 cd 41 |.^......<...:F.A| -00000060 60 dc 6f 13 d0 eb 76 7e b4 46 31 0f 23 22 0f b1 |`.o...v~.F1.#"..| -00000070 c8 91 14 42 ac 67 6f 83 92 a7 5b 2c 88 16 fc cf |...B.go...[,....| -00000080 ef 97 56 2f 2b 64 92 7d 1a ae a7 94 66 5d 35 f3 |..V/+d.}....f]5.| -00000090 77 63 c2 ef 82 d7 33 6d 0e 60 b2 a3 6b 01 aa 84 |wc....3m.`..k...| -000000a0 32 d0 df 47 e1 01 52 15 17 03 03 00 1e 05 90 37 |2..G..R........7| -000000b0 26 ed e0 a9 8d b1 07 26 42 6d 77 7c 19 aa c2 56 |&......&Bmw|...V| -000000c0 f1 92 eb de 96 46 f2 25 d9 93 df 17 03 03 00 13 |.....F.%........| -000000d0 ed b0 6c 70 1e 85 32 0d 8b ef 55 32 8c d6 fe 1d |..lp..2...U2....| -000000e0 c5 b0 4f |..O| +00000000 17 03 03 00 a3 5e 44 99 71 b2 70 5b 36 d3 17 a9 |.....^D.q.p[6...| +00000010 eb 0b 02 b2 28 54 9d f7 3d f2 c4 d0 18 e1 fb 62 |....(T..=......b| +00000020 e2 8a 37 b7 98 2a 98 39 c0 9d 5a 3c 53 99 31 79 |..7..*.9..Z>> Flow 1 (client to server) +00000000 16 03 01 00 e0 01 00 00 dc 03 03 d8 00 36 18 75 |.............6.u| +00000010 c8 be 9e c0 c2 8c 7d 8b b5 e7 f3 ab 31 0f 5e af |......}.....1.^.| +00000020 f2 3c d6 e5 93 26 78 2f 94 19 23 20 8e b2 d2 08 |.<...&x/..# ....| +00000030 7e 69 f5 38 73 13 2f 6d ba ec ea 29 54 64 32 a0 |~i.8s./m...)Td2.| +00000040 42 b8 d8 d4 2f 34 db 2f 55 25 54 3f 00 08 13 02 |B.../4./U%T?....| +00000050 13 03 13 01 00 ff 01 00 00 8b 00 00 00 0e 00 0c |................| +00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| +00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| +00000080 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 1e |................| +00000090 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| +000000a0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 00 2b |...............+| +000000b0 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 26 00 |......-.....3.&.| +000000c0 24 00 1d 00 20 39 4b 85 87 27 a7 4c f3 5d 60 0e |$... 9K..'.L.]`.| +000000d0 27 d9 31 11 0f 9a fc a8 66 14 e5 57 72 3c c5 2b |'.1.....f..Wr<.+| +000000e0 01 e0 bb 26 29 |...&)| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 8e b2 d2 08 |........... ....| +00000030 7e 69 f5 38 73 13 2f 6d ba ec ea 29 54 64 32 a0 |~i.8s./m...)Td2.| +00000040 42 b8 d8 d4 2f 34 db 2f 55 25 54 3f 13 02 00 00 |B.../4./U%T?....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| +00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| +00000080 03 03 00 01 01 17 03 03 00 17 34 9b a4 9b 55 78 |..........4...Ux| +00000090 ad 94 a9 7b 1b 4a 5f 40 23 34 5d 98 87 74 f7 b3 |...{.J_@#4]..t..| +000000a0 6d 17 03 03 01 50 8d 3f 8c 8d 12 99 a9 bd 78 42 |m....P.?......xB| +000000b0 cc 8f 26 bf e2 55 12 32 8f 2b 0c c1 e1 13 e4 c0 |..&..U.2.+......| +000000c0 20 06 4a ce c9 e5 3d 3a ce d8 86 fc 9a 6d 47 59 | .J...=:.....mGY| +000000d0 ba 11 70 08 1d f5 3f f4 5d 15 66 7e 8c ea 73 12 |..p...?.].f~..s.| +000000e0 19 4f 65 29 10 f7 d2 da b7 7d c5 bd a2 ec 2c 19 |.Oe).....}....,.| +000000f0 fb a9 c5 d3 eb b2 bc 73 f6 73 e3 ae 95 4f 77 3c |.......s.s...Ow<| +00000100 62 e6 4b 46 a9 d3 36 0c 8a 6e a6 e6 a5 1c 8d 9d |b.KF..6..n......| +00000110 2c a0 76 c1 f6 ed bf 99 64 fe bc 03 62 8e 89 ac |,.v.....d...b...| +00000120 0c 74 56 f4 09 aa 4e f5 fd 89 8f 68 9e ac b2 c8 |.tV...N....h....| +00000130 e1 d4 e0 cd 9c a8 0a 2b 11 61 fc fc 16 fd cf 09 |.......+.a......| +00000140 cd 7c bc cd 3f ce 60 f8 7a 71 f1 1b b9 2b a1 93 |.|..?.`.zq...+..| +00000150 60 1b d1 90 5b 5f bc 57 26 17 c6 e1 a4 6b 4f a4 |`...[_.W&....kO.| +00000160 4e b2 58 57 c0 f2 61 1c c9 5c 72 57 3d b2 03 07 |N.XW..a..\rW=...| +00000170 22 a7 25 d2 2f 06 4d 55 18 26 06 bb 26 5e 58 a6 |".%./.MU.&..&^X.| +00000180 e1 91 86 bd 02 22 f5 e7 af 6d c1 06 19 a6 fc 0d |....."...m......| +00000190 20 68 0e 05 ba 09 56 8d 43 33 9b 04 79 62 66 f0 | h....V.C3..ybf.| +000001a0 7c 01 4d 74 86 23 64 e7 c5 6b 10 f5 61 6c c1 83 ||.Mt.#d..k..al..| +000001b0 7a 02 f8 1e 4c 11 e3 81 90 75 a1 ff dd 63 af 07 |z...L....u...c..| +000001c0 c6 c2 54 22 79 61 1f 2d 01 84 76 38 ee 5b dd 93 |..T"ya.-..v8.[..| +000001d0 34 4d 06 dc 6f d1 5d cd c7 31 e0 56 37 06 ea f3 |4M..o.]..1.V7...| +000001e0 ca e2 00 86 17 73 58 b1 63 f0 91 03 a3 f7 b4 21 |.....sX.c......!| +000001f0 ca 31 60 c4 a6 b6 17 03 03 00 59 25 ed f6 65 f5 |.1`.......Y%..e.| +00000200 19 ba 78 3d 2d fb 86 3a 22 8b 9a 00 c1 3b ac 38 |..x=-..:"....;.8| +00000210 cd ad c1 b7 14 91 fc e0 84 c0 ed 4a 86 ca 49 eb |...........J..I.| +00000220 a9 f2 9f dd a3 74 aa f0 a9 e4 fb 18 38 51 0a 10 |.....t......8Q..| +00000230 13 8e ff a9 d2 3e 68 05 8f 82 5a c7 30 a5 02 f6 |.....>h...Z.0...| +00000240 d3 38 6e e3 e4 b3 4d ca c1 83 b2 e3 19 26 3a c2 |.8n...M......&:.| +00000250 26 5f 38 d1 17 03 03 00 45 df 7e cc 71 f0 9e ca |&_8.....E.~.q...| +00000260 00 9a 64 b4 ab 3a b8 50 b9 cd e9 eb 5b be 88 3b |..d..:.P....[..;| +00000270 66 cf 15 98 5e 63 0c ad e3 0c 40 83 87 6e 3e 01 |f...^c....@..n>.| +00000280 a3 78 03 75 cd 93 0e 7d d3 dc f2 f0 ed 3f 12 8d |.x.u...}.....?..| +00000290 fc c5 c3 c8 36 f2 82 fe dc 69 02 26 84 8b 17 03 |....6....i.&....| +000002a0 03 00 a3 d7 77 67 0e 4c d9 19 f8 bd 86 6e 1c aa |....wg.L.....n..| +000002b0 16 ab 1b 48 21 f2 85 3e c9 22 4b fd 21 8e b5 fa |...H!..>."K.!...| +000002c0 43 34 85 86 56 38 d3 4f ec 9f 25 79 eb bb fe d0 |C4..V8.O..%y....| +000002d0 69 98 05 1c c8 37 51 cf cc 77 bc f1 e7 dc 9c c3 |i....7Q..w......| +000002e0 d9 0b 3f 74 27 46 1e f3 7c 26 7e a4 6b ef c2 40 |..?t'F..|&~.k..@| +000002f0 5b 23 de b6 ec 80 79 3b 8f d5 56 d4 ea 44 30 7e |[#....y;..V..D0~| +00000300 73 2b 09 44 32 5c b9 2c 04 6e 94 50 32 61 80 93 |s+.D2\.,.n.P2a..| +00000310 41 b6 83 73 19 a0 b4 ee b1 8b 23 a1 36 9c 5c 33 |A..s......#.6.\3| +00000320 89 87 cd ef 8a 58 c7 51 a5 31 9c 8e 60 7a 6a ce |.....X.Q.1..`zj.| +00000330 5f 7e 13 43 ee 44 8d b7 2c 81 da 3d c6 c6 d2 18 |_~.C.D..,..=....| +00000340 aa 85 22 63 d7 bd |.."c..| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 45 03 21 4e 7f 71 |..........E.!N.q| +00000010 cf b4 fa 18 34 06 57 62 51 99 3d 4a da 52 36 54 |....4.WbQ.=J.R6T| +00000020 5b 22 2b 66 90 c1 8a 21 ec 5e 8b 3c 40 7a 18 0e |["+f...!.^.<@z..| +00000030 b5 82 c1 14 e5 9e 15 72 16 f2 fc 15 cb dd f1 e8 |.......r........| +00000040 7c 03 5e ba c9 96 86 11 ec 88 44 97 24 a5 b2 5a ||.^.......D.$..Z| +>>> Flow 4 (server to client) +00000000 17 03 03 00 1e 4b 9e 56 c2 1a a7 67 94 04 eb b0 |.....K.V...g....| +00000010 48 87 44 38 7d f2 c7 b7 6c 1b a5 40 bb 1a 94 22 |H.D8}...l..@..."| +00000020 a2 f0 9e 17 03 03 00 13 64 42 12 84 e4 d8 64 fd |........dB....d.| +00000030 8c 70 ff f5 43 4d 57 39 b2 d3 1e |.p..CMW9...| diff --git a/libgo/go/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled b/libgo/go/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled deleted file mode 100644 index c13db8d68a6..00000000000 --- a/libgo/go/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled +++ /dev/null @@ -1,103 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 e0 01 00 00 dc 03 03 1e 9f 50 05 56 |.............P.V| -00000010 a7 21 c8 df 56 a8 f3 bb e4 15 3b b0 04 e5 f5 10 |.!..V.....;.....| -00000020 d8 5b 0e 68 d3 b4 39 64 b5 89 9c 20 5a 6b 29 6d |.[.h..9d... Zk)m| -00000030 22 a0 e0 fb 7f 2d 87 48 e7 b4 c9 b3 5a d0 2b c7 |"....-.H....Z.+.| -00000040 ad d8 e4 ad d5 eb 81 b3 1f 61 0e 65 00 08 13 02 |.........a.e....| -00000050 13 03 13 01 00 ff 01 00 00 8b 00 00 00 0e 00 0c |................| -00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| -00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| -00000080 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 1e |................| -00000090 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| -000000a0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 00 2b |...............+| -000000b0 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 26 00 |......-.....3.&.| -000000c0 24 00 1d 00 20 ba 67 99 b3 60 71 ed 6c bb 8d 7e |$... .g..`q.l..~| -000000d0 4c c3 ea 37 6d 90 b6 f8 91 67 71 2c 84 a7 32 3a |L..7m....gq,..2:| -000000e0 23 2a 90 13 35 |#*..5| ->>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 5a 6b 29 6d |........... Zk)m| -00000030 22 a0 e0 fb 7f 2d 87 48 e7 b4 c9 b3 5a d0 2b c7 |"....-.H....Z.+.| -00000040 ad d8 e4 ad d5 eb 81 b3 1f 61 0e 65 13 02 00 00 |.........a.e....| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| -00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| -00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| -00000080 03 03 00 01 01 17 03 03 00 17 d9 74 68 ee e6 54 |...........th..T| -00000090 e3 7a 0e ee 86 c7 a8 bb c7 65 fc e4 c4 6c 58 7a |.z.......e...lXz| -000000a0 1e 17 03 03 02 6d 98 c3 0c cc 80 fe ea 70 13 4e |.....m.......p.N| -000000b0 2f f6 49 99 5f 27 0a f9 4d cf e5 1a 9a 37 fb e7 |/.I._'..M....7..| -000000c0 3b a4 60 82 43 df fb fa 47 15 6f d8 db d2 3e c3 |;.`.C...G.o...>.| -000000d0 dd a0 37 ca b2 b4 c9 1b 5c 86 4a e0 7e 06 1e 27 |..7.....\.J.~..'| -000000e0 73 c6 cd 54 37 df 95 b1 c6 d5 44 85 2c 67 7d a7 |s..T7.....D.,g}.| -000000f0 2a 7d 87 86 5e f3 e5 60 f8 7c de bf 78 89 35 9b |*}..^..`.|..x.5.| -00000100 d1 0b 8a dd 6f 40 d8 5a 55 10 e2 71 b0 7a 5e 4b |....o@.ZU..q.z^K| -00000110 86 18 be 18 a7 f8 8e c6 ae 8c 1e df bf 84 77 c5 |..............w.| -00000120 dc b1 17 26 72 ea bb 9b 28 6c bf 19 8d 1a 22 90 |...&r...(l....".| -00000130 0f 19 92 5b ff db 07 84 48 61 68 f0 50 20 76 a3 |...[....Hah.P v.| -00000140 d3 f2 4a 3b 60 f5 73 cb 61 f7 11 63 f2 a7 0e 18 |..J;`.s.a..c....| -00000150 30 96 d0 17 f1 2f 58 09 49 33 15 3e 31 e4 17 e8 |0..../X.I3.>1...| -00000160 07 48 b5 43 06 40 60 4f a0 78 0d 51 0c 3f 0f 1a |.H.C.@`O.x.Q.?..| -00000170 8c 95 7a 3e 36 66 36 22 dc 58 4e b7 3e 19 ad de |..z>6f6".XN.>...| -00000180 c9 f9 b0 76 e4 e2 8c 04 27 6f 67 8f fe 86 b9 41 |...v....'og....A| -00000190 53 7d 9f d1 e0 a6 0b ec fc c0 82 bf 00 36 28 4d |S}...........6(M| -000001a0 20 3a e3 42 67 87 16 64 6c 4f e2 54 23 d1 0f 32 | :.Bg..dlO.T#..2| -000001b0 e9 16 9a da 46 a6 39 18 d5 6e a6 93 25 de a1 77 |....F.9..n..%..w| -000001c0 d9 26 b5 7c b4 85 8a 69 48 90 11 a9 8c 42 ca b8 |.&.|...iH....B..| -000001d0 88 63 df ec 6c e3 9f 2c 29 75 9b 57 79 8b 69 66 |.c..l..,)u.Wy.if| -000001e0 16 9e 93 48 04 8a 41 e0 8b 0e fb a5 9c fd 68 f6 |...H..A.......h.| -000001f0 5f ab 89 11 e4 aa 4c 6c 92 df b3 a3 39 f0 38 d9 |_.....Ll....9.8.| -00000200 7d 1b 42 13 ee d1 83 e2 20 3f 60 81 96 d9 63 2c |}.B..... ?`...c,| -00000210 e8 54 a5 08 41 9b 1d 02 41 37 a2 ce 0c 9b 34 bf |.T..A...A7....4.| -00000220 43 c5 ac 90 67 cd 6b b6 55 31 36 b1 2b 0e ed 8c |C...g.k.U16.+...| -00000230 23 ae 71 b2 ab f3 94 68 f2 f6 87 d3 87 61 ca aa |#.q....h.....a..| -00000240 0b 65 63 a1 11 dc 6d 74 33 c8 24 a6 ae 40 27 c7 |.ec...mt3.$..@'.| -00000250 d4 06 51 89 15 35 66 21 b0 82 15 87 70 c5 b8 8d |..Q..5f!....p...| -00000260 34 48 ff 41 e0 1a b0 46 f7 38 47 53 64 f7 a3 a2 |4H.A...F.8GSd...| -00000270 61 96 72 ea 90 de 86 18 64 49 91 ed 97 05 e3 27 |a.r.....dI.....'| -00000280 47 df ea 06 c6 28 f9 79 51 5e 64 b6 de 52 75 8a |G....(.yQ^d..Ru.| -00000290 79 8d 8e a6 d5 b0 f1 a6 ab 76 44 25 4b 80 5e e4 |y........vD%K.^.| -000002a0 d4 aa c6 2d 77 1a 49 52 16 d6 73 6b 18 2d d1 a6 |...-w.IR..sk.-..| -000002b0 4c e1 be 4d f8 79 34 a1 4c 81 88 9c 4b 85 f3 28 |L..M.y4.L...K..(| -000002c0 97 fc 3a 7e cf d4 81 2c d3 57 df 09 f5 49 f5 cf |..:~...,.W...I..| -000002d0 c7 7c 22 b3 8e 95 0f 97 6d d1 56 e3 43 7e 52 0f |.|".....m.V.C~R.| -000002e0 d4 da 3f e0 4e 06 b9 84 18 7d 7c 56 49 e0 d7 4a |..?.N....}|VI..J| -000002f0 d6 df c4 70 0c 74 5b 1f 4d 76 28 cd 3b b0 9e 27 |...p.t[.Mv(.;..'| -00000300 cc 6b 1a 13 41 1a 6b bf 0d 2d 93 b2 d5 7e 7e 25 |.k..A.k..-...~~%| -00000310 0e 8a 9c 17 03 03 00 99 df 4b 8e 3e d0 14 be 76 |.........K.>...v| -00000320 f1 d3 ca b1 39 c0 7e 6c 4f 8c d9 0d b8 83 07 39 |....9.~lO......9| -00000330 08 55 13 1e 3d 68 0f 99 9f 9a 68 1f 57 6a aa 41 |.U..=h....h.Wj.A| -00000340 a4 40 2b 12 f2 4b 6c db 3c 59 fa 99 5c e2 c7 2d |.@+..Kl.>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 45 4b 7c c5 9e c6 |..........EK|...| -00000010 47 4a 90 d8 c2 c0 49 f7 3b c4 26 eb 15 18 9c bc |GJ....I.;.&.....| -00000020 c8 44 f0 53 94 2f 0f c8 d7 c1 86 42 ed b7 8f 63 |.D.S./.....B...c| -00000030 a0 97 5d 5b 15 01 3a 3d ca a6 d0 1a a4 77 cc 7e |..][..:=.....w.~| -00000040 88 fd 0b c9 a0 46 b7 40 25 8a 03 6e 99 66 bb 84 |.....F.@%..n.f..| ->>> Flow 4 (server to client) -00000000 17 03 03 00 1e 6a 41 80 ca 72 5f c3 ee e1 88 49 |.....jA..r_....I| -00000010 6d be a4 d9 26 07 5c 2b 2c a7 83 b5 c4 eb 4e 4b |m...&.\+,.....NK| -00000020 a1 29 98 17 03 03 00 13 2a f9 33 6c 46 f7 9a 51 |.)......*.3lF..Q| -00000030 1b 36 cd bc d8 5d 94 0d 9e 4b 72 |.6...]...Kr| diff --git a/libgo/go/crypto/tls/ticket.go b/libgo/go/crypto/tls/ticket.go index 9560176259e..c873e43a70b 100644 --- a/libgo/go/crypto/tls/ticket.go +++ b/libgo/go/crypto/tls/ticket.go @@ -12,7 +12,7 @@ import ( "crypto/sha256" "crypto/subtle" "errors" - "internal/x/crypto/cryptobyte" + "golang.org/x/crypto/cryptobyte" "io" ) diff --git a/libgo/go/crypto/tls/tls.go b/libgo/go/crypto/tls/tls.go index 578035cf731..ba6d5eba15b 100644 --- a/libgo/go/crypto/tls/tls.go +++ b/libgo/go/crypto/tls/tls.go @@ -5,14 +5,9 @@ // Package tls partially implements TLS 1.2, as specified in RFC 5246, // and TLS 1.3, as specified in RFC 8446. // -// TLS 1.3 is available only on an opt-in basis in Go 1.12. To enable +// TLS 1.3 is available on an opt-out basis in Go 1.13. To disable // it, set the GODEBUG environment variable (comma-separated key=value -// options) such that it includes "tls13=1". To enable it from within -// the process, set the environment variable before any use of TLS: -// -// func init() { -// os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1") -// } +// options) such that it includes "tls13=0". package tls // BUG(agl): The crypto/tls package only implements some countermeasures @@ -21,8 +16,10 @@ package tls // https://www.imperialviolet.org/2013/02/04/luckythirteen.html. import ( + "bytes" "crypto" "crypto/ecdsa" + "crypto/ed25519" "crypto/rsa" "crypto/x509" "encoding/pem" @@ -276,6 +273,14 @@ func X509KeyPair(certPEMBlock, keyPEMBlock []byte) (Certificate, error) { if pub.X.Cmp(priv.X) != 0 || pub.Y.Cmp(priv.Y) != 0 { return fail(errors.New("tls: private key does not match public key")) } + case ed25519.PublicKey: + priv, ok := cert.PrivateKey.(ed25519.PrivateKey) + if !ok { + return fail(errors.New("tls: private key type does not match public key type")) + } + if !bytes.Equal(priv.Public().(ed25519.PublicKey), pub) { + return fail(errors.New("tls: private key does not match public key")) + } default: return fail(errors.New("tls: unknown public key algorithm")) } @@ -292,7 +297,7 @@ func parsePrivateKey(der []byte) (crypto.PrivateKey, error) { } if key, err := x509.ParsePKCS8PrivateKey(der); err == nil { switch key := key.(type) { - case *rsa.PrivateKey, *ecdsa.PrivateKey: + case *rsa.PrivateKey, *ecdsa.PrivateKey, ed25519.PrivateKey: return key, nil default: return nil, errors.New("tls: found unknown private key type in PKCS#8 wrapping") diff --git a/libgo/go/crypto/tls/tls_test.go b/libgo/go/crypto/tls/tls_test.go index 208c13c1953..a07727c92bf 100644 --- a/libgo/go/crypto/tls/tls_test.go +++ b/libgo/go/crypto/tls/tls_test.go @@ -23,17 +23,6 @@ import ( "time" ) -var savedSupportedSignatureAlgorithmsTLS12 = supportedSignatureAlgorithmsTLS12 - -func init() { - // TLS 1.3 is opt-in for Go 1.12, and RSA-PSS is disabled in TLS 1.2, but we - // want to run most tests with both enabled. TestTLS13Switch below and the - // "PSS-Disabled" recordings test the disabled behavior. See Issue 30055. - tls13Support.Do(func() {}) // defuse the sync.Once - tls13Support.cached = true - supportedSignatureAlgorithmsTLS12 = supportedSignatureAlgorithms -} - var rsaCertPEM = `-----BEGIN CERTIFICATE----- MIIB0zCCAX2gAwIBAgIJAI/M7BYjwB+uMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX @@ -48,7 +37,7 @@ r5QuVbpQhH6u+0UgcW0jp9QwpxoPTLTWGXEWBBBurxFwiCBhkQ+V -----END CERTIFICATE----- ` -var rsaKeyPEM = `-----BEGIN RSA PRIVATE KEY----- +var rsaKeyPEM = testingKey(`-----BEGIN RSA TESTING KEY----- MIIBOwIBAAJBANLJhPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wo k/4xIA+ui35/MmNartNuC+BdZ1tMuVCPFZcCAwEAAQJAEJ2N+zsR0Xn8/Q6twa4G 6OB1M1WO+k+ztnX/1SvNeWu8D6GImtupLTYgjZcHufykj09jiHmjHx8u8ZZB/o1N @@ -56,12 +45,12 @@ MQIhAPW+eyZo7ay3lMz1V01WVjNKK9QSn1MJlb06h/LuYv9FAiEA25WPedKgVyCW SmUwbPw8fnTcpqDWE3yTO3vKcebqMSsCIBF3UmVue8YU3jybC3NxuXq3wNm34R8T xVLHwDXh/6NJAiEAl2oHGGLz64BuAfjKrqwz7qMYr9HCLIe/YsoWq/olzScCIQDi D2lWusoe2/nEqfDVVWGWlyJ7yOmqaVm/iNUN9B2N2g== ------END RSA PRIVATE KEY----- -` +-----END RSA TESTING KEY----- +`) // keyPEM is the same as rsaKeyPEM, but declares itself as just // "PRIVATE KEY", not "RSA PRIVATE KEY". https://golang.org/issue/4477 -var keyPEM = `-----BEGIN PRIVATE KEY----- +var keyPEM = testingKey(`-----BEGIN TESTING KEY----- MIIBOwIBAAJBANLJhPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wo k/4xIA+ui35/MmNartNuC+BdZ1tMuVCPFZcCAwEAAQJAEJ2N+zsR0Xn8/Q6twa4G 6OB1M1WO+k+ztnX/1SvNeWu8D6GImtupLTYgjZcHufykj09jiHmjHx8u8ZZB/o1N @@ -69,8 +58,8 @@ MQIhAPW+eyZo7ay3lMz1V01WVjNKK9QSn1MJlb06h/LuYv9FAiEA25WPedKgVyCW SmUwbPw8fnTcpqDWE3yTO3vKcebqMSsCIBF3UmVue8YU3jybC3NxuXq3wNm34R8T xVLHwDXh/6NJAiEAl2oHGGLz64BuAfjKrqwz7qMYr9HCLIe/YsoWq/olzScCIQDi D2lWusoe2/nEqfDVVWGWlyJ7yOmqaVm/iNUN9B2N2g== ------END PRIVATE KEY----- -` +-----END TESTING KEY----- +`) var ecdsaCertPEM = `-----BEGIN CERTIFICATE----- MIIB/jCCAWICCQDscdUxw16XFDAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw @@ -87,17 +76,17 @@ H5jBImIxPL4WxQNiBTexAkF8D1EtpYuWdlVQ80/h/f4pBcGiXPqX5h2PQSQY7hP1 -----END CERTIFICATE----- ` -var ecdsaKeyPEM = `-----BEGIN EC PARAMETERS----- +var ecdsaKeyPEM = testingKey(`-----BEGIN EC PARAMETERS----- BgUrgQQAIw== -----END EC PARAMETERS----- ------BEGIN EC PRIVATE KEY----- +-----BEGIN EC TESTING KEY----- MIHcAgEBBEIBrsoKp0oqcv6/JovJJDoDVSGWdirrkgCWxrprGlzB9o0X8fV675X0 NwuBenXFfeZvVcwluO7/Q9wkYoPd/t3jGImgBwYFK4EEACOhgYkDgYYABAFj36bL 06h5JRGUNB1X/Hwuw64uKW2GGJLVPPhoYMcg/ALWaW+d/t+DmV5xikwKssuFq4Bz VQldyCXTXGgu7OC0AQCC/Y/+ODK3NFKlRi+AsG3VQDSV4tgHLqZBBus0S6pPcg1q kohxS/xfFg/TEwRSSws+roJr4JFKpO2t3/be5OdqmQ== ------END EC PRIVATE KEY----- -` +-----END EC TESTING KEY----- +`) var keyPairTests = []struct { algo string @@ -383,7 +372,9 @@ func testVerifyHostnameResumed(t *testing.T, version uint16) { ClientSessionCache: NewLRUClientSessionCache(32), } for i := 0; i < 2; i++ { - c, err := Dial("tcp", "mail.google.com:https", config) + c, err := DialWithDialer(&net.Dialer{ + Timeout: 10 * time.Second, + }, "tcp", "mail.google.com:https", config) if err != nil { t.Fatalf("Dial #%d: %v", i, err) } @@ -400,12 +391,13 @@ func testVerifyHostnameResumed(t *testing.T, version uint16) { if err := c.VerifyHostname("mail.google.com"); err != nil { t.Fatalf("verify mail.google.com #%d: %v", i, err) } - // Give the client a chance to read the server session tickets. - c.SetReadDeadline(time.Now().Add(500 * time.Millisecond)) + // Have the server send some data so session tickets are delivered. + c.SetDeadline(time.Now().Add(5 * time.Second)) + if _, err := io.WriteString(c, "HEAD / HTTP/1.0\n\n"); err != nil { + t.Fatal(err) + } if _, err := c.Read(make([]byte, 1)); err != nil { - if err, ok := err.(net.Error); !ok || !err.Timeout() { - t.Fatal(err) - } + t.Fatal(err) } c.Close() } @@ -1150,3 +1142,5 @@ func TestBuildNameToCertificate_doesntModifyCertificates(t *testing.T) { t.Fatalf("Certificates were mutated by BuildNameToCertificate\nGot: %#v\nWant: %#v\n", got, want) } } + +func testingKey(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") } diff --git a/libgo/go/crypto/x509/name_constraints_test.go b/libgo/go/crypto/x509/name_constraints_test.go index 4c9bc1b87a6..2020e37a5b1 100644 --- a/libgo/go/crypto/x509/name_constraints_test.go +++ b/libgo/go/crypto/x509/name_constraints_test.go @@ -63,10 +63,8 @@ type leafSpec struct { var nameConstraintsTests = []nameConstraintsTest{ // #0: dummy test for the certificate generation process itself. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), leaf: leafSpec{ sans: []string{"dns:example.com"}, }, @@ -74,13 +72,11 @@ var nameConstraintsTests = []nameConstraintsTest{ // #1: dummy test for the certificate generation process itself: single // level of intermediate. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -90,16 +86,14 @@ var nameConstraintsTests = []nameConstraintsTest{ // #2: dummy test for the certificate generation process itself: two // levels of intermediates. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -108,15 +102,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #3: matching DNS constraint in root - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -125,13 +119,11 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #4: matching DNS constraint in intermediate. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ok: []string{"dns:example.com"}, }, }, @@ -142,15 +134,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #5: .example.com only matches subdomains. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -160,13 +152,11 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #6: .example.com matches subdomains. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ok: []string{"dns:.example.com"}, }, }, @@ -177,15 +167,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #7: .example.com matches multiple levels of subdomains - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -195,15 +185,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #8: specifying a permitted list of names does not exclude other name // types - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -213,15 +203,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #9: specifying a permitted list of names does not exclude other name // types - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"ip:10.0.0.0/8"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -232,15 +222,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #10: intermediates can try to permit other names, which isn't // forbidden if the leaf doesn't mention them. I.e. name constraints // apply to names, not constraints themselves. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ok: []string{"dns:example.com", "dns:foo.com"}, }, }, @@ -252,15 +242,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #11: intermediates cannot add permitted names that the root doesn't // grant them. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ok: []string{"dns:example.com", "dns:foo.com"}, }, }, @@ -272,15 +262,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #12: intermediates can further limit their scope if they wish. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ok: []string{"dns:.bar.example.com"}, }, }, @@ -292,15 +282,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #13: intermediates can further limit their scope and that limitation // is effective - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ok: []string{"dns:.bar.example.com"}, }, }, @@ -312,15 +302,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #14: roots can exclude subtrees and that doesn't affect other names. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"dns:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -329,15 +319,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #15: roots exclusions are effective. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"dns:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -348,13 +338,11 @@ var nameConstraintsTests = []nameConstraintsTest{ // #16: intermediates can also exclude names and that doesn't affect // other names. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { bad: []string{"dns:.example.com"}, }, }, @@ -365,13 +353,11 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #17: intermediate exclusions are effective. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { bad: []string{"dns:.example.com"}, }, }, @@ -383,15 +369,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #18: having an exclusion doesn't prohibit other types of names. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"dns:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -401,15 +387,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #19: IP-based exclusions are permitted and don't affect unrelated IP // addresses. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"ip:10.0.0.0/8"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -418,15 +404,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #20: IP-based exclusions are effective - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"ip:10.0.0.0/8"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -436,15 +422,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #21: intermediates can further constrain IP ranges. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"ip:0.0.0.0/1"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { bad: []string{"ip:11.0.0.0/8"}, }, }, @@ -457,16 +443,14 @@ var nameConstraintsTests = []nameConstraintsTest{ // #22: when multiple intermediates are present, chain building can // avoid intermediates with incompatible constraints. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ok: []string{"dns:.foo.com"}, }, - constraintsSpec{ + { ok: []string{"dns:.example.com"}, }, }, @@ -479,16 +463,14 @@ var nameConstraintsTests = []nameConstraintsTest{ // #23: (same as the previous test, but in the other order in ensure // that we don't pass it by luck.) - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ok: []string{"dns:.example.com"}, }, - constraintsSpec{ + { ok: []string{"dns:.foo.com"}, }, }, @@ -501,16 +483,16 @@ var nameConstraintsTests = []nameConstraintsTest{ // #24: when multiple roots are valid, chain building can avoid roots // with incompatible constraints. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{}, - constraintsSpec{ + {}, + { ok: []string{"dns:foo.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -521,16 +503,16 @@ var nameConstraintsTests = []nameConstraintsTest{ // #25: (same as the previous test, but in the other order in ensure // that we don't pass it by luck.) - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:foo.com"}, }, - constraintsSpec{}, + {}, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -541,26 +523,26 @@ var nameConstraintsTests = []nameConstraintsTest{ // #26: chain building can find a valid path even with multiple levels // of alternative intermediates and alternative roots. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:foo.com"}, }, - constraintsSpec{ + { ok: []string{"dns:example.com"}, }, - constraintsSpec{}, + {}, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, - constraintsSpec{ + { + {}, + { ok: []string{"dns:foo.com"}, }, }, - []constraintsSpec{ - constraintsSpec{}, - constraintsSpec{ + { + {}, + { ok: []string{"dns:foo.com"}, }, }, @@ -572,27 +554,27 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #27: chain building doesn't get stuck when there is no valid path. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:foo.com"}, }, - constraintsSpec{ + { ok: []string{"dns:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, - constraintsSpec{ + { + {}, + { ok: []string{"dns:foo.com"}, }, }, - []constraintsSpec{ - constraintsSpec{ + { + { ok: []string{"dns:bar.com"}, }, - constraintsSpec{ + { ok: []string{"dns:foo.com"}, }, }, @@ -604,13 +586,11 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #28: unknown name types don't cause a problem without constraints. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -619,15 +599,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #29: unknown name types are allowed even in constrained chains. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:foo.com", "dns:.foo.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -636,15 +616,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #30: without SANs, a certificate with a CN is rejected in a constrained chain. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:foo.com", "dns:.foo.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -656,15 +636,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #31: IPv6 addresses work in constraints: roots can permit them as // expected. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"ip:2000:abcd::/32"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -674,15 +654,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #32: IPv6 addresses work in constraints: root restrictions are // effective. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"ip:2000:abcd::/32"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -692,15 +672,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #33: An IPv6 permitted subtree doesn't affect DNS names. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"ip:2000:abcd::/32"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -709,15 +689,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #34: IPv6 exclusions don't affect unrelated addresses. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"ip:2000:abcd::/32"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -726,15 +706,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #35: IPv6 exclusions are effective. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"ip:2000:abcd::/32"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -744,15 +724,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #36: IPv6 constraints do not permit IPv4 addresses. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"ip:2000:abcd::/32"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -762,15 +742,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #37: IPv4 constraints do not permit IPv6 addresses. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"ip:10.0.0.0/8"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -780,15 +760,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #38: an exclusion of an unknown type doesn't affect other names. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"unknown:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -798,15 +778,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #39: a permitted subtree of an unknown type doesn't affect other // name types. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"unknown:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -815,15 +795,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #40: exact email constraints work - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:foo@example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -832,15 +812,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #41: exact email constraints are effective - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:foo@example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -850,15 +830,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #42: email canonicalisation works. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:foo@example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -868,15 +848,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #43: limiting email addresses to a host works. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -885,15 +865,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #44: a leading dot matches hosts one level deep - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -902,15 +882,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #45: a leading dot does not match the host itself - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -920,15 +900,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #46: a leading dot also matches two (or more) levels deep. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:.example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -937,15 +917,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #47: the local part of an email is case-sensitive - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:foo@example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -955,15 +935,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #48: the domain part of an email is not case-sensitive - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:foo@EXAMPLE.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -972,15 +952,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #49: the domain part of a DNS constraint is also not case-sensitive. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:EXAMPLE.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -989,15 +969,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #50: URI constraints only cover the host part of the URI - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"uri:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1010,15 +990,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #51: URIs with IPs are rejected - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"uri:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1028,15 +1008,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #52: URIs with IPs and ports are rejected - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"uri:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1046,15 +1026,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #53: URIs with IPv6 addresses are also rejected - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"uri:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1064,15 +1044,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #54: URIs with IPv6 addresses with ports are also rejected - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"uri:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1082,15 +1062,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #55: URI constraints are effective - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"uri:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1100,15 +1080,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #56: URI constraints are effective - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"uri:foo.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1118,15 +1098,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #57: URI constraints can allow subdomains - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"uri:.foo.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1136,15 +1116,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #58: excluding an IPv4-mapped-IPv6 address doesn't affect the IPv4 // version of that address. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"ip:::ffff:1.2.3.4/128"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1153,15 +1133,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #59: a URI constraint isn't matched by a URN. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"uri:example.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1172,16 +1152,16 @@ var nameConstraintsTests = []nameConstraintsTest{ // #60: excluding all IPv6 addresses doesn't exclude all IPv4 addresses // too, even though IPv4 is mapped into the IPv6 range. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"ip:1.2.3.0/24"}, bad: []string{"ip:::0/0"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1191,13 +1171,11 @@ var nameConstraintsTests = []nameConstraintsTest{ // #61: omitting extended key usage in a CA certificate implies that // any usage is ok. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1207,13 +1185,11 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #62: The “any” EKU also means that any usage is ok. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ekus: []string{"any"}, }, }, @@ -1227,13 +1203,11 @@ var nameConstraintsTests = []nameConstraintsTest{ // #63: An intermediate with enumerated EKUs causes a failure if we // test for an EKU not in that set. (ServerAuth is required by // default.) - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ekus: []string{"email"}, }, }, @@ -1247,13 +1221,11 @@ var nameConstraintsTests = []nameConstraintsTest{ // #64: an unknown EKU in the leaf doesn't break anything, even if it's not // correctly nested. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ekus: []string{"email"}, }, }, @@ -1268,15 +1240,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #65: trying to add extra permitted key usages in an intermediate // (after a limitation in the root) is acceptable so long as the leaf // certificate doesn't use them. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ekus: []string{"serverAuth"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ekus: []string{"serverAuth", "email"}, }, }, @@ -1288,15 +1260,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #66: EKUs in roots are not ignored. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ekus: []string{"email"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ekus: []string{"serverAuth"}, }, }, @@ -1310,13 +1282,13 @@ var nameConstraintsTests = []nameConstraintsTest{ // #67: in order to support COMODO chains, SGC key usages permit // serverAuth and clientAuth. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{}, + {}, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ekus: []string{"netscapeSGC"}, }, }, @@ -1329,13 +1301,11 @@ var nameConstraintsTests = []nameConstraintsTest{ // #68: in order to support COMODO chains, SGC key usages permit // serverAuth and clientAuth. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ekus: []string{"msSGC"}, }, }, @@ -1347,15 +1317,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #69: an empty DNS constraint should allow anything. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1364,15 +1334,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #70: an empty DNS constraint should also reject everything. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"dns:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1382,15 +1352,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #71: an empty email constraint should allow anything - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"email:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1399,15 +1369,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #72: an empty email constraint should also reject everything. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"email:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1417,15 +1387,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #73: an empty URI constraint should allow anything - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"uri:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1434,15 +1404,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #74: an empty URI constraint should also reject everything. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"uri:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1453,13 +1423,11 @@ var nameConstraintsTests = []nameConstraintsTest{ // #75: serverAuth in a leaf shouldn't permit clientAuth when requested in // VerifyOptions. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1471,13 +1439,11 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #76: However, MSSGC in a leaf should match a request for serverAuth. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1493,13 +1459,11 @@ var nameConstraintsTests = []nameConstraintsTest{ // #77: an invalid DNS or mail SAN will not be detected if name constaint // checking is not triggered. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1509,15 +1473,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #78: an invalid DNS SAN will be detected if any name constraint checking // is triggered. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"uri:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1528,15 +1492,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #79: an invalid email SAN will be detected if any name constraint // checking is triggered. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { bad: []string{"uri:"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1546,13 +1510,11 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #80: if several EKUs are requested, satisfying any of them is sufficient. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1564,13 +1526,11 @@ var nameConstraintsTests = []nameConstraintsTest{ // #81: EKUs that are not asserted in VerifyOpts are not required to be // nested. - nameConstraintsTest{ - roots: []constraintsSpec{ - constraintsSpec{}, - }, + { + roots: make([]constraintsSpec, 1), intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{ + { + { ekus: []string{"serverAuth"}, }, }, @@ -1584,15 +1544,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #82: a certificate without SANs and CN is accepted in a constrained chain. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:foo.com", "dns:.foo.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1602,15 +1562,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #83: a certificate without SANs and with a CN that does not parse as a // hostname is accepted in a constrained chain. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:foo.com", "dns:.foo.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1620,15 +1580,15 @@ var nameConstraintsTests = []nameConstraintsTest{ }, // #84: a certificate with SANs and CN is accepted in a constrained chain. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:foo.com", "dns:.foo.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -1639,15 +1599,15 @@ var nameConstraintsTests = []nameConstraintsTest{ // #85: without SANs, a certificate with a valid CN is accepted in a // constrained chain if x509ignoreCN is set. - nameConstraintsTest{ + { roots: []constraintsSpec{ - constraintsSpec{ + { ok: []string{"dns:foo.com", "dns:.foo.com"}, }, }, intermediates: [][]constraintsSpec{ - []constraintsSpec{ - constraintsSpec{}, + { + {}, }, }, leaf: leafSpec{ @@ -2220,10 +2180,8 @@ func TestBadNamesInSANs(t *testing.T) { continue } - if err != nil { - if str := err.Error(); !strings.Contains(str, "cannot parse ") { - t.Errorf("bad name %q triggered unrecognised error: %s", badName, str) - } + if str := err.Error(); !strings.Contains(str, "cannot parse ") { + t.Errorf("bad name %q triggered unrecognised error: %s", badName, str) } } } diff --git a/libgo/go/crypto/x509/pem_decrypt_test.go b/libgo/go/crypto/x509/pem_decrypt_test.go index 685d5ee1569..dacef8b8617 100644 --- a/libgo/go/crypto/x509/pem_decrypt_test.go +++ b/libgo/go/crypto/x509/pem_decrypt_test.go @@ -80,8 +80,8 @@ var testData = []struct { { kind: PEMCipherDES, password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-CBC,34F09A4FC8DE22B5 @@ -92,7 +92,7 @@ qtHb1kirfGKEtgWTF+ynyco6+2gMXNu70L7nJcnxnV/RLFkHt7AUU1yrclxz7eZz XOH9VfTjb52q/I8Suozq9coVQwg4tXfIoYUdT//O+mB7zJb9HI9Ps77b9TxDE6Gm 4C9brwZ3zg2vqXcwwV6QRZMtyll9rOpxkbw6NPlpfBqkc3xS51bbxivbO/Nve4KD r12ymjFNF4stXCfJnNqKoZ50BHmEEUDu5Wb0fpVn82XrGw7CYc4iug== ------END RSA PRIVATE KEY-----`), +-----END RSA TESTING KEY-----`)), plainDER: ` MIIBPAIBAAJBAPASZe+tCPU6p80AjHhDkVsLYa51D35e/YGa8QcZyooeZM8EHozo KD0fNiKI+53bHdy07N+81VQ8/ejPcRoXPlsCAwEAAQJBAMTxIuSq27VpR+zZ7WJf @@ -105,8 +105,8 @@ glcRgT6QCEtz2wIhANSyqaFtosIkHKqrDUGfz/bb5tqMYTAnBruVPaf/WEOBAiEA { kind: PEMCipher3DES, password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,C1F4A6A03682C2C7 @@ -117,7 +117,7 @@ Fgx5f84nT+/ovvreG+xeOzWgvtKo0UUZVrhGOgfKLpa57adumcJ6SkUuBtEFpZFB ldw5w7WC7d13x2LsRkwo8ZrDKgIV+Y9GNvhuCCkTzNP0V3gNeJpd201HZHR+9n3w 3z0VjR/MGqsfcy1ziEWMNOO53At3zlG6zP05aHMnMcZoVXadEK6L1gz++inSSDCq gI0UJP4e3JVB7AkgYymYAwiYALAkoEIuanxoc50njJk= ------END RSA PRIVATE KEY-----`), +-----END RSA TESTING KEY-----`)), plainDER: ` MIIBOwIBAAJBANOCXKdoNS/iP/MAbl9cf1/SF3P+Ns7ZeNL27CfmDh0O6Zduaax5 NBiumd2PmjkaCu7lQ5JOibHfWn+xJsc3kw0CAwEAAQJANX/W8d1Q/sCqzkuAn4xl @@ -130,8 +130,8 @@ tZZZxCtPAm7shftEib0VU77Lk8MsXJcx2C4voRsjEw==`, { kind: PEMCipherAES128, password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-128-CBC,D4492E793FC835CC038A728ED174F78A @@ -142,7 +142,7 @@ GZbBpf1jDH/pr0iGonuAdl2PCCZUiy+8eLsD2tyviHUkFLOB+ykYoJ5t8ngZ/B6D 3NbvRVvYTgs8K9EPk4K+5R+P2kD8J8KvEIGxVa1vz8QoCJ/jr7Ka2rvNgPCex5/E 080LzLHPCrXKdlr/f50yhNWq08ZxMWQFkui+FDHPDUaEELKAXV8/5PDxw80Rtybo AVYoCVIbZXZCuCO81op8UcOgEpTtyU5Lgh3Mw5scQL0= ------END RSA PRIVATE KEY-----`), +-----END RSA TESTING KEY-----`)), plainDER: ` MIIBOgIBAAJBAMBlj5FxYtqbcy8wY89d/S7n0+r5MzD9F63BA/Lpl78vQKtdJ5dT cDGh/rBt1ufRrNp0WihcmZi7Mpl/3jHjiWECAwEAAQJABNOHYnKhtDIqFYj1OAJ3 @@ -155,8 +155,8 @@ B3WlRNTXR2WsJ5JdByezg9xzdXzULqmga0OE339a`, { kind: PEMCipherAES192, password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-192-CBC,E2C9FB02BCA23ADE1829F8D8BC5F5369 @@ -167,7 +167,7 @@ Rb7tshNTMqHbCpyo9Rn3UxeFIf9efdl8YLiMoIqc7J8E5e9VlbeQSdLMQOgDAQJG ReUtTw8exmKsY4gsSjhkg5uiw7/ZB1Ihto0qnfQJgjGc680qGkT1d6JfvOfeYAk6 xn5RqS/h8rYAYm64KnepfC9vIujo4NqpaREDmaLdX5MJPQ+SlytITQvgUsUq3q/t Ss85xjQEZH3hzwjQqdJvmA4hYP6SUjxYpBM+02xZ1Xw= ------END RSA PRIVATE KEY-----`), +-----END RSA TESTING KEY-----`)), plainDER: ` MIIBOwIBAAJBAMGcRrZiNNmtF20zyS6MQ7pdGx17aFDl+lTl+qnLuJRUCMUG05xs OmxmL/O1Qlf+bnqR8Bgg65SfKg21SYuLhiMCAwEAAQJBAL94uuHyO4wux2VC+qpj @@ -180,8 +180,8 @@ uZ3pWbaXf5PNuQIgAcdXarvhelH2w2piY1g3BPeFqhzBSCK/yLGxR82KIh8CIQDD { kind: PEMCipherAES256, password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-256-CBC,8E7ED5CD731902CE938957A886A5FFBD @@ -192,7 +192,7 @@ Pz3RZScwIuubzTGJ1x8EzdffYOsdCa9Mtgpp3L136+23dOd6L/qK2EG2fzrJSHs/ 2XugkleBFSMKzEp9mxXKRfa++uidQvMZTFLDK9w5YjrRvMBo/l2BoZIsq0jAIE1N sv5Z/KwlX+3MDEpPQpUwGPlGGdLnjI3UZ+cjgqBcoMiNc6HfgbBgYJSU6aDSHuCk clCwByxWkBNgJ2GrkwNrF26v+bGJJJNR4SKouY1jQf0= ------END RSA PRIVATE KEY-----`), +-----END RSA TESTING KEY-----`)), plainDER: ` MIIBOgIBAAJBAKy3GFkstoCHIEeUU/qO8207m8WSrjksR+p9B4tf1w5k+2O1V/GY AQ5WFCApItcOkQe/I0yZZJk/PmCqMzSxrc8CAwEAAQJAOCAz0F7AW9oNelVQSP8F @@ -207,15 +207,15 @@ PXHYtPqxQIbD2pScR5qum7iGUh11lEUPkmt+2uqS`, // openssl genrsa -aes128 -passout pass:asdf -out server.orig.key 128 kind: PEMCipherAES128, password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-128-CBC,74611ABC2571AF11B1BF9B69E62C89E7 6ei/MlytjE0FFgZOGQ+jrwomKfpl8kdefeE0NSt/DMRrw8OacHAzBNi3pPEa0eX3 eND9l7C9meCirWovjj9QWVHrXyugFuDIqgdhQ8iHTgCfF3lrmcttVrbIfMDw+smD hTP8O1mS/MHl92NE0nhv0w== ------END RSA PRIVATE KEY-----`), +-----END RSA TESTING KEY-----`)), plainDER: ` MGMCAQACEQC6ssxmYuauuHGOCDAI54RdAgMBAAECEQCWIn6Yv2O+kBcDF7STctKB AgkA8SEfu/2i3g0CCQDGNlXbBHX7kQIIK3Ww5o0cYbECCQDCimPb0dYGsQIIeQ7A @@ -223,14 +223,14 @@ jryIst8=`, }, } -const incompleteBlockPEM = ` ------BEGIN RSA PRIVATE KEY----- +var incompleteBlockPEM = testingKey(` +-----BEGIN RSA TESTING KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-128-CBC,74611ABC2571AF11B1BF9B69E62C89E7 6L8yXK2MTQUWBk4ZD6OvCiYp+mXyR1594TQ1K38MxGvDw5pwcDME2Lek8RrR5fd40P2XsL2Z4KKt ai+OP1BZUetfK6AW4MiqB2FDyIdOAJ8XeWuZy21Wtsh8wPD6yYOFM/w7WZL8weX3Y0TSeG/T ------END RSA PRIVATE KEY-----` +-----END RSA TESTING KEY-----`) func TestIncompleteBlock(t *testing.T) { // incompleteBlockPEM contains ciphertext that is not a multiple of the @@ -245,3 +245,5 @@ func TestIncompleteBlock(t *testing.T) { t.Fatalf("Expected error containing %q but got: %q", expectedSubstr, e) } } + +func testingKey(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") } diff --git a/libgo/go/crypto/x509/pkcs1.go b/libgo/go/crypto/x509/pkcs1.go index 82502cfe581..a48c6f9d64e 100644 --- a/libgo/go/crypto/x509/pkcs1.go +++ b/libgo/go/crypto/x509/pkcs1.go @@ -41,7 +41,9 @@ type pkcs1PublicKey struct { E int } -// ParsePKCS1PrivateKey returns an RSA private key from its ASN.1 PKCS#1 DER encoded form. +// ParsePKCS1PrivateKey parses an RSA private key in PKCS#1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "RSA PRIVATE KEY". func ParsePKCS1PrivateKey(der []byte) (*rsa.PrivateKey, error) { var priv pkcs1PrivateKey rest, err := asn1.Unmarshal(der, &priv) @@ -49,6 +51,12 @@ func ParsePKCS1PrivateKey(der []byte) (*rsa.PrivateKey, error) { return nil, asn1.SyntaxError{Msg: "trailing data"} } if err != nil { + if _, err := asn1.Unmarshal(der, &ecPrivateKey{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParseECPrivateKey instead for this key format)") + } + if _, err := asn1.Unmarshal(der, &pkcs8{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParsePKCS8PrivateKey instead for this key format)") + } return nil, err } @@ -88,7 +96,11 @@ func ParsePKCS1PrivateKey(der []byte) (*rsa.PrivateKey, error) { return key, nil } -// MarshalPKCS1PrivateKey converts a private key to ASN.1 DER encoded form. +// MarshalPKCS1PrivateKey converts an RSA private key to PKCS#1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "RSA PRIVATE KEY". +// For a more flexible key format which is not RSA specific, use +// MarshalPKCS8PrivateKey. func MarshalPKCS1PrivateKey(key *rsa.PrivateKey) []byte { key.Precompute() @@ -120,11 +132,16 @@ func MarshalPKCS1PrivateKey(key *rsa.PrivateKey) []byte { return b } -// ParsePKCS1PublicKey parses a PKCS#1 public key in ASN.1 DER form. +// ParsePKCS1PublicKey parses an RSA public key in PKCS#1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "RSA PUBLIC KEY". func ParsePKCS1PublicKey(der []byte) (*rsa.PublicKey, error) { var pub pkcs1PublicKey rest, err := asn1.Unmarshal(der, &pub) if err != nil { + if _, err := asn1.Unmarshal(der, &publicKeyInfo{}); err == nil { + return nil, errors.New("x509: failed to parse public key (use ParsePKIXPublicKey instead for this key format)") + } return nil, err } if len(rest) > 0 { @@ -145,6 +162,8 @@ func ParsePKCS1PublicKey(der []byte) (*rsa.PublicKey, error) { } // MarshalPKCS1PublicKey converts an RSA public key to PKCS#1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "RSA PUBLIC KEY". func MarshalPKCS1PublicKey(key *rsa.PublicKey) []byte { derBytes, _ := asn1.Marshal(pkcs1PublicKey{ N: key.N, diff --git a/libgo/go/crypto/x509/pkcs8.go b/libgo/go/crypto/x509/pkcs8.go index fb1340c6df7..d37fc9e1b3f 100644 --- a/libgo/go/crypto/x509/pkcs8.go +++ b/libgo/go/crypto/x509/pkcs8.go @@ -6,6 +6,7 @@ package x509 import ( "crypto/ecdsa" + "crypto/ed25519" "crypto/rsa" "crypto/x509/pkix" "encoding/asn1" @@ -23,11 +24,21 @@ type pkcs8 struct { // optional attributes omitted. } -// ParsePKCS8PrivateKey parses an unencrypted, PKCS#8 private key. -// See RFC 5208. +// ParsePKCS8PrivateKey parses an unencrypted private key in PKCS#8, ASN.1 DER form. +// +// It returns a *rsa.PrivateKey, a *ecdsa.PrivateKey, or a ed25519.PrivateKey. +// More types might be supported in the future. +// +// This kind of key is commonly encoded in PEM blocks of type "PRIVATE KEY". func ParsePKCS8PrivateKey(der []byte) (key interface{}, err error) { var privKey pkcs8 if _, err := asn1.Unmarshal(der, &privKey); err != nil { + if _, err := asn1.Unmarshal(der, &ecPrivateKey{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParseECPrivateKey instead for this key format)") + } + if _, err := asn1.Unmarshal(der, &pkcs1PrivateKey{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParsePKCS1PrivateKey instead for this key format)") + } return nil, err } switch { @@ -50,16 +61,30 @@ func ParsePKCS8PrivateKey(der []byte) (key interface{}, err error) { } return key, nil + case privKey.Algo.Algorithm.Equal(oidPublicKeyEd25519): + if l := len(privKey.Algo.Parameters.FullBytes); l != 0 { + return nil, errors.New("x509: invalid Ed25519 private key parameters") + } + var curvePrivateKey []byte + if _, err := asn1.Unmarshal(privKey.PrivateKey, &curvePrivateKey); err != nil { + return nil, fmt.Errorf("x509: invalid Ed25519 private key: %v", err) + } + if l := len(curvePrivateKey); l != ed25519.SeedSize { + return nil, fmt.Errorf("x509: invalid Ed25519 private key length: %d", l) + } + return ed25519.NewKeyFromSeed(curvePrivateKey), nil + default: return nil, fmt.Errorf("x509: PKCS#8 wrapping contained private key with unknown algorithm: %v", privKey.Algo.Algorithm) } } -// MarshalPKCS8PrivateKey converts a private key to PKCS#8 encoded form. -// The following key types are supported: *rsa.PrivateKey, *ecdsa.PrivateKey. -// Unsupported key types result in an error. +// MarshalPKCS8PrivateKey converts an RSA private key to PKCS#8, ASN.1 DER form. +// +// The following key types are currently supported: *rsa.PrivateKey, *ecdsa.PrivateKey +// and ed25519.PrivateKey. Unsupported key types result in an error. // -// See RFC 5208. +// This kind of key is commonly encoded in PEM blocks of type "PRIVATE KEY". func MarshalPKCS8PrivateKey(key interface{}) ([]byte, error) { var privKey pkcs8 @@ -74,7 +99,7 @@ func MarshalPKCS8PrivateKey(key interface{}) ([]byte, error) { case *ecdsa.PrivateKey: oid, ok := oidFromNamedCurve(k.Curve) if !ok { - return nil, errors.New("x509: unknown curve while marshalling to PKCS#8") + return nil, errors.New("x509: unknown curve while marshaling to PKCS#8") } oidBytes, err := asn1.Marshal(oid) @@ -93,8 +118,18 @@ func MarshalPKCS8PrivateKey(key interface{}) ([]byte, error) { return nil, errors.New("x509: failed to marshal EC private key while building PKCS#8: " + err.Error()) } + case ed25519.PrivateKey: + privKey.Algo = pkix.AlgorithmIdentifier{ + Algorithm: oidPublicKeyEd25519, + } + curvePrivateKey, err := asn1.Marshal(k.Seed()) + if err != nil { + return nil, fmt.Errorf("x509: failed to marshal private key: %v", err) + } + privKey.PrivateKey = curvePrivateKey + default: - return nil, fmt.Errorf("x509: unknown key type while marshalling PKCS#8: %T", key) + return nil, fmt.Errorf("x509: unknown key type while marshaling PKCS#8: %T", key) } return asn1.Marshal(privKey) diff --git a/libgo/go/crypto/x509/pkcs8_test.go b/libgo/go/crypto/x509/pkcs8_test.go index c8f11e64d12..cb7ee4c1627 100644 --- a/libgo/go/crypto/x509/pkcs8_test.go +++ b/libgo/go/crypto/x509/pkcs8_test.go @@ -7,10 +7,12 @@ package x509 import ( "bytes" "crypto/ecdsa" + "crypto/ed25519" "crypto/elliptic" "crypto/rsa" "encoding/hex" "reflect" + "strings" "testing" ) @@ -39,6 +41,9 @@ var pkcs8P384PrivateKeyHex = `3081b6020100301006072a8648ce3d020106052b8104002204 // expected and the Go test will fail to recreate it exactly. var pkcs8P521PrivateKeyHex = `3081ee020100301006072a8648ce3d020106052b810400230481d63081d3020101044200cfe0b87113a205cf291bb9a8cd1a74ac6c7b2ebb8199aaa9a5010d8b8012276fa3c22ac913369fa61beec2a3b8b4516bc049bde4fb3b745ac11b56ab23ac52e361a1818903818600040138f75acdd03fbafa4f047a8e4b272ba9d555c667962b76f6f232911a5786a0964e5edea6bd21a6f8725720958de049c6e3e6661c1c91b227cebee916c0319ed6ca003db0a3206d372229baf9dd25d868bf81140a518114803ce40c1855074d68c4e9dab9e65efba7064c703b400f1767f217dac82715ac1f6d88c74baf47a7971de4ea` +// From RFC 8410, Section 7. +var pkcs8Ed25519PrivateKeyHex = `302e020100300506032b657004220420d4ee72dbf913584ad5b6d8f1f769f8ad3afe7c28cbf1d4fbe097a88f44755842` + func TestPKCS8(t *testing.T) { tests := []struct { name string @@ -75,6 +80,11 @@ func TestPKCS8(t *testing.T) { keyType: reflect.TypeOf(&ecdsa.PrivateKey{}), curve: elliptic.P521(), }, + { + name: "Ed25519 private key", + keyHex: pkcs8Ed25519PrivateKeyHex, + keyType: reflect.TypeOf(ed25519.PrivateKey{}), + }, } for _, test := range tests { @@ -102,8 +112,29 @@ func TestPKCS8(t *testing.T) { continue } if !bytes.Equal(derBytes, reserialised) { - t.Errorf("%s: marshalled PKCS#8 didn't match original: got %x, want %x", test.name, reserialised, derBytes) + t.Errorf("%s: marshaled PKCS#8 didn't match original: got %x, want %x", test.name, reserialised, derBytes) continue } } } + +const hexPKCS8TestPKCS1Key = "3082025c02010002818100b1a1e0945b9289c4d3f1329f8a982c4a2dcd59bfd372fb8085a9c517554607ebd2f7990eef216ac9f4605f71a03b04f42a5255b158cf8e0844191f5119348baa44c35056e20609bcf9510f30ead4b481c81d7865fb27b8e0090e112b717f3ee08cdfc4012da1f1f7cf2a1bc34c73a54a12b06372d09714742dd7895eadde4aa5020301000102818062b7fa1db93e993e40237de4d89b7591cc1ea1d04fed4904c643f17ae4334557b4295270d0491c161cb02a9af557978b32b20b59c267a721c4e6c956c2d147046e9ae5f2da36db0106d70021fa9343455f8f973a4b355a26fd19e6b39dee0405ea2b32deddf0f4817759ef705d02b34faab9ca93c6766e9f722290f119f34449024100d9c29a4a013a90e35fd1be14a3f747c589fac613a695282d61812a711906b8a0876c6181f0333ca1066596f57bff47e7cfcabf19c0fc69d9cd76df743038b3cb024100d0d3546fecf879b5551f2bd2c05e6385f2718a08a6face3d2aecc9d7e03645a480a46c81662c12ad6bd6901e3bd4f38029462de7290859567cdf371c79088d4f024100c254150657e460ea58573fcf01a82a4791e3d6223135c8bdfed69afe84fbe7857274f8eb5165180507455f9b4105c6b08b51fe8a481bb986a202245576b713530240045700003b7a867d0041df9547ae2e7f50248febd21c9040b12dae9c2feab0d3d4609668b208e4727a3541557f84d372ac68eaf74ce1018a4c9a0ef92682c8fd02405769731480bb3a4570abf422527c5f34bf732fa6c1e08cc322753c511ce055fac20fc770025663ad3165324314df907f1f1942f0448a7e9cdbf87ecd98b92156" +const hexPKCS8TestECKey = "3081a40201010430bdb9839c08ee793d1157886a7a758a3c8b2a17a4df48f17ace57c72c56b4723cf21dcda21d4e1ad57ff034f19fcfd98ea00706052b81040022a16403620004feea808b5ee2429cfcce13c32160e1c960990bd050bb0fdf7222f3decd0a55008e32a6aa3c9062051c4cba92a7a3b178b24567412d43cdd2f882fa5addddd726fe3e208d2c26d733a773a597abb749714df7256ead5105fa6e7b3650de236b50" + +var pkcs8MismatchKeyTests = []struct { + hexKey string + errorContains string +}{ + {hexKey: hexPKCS8TestECKey, errorContains: "use ParseECPrivateKey instead"}, + {hexKey: hexPKCS8TestPKCS1Key, errorContains: "use ParsePKCS1PrivateKey instead"}, +} + +func TestPKCS8MismatchKeyFormat(t *testing.T) { + for i, test := range pkcs8MismatchKeyTests { + derBytes, _ := hex.DecodeString(test.hexKey) + _, err := ParsePKCS8PrivateKey(derBytes) + if !strings.Contains(err.Error(), test.errorContains) { + t.Errorf("#%d: expected error containing %q, got %s", i, test.errorContains, err) + } + } +} diff --git a/libgo/go/crypto/x509/root_cgo_darwin.go b/libgo/go/crypto/x509/root_cgo_darwin.go index e6332072d62..255a8d3525e 100644 --- a/libgo/go/crypto/x509/root_cgo_darwin.go +++ b/libgo/go/crypto/x509/root_cgo_darwin.go @@ -16,7 +16,7 @@ package x509 #include #include -static bool isSSLPolicy(SecPolicyRef policyRef) { +static Boolean isSSLPolicy(SecPolicyRef policyRef) { if (!policyRef) { return false; } @@ -24,13 +24,13 @@ static bool isSSLPolicy(SecPolicyRef policyRef) { if (properties == NULL) { return false; } + Boolean isSSL = false; CFTypeRef value = NULL; if (CFDictionaryGetValueIfPresent(properties, kSecPolicyOid, (const void **)&value)) { - CFRelease(properties); - return CFEqual(value, kSecPolicyAppleSSL); + isSSL = CFEqual(value, kSecPolicyAppleSSL); } CFRelease(properties); - return false; + return isSSL; } // sslTrustSettingsResult obtains the final kSecTrustSettingsResult value @@ -51,6 +51,7 @@ static SInt32 sslTrustSettingsResult(SecCertificateRef cert) { } // > no trust settings [...] means "this certificate must be verified to a known trusted certificate” + // (Should this cause a fallback from user to admin domain? It's unclear.) if (err != errSecSuccess || trustSettings == NULL) { if (trustSettings != NULL) CFRelease(trustSettings); return kSecTrustSettingsResultUnspecified; @@ -77,16 +78,12 @@ static SInt32 sslTrustSettingsResult(SecCertificateRef cert) { for (m = 0; m < CFArrayGetCount(trustSettings); m++) { CFDictionaryRef tSetting = (CFDictionaryRef)CFArrayGetValueAtIndex(trustSettings, m); - // First, check if this trust setting applies to our policy. We assume - // only one will. The docs suggest that there might be multiple applying - // but don't explain how to combine them. + // First, check if this trust setting is constrained to a non-SSL policy. SecPolicyRef policyRef; if (CFDictionaryGetValueIfPresent(tSetting, _kSecTrustSettingsPolicy, (const void**)&policyRef)) { if (!isSSLPolicy(policyRef)) { continue; } - } else { - continue; } if (CFDictionaryContainsKey(tSetting, _kSecTrustSettingsPolicyString)) { @@ -98,13 +95,23 @@ static SInt32 sslTrustSettingsResult(SecCertificateRef cert) { if (CFDictionaryGetValueIfPresent(tSetting, _kSecTrustSettingsResult, (const void**)&cfNum)) { CFNumberGetValue(cfNum, kCFNumberSInt32Type, &result); } else { - // > If the value of the kSecTrustSettingsResult component is not - // > kSecTrustSettingsResultUnspecified for a usage constraints dictionary that has - // > no constraints, the default value kSecTrustSettingsResultTrustRoot is assumed. + // > If this key is not present, a default value of + // > kSecTrustSettingsResultTrustRoot is assumed. result = kSecTrustSettingsResultTrustRoot; } - break; + // If multiple dictionaries match, we are supposed to "OR" them, + // the semantics of which are not clear. Since TrustRoot and TrustAsRoot + // are mutually exclusive, Deny should probably override, and Invalid and + // Unspecified be overridden, approximate this by stopping at the first + // TrustRoot, TrustAsRoot or Deny. + if (result == kSecTrustSettingsResultTrustRoot) { + break; + } else if (result == kSecTrustSettingsResultTrustAsRoot) { + break; + } else if (result == kSecTrustSettingsResultDeny) { + break; + } } // If trust settings are present, but none of them match the policy... @@ -143,7 +150,7 @@ static Boolean isRootCertificate(SecCertificateRef cert, CFErrorRef *errRef) { return equal; } -// FetchPEMRoots fetches the system's list of trusted X.509 root certificates +// CopyPEMRoots fetches the system's list of trusted X.509 root certificates // for the kSecTrustSettingsPolicy SSL. // // On success it returns 0 and fills pemRoots with a CFDataRef that contains the extracted root @@ -152,15 +159,15 @@ static Boolean isRootCertificate(SecCertificateRef cert, CFErrorRef *errRef) { // // Note: The CFDataRef returned in pemRoots and untrustedPemRoots must // be released (using CFRelease) after we've consumed its content. -int FetchPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots, bool debugDarwinRoots) { +int CopyPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots, bool debugDarwinRoots) { int i; if (debugDarwinRoots) { - printf("crypto/x509: kSecTrustSettingsResultInvalid = %d\n", kSecTrustSettingsResultInvalid); - printf("crypto/x509: kSecTrustSettingsResultTrustRoot = %d\n", kSecTrustSettingsResultTrustRoot); - printf("crypto/x509: kSecTrustSettingsResultTrustAsRoot = %d\n", kSecTrustSettingsResultTrustAsRoot); - printf("crypto/x509: kSecTrustSettingsResultDeny = %d\n", kSecTrustSettingsResultDeny); - printf("crypto/x509: kSecTrustSettingsResultUnspecified = %d\n", kSecTrustSettingsResultUnspecified); + fprintf(stderr, "crypto/x509: kSecTrustSettingsResultInvalid = %d\n", kSecTrustSettingsResultInvalid); + fprintf(stderr, "crypto/x509: kSecTrustSettingsResultTrustRoot = %d\n", kSecTrustSettingsResultTrustRoot); + fprintf(stderr, "crypto/x509: kSecTrustSettingsResultTrustAsRoot = %d\n", kSecTrustSettingsResultTrustAsRoot); + fprintf(stderr, "crypto/x509: kSecTrustSettingsResultDeny = %d\n", kSecTrustSettingsResultDeny); + fprintf(stderr, "crypto/x509: kSecTrustSettingsResultUnspecified = %d\n", kSecTrustSettingsResultUnspecified); } // Get certificates from all domains, not just System, this lets @@ -170,7 +177,7 @@ int FetchPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots, bool debugD kSecTrustSettingsDomainAdmin, kSecTrustSettingsDomainUser }; int numDomains = sizeof(domains)/sizeof(SecTrustSettingsDomain); - if (pemRoots == NULL) { + if (pemRoots == NULL || untrustedPemRoots == NULL) { return -1; } @@ -186,8 +193,6 @@ int FetchPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots, bool debugD CFIndex numCerts = CFArrayGetCount(certs); for (j = 0; j < numCerts; j++) { - CFDataRef data = NULL; - CFArrayRef trustSettings = NULL; SecCertificateRef cert = (SecCertificateRef)CFArrayGetValueAtIndex(certs, j); if (cert == NULL) { continue; @@ -206,7 +211,7 @@ int FetchPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots, bool debugD CFErrorRef errRef = NULL; CFStringRef summary = SecCertificateCopyShortDescription(NULL, cert, &errRef); if (errRef != NULL) { - printf("crypto/x509: SecCertificateCopyShortDescription failed\n"); + fprintf(stderr, "crypto/x509: SecCertificateCopyShortDescription failed\n"); CFRelease(errRef); continue; } @@ -215,7 +220,7 @@ int FetchPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots, bool debugD CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1; char *buffer = malloc(maxSize); if (CFStringGetCString(summary, buffer, maxSize, kCFStringEncodingUTF8)) { - printf("crypto/x509: %s returned %d\n", buffer, (int)result); + fprintf(stderr, "crypto/x509: %s returned %d\n", buffer, (int)result); } free(buffer); CFRelease(summary); @@ -246,11 +251,16 @@ int FetchPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots, bool debugD } else if (result == kSecTrustSettingsResultDeny) { appendTo = combinedUntrustedData; } else if (result == kSecTrustSettingsResultUnspecified) { + // Certificates with unspecified trust should probably be added to a pool of + // intermediates for chain building, or checked for transitive trust and + // added to the root pool (which is an imprecise approximation because it + // cuts chains short) but we don't support either at the moment. TODO. continue; } else { continue; } + CFDataRef data = NULL; err = SecItemExport(cert, kSecFormatX509Cert, kSecItemPemArmour, NULL, &data); if (err != noErr) { continue; @@ -274,22 +284,22 @@ import ( ) func loadSystemRoots() (*CertPool, error) { - roots := NewCertPool() - - var data C.CFDataRef = 0 - var untrustedData C.CFDataRef = 0 - err := C.FetchPEMRoots(&data, &untrustedData, C.bool(debugDarwinRoots)) + var data, untrustedData C.CFDataRef + err := C.CopyPEMRoots(&data, &untrustedData, C.bool(debugDarwinRoots)) if err == -1 { return nil, errors.New("crypto/x509: failed to load darwin system roots with cgo") } - defer C.CFRelease(C.CFTypeRef(data)) + defer C.CFRelease(C.CFTypeRef(untrustedData)) + buf := C.GoBytes(unsafe.Pointer(C.CFDataGetBytePtr(data)), C.int(C.CFDataGetLength(data))) + roots := NewCertPool() roots.AppendCertsFromPEM(buf) - if untrustedData == 0 { + + if C.CFDataGetLength(untrustedData) == 0 { return roots, nil } - defer C.CFRelease(C.CFTypeRef(untrustedData)) + buf = C.GoBytes(unsafe.Pointer(C.CFDataGetBytePtr(untrustedData)), C.int(C.CFDataGetLength(untrustedData))) untrustedRoots := NewCertPool() untrustedRoots.AppendCertsFromPEM(buf) diff --git a/libgo/go/crypto/x509/root_darwin.go b/libgo/go/crypto/x509/root_darwin.go index 9b8a1cca7de..2f6a8b8d607 100644 --- a/libgo/go/crypto/x509/root_darwin.go +++ b/libgo/go/crypto/x509/root_darwin.go @@ -58,7 +58,7 @@ func execSecurityRoots() (*CertPool, error) { return nil, err } if debugDarwinRoots { - fmt.Printf("crypto/x509: %d certs have a trust policy\n", len(hasPolicy)) + fmt.Fprintf(os.Stderr, "crypto/x509: %d certs have a trust policy\n", len(hasPolicy)) } keychains := []string{"/Library/Keychains/System.keychain"} @@ -68,7 +68,7 @@ func execSecurityRoots() (*CertPool, error) { home, err := os.UserHomeDir() if err != nil { if debugDarwinRoots { - fmt.Printf("crypto/x509: can't get user home directory: %v\n", err) + fmt.Fprintf(os.Stderr, "crypto/x509: can't get user home directory: %v\n", err) } } else { keychains = append(keychains, @@ -148,7 +148,7 @@ func execSecurityRoots() (*CertPool, error) { wg.Wait() if debugDarwinRoots { - fmt.Printf("crypto/x509: ran security verify-cert %d times\n", numVerified) + fmt.Fprintf(os.Stderr, "crypto/x509: ran security verify-cert %d times\n", numVerified) } return roots, nil @@ -205,12 +205,12 @@ func verifyCertWithSystem(cert *Certificate) bool { } if err := cmd.Run(); err != nil { if debugDarwinRoots { - fmt.Printf("crypto/x509: verify-cert rejected %s: %q\n", cert.Subject, bytes.TrimSpace(stderr.Bytes())) + fmt.Fprintf(os.Stderr, "crypto/x509: verify-cert rejected %s: %q\n", cert.Subject, bytes.TrimSpace(stderr.Bytes())) } return false } if debugDarwinRoots { - fmt.Printf("crypto/x509: verify-cert approved %s\n", cert.Subject) + fmt.Fprintf(os.Stderr, "crypto/x509: verify-cert approved %s\n", cert.Subject) } return true } @@ -243,7 +243,7 @@ func getCertsWithTrustPolicy() (map[string]bool, error) { // localized on macOS, just interpret any failure to mean that // there are no trust settings. if debugDarwinRoots { - fmt.Printf("crypto/x509: exec %q: %v, %s\n", cmd.Args, err, stderr.Bytes()) + fmt.Fprintf(os.Stderr, "crypto/x509: exec %q: %v, %s\n", cmd.Args, err, stderr.Bytes()) } return nil } diff --git a/libgo/go/crypto/x509/root_linux.go b/libgo/go/crypto/x509/root_linux.go index aa1785e4c63..267775dc5f0 100644 --- a/libgo/go/crypto/x509/root_linux.go +++ b/libgo/go/crypto/x509/root_linux.go @@ -11,4 +11,5 @@ var certFiles = []string{ "/etc/ssl/ca-bundle.pem", // OpenSUSE "/etc/pki/tls/cacert.pem", // OpenELEC "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem", // CentOS/RHEL 7 + "/etc/ssl/cert.pem", // Alpine Linux } diff --git a/libgo/go/crypto/x509/root_windows.go b/libgo/go/crypto/x509/root_windows.go index 74d395df707..1e3ebe89422 100644 --- a/libgo/go/crypto/x509/root_windows.go +++ b/libgo/go/crypto/x509/root_windows.go @@ -229,7 +229,11 @@ func loadSystemRoots() (*CertPool, error) { // TODO: restore this functionality on Windows. We tried to do // it in Go 1.8 but had to revert it. See Issue 18609. // Returning (nil, nil) was the old behavior, prior to CL 30578. - return nil, nil + // The if statement here avoids vet complaining about + // unreachable code below. + if true { + return nil, nil + } const CRYPT_E_NOT_FOUND = 0x80092004 diff --git a/libgo/go/crypto/x509/sec1.go b/libgo/go/crypto/x509/sec1.go index 3008d0df773..6cffa59d0e9 100644 --- a/libgo/go/crypto/x509/sec1.go +++ b/libgo/go/crypto/x509/sec1.go @@ -28,12 +28,18 @@ type ecPrivateKey struct { PublicKey asn1.BitString `asn1:"optional,explicit,tag:1"` } -// ParseECPrivateKey parses an ASN.1 Elliptic Curve Private Key Structure. +// ParseECPrivateKey parses an EC public key in SEC 1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "EC PUBLIC KEY". func ParseECPrivateKey(der []byte) (*ecdsa.PrivateKey, error) { return parseECPrivateKey(nil, der) } -// MarshalECPrivateKey marshals an EC private key into ASN.1, DER format. +// MarshalECPrivateKey converts an EC private key to SEC 1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "EC PRIVATE KEY". +// For a more flexible key format which is not EC specific, use +// MarshalPKCS8PrivateKey. func MarshalECPrivateKey(key *ecdsa.PrivateKey) ([]byte, error) { oid, ok := oidFromNamedCurve(key.Curve) if !ok { @@ -65,6 +71,12 @@ func marshalECPrivateKeyWithOID(key *ecdsa.PrivateKey, oid asn1.ObjectIdentifier func parseECPrivateKey(namedCurveOID *asn1.ObjectIdentifier, der []byte) (key *ecdsa.PrivateKey, err error) { var privKey ecPrivateKey if _, err := asn1.Unmarshal(der, &privKey); err != nil { + if _, err := asn1.Unmarshal(der, &pkcs8{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParsePKCS8PrivateKey instead for this key format)") + } + if _, err := asn1.Unmarshal(der, &pkcs1PrivateKey{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParsePKCS1PrivateKey instead for this key format)") + } return nil, errors.New("x509: failed to parse EC private key: " + err.Error()) } if privKey.Version != ecPrivKeyVersion { diff --git a/libgo/go/crypto/x509/sec1_test.go b/libgo/go/crypto/x509/sec1_test.go index 573c937cafd..9ac251896bd 100644 --- a/libgo/go/crypto/x509/sec1_test.go +++ b/libgo/go/crypto/x509/sec1_test.go @@ -7,6 +7,7 @@ package x509 import ( "bytes" "encoding/hex" + "strings" "testing" ) @@ -42,3 +43,24 @@ func TestParseECPrivateKey(t *testing.T) { } } } + +const hexECTestPKCS1Key = "3082025c02010002818100b1a1e0945b9289c4d3f1329f8a982c4a2dcd59bfd372fb8085a9c517554607ebd2f7990eef216ac9f4605f71a03b04f42a5255b158cf8e0844191f5119348baa44c35056e20609bcf9510f30ead4b481c81d7865fb27b8e0090e112b717f3ee08cdfc4012da1f1f7cf2a1bc34c73a54a12b06372d09714742dd7895eadde4aa5020301000102818062b7fa1db93e993e40237de4d89b7591cc1ea1d04fed4904c643f17ae4334557b4295270d0491c161cb02a9af557978b32b20b59c267a721c4e6c956c2d147046e9ae5f2da36db0106d70021fa9343455f8f973a4b355a26fd19e6b39dee0405ea2b32deddf0f4817759ef705d02b34faab9ca93c6766e9f722290f119f34449024100d9c29a4a013a90e35fd1be14a3f747c589fac613a695282d61812a711906b8a0876c6181f0333ca1066596f57bff47e7cfcabf19c0fc69d9cd76df743038b3cb024100d0d3546fecf879b5551f2bd2c05e6385f2718a08a6face3d2aecc9d7e03645a480a46c81662c12ad6bd6901e3bd4f38029462de7290859567cdf371c79088d4f024100c254150657e460ea58573fcf01a82a4791e3d6223135c8bdfed69afe84fbe7857274f8eb5165180507455f9b4105c6b08b51fe8a481bb986a202245576b713530240045700003b7a867d0041df9547ae2e7f50248febd21c9040b12dae9c2feab0d3d4609668b208e4727a3541557f84d372ac68eaf74ce1018a4c9a0ef92682c8fd02405769731480bb3a4570abf422527c5f34bf732fa6c1e08cc322753c511ce055fac20fc770025663ad3165324314df907f1f1942f0448a7e9cdbf87ecd98b92156" +const hexECTestPKCS8Key = "30820278020100300d06092a864886f70d0101010500048202623082025e02010002818100cfb1b5bf9685ffa97b4f99df4ff122b70e59ac9b992f3bc2b3dde17d53c1a34928719b02e8fd17839499bfbd515bd6ef99c7a1c47a239718fe36bfd824c0d96060084b5f67f0273443007a24dfaf5634f7772c9346e10eb294c2306671a5a5e719ae24b4de467291bc571014b0e02dec04534d66a9bb171d644b66b091780e8d020301000102818100b595778383c4afdbab95d2bfed12b3f93bb0a73a7ad952f44d7185fd9ec6c34de8f03a48770f2009c8580bcd275e9632714e9a5e3f32f29dc55474b2329ff0ebc08b3ffcb35bc96e6516b483df80a4a59cceb71918cbabf91564e64a39d7e35dce21cb3031824fdbc845dba6458852ec16af5dddf51a8397a8797ae0337b1439024100ea0eb1b914158c70db39031dd8904d6f18f408c85fbbc592d7d20dee7986969efbda081fdf8bc40e1b1336d6b638110c836bfdc3f314560d2e49cd4fbde1e20b024100e32a4e793b574c9c4a94c8803db5152141e72d03de64e54ef2c8ed104988ca780cd11397bc359630d01b97ebd87067c5451ba777cf045ca23f5912f1031308c702406dfcdbbd5a57c9f85abc4edf9e9e29153507b07ce0a7ef6f52e60dcfebe1b8341babd8b789a837485da6c8d55b29bbb142ace3c24a1f5b54b454d01b51e2ad03024100bd6a2b60dee01e1b3bfcef6a2f09ed027c273cdbbaf6ba55a80f6dcc64e4509ee560f84b4f3e076bd03b11e42fe71a3fdd2dffe7e0902c8584f8cad877cdc945024100aa512fa4ada69881f1d8bb8ad6614f192b83200aef5edf4811313d5ef30a86cbd0a90f7b025c71ea06ec6b34db6306c86b1040670fd8654ad7291d066d06d031" + +var ecMismatchKeyTests = []struct { + hexKey string + errorContains string +}{ + {hexKey: hexECTestPKCS8Key, errorContains: "use ParsePKCS8PrivateKey instead"}, + {hexKey: hexECTestPKCS1Key, errorContains: "use ParsePKCS1PrivateKey instead"}, +} + +func TestECMismatchKeyFormat(t *testing.T) { + for i, test := range ecMismatchKeyTests { + derBytes, _ := hex.DecodeString(test.hexKey) + _, err := ParseECPrivateKey(derBytes) + if !strings.Contains(err.Error(), test.errorContains) { + t.Errorf("#%d: expected error containing %q, got %s", i, test.errorContains, err) + } + } +} diff --git a/libgo/go/crypto/x509/verify.go b/libgo/go/crypto/x509/verify.go index 56b7948c415..3b5b3576bdd 100644 --- a/libgo/go/crypto/x509/verify.go +++ b/libgo/go/crypto/x509/verify.go @@ -369,7 +369,7 @@ func domainToReverseLabels(domain string) (reverseLabels []string, ok bool) { reverseLabels = append(reverseLabels, domain) domain = "" } else { - reverseLabels = append(reverseLabels, domain[i+1:len(domain)]) + reverseLabels = append(reverseLabels, domain[i+1:]) domain = domain[:i] } } diff --git a/libgo/go/crypto/x509/x509.go b/libgo/go/crypto/x509/x509.go index 58098adc2d5..1cd8fdeb331 100644 --- a/libgo/go/crypto/x509/x509.go +++ b/libgo/go/crypto/x509/x509.go @@ -14,6 +14,7 @@ import ( "crypto" "crypto/dsa" "crypto/ecdsa" + "crypto/ed25519" "crypto/elliptic" "crypto/rsa" _ "crypto/sha1" @@ -24,8 +25,8 @@ import ( "encoding/pem" "errors" "fmt" - "internal/x/crypto/cryptobyte" - cryptobyte_asn1 "internal/x/crypto/cryptobyte/asn1" + "golang.org/x/crypto/cryptobyte" + cryptobyte_asn1 "golang.org/x/crypto/cryptobyte/asn1" "io" "math/big" "net" @@ -43,17 +44,18 @@ type pkixPublicKey struct { BitString asn1.BitString } -// ParsePKIXPublicKey parses a DER encoded public key. These values are -// typically found in PEM blocks with "BEGIN PUBLIC KEY". +// ParsePKIXPublicKey parses a public key in PKIX, ASN.1 DER form. // -// Supported key types include RSA, DSA, and ECDSA. Unknown key -// types result in an error. +// It returns a *rsa.PublicKey, *dsa.PublicKey, *ecdsa.PublicKey, or +// ed25519.PublicKey. More types might be supported in the future. // -// On success, pub will be of type *rsa.PublicKey, *dsa.PublicKey, -// or *ecdsa.PublicKey. +// This kind of key is commonly encoded in PEM blocks of type "PUBLIC KEY". func ParsePKIXPublicKey(derBytes []byte) (pub interface{}, err error) { var pki publicKeyInfo if rest, err := asn1.Unmarshal(derBytes, &pki); err != nil { + if _, err := asn1.Unmarshal(derBytes, &pkcs1PublicKey{}); err == nil { + return nil, errors.New("x509: failed to parse public key (use ParsePKCS1PublicKey instead for this key format)") + } return nil, err } else if len(rest) != 0 { return nil, errors.New("x509: trailing data after ASN.1 of public-key") @@ -92,6 +94,9 @@ func marshalPublicKey(pub interface{}) (publicKeyBytes []byte, publicKeyAlgorith return } publicKeyAlgorithm.Parameters.FullBytes = paramBytes + case ed25519.PublicKey: + publicKeyBytes = pub + publicKeyAlgorithm.Algorithm = oidPublicKeyEd25519 default: return nil, pkix.AlgorithmIdentifier{}, errors.New("x509: only RSA and ECDSA public keys supported") } @@ -99,7 +104,12 @@ func marshalPublicKey(pub interface{}) (publicKeyBytes []byte, publicKeyAlgorith return publicKeyBytes, publicKeyAlgorithm, nil } -// MarshalPKIXPublicKey serialises a public key to DER-encoded PKIX format. +// MarshalPKIXPublicKey converts a public key to PKIX, ASN.1 DER form. +// +// The following key types are currently supported: *rsa.PublicKey, *ecdsa.PublicKey +// and ed25519.PublicKey. Unsupported key types result in an error. +// +// This kind of key is commonly encoded in PEM blocks of type "PUBLIC KEY". func MarshalPKIXPublicKey(pub interface{}) ([]byte, error) { var publicKeyBytes []byte var publicKeyAlgorithm pkix.AlgorithmIdentifier @@ -188,6 +198,7 @@ const ( SHA256WithRSAPSS SHA384WithRSAPSS SHA512WithRSAPSS + PureEd25519 ) func (algo SignatureAlgorithm) isRSAPSS() bool { @@ -215,12 +226,14 @@ const ( RSA DSA ECDSA + Ed25519 ) var publicKeyAlgoName = [...]string{ - RSA: "RSA", - DSA: "DSA", - ECDSA: "ECDSA", + RSA: "RSA", + DSA: "DSA", + ECDSA: "ECDSA", + Ed25519: "Ed25519", } func (algo PublicKeyAlgorithm) String() string { @@ -279,6 +292,11 @@ func (algo PublicKeyAlgorithm) String() string { // // ecdsa-with-SHA512 OBJECT IDENTIFIER ::= { iso(1) member-body(2) // us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 4 } +// +// +// RFC 8410 3 Curve25519 and Curve448 Algorithm Identifiers +// +// id-Ed25519 OBJECT IDENTIFIER ::= { 1 3 101 112 } var ( oidSignatureMD2WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 2} @@ -294,6 +312,7 @@ var ( oidSignatureECDSAWithSHA256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 2} oidSignatureECDSAWithSHA384 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 3} oidSignatureECDSAWithSHA512 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 4} + oidSignatureEd25519 = asn1.ObjectIdentifier{1, 3, 101, 112} oidSHA256 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 1} oidSHA384 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 2} @@ -330,6 +349,7 @@ var signatureAlgorithmDetails = []struct { {ECDSAWithSHA256, "ECDSA-SHA256", oidSignatureECDSAWithSHA256, ECDSA, crypto.SHA256}, {ECDSAWithSHA384, "ECDSA-SHA384", oidSignatureECDSAWithSHA384, ECDSA, crypto.SHA384}, {ECDSAWithSHA512, "ECDSA-SHA512", oidSignatureECDSAWithSHA512, ECDSA, crypto.SHA512}, + {PureEd25519, "Ed25519", oidSignatureEd25519, Ed25519, crypto.Hash(0) /* no pre-hashing */}, } // pssParameters reflects the parameters in an AlgorithmIdentifier that @@ -390,6 +410,14 @@ func rsaPSSParameters(hashFunc crypto.Hash) asn1.RawValue { } func getSignatureAlgorithmFromAI(ai pkix.AlgorithmIdentifier) SignatureAlgorithm { + if ai.Algorithm.Equal(oidSignatureEd25519) { + // RFC 8410, Section 3 + // > For all of the OIDs, the parameters MUST be absent. + if len(ai.Parameters.FullBytes) != 0 { + return UnknownSignatureAlgorithm + } + } + if !ai.Algorithm.Equal(oidSignatureRSAPSS) { for _, details := range signatureAlgorithmDetails { if ai.Algorithm.Equal(details.oid) { @@ -452,9 +480,10 @@ func getSignatureAlgorithmFromAI(ai pkix.AlgorithmIdentifier) SignatureAlgorithm // id-ecPublicKey OBJECT IDENTIFIER ::= { // iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 } var ( - oidPublicKeyRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1} - oidPublicKeyDSA = asn1.ObjectIdentifier{1, 2, 840, 10040, 4, 1} - oidPublicKeyECDSA = asn1.ObjectIdentifier{1, 2, 840, 10045, 2, 1} + oidPublicKeyRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1} + oidPublicKeyDSA = asn1.ObjectIdentifier{1, 2, 840, 10040, 4, 1} + oidPublicKeyECDSA = asn1.ObjectIdentifier{1, 2, 840, 10045, 2, 1} + oidPublicKeyEd25519 = oidSignatureEd25519 ) func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm { @@ -465,6 +494,8 @@ func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm return DSA case oid.Equal(oidPublicKeyECDSA): return ECDSA + case oid.Equal(oidPublicKeyEd25519): + return Ed25519 } return UnknownPublicKeyAlgorithm } @@ -871,28 +902,29 @@ func checkSignature(algo SignatureAlgorithm, signed, signature []byte, publicKey switch hashType { case crypto.Hash(0): - return ErrUnsupportedAlgorithm + if pubKeyAlgo != Ed25519 { + return ErrUnsupportedAlgorithm + } case crypto.MD5: return InsecureAlgorithmError(algo) + default: + if !hashType.Available() { + return ErrUnsupportedAlgorithm + } + h := hashType.New() + h.Write(signed) + signed = h.Sum(nil) } - if !hashType.Available() { - return ErrUnsupportedAlgorithm - } - h := hashType.New() - - h.Write(signed) - digest := h.Sum(nil) - switch pub := publicKey.(type) { case *rsa.PublicKey: if pubKeyAlgo != RSA { return signaturePublicKeyAlgoMismatchError(pubKeyAlgo, pub) } if algo.isRSAPSS() { - return rsa.VerifyPSS(pub, hashType, digest, signature, &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash}) + return rsa.VerifyPSS(pub, hashType, signed, signature, &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash}) } else { - return rsa.VerifyPKCS1v15(pub, hashType, digest, signature) + return rsa.VerifyPKCS1v15(pub, hashType, signed, signature) } case *dsa.PublicKey: if pubKeyAlgo != DSA { @@ -907,7 +939,7 @@ func checkSignature(algo SignatureAlgorithm, signed, signature []byte, publicKey if dsaSig.R.Sign() <= 0 || dsaSig.S.Sign() <= 0 { return errors.New("x509: DSA signature contained zero or negative values") } - if !dsa.Verify(pub, digest, dsaSig.R, dsaSig.S) { + if !dsa.Verify(pub, signed, dsaSig.R, dsaSig.S) { return errors.New("x509: DSA verification failure") } return @@ -924,10 +956,18 @@ func checkSignature(algo SignatureAlgorithm, signed, signature []byte, publicKey if ecdsaSig.R.Sign() <= 0 || ecdsaSig.S.Sign() <= 0 { return errors.New("x509: ECDSA signature contained zero or negative values") } - if !ecdsa.Verify(pub, digest, ecdsaSig.R, ecdsaSig.S) { + if !ecdsa.Verify(pub, signed, ecdsaSig.R, ecdsaSig.S) { return errors.New("x509: ECDSA verification failure") } return + case ed25519.PublicKey: + if pubKeyAlgo != Ed25519 { + return signaturePublicKeyAlgoMismatchError(pubKeyAlgo, pub) + } + if !ed25519.Verify(pub, signed, signature) { + return errors.New("x509: Ed25519 verification failure") + } + return } return ErrUnsupportedAlgorithm } @@ -1065,6 +1105,18 @@ func parsePublicKey(algo PublicKeyAlgorithm, keyData *publicKeyInfo) (interface{ Y: y, } return pub, nil + case Ed25519: + // RFC 8410, Section 3 + // > For all of the OIDs, the parameters MUST be absent. + if len(keyData.Algorithm.Parameters.FullBytes) != 0 { + return nil, errors.New("x509: Ed25519 key encoded with illegal parameters") + } + if len(asn1Data) != ed25519.PublicKeySize { + return nil, errors.New("x509: wrong Ed25519 public key size") + } + pub := make([]byte, ed25519.PublicKeySize) + copy(pub, asn1Data) + return ed25519.PublicKey(pub), nil default: return nil, nil } @@ -1927,7 +1979,7 @@ func buildExtensions(template *Certificate, subjectIsEmpty bool, authorityKeyId dp := distributionPoint{ DistributionPoint: distributionPointName{ FullName: []asn1.RawValue{ - asn1.RawValue{Tag: 6, Class: 2, Bytes: []byte(name)}, + {Tag: 6, Class: 2, Bytes: []byte(name)}, }, }, } @@ -1986,8 +2038,12 @@ func signingParamsForPublicKey(pub interface{}, requestedSigAlgo SignatureAlgori err = errors.New("x509: unknown elliptic curve") } + case ed25519.PublicKey: + pubType = Ed25519 + sigAlgo.Algorithm = oidSignatureEd25519 + default: - err = errors.New("x509: only RSA and ECDSA keys supported") + err = errors.New("x509: only RSA, ECDSA and Ed25519 keys supported") } if err != nil { @@ -2006,7 +2062,7 @@ func signingParamsForPublicKey(pub interface{}, requestedSigAlgo SignatureAlgori return } sigAlgo.Algorithm, hashFunc = details.oid, details.hash - if hashFunc == 0 { + if hashFunc == 0 && pubType != Ed25519 { err = errors.New("x509: cannot sign with hash function requested") return } @@ -2070,8 +2126,9 @@ var emptyASN1Subject = []byte{0x30, 0} // // The returned slice is the certificate in DER encoding. // -// All keys types that are implemented via crypto.Signer are supported (This -// includes *rsa.PublicKey and *ecdsa.PublicKey.) +// The currently supported key types are *rsa.PublicKey, *ecdsa.PublicKey and +// ed25519.PublicKey. pub must be a supported key type, and priv must be a +// crypto.Signer with a supported public key. // // The AuthorityKeyId will be taken from the SubjectKeyId of parent, if any, // unless the resulting certificate is self-signed. Otherwise the value from @@ -2132,15 +2189,16 @@ func CreateCertificate(rand io.Reader, template, parent *Certificate, pub, priv if err != nil { return } - c.Raw = tbsCertContents - h := hashFunc.New() - h.Write(tbsCertContents) - digest := h.Sum(nil) + signed := tbsCertContents + if hashFunc != 0 { + h := hashFunc.New() + h.Write(signed) + signed = h.Sum(nil) + } - var signerOpts crypto.SignerOpts - signerOpts = hashFunc + var signerOpts crypto.SignerOpts = hashFunc if template.SignatureAlgorithm != 0 && template.SignatureAlgorithm.isRSAPSS() { signerOpts = &rsa.PSSOptions{ SaltLength: rsa.PSSSaltLengthEqualsHash, @@ -2149,7 +2207,7 @@ func CreateCertificate(rand io.Reader, template, parent *Certificate, pub, priv } var signature []byte - signature, err = key.Sign(rand, digest, signerOpts) + signature, err = key.Sign(rand, signed, signerOpts) if err != nil { return } @@ -2275,7 +2333,7 @@ type CertificateRequest struct { // Attributes contains the CSR attributes that can parse as // pkix.AttributeTypeAndValueSET. // - // Deprecated: use Extensions and ExtraExtensions instead for parsing and + // Deprecated: Use Extensions and ExtraExtensions instead for parsing and // generating the requestedExtensions attribute. Attributes []pkix.AttributeTypeAndValueSET @@ -2400,8 +2458,9 @@ func parseCSRExtensions(rawAttributes []asn1.RawValue) ([]pkix.Extension, error) // // priv is the private key to sign the CSR with, and the corresponding public // key will be included in the CSR. It must implement crypto.Signer and its -// Public() method must return a *rsa.PublicKey or a *ecdsa.PublicKey. (A -// *rsa.PrivateKey or *ecdsa.PrivateKey satisfies this.) +// Public() method must return a *rsa.PublicKey or a *ecdsa.PublicKey or a +// ed25519.PublicKey. (A *rsa.PrivateKey, *ecdsa.PrivateKey or +// ed25519.PrivateKey satisfies this.) // // The returned slice is the certificate request in DER encoding. func CreateCertificateRequest(rand io.Reader, template *CertificateRequest, priv interface{}) (csr []byte, err error) { @@ -2550,12 +2609,15 @@ func CreateCertificateRequest(rand io.Reader, template *CertificateRequest, priv } tbsCSR.Raw = tbsCSRContents - h := hashFunc.New() - h.Write(tbsCSRContents) - digest := h.Sum(nil) + signed := tbsCSRContents + if hashFunc != 0 { + h := hashFunc.New() + h.Write(signed) + signed = h.Sum(nil) + } var signature []byte - signature, err = key.Sign(rand, digest, hashFunc) + signature, err = key.Sign(rand, signed, hashFunc) if err != nil { return } diff --git a/libgo/go/crypto/x509/x509_test.go b/libgo/go/crypto/x509/x509_test.go index 388156e2097..171509f7c45 100644 --- a/libgo/go/crypto/x509/x509_test.go +++ b/libgo/go/crypto/x509/x509_test.go @@ -8,6 +8,7 @@ import ( "bytes" "crypto/dsa" "crypto/ecdsa" + "crypto/ed25519" "crypto/elliptic" "crypto/rand" "crypto/rsa" @@ -54,27 +55,50 @@ func TestParsePKCS1PrivateKey(t *testing.T) { } } -func TestParsePKIXPublicKey(t *testing.T) { - block, _ := pem.Decode([]byte(pemPublicKey)) +func TestPKCS1MismatchPublicKeyFormat(t *testing.T) { + + const pkixPublicKey = "30820122300d06092a864886f70d01010105000382010f003082010a0282010100dd5a0f37d3ca5232852ccc0e81eebec270e2f2c6c44c6231d852971a0aad00aa7399e9b9de444611083c59ea919a9d76c20a7be131a99045ec19a7bb452d647a72429e66b87e28be9e8187ed1d2a2a01ef3eb2360706bd873b07f2d1f1a72337aab5ec94e983e39107f52c480d404915e84d75a3db2cfd601726a128cb1d7f11492d4bdb53272e652276667220795c709b8a9b4af6489cbf48bb8173b8fb607c834a71b6e8bf2d6aab82af3c8ad7ce16d8dcf58373a6edc427f7484d09744d4c08f4e19ed07adbf6cb31243bc5d0d1145e77a08a6fc5efd208eca67d6abf2d6f38f58b6fdd7c28774fb0cc03fc4935c6e074842d2e1479d3d8787249258719f90203010001" + const errorContains = "use ParsePKIXPublicKey instead" + derBytes, _ := hex.DecodeString(pkixPublicKey) + _, err := ParsePKCS1PublicKey(derBytes) + if !strings.Contains(err.Error(), errorContains) { + t.Errorf("expected error containing %q, got %s", errorContains, err) + } +} + +func testParsePKIXPublicKey(t *testing.T, pemBytes string) (pub interface{}) { + block, _ := pem.Decode([]byte(pemBytes)) pub, err := ParsePKIXPublicKey(block.Bytes) if err != nil { - t.Errorf("Failed to parse RSA public key: %s", err) - return - } - rsaPub, ok := pub.(*rsa.PublicKey) - if !ok { - t.Errorf("Value returned from ParsePKIXPublicKey was not an RSA public key") - return + t.Fatalf("Failed to parse public key: %s", err) } - pubBytes2, err := MarshalPKIXPublicKey(rsaPub) + pubBytes2, err := MarshalPKIXPublicKey(pub) if err != nil { - t.Errorf("Failed to marshal RSA public key for the second time: %s", err) + t.Errorf("Failed to marshal public key for the second time: %s", err) return } if !bytes.Equal(pubBytes2, block.Bytes) { t.Errorf("Reserialization of public key didn't match. got %x, want %x", pubBytes2, block.Bytes) } + return +} + +func TestParsePKIXPublicKey(t *testing.T) { + t.Run("RSA", func(t *testing.T) { + pub := testParsePKIXPublicKey(t, pemPublicKey) + _, ok := pub.(*rsa.PublicKey) + if !ok { + t.Errorf("Value returned from ParsePKIXPublicKey was not an RSA public key") + } + }) + t.Run("Ed25519", func(t *testing.T) { + pub := testParsePKIXPublicKey(t, pemEd25519Key) + _, ok := pub.(ed25519.PublicKey) + if !ok { + t.Errorf("Value returned from ParsePKIXPublicKey was not an Ed25519 public key") + } + }) } var pemPublicKey = `-----BEGIN PUBLIC KEY----- @@ -88,8 +112,8 @@ FF53oIpvxe/SCOymfWq/LW849Ytv3Xwod0+wzAP8STXG4HSELS4UedPYeHJJJYcZ -----END PUBLIC KEY----- ` -var pemPrivateKey = ` ------BEGIN RSA PRIVATE KEY----- +var pemPrivateKey = testingKey(` +-----BEGIN RSA TESTING KEY----- MIICXAIBAAKBgQCxoeCUW5KJxNPxMp+KmCxKLc1Zv9Ny+4CFqcUXVUYH69L3mQ7v IWrJ9GBfcaA7BPQqUlWxWM+OCEQZH1EZNIuqRMNQVuIGCbz5UQ8w6tS0gcgdeGX7 J7jgCQ4RK3F/PuCM38QBLaHx988qG8NMc6VKErBjctCXFHQt14lerd5KpQIDAQAB @@ -103,9 +127,27 @@ MTXIvf7Wmv6E++eFcnT461FlGAUHRV+bQQXGsItR/opIG7mGogIkVXa3E1MCQARX AAA7eoZ9AEHflUeuLn9QJI/r0hyQQLEtrpwv6rDT1GCWaLII5HJ6NUFVf4TTcqxo 6vdM4QGKTJoO+SaCyP0CQFdpcxSAuzpFcKv0IlJ8XzS/cy+mweCMwyJ1PFEc4FX6 wg/HcAJWY60xZTJDFN+Qfx8ZQvBEin6c2/h+zZi5IVY= ------END RSA PRIVATE KEY----- +-----END RSA TESTING KEY----- +`) + +// pemEd25519Key is the example from RFC 8410, Secrion 4. +var pemEd25519Key = ` +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEAGb9ECWmEzf6FQbrBZ9w7lshQhqowtrbLDFw4rXAxZuE= +-----END PUBLIC KEY----- ` +func TestPKIXMismatchPublicKeyFormat(t *testing.T) { + + const pkcs1PublicKey = "308201080282010100817cfed98bcaa2e2a57087451c7674e0c675686dc33ff1268b0c2a6ee0202dec710858ee1c31bdf5e7783582e8ca800be45f3275c6576adc35d98e26e95bb88ca5beb186f853b8745d88bc9102c5f38753bcda519fb05948d5c77ac429255ff8aaf27d9f45d1586e95e2e9ba8a7cb771b8a09dd8c8fed3f933fd9b439bc9f30c475953418ef25f71a2b6496f53d94d39ce850aa0cc75d445b5f5b4f4ee4db78ab197a9a8d8a852f44529a007ac0ac23d895928d60ba538b16b0b087a7f903ed29770e215019b77eaecc360f35f7ab11b6d735978795b2c4a74e5bdea4dc6594cd67ed752a108e666729a753ab36d6c4f606f8760f507e1765be8cd744007e629020103" + const errorContains = "use ParsePKCS1PublicKey instead" + derBytes, _ := hex.DecodeString(pkcs1PublicKey) + _, err := ParsePKIXPublicKey(derBytes) + if !strings.Contains(err.Error(), errorContains) { + t.Errorf("expected error containing %q, got %s", errorContains, err) + } +} + var testPrivateKey *rsa.PrivateKey func init() { @@ -496,6 +538,11 @@ func TestCreateSelfSignedCertificate(t *testing.T) { t.Fatalf("Failed to generate ECDSA key: %s", err) } + ed25519Pub, ed25519Priv, err := ed25519.GenerateKey(random) + if err != nil { + t.Fatalf("Failed to generate Ed25519 key: %s", err) + } + tests := []struct { name string pub, priv interface{} @@ -509,6 +556,7 @@ func TestCreateSelfSignedCertificate(t *testing.T) { {"RSAPSS/RSAPSS", &testPrivateKey.PublicKey, testPrivateKey, true, SHA256WithRSAPSS}, {"ECDSA/RSAPSS", &ecdsaPriv.PublicKey, testPrivateKey, false, SHA256WithRSAPSS}, {"RSAPSS/ECDSA", &testPrivateKey.PublicKey, ecdsaPriv, false, ECDSAWithSHA384}, + {"Ed25519", ed25519Pub, ed25519Priv, true, PureEd25519}, } testExtKeyUsage := []ExtKeyUsage{ExtKeyUsageClientAuth, ExtKeyUsageServerAuth} @@ -995,6 +1043,76 @@ func TestRSAPSSSelfSigned(t *testing.T) { } } +const ed25519Certificate = ` +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0c:83:d8:21:2b:82:cb:23:98:23:63:e2:f7:97:8a:43:5b:f3:bd:92 + Signature Algorithm: ED25519 + Issuer: CN = Ed25519 test certificate + Validity + Not Before: May 6 17:27:16 2019 GMT + Not After : Jun 5 17:27:16 2019 GMT + Subject: CN = Ed25519 test certificate + Subject Public Key Info: + Public Key Algorithm: ED25519 + ED25519 Public-Key: + pub: + 36:29:c5:6c:0d:4f:14:6c:81:d0:ff:75:d3:6a:70: + 5f:69:cd:0f:4d:66:d5:da:98:7e:82:49:89:a3:8a: + 3c:fa + X509v3 extensions: + X509v3 Subject Key Identifier: + 09:3B:3A:9D:4A:29:D8:95:FF:68:BE:7B:43:54:72:E0:AD:A2:E3:AE + X509v3 Authority Key Identifier: + keyid:09:3B:3A:9D:4A:29:D8:95:FF:68:BE:7B:43:54:72:E0:AD:A2:E3:AE + + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: ED25519 + 53:a5:58:1c:2c:3b:2a:9e:ac:9d:4e:a5:1d:5f:5d:6d:a6:b5: + 08:de:12:82:f3:97:20:ae:fa:d8:98:f4:1a:83:32:6b:91:f5: + 24:1d:c4:20:7f:2c:e2:4d:da:13:3b:6d:54:1a:d2:a8:28:dc: + 60:b9:d4:f4:78:4b:3c:1c:91:00 +-----BEGIN CERTIFICATE----- +MIIBWzCCAQ2gAwIBAgIUDIPYISuCyyOYI2Pi95eKQ1vzvZIwBQYDK2VwMCMxITAf +BgNVBAMMGEVkMjU1MTkgdGVzdCBjZXJ0aWZpY2F0ZTAeFw0xOTA1MDYxNzI3MTZa +Fw0xOTA2MDUxNzI3MTZaMCMxITAfBgNVBAMMGEVkMjU1MTkgdGVzdCBjZXJ0aWZp +Y2F0ZTAqMAUGAytlcAMhADYpxWwNTxRsgdD/ddNqcF9pzQ9NZtXamH6CSYmjijz6 +o1MwUTAdBgNVHQ4EFgQUCTs6nUop2JX/aL57Q1Ry4K2i464wHwYDVR0jBBgwFoAU +CTs6nUop2JX/aL57Q1Ry4K2i464wDwYDVR0TAQH/BAUwAwEB/zAFBgMrZXADQQBT +pVgcLDsqnqydTqUdX11tprUI3hKC85cgrvrYmPQagzJrkfUkHcQgfyziTdoTO21U +GtKoKNxgudT0eEs8HJEA +-----END CERTIFICATE-----` + +func TestEd25519SelfSigned(t *testing.T) { + der, _ := pem.Decode([]byte(ed25519Certificate)) + if der == nil { + t.Fatalf("Failed to find PEM block") + } + + cert, err := ParseCertificate(der.Bytes) + if err != nil { + t.Fatalf("Failed to parse: %s", err) + } + + if cert.PublicKeyAlgorithm != Ed25519 { + t.Fatalf("Parsed key algorithm was not Ed25519") + } + parsedKey, ok := cert.PublicKey.(ed25519.PublicKey) + if !ok { + t.Fatalf("Parsed key was not an Ed25519 key: %s", err) + } + if len(parsedKey) != ed25519.PublicKeySize { + t.Fatalf("Invalid Ed25519 key") + } + + if err = cert.CheckSignatureFrom(cert); err != nil { + t.Fatalf("Signature check failed: %s", err) + } +} + const pemCertificate = `-----BEGIN CERTIFICATE----- MIIDATCCAemgAwIBAgIRAKQkkrFx1T/dgB/Go/xBM5swDQYJKoZIhvcNAQELBQAw EjEQMA4GA1UEChMHQWNtZSBDbzAeFw0xNjA4MTcyMDM2MDdaFw0xNzA4MTcyMDM2 @@ -1125,10 +1243,13 @@ func TestParsePEMCRL(t *testing.T) { } func TestImports(t *testing.T) { + if testing.Short() { + t.Skip("skipping in -short mode") + } testenv.MustHaveGoRun(t) - if err := exec.Command(testenv.GoToolPath(t), "run", "x509_test_import.go").Run(); err != nil { - t.Errorf("failed to run x509_test_import.go: %s", err) + if out, err := exec.Command(testenv.GoToolPath(t), "run", "x509_test_import.go").CombinedOutput(); err != nil { + t.Errorf("failed to run x509_test_import.go: %s\n%s", err, out) } } @@ -1154,6 +1275,11 @@ func TestCreateCertificateRequest(t *testing.T) { t.Fatalf("Failed to generate ECDSA key: %s", err) } + _, ed25519Priv, err := ed25519.GenerateKey(random) + if err != nil { + t.Fatalf("Failed to generate Ed25519 key: %s", err) + } + tests := []struct { name string priv interface{} @@ -1163,6 +1289,7 @@ func TestCreateCertificateRequest(t *testing.T) { {"ECDSA-256", ecdsa256Priv, ECDSAWithSHA1}, {"ECDSA-384", ecdsa384Priv, ECDSAWithSHA1}, {"ECDSA-521", ecdsa521Priv, ECDSAWithSHA1}, + {"Ed25519", ed25519Priv, PureEd25519}, } for _, test := range tests { @@ -2017,3 +2144,24 @@ func TestMultipleURLsInCRLDP(t *testing.T) { t.Errorf("CRL distribution points = %#v, want #%v", got, want) } } + +const hexPKCS1TestPKCS8Key = "30820278020100300d06092a864886f70d0101010500048202623082025e02010002818100cfb1b5bf9685ffa97b4f99df4ff122b70e59ac9b992f3bc2b3dde17d53c1a34928719b02e8fd17839499bfbd515bd6ef99c7a1c47a239718fe36bfd824c0d96060084b5f67f0273443007a24dfaf5634f7772c9346e10eb294c2306671a5a5e719ae24b4de467291bc571014b0e02dec04534d66a9bb171d644b66b091780e8d020301000102818100b595778383c4afdbab95d2bfed12b3f93bb0a73a7ad952f44d7185fd9ec6c34de8f03a48770f2009c8580bcd275e9632714e9a5e3f32f29dc55474b2329ff0ebc08b3ffcb35bc96e6516b483df80a4a59cceb71918cbabf91564e64a39d7e35dce21cb3031824fdbc845dba6458852ec16af5dddf51a8397a8797ae0337b1439024100ea0eb1b914158c70db39031dd8904d6f18f408c85fbbc592d7d20dee7986969efbda081fdf8bc40e1b1336d6b638110c836bfdc3f314560d2e49cd4fbde1e20b024100e32a4e793b574c9c4a94c8803db5152141e72d03de64e54ef2c8ed104988ca780cd11397bc359630d01b97ebd87067c5451ba777cf045ca23f5912f1031308c702406dfcdbbd5a57c9f85abc4edf9e9e29153507b07ce0a7ef6f52e60dcfebe1b8341babd8b789a837485da6c8d55b29bbb142ace3c24a1f5b54b454d01b51e2ad03024100bd6a2b60dee01e1b3bfcef6a2f09ed027c273cdbbaf6ba55a80f6dcc64e4509ee560f84b4f3e076bd03b11e42fe71a3fdd2dffe7e0902c8584f8cad877cdc945024100aa512fa4ada69881f1d8bb8ad6614f192b83200aef5edf4811313d5ef30a86cbd0a90f7b025c71ea06ec6b34db6306c86b1040670fd8654ad7291d066d06d031" +const hexPKCS1TestECKey = "3081a40201010430bdb9839c08ee793d1157886a7a758a3c8b2a17a4df48f17ace57c72c56b4723cf21dcda21d4e1ad57ff034f19fcfd98ea00706052b81040022a16403620004feea808b5ee2429cfcce13c32160e1c960990bd050bb0fdf7222f3decd0a55008e32a6aa3c9062051c4cba92a7a3b178b24567412d43cdd2f882fa5addddd726fe3e208d2c26d733a773a597abb749714df7256ead5105fa6e7b3650de236b50" + +var pkcs1MismatchKeyTests = []struct { + hexKey string + errorContains string +}{ + {hexKey: hexPKCS1TestPKCS8Key, errorContains: "use ParsePKCS8PrivateKey instead"}, + {hexKey: hexPKCS1TestECKey, errorContains: "use ParseECPrivateKey instead"}, +} + +func TestPKCS1MismatchKeyFormat(t *testing.T) { + for i, test := range pkcs1MismatchKeyTests { + derBytes, _ := hex.DecodeString(test.hexKey) + _, err := ParsePKCS1PrivateKey(derBytes) + if !strings.Contains(err.Error(), test.errorContains) { + t.Errorf("#%d: expected error containing %q, got %s", i, test.errorContains, err) + } + } +} diff --git a/libgo/go/crypto/x509/x509_test_import.go b/libgo/go/crypto/x509/x509_test_import.go index 3fda7da188c..b778df261aa 100644 --- a/libgo/go/crypto/x509/x509_test_import.go +++ b/libgo/go/crypto/x509/x509_test_import.go @@ -15,6 +15,7 @@ import ( "crypto/x509/pkix" "encoding/pem" "math/big" + "strings" "time" ) @@ -41,7 +42,7 @@ func main() { } } -var pemPrivateKey = `-----BEGIN RSA PRIVATE KEY----- +var pemPrivateKey = testingKey(`-----BEGIN RSA TESTING KEY----- MIIBOgIBAAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0 fd7Ai2KW5ToIwzFofvJcS/STa6HA5gQenRUCAwEAAQJBAIq9amn00aS0h/CrjXqu /ThglAXJmZhOMPVn4eiu7/ROixi9sex436MaVeMqSNf7Ex9a8fRNfWss7Sqd9eWu @@ -49,5 +50,7 @@ RTUCIQDasvGASLqmjeffBNLTXV2A5g4t+kLVCpsEIZAycV5GswIhANEPLmax0ME/ EO+ZJ79TJKN5yiGBRsv5yvx5UiHxajEXAiAhAol5N4EUyq6I9w1rYdhPMGpLfk7A IU2snfRJ6Nq2CQIgFrPsWRCkV+gOYcajD17rEqmuLrdIRexpg8N1DOSXoJ8CIGlS tAboUGBxTDq3ZroNism3DaMIbKPyYrAqhKov1h5V ------END RSA PRIVATE KEY----- -` +-----END RSA TESTING KEY----- +`) + +func testingKey(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") } diff --git a/libgo/go/database/sql/convert.go b/libgo/go/database/sql/convert.go index c450d987a46..4c056a1edad 100644 --- a/libgo/go/database/sql/convert.go +++ b/libgo/go/database/sql/convert.go @@ -98,10 +98,12 @@ func defaultCheckNamedValue(nv *driver.NamedValue) (err error) { return err } -// driverArgs converts arguments from callers of Stmt.Exec and +// driverArgsConnLocked converts arguments from callers of Stmt.Exec and // Stmt.Query into driver Values. // // The statement ds may be nil, if no statement is available. +// +// ci must be locked. func driverArgsConnLocked(ci driver.Conn, ds *driverStmt, args []interface{}) ([]driver.NamedValue, error) { nvargs := make([]driver.NamedValue, len(args)) @@ -286,6 +288,11 @@ func convertAssignRows(dest, src interface{}, rows *Rows) error { *d = s.AppendFormat((*d)[:0], time.RFC3339Nano) return nil } + case decimalDecompose: + switch d := dest.(type) { + case decimalCompose: + return d.Compose(s.Decompose(nil)) + } case nil: switch d := dest.(type) { case *interface{}: @@ -420,6 +427,9 @@ func convertAssignRows(dest, src interface{}, rows *Rows) error { dv.Set(reflect.New(dv.Type().Elem())) return convertAssignRows(dv.Interface(), src, rows) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if src == nil { + return fmt.Errorf("converting NULL to %s is unsupported", dv.Kind()) + } s := asString(src) i64, err := strconv.ParseInt(s, 10, dv.Type().Bits()) if err != nil { @@ -429,6 +439,9 @@ func convertAssignRows(dest, src interface{}, rows *Rows) error { dv.SetInt(i64) return nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if src == nil { + return fmt.Errorf("converting NULL to %s is unsupported", dv.Kind()) + } s := asString(src) u64, err := strconv.ParseUint(s, 10, dv.Type().Bits()) if err != nil { @@ -438,6 +451,9 @@ func convertAssignRows(dest, src interface{}, rows *Rows) error { dv.SetUint(u64) return nil case reflect.Float32, reflect.Float64: + if src == nil { + return fmt.Errorf("converting NULL to %s is unsupported", dv.Kind()) + } s := asString(src) f64, err := strconv.ParseFloat(s, dv.Type().Bits()) if err != nil { @@ -447,6 +463,9 @@ func convertAssignRows(dest, src interface{}, rows *Rows) error { dv.SetFloat(f64) return nil case reflect.String: + if src == nil { + return fmt.Errorf("converting NULL to %s is unsupported", dv.Kind()) + } switch v := src.(type) { case string: dv.SetString(v) @@ -539,3 +558,42 @@ func callValuerValue(vr driver.Valuer) (v driver.Value, err error) { } return vr.Value() } + +// decimal composes or decomposes a decimal value to and from individual parts. +// There are four parts: a boolean negative flag, a form byte with three possible states +// (finite=0, infinite=1, NaN=2), a base-2 big-endian integer +// coefficient (also known as a significand) as a []byte, and an int32 exponent. +// These are composed into a final value as "decimal = (neg) (form=finite) coefficient * 10 ^ exponent". +// A zero length coefficient is a zero value. +// The big-endian integer coefficent stores the most significant byte first (at coefficent[0]). +// If the form is not finite the coefficient and exponent should be ignored. +// The negative parameter may be set to true for any form, although implementations are not required +// to respect the negative parameter in the non-finite form. +// +// Implementations may choose to set the negative parameter to true on a zero or NaN value, +// but implementations that do not differentiate between negative and positive +// zero or NaN values should ignore the negative parameter without error. +// If an implementation does not support Infinity it may be converted into a NaN without error. +// If a value is set that is larger than what is supported by an implementation, +// an error must be returned. +// Implementations must return an error if a NaN or Infinity is attempted to be set while neither +// are supported. +// +// NOTE(kardianos): This is an experimental interface. See https://golang.org/issue/30870 +type decimal interface { + decimalDecompose + decimalCompose +} + +type decimalDecompose interface { + // Decompose returns the internal decimal state in parts. + // If the provided buf has sufficient capacity, buf may be returned as the coefficient with + // the value set and length set as appropriate. + Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) +} + +type decimalCompose interface { + // Compose sets the internal decimal value from parts. If the value cannot be + // represented then an error should be returned. + Compose(form byte, negative bool, coefficient []byte, exponent int32) error +} diff --git a/libgo/go/database/sql/convert_test.go b/libgo/go/database/sql/convert_test.go index b0aff7b1685..8a82891c253 100644 --- a/libgo/go/database/sql/convert_test.go +++ b/libgo/go/database/sql/convert_test.go @@ -439,7 +439,7 @@ func TestDriverArgs(t *testing.T) { 0: { args: []interface{}{Valuer_V("foo")}, want: []driver.NamedValue{ - driver.NamedValue{ + { Ordinal: 1, Value: "FOO", }, @@ -448,7 +448,7 @@ func TestDriverArgs(t *testing.T) { 1: { args: []interface{}{nilValuerVPtr}, want: []driver.NamedValue{ - driver.NamedValue{ + { Ordinal: 1, Value: nil, }, @@ -457,7 +457,7 @@ func TestDriverArgs(t *testing.T) { 2: { args: []interface{}{nilValuerPPtr}, want: []driver.NamedValue{ - driver.NamedValue{ + { Ordinal: 1, Value: "nil-to-str", }, @@ -466,7 +466,7 @@ func TestDriverArgs(t *testing.T) { 3: { args: []interface{}{"plain-str"}, want: []driver.NamedValue{ - driver.NamedValue{ + { Ordinal: 1, Value: "plain-str", }, @@ -475,7 +475,7 @@ func TestDriverArgs(t *testing.T) { 4: { args: []interface{}{nilStrPtr}, want: []driver.NamedValue{ - driver.NamedValue{ + { Ordinal: 1, Value: nil, }, @@ -494,3 +494,107 @@ func TestDriverArgs(t *testing.T) { } } } + +type dec struct { + form byte + neg bool + coefficient [16]byte + exponent int32 +} + +func (d dec) Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) { + coef := make([]byte, 16) + copy(coef, d.coefficient[:]) + return d.form, d.neg, coef, d.exponent +} + +func (d *dec) Compose(form byte, negative bool, coefficient []byte, exponent int32) error { + switch form { + default: + return fmt.Errorf("unknown form %d", form) + case 1, 2: + d.form = form + d.neg = negative + return nil + case 0: + } + d.form = form + d.neg = negative + d.exponent = exponent + + // This isn't strictly correct, as the extra bytes could be all zero, + // ignore this for this test. + if len(coefficient) > 16 { + return fmt.Errorf("coefficent too large") + } + copy(d.coefficient[:], coefficient) + + return nil +} + +type decFinite struct { + neg bool + coefficient [16]byte + exponent int32 +} + +func (d decFinite) Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) { + coef := make([]byte, 16) + copy(coef, d.coefficient[:]) + return 0, d.neg, coef, d.exponent +} + +func (d *decFinite) Compose(form byte, negative bool, coefficient []byte, exponent int32) error { + switch form { + default: + return fmt.Errorf("unknown form %d", form) + case 1, 2: + return fmt.Errorf("unsupported form %d", form) + case 0: + } + d.neg = negative + d.exponent = exponent + + // This isn't strictly correct, as the extra bytes could be all zero, + // ignore this for this test. + if len(coefficient) > 16 { + return fmt.Errorf("coefficent too large") + } + copy(d.coefficient[:], coefficient) + + return nil +} + +func TestDecimal(t *testing.T) { + list := []struct { + name string + in decimalDecompose + out dec + err bool + }{ + {name: "same", in: dec{exponent: -6}, out: dec{exponent: -6}}, + + // Ensure reflection is not used to assign the value by using different types. + {name: "diff", in: decFinite{exponent: -6}, out: dec{exponent: -6}}, + + {name: "bad-form", in: dec{form: 200}, err: true}, + } + for _, item := range list { + t.Run(item.name, func(t *testing.T) { + out := dec{} + err := convertAssign(&out, item.in) + if item.err { + if err == nil { + t.Fatalf("unexpected nil error") + } + return + } + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if !reflect.DeepEqual(out, item.out) { + t.Fatalf("got %#v want %#v", out, item.out) + } + }) + } +} diff --git a/libgo/go/database/sql/driver/driver.go b/libgo/go/database/sql/driver/driver.go index ecc6547bf37..316e7cea375 100644 --- a/libgo/go/database/sql/driver/driver.go +++ b/libgo/go/database/sql/driver/driver.go @@ -26,7 +26,7 @@ import ( // time.Time // // If the driver supports cursors, a returned Value may also implement the Rows interface -// in this package. This is used when, for example, when a user selects a cursor +// in this package. This is used, for example, when a user selects a cursor // such as "select cursor(select * from my_table) from dual". If the Rows // from the select is closed, the cursor Rows will also be closed. type Value interface{} diff --git a/libgo/go/database/sql/driver/types.go b/libgo/go/database/sql/driver/types.go index 8b3cb6c8f61..24c3a454836 100644 --- a/libgo/go/database/sql/driver/types.go +++ b/libgo/go/database/sql/driver/types.go @@ -38,6 +38,7 @@ type ValueConverter interface { // themselves to a driver Value. type Valuer interface { // Value returns a driver Value. + // Value must not panic. Value() (Value, error) } @@ -179,6 +180,8 @@ func IsValue(v interface{}) bool { switch v.(type) { case []byte, bool, float64, int64, string, time.Time: return true + case decimalDecompose: + return true } return false } @@ -235,7 +238,8 @@ func (defaultConverter) ConvertValue(v interface{}) (Value, error) { return v, nil } - if vr, ok := v.(Valuer); ok { + switch vr := v.(type) { + case Valuer: sv, err := callValuerValue(vr) if err != nil { return nil, err @@ -244,6 +248,10 @@ func (defaultConverter) ConvertValue(v interface{}) (Value, error) { return nil, fmt.Errorf("non-Value type %T returned from Value", sv) } return sv, nil + + // For now, continue to prefer the Valuer interface over the decimal decompose interface. + case decimalDecompose: + return vr, nil } rv := reflect.ValueOf(v) @@ -280,3 +288,10 @@ func (defaultConverter) ConvertValue(v interface{}) (Value, error) { } return nil, fmt.Errorf("unsupported type %T, a %s", v, rv.Kind()) } + +type decimalDecompose interface { + // Decompose returns the internal decimal state into parts. + // If the provided buf has sufficient capacity, buf may be returned as the coefficient with + // the value set and length set as appropriate. + Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) +} diff --git a/libgo/go/database/sql/driver/types_test.go b/libgo/go/database/sql/driver/types_test.go index 0379bf8892f..4c2996da85f 100644 --- a/libgo/go/database/sql/driver/types_test.go +++ b/libgo/go/database/sql/driver/types_test.go @@ -57,6 +57,7 @@ var valueConverterTests = []valueConverterTest{ {DefaultParameterConverter, bs{1}, []byte{1}, ""}, {DefaultParameterConverter, s("a"), "a", ""}, {DefaultParameterConverter, is{1}, nil, "unsupported type driver.is, a slice of int"}, + {DefaultParameterConverter, dec{exponent: -6}, dec{exponent: -6}, ""}, } func TestValueConverters(t *testing.T) { @@ -79,3 +80,16 @@ func TestValueConverters(t *testing.T) { } } } + +type dec struct { + form byte + neg bool + coefficient [16]byte + exponent int32 +} + +func (d dec) Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) { + coef := make([]byte, 16) + copy(coef, d.coefficient[:]) + return d.form, d.neg, coef, d.exponent +} diff --git a/libgo/go/database/sql/fakedb_test.go b/libgo/go/database/sql/fakedb_test.go index dcdd264baa8..c0371f3e784 100644 --- a/libgo/go/database/sql/fakedb_test.go +++ b/libgo/go/database/sql/fakedb_test.go @@ -1141,6 +1141,8 @@ func converterForType(typ string) driver.ValueConverter { return driver.Null{Converter: driver.Bool} case "int32": return driver.Int32 + case "nullint32": + return driver.Null{Converter: driver.DefaultParameterConverter} case "string": return driver.NotNull{Converter: fakeDriverString{}} case "nullstring": @@ -1158,7 +1160,9 @@ func converterForType(typ string) driver.ValueConverter { // TODO(coopernurse): add type-specific converter return driver.Null{Converter: driver.DefaultParameterConverter} case "datetime": - return driver.DefaultParameterConverter + return driver.NotNull{Converter: driver.DefaultParameterConverter} + case "nulldatetime": + return driver.Null{Converter: driver.DefaultParameterConverter} case "any": return anyTypeConverter{} } @@ -1173,6 +1177,8 @@ func colTypeToReflectType(typ string) reflect.Type { return reflect.TypeOf(NullBool{}) case "int32": return reflect.TypeOf(int32(0)) + case "nullint32": + return reflect.TypeOf(NullInt32{}) case "string": return reflect.TypeOf("") case "nullstring": diff --git a/libgo/go/database/sql/sql.go b/libgo/go/database/sql/sql.go index 8cdc903c680..5c5b7dc7e97 100644 --- a/libgo/go/database/sql/sql.go +++ b/libgo/go/database/sql/sql.go @@ -8,7 +8,7 @@ // The sql package must be used in conjunction with a database driver. // See https://golang.org/s/sqldrivers for a list of drivers. // -// Drivers that do not support context cancelation will not return until +// Drivers that do not support context cancellation will not return until // after the query is completed. // // For usage examples, see the wiki page at @@ -234,6 +234,32 @@ func (n NullInt64) Value() (driver.Value, error) { return n.Int64, nil } +// NullInt32 represents an int32 that may be null. +// NullInt32 implements the Scanner interface so +// it can be used as a scan destination, similar to NullString. +type NullInt32 struct { + Int32 int32 + Valid bool // Valid is true if Int32 is not NULL +} + +// Scan implements the Scanner interface. +func (n *NullInt32) Scan(value interface{}) error { + if value == nil { + n.Int32, n.Valid = 0, false + return nil + } + n.Valid = true + return convertAssign(&n.Int32, value) +} + +// Value implements the driver Valuer interface. +func (n NullInt32) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + return int64(n.Int32), nil +} + // NullFloat64 represents a float64 that may be null. // NullFloat64 implements the Scanner interface so // it can be used as a scan destination, similar to NullString. @@ -286,6 +312,32 @@ func (n NullBool) Value() (driver.Value, error) { return n.Bool, nil } +// NullTime represents a time.Time that may be null. +// NullTime implements the Scanner interface so +// it can be used as a scan destination, similar to NullString. +type NullTime struct { + Time time.Time + Valid bool // Valid is true if Time is not NULL +} + +// Scan implements the Scanner interface. +func (n *NullTime) Scan(value interface{}) error { + if value == nil { + n.Time, n.Valid = time.Time{}, false + return nil + } + n.Valid = true + return convertAssign(&n.Time, value) +} + +// Value implements the driver Valuer interface. +func (n NullTime) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + return n.Time, nil +} + // Scanner is an interface used by Scan. type Scanner interface { // Scan assigns a value from a database driver. @@ -1740,6 +1792,8 @@ type Conn struct { done int32 } +// grabConn takes a context to implement stmtConnGrabber +// but the context is not used. func (c *Conn) grabConn(context.Context) (*driverConn, releaseConn, error) { if atomic.LoadInt32(&c.done) != 0 { return nil, nil, ErrConnDone @@ -1804,6 +1858,39 @@ func (c *Conn) PrepareContext(ctx context.Context, query string) (*Stmt, error) return c.db.prepareDC(ctx, dc, release, c, query) } +// Raw executes f exposing the underlying driver connection for the +// duration of f. The driverConn must not be used outside of f. +// +// Once f returns and err is nil, the Conn will continue to be usable +// until Conn.Close is called. +func (c *Conn) Raw(f func(driverConn interface{}) error) (err error) { + var dc *driverConn + var release releaseConn + + // grabConn takes a context to implement stmtConnGrabber, but the context is not used. + dc, release, err = c.grabConn(nil) + if err != nil { + return + } + fPanic := true + dc.Mutex.Lock() + defer func() { + dc.Mutex.Unlock() + + // If f panics fPanic will remain true. + // Ensure an error is passed to release so the connection + // may be discarded. + if fPanic { + err = driver.ErrBadConn + } + release(err) + }() + err = f(dc.ci) + fPanic = false + + return +} + // BeginTx starts a transaction. // // The provided context is used until the transaction is committed or rolled back. diff --git a/libgo/go/database/sql/sql_test.go b/libgo/go/database/sql/sql_test.go index 64b9dfea5c2..f68cefe43ae 100644 --- a/libgo/go/database/sql/sql_test.go +++ b/libgo/go/database/sql/sql_test.go @@ -131,6 +131,7 @@ func TestDriverPanic(t *testing.T) { } func exec(t testing.TB, db *DB, query string, args ...interface{}) { + t.Helper() _, err := db.Exec(query, args...) if err != nil { t.Fatalf("Exec of %q: %v", query, err) @@ -1338,6 +1339,54 @@ func TestConnQuery(t *testing.T) { } } +func TestConnRaw(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + conn, err := db.Conn(ctx) + if err != nil { + t.Fatal(err) + } + conn.dc.ci.(*fakeConn).skipDirtySession = true + defer conn.Close() + + sawFunc := false + err = conn.Raw(func(dc interface{}) error { + sawFunc = true + if _, ok := dc.(*fakeConn); !ok { + return fmt.Errorf("got %T want *fakeConn", dc) + } + return nil + }) + if err != nil { + t.Fatal(err) + } + if !sawFunc { + t.Fatal("Raw func not called") + } + + func() { + defer func() { + x := recover() + if x == nil { + t.Fatal("expected panic") + } + conn.closemu.Lock() + closed := conn.dc == nil + conn.closemu.Unlock() + if !closed { + t.Fatal("expected connection to be closed after panic") + } + }() + err = conn.Raw(func(dc interface{}) error { + panic("Conn.Raw panic should return an error") + }) + t.Fatal("expected panic from Raw func") + }() +} + func TestCursorFake(t *testing.T) { db := newTestDB(t, "people") defer closeDB(t, db) @@ -1401,7 +1450,7 @@ func TestInvalidNilValues(t *testing.T) { { name: "int", input: &date2, - expectedError: `sql: Scan error on column index 0, name "bdate": converting driver.Value type ("") to a int: invalid syntax`, + expectedError: `sql: Scan error on column index 0, name "bdate": converting NULL to int is unsupported`, }, } @@ -1671,6 +1720,18 @@ func TestNullInt64Param(t *testing.T) { nullTestRun(t, spec) } +func TestNullInt32Param(t *testing.T) { + spec := nullTestSpec{"nullint32", "int32", [6]nullTestRow{ + {NullInt32{31, true}, 1, NullInt32{31, true}}, + {NullInt32{-22, false}, 1, NullInt32{0, false}}, + {22, 1, NullInt32{22, true}}, + {NullInt32{33, true}, 1, NullInt32{33, true}}, + {NullInt32{222, false}, 1, NullInt32{0, false}}, + {0, NullInt32{31, false}, nil}, + }} + nullTestRun(t, spec) +} + func TestNullFloat64Param(t *testing.T) { spec := nullTestSpec{"nullfloat64", "float64", [6]nullTestRow{ {NullFloat64{31.2, true}, 1, NullFloat64{31.2, true}}, @@ -1695,6 +1756,21 @@ func TestNullBoolParam(t *testing.T) { nullTestRun(t, spec) } +func TestNullTimeParam(t *testing.T) { + t0 := time.Time{} + t1 := time.Date(2000, 1, 1, 8, 9, 10, 11, time.UTC) + t2 := time.Date(2010, 1, 1, 8, 9, 10, 11, time.UTC) + spec := nullTestSpec{"nulldatetime", "datetime", [6]nullTestRow{ + {NullTime{t1, true}, t2, NullTime{t1, true}}, + {NullTime{t1, false}, t2, NullTime{t0, false}}, + {t1, t2, NullTime{t1, true}}, + {NullTime{t1, true}, t2, NullTime{t1, true}}, + {NullTime{t1, false}, t2, NullTime{t0, false}}, + {t2, NullTime{t1, false}, nil}, + }} + nullTestRun(t, spec) +} + func nullTestRun(t *testing.T, spec nullTestSpec) { db := newTestDB(t, "") defer closeDB(t, db) @@ -3530,7 +3606,7 @@ type nvcConn struct { skipNamedValueCheck bool } -type decimal struct { +type decimalInt struct { value int } @@ -3554,7 +3630,7 @@ func (c *nvcConn) CheckNamedValue(nv *driver.NamedValue) error { nv.Value = "OUT:*string" } return nil - case decimal, []int64: + case decimalInt, []int64: return nil case doNotInclude: return driver.ErrRemoveArgument @@ -3583,13 +3659,13 @@ func TestNamedValueChecker(t *testing.T) { } o1 := "" - _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A,str1=?,out1=?O1,array1=?", Named("A", decimal{123}), "hello", Named("O1", Out{Dest: &o1}), []int64{42, 128, 707}, doNotInclude{}) + _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A,str1=?,out1=?O1,array1=?", Named("A", decimalInt{123}), "hello", Named("O1", Out{Dest: &o1}), []int64{42, 128, 707}, doNotInclude{}) if err != nil { t.Fatal("exec insert", err) } var ( str1 string - dec1 decimal + dec1 decimalInt arr1 []int64 ) err = db.QueryRowContext(ctx, "SELECT|keys|dec1,str1,array1|").Scan(&dec1, &str1, &arr1) @@ -3599,7 +3675,7 @@ func TestNamedValueChecker(t *testing.T) { list := []struct{ got, want interface{} }{ {o1, "from-server"}, - {dec1, decimal{123}}, + {dec1, decimalInt{123}}, {str1, "hello"}, {arr1, []int64{42, 128, 707}}, } @@ -3632,7 +3708,7 @@ func TestNamedValueCheckerSkip(t *testing.T) { t.Fatal("exec create", err) } - _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A", Named("A", decimal{123})) + _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A", Named("A", decimalInt{123})) if err == nil { t.Fatalf("expected error with bad argument, got %v", err) } diff --git a/libgo/go/debug/dwarf/testdata/cppunsuptypes.cc b/libgo/go/debug/dwarf/testdata/cppunsuptypes.cc new file mode 100644 index 00000000000..e9281c7dec7 --- /dev/null +++ b/libgo/go/debug/dwarf/testdata/cppunsuptypes.cc @@ -0,0 +1,34 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// cppunsuptypes.elf built with g++ 7.3 +// g++ -g -c -o cppunsuptypes.elf cppunsuptypes.cc + +int i = 3; +double d = 3; + +// anonymous reference type +int &culprit = i; + +// named reference type +typedef double &dref; +dref dr = d; + +// incorporated into another type +typedef struct { + dref q; + int &r; +} hasrefs; + +hasrefs hr = { d, i }; + +// This code is intended to trigger a DWARF "pointer to member" type DIE +struct CS { int dm; }; + +int foo() +{ + int CS::* pdm = &CS::dm; + CS cs = {42}; + return cs.*pdm; +} diff --git a/libgo/go/debug/dwarf/testdata/cppunsuptypes.elf b/libgo/go/debug/dwarf/testdata/cppunsuptypes.elf new file mode 100644 index 0000000000000000000000000000000000000000..e955512ecd0227f5564ab4d1a29c054d636742d9 GIT binary patch literal 3920 zcmbVP&2Jl35TCc3CU%{;PTZ!ALZ}-RK`B|c5Zbh;txFo30OC;814SWS+nd-B+hKQI zQUv0F0HK1EUigrT1P7#w8#j(X1%+ELNWhIl{{W;Of;hm;?u`BXvZWFu?Rzu7`FykQ zy|v$(d-f?yDG*X{61tM002}EpUy9fg?1oV|KmY#i`I~c_1l^pw^Ds{HSLQb7KRkbD zUfsF^i#H-;u;YoxRH;Y&58*Tx(--MeQCTssIZSH2RRlF!Ph{CCaQp1@(5J?!f$3@k)OZOwfD8?4g2oaJOtM;a?HIOWaE(0n5^G(p z4ORkBg+I{Jx>|)HVoLa^Nl?S;fowiwXUDU{YGfd{8%?IcP94uYky*%}8ngBQ*!v-q zIhnCj*l%XD0NcI9#`g>26&I~D6mn{m{s zu{dfoyO5`fN_#$ja*T9?-Lj~tp}jDXU&ud=EIfjbg%9;qCuxa}5q}0B3m(K#slT&B zI7ZtXd!?YVw$^S2?X~donin{g3fW`Xad_nH3H8j|?Vl|Rz0N*&zA$_6;Nj`QQRgw| zP+_VOwwvCG6|d>}^$LovU#Xo~pE)vhWV$f50!M3Z;Cssf6oa7pXmO=g4E##5>Xq9o z#p-LWzg!HxAgsEf3stm(62> zcbjo#Q;#2r8CuIu8j#fM=RmFJ)cD{)Y6I7PA7b|dJ``&PO5Khx$JwF#3zP)x4GhV;z!tOz3GVy)&owZ)o6J5OT=lmLeIgE%2W`# zl~*{BS6f>4-G=N2UhMyv#?gm*Cw-R?C1xfC;F)Z7+J^#Ro!=*{tnsYxaf0--NiuzJ z2{ZlINtr-q{=;aKlwbVsm7jhk&@EZQN2eKXh@1zyXUR_Lr(YOE3-~1E--xu`eaqsO zJMIiBlJeIQ@)Km{e+euG8-Y)1UsP dCM`9^`+o}cI+^RIZ*P+Sx18vf?u@+Y|1bX320;J- literal 0 HcmV?d00001 diff --git a/libgo/go/debug/dwarf/type.go b/libgo/go/debug/dwarf/type.go index 4352092ed0d..316db258f65 100644 --- a/libgo/go/debug/dwarf/type.go +++ b/libgo/go/debug/dwarf/type.go @@ -261,6 +261,20 @@ func (t *TypedefType) String() string { return t.Name } func (t *TypedefType) Size() int64 { return t.Type.Size() } +// An UnsupportedType is a placeholder returned in situations where we +// encounter a type that isn't supported. +type UnsupportedType struct { + CommonType + Tag Tag +} + +func (t *UnsupportedType) String() string { + if t.Name != "" { + return t.Name + } + return t.Name + "(unsupported type " + t.Tag.String() + ")" +} + // typeReader is used to read from either the info section or the // types section. type typeReader interface { @@ -680,6 +694,16 @@ func (d *Data) readType(name string, r typeReader, off Offset, typeCache map[Off typ = t typeCache[off] = t t.Name, _ = e.Val(AttrName).(string) + + default: + // This is some other type DIE that we're currently not + // equipped to handle. Return an abstract "unsupported type" + // object in such cases. + t := new(UnsupportedType) + typ = t + typeCache[off] = t + t.Tag = e.Tag + t.Name, _ = e.Val(AttrName).(string) } if err != nil { diff --git a/libgo/go/debug/dwarf/type_test.go b/libgo/go/debug/dwarf/type_test.go index 6c06731ea18..aa2fbeca0b3 100644 --- a/libgo/go/debug/dwarf/type_test.go +++ b/libgo/go/debug/dwarf/type_test.go @@ -9,6 +9,8 @@ import ( "debug/elf" "debug/macho" "debug/pe" + "fmt" + "strconv" "testing" ) @@ -168,3 +170,61 @@ func TestTypedefCycle(t *testing.T) { } } } + +var unsupportedTypeTests = []string{ + // varname:typename:string:size + "culprit::(unsupported type ReferenceType):8", + "pdm::(unsupported type PtrToMemberType):-1", +} + +func TestUnsupportedTypes(t *testing.T) { + // Issue 29601: + // When reading DWARF from C++ load modules, we can encounter + // oddball type DIEs. These will be returned as "UnsupportedType" + // objects; check to make sure this works properly. + d := elfData(t, "testdata/cppunsuptypes.elf") + r := d.Reader() + seen := make(map[string]bool) + for { + e, err := r.Next() + if err != nil { + t.Fatal("r.Next:", err) + } + if e == nil { + break + } + if e.Tag == TagVariable { + vname, _ := e.Val(AttrName).(string) + tAttr := e.Val(AttrType) + typOff, ok := tAttr.(Offset) + if !ok { + t.Errorf("variable at offset %v has no type", e.Offset) + continue + } + typ, err := d.Type(typOff) + if err != nil { + t.Errorf("err in type decode: %v\n", err) + continue + } + unsup, isok := typ.(*UnsupportedType) + if !isok { + continue + } + tag := vname + ":" + unsup.Name + ":" + unsup.String() + + ":" + strconv.FormatInt(unsup.Size(), 10) + seen[tag] = true + } + } + dumpseen := false + for _, v := range unsupportedTypeTests { + if !seen[v] { + t.Errorf("missing %s", v) + dumpseen = true + } + } + if dumpseen { + for k, _ := range seen { + fmt.Printf("seen: %s\n", k) + } + } +} diff --git a/libgo/go/debug/elf/file.go b/libgo/go/debug/elf/file.go index bd6146437c9..1a5424f54e8 100644 --- a/libgo/go/debug/elf/file.go +++ b/libgo/go/debug/elf/file.go @@ -276,7 +276,6 @@ func NewFile(r io.ReaderAt) (*File, error) { var phentsize, phnum int var shoff int64 var shentsize, shnum, shstrndx int - shstrndx = -1 switch f.Class { case ELFCLASS32: hdr := new(Header32) @@ -318,7 +317,11 @@ func NewFile(r io.ReaderAt) (*File, error) { shstrndx = int(hdr.Shstrndx) } - if shnum > 0 && shoff > 0 && (shstrndx < 0 || shstrndx >= shnum) { + if shoff == 0 && shnum != 0 { + return nil, &FormatError{0, "invalid ELF shnum for shoff=0", shnum} + } + + if shnum > 0 && shstrndx >= shnum { return nil, &FormatError{0, "invalid ELF shstrndx", shstrndx} } diff --git a/libgo/go/debug/elf/file_test.go b/libgo/go/debug/elf/file_test.go index d7c1e9f800d..b826a0ff050 100644 --- a/libgo/go/debug/elf/file_test.go +++ b/libgo/go/debug/elf/file_test.go @@ -810,3 +810,14 @@ func TestNoSectionOverlaps(t *testing.T) { } } } + +func TestIssue10996(t *testing.T) { + data := []byte("\u007fELF\x02\x01\x010000000000000" + + "\x010000000000000000000" + + "\x00\x00\x00\x00\x00\x00\x00\x0000000000\x00\x00\x00\x00" + + "0000") + _, err := NewFile(bytes.NewReader(data)) + if err == nil { + t.Fatalf("opening invalid ELF file unexpectedly suceeded") + } +} diff --git a/libgo/go/debug/gosym/pclntab.go b/libgo/go/debug/gosym/pclntab.go index ad99b4dc5a6..7e54a943510 100644 --- a/libgo/go/debug/gosym/pclntab.go +++ b/libgo/go/debug/gosym/pclntab.go @@ -93,7 +93,8 @@ func (t *LineTable) slice(pc uint64) *LineTable { } // PCToLine returns the line number for the given program counter. -// Callers should use Table's PCToLine method instead. +// +// Deprecated: Use Table's PCToLine method instead. func (t *LineTable) PCToLine(pc uint64) int { if t.isGo12() { return t.go12PCToLine(pc) @@ -104,7 +105,8 @@ func (t *LineTable) PCToLine(pc uint64) int { // LineToPC returns the program counter for the given line number, // considering only program counters before maxpc. -// Callers should use Table's LineToPC method instead. +// +// Deprecated: Use Table's LineToPC method instead. func (t *LineTable) LineToPC(line int, maxpc uint64) uint64 { if t.isGo12() { return 0 diff --git a/libgo/go/debug/gosym/pclntab_test.go b/libgo/go/debug/gosym/pclntab_test.go index d21f0e24a83..6baa53defd1 100644 --- a/libgo/go/debug/gosym/pclntab_test.go +++ b/libgo/go/debug/gosym/pclntab_test.go @@ -55,7 +55,7 @@ func endtest() { // These tests open and examine the test binary, and use elf.Open to do so. func skipIfNotELF(t *testing.T) { switch runtime.GOOS { - case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris": + case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris", "illumos": // OK. default: t.Skipf("skipping on non-ELF system %s", runtime.GOOS) @@ -196,6 +196,9 @@ func TestLineAline(t *testing.T) { } func TestPCLine(t *testing.T) { + if testing.Short() { + t.Skip("skipping in -short mode") + } dotest(t) defer endtest() diff --git a/libgo/go/debug/gosym/symtab.go b/libgo/go/debug/gosym/symtab.go index a84b7f6def1..3be612e1df7 100644 --- a/libgo/go/debug/gosym/symtab.go +++ b/libgo/go/debug/gosym/symtab.go @@ -35,13 +35,21 @@ func (s *Sym) Static() bool { return s.Type >= 'a' } // PackageName returns the package part of the symbol name, // or the empty string if there is none. func (s *Sym) PackageName() string { - pathend := strings.LastIndex(s.Name, "/") + name := s.Name + + // A prefix of "type." and "go." is a compiler-generated symbol that doesn't belong to any package. + // See variable reservedimports in cmd/compile/internal/gc/subr.go + if strings.HasPrefix(name, "go.") || strings.HasPrefix(name, "type.") { + return "" + } + + pathend := strings.LastIndex(name, "/") if pathend < 0 { pathend = 0 } - if i := strings.Index(s.Name[pathend:], "."); i != -1 { - return s.Name[:pathend+i] + if i := strings.Index(name[pathend:], "."); i != -1 { + return name[:pathend+i] } return "" } diff --git a/libgo/go/debug/gosym/symtab_test.go b/libgo/go/debug/gosym/symtab_test.go index 08e86336b8e..b6ed8f554c5 100644 --- a/libgo/go/debug/gosym/symtab_test.go +++ b/libgo/go/debug/gosym/symtab_test.go @@ -41,3 +41,18 @@ func TestRemotePackage(t *testing.T) { assertString(t, fmt.Sprintf("receiver of %q", s1.Name), s1.ReceiverName(), "(*FlagSet)") assertString(t, fmt.Sprintf("receiver of %q", s2.Name), s2.ReceiverName(), "") } + +func TestIssue29551(t *testing.T) { + symNames := []string{ + "type..eq.[9]debug/elf.intName", + "type..hash.debug/elf.ProgHeader", + "type..eq.runtime._panic", + "type..hash.struct { runtime.gList; runtime.n int32 }", + "go.(*struct { sync.Mutex; math/big.table [64]math/big", + } + + for _, symName := range symNames { + s := Sym{Name: symName} + assertString(t, fmt.Sprintf("package of %q", s.Name), s.PackageName(), "") + } +} diff --git a/libgo/go/debug/macho/file_test.go b/libgo/go/debug/macho/file_test.go index 003c14e69b1..28b76f93d7a 100644 --- a/libgo/go/debug/macho/file_test.go +++ b/libgo/go/debug/macho/file_test.go @@ -154,7 +154,7 @@ var fileTests = []fileTest{ nil, nil, map[string][]Reloc{ - "__text": []Reloc{ + "__text": { { Addr: 0x1d, Type: uint8(GENERIC_RELOC_VANILLA), @@ -189,7 +189,7 @@ var fileTests = []fileTest{ nil, nil, map[string][]Reloc{ - "__text": []Reloc{ + "__text": { { Addr: 0x19, Type: uint8(X86_64_RELOC_BRANCH), @@ -207,7 +207,7 @@ var fileTests = []fileTest{ Value: 2, }, }, - "__compact_unwind": []Reloc{ + "__compact_unwind": { { Addr: 0x0, Type: uint8(X86_64_RELOC_UNSIGNED), diff --git a/libgo/go/debug/macho/macho.go b/libgo/go/debug/macho/macho.go index 7bc1950bfdb..49e107eed3d 100644 --- a/libgo/go/debug/macho/macho.go +++ b/libgo/go/debug/macho/macho.go @@ -3,7 +3,12 @@ // license that can be found in the LICENSE file. // Mach-O header data structures -// http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html +// Originally at: +// http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html (since deleted by Apply) +// Archived copy at: +// https://web.archive.org/web/20090819232456/http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/index.html +// For cloned PDF see: +// https://github.com/aidansteele/osx-abi-macho-file-format-reference package macho diff --git a/libgo/go/debug/pe/file.go b/libgo/go/debug/pe/file.go index 1c308b3dc3b..58814162bcf 100644 --- a/libgo/go/debug/pe/file.go +++ b/libgo/go/debug/pe/file.go @@ -324,6 +324,10 @@ type ImportDirectory struct { // satisfied by other libraries at dynamic load time. // It does not return weak symbols. func (f *File) ImportedSymbols() ([]string, error) { + if f.OptionalHeader == nil { + return nil, nil + } + pe64 := f.Machine == IMAGE_FILE_MACHINE_AMD64 // grab the number of data directory entries @@ -373,7 +377,7 @@ func (f *File) ImportedSymbols() ([]string, error) { // start decoding the import directory var ida []ImportDirectory - for len(d) > 0 { + for len(d) >= 20 { var dt ImportDirectory dt.OriginalFirstThunk = binary.LittleEndian.Uint32(d[0:4]) dt.TimeDateStamp = binary.LittleEndian.Uint32(d[4:8]) diff --git a/libgo/go/debug/pe/file_test.go b/libgo/go/debug/pe/file_test.go index 9613af3a3c3..6c7fe13caf0 100644 --- a/libgo/go/debug/pe/file_test.go +++ b/libgo/go/debug/pe/file_test.go @@ -5,6 +5,7 @@ package pe import ( + "bytes" "debug/dwarf" "internal/testenv" "io/ioutil" @@ -627,3 +628,52 @@ func TestImportTableInUnknownSection(t *testing.T) { t.Fatalf("unable to locate any imported symbols within file %q.", path) } } + +func TestInvalidFormat(t *testing.T) { + crashers := [][]byte{ + // https://golang.org/issue/30250 + []byte("\x00\x00\x00\x0000000\x00\x00\x00\x00\x00\x00\x000000" + + "00000000000000000000" + + "000000000\x00\x00\x0000000000" + + "00000000000000000000" + + "0000000000000000"), + // https://golang.org/issue/30253 + []byte("L\x01\b\x00regi\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x00\x0f\x03" + + "\v\x01\x02\x18\x00\x0e\x00\x00\x00\x1e\x00\x00\x00\x02\x00\x00\x80\x12\x00\x00" + + "\x00\x10\x00\x00\x00 \x00\x00\x00\x00@\x00\x00\x10\x00\x00\x00\x02\x00\x00" + + "\x04\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x90\x00\x00" + + "\x00\x04\x00\x00\x06S\x00\x00\x03\x00\x00\x00\x00\x00 \x00\x00\x10\x00\x00" + + "\x00\x00\x10\x00\x00\x10\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00`\x00\x00x\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x80\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb8`\x00\x00|\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00.text\x00\x00\x00d\f\x00\x00\x00\x10\x00\x00" + + "\x00\x0e\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "`\x00P`.data\x00\x00\x00\x10\x00\x00\x00\x00 \x00\x00" + + "\x00\x02\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "@\x000\xc0.rdata\x00\x004\x01\x00\x00\x000\x00\x00" + + "\x00\x02\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "@\x000@.eh_fram\xa0\x03\x00\x00\x00@\x00\x00" + + "\x00\x04\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "@\x000@.bss\x00\x00\x00\x00`\x00\x00\x00\x00P\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x80\x000\xc0.idata\x00\x00x\x03\x00\x00\x00`\x00\x00" + + "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x00" + + "0\xc0.CRT\x00\x00\x00\x00\x18\x00\x00\x00\x00p\x00\x00\x00\x02" + + "\x00\x00\x00\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x00" + + "0\xc0.tls\x00\x00\x00\x00 \x00\x00\x00\x00\x80\x00\x00\x00\x02" + + "\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x001\xc9" + + "H\x895\x1d"), + } + + for _, data := range crashers { + f, err := NewFile(bytes.NewReader(data)) + if err != nil { + t.Error(err) + } + f.ImportedSymbols() + } +} diff --git a/libgo/go/encoding/base32/base32.go b/libgo/go/encoding/base32/base32.go index 3fb6caceab4..e14d2d49871 100644 --- a/libgo/go/encoding/base32/base32.go +++ b/libgo/go/encoding/base32/base32.go @@ -284,7 +284,12 @@ func (e CorruptInputError) Error() string { // additional data is an error. This method assumes that src has been // stripped of all supported whitespace ('\r' and '\n'). func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { + // Lift the nil check outside of the loop. + _ = enc.decodeMap + + dsti := 0 olen := len(src) + for len(src) > 0 && !end { // Decode quantum using the base32 alphabet var dbuf [8]byte @@ -292,17 +297,15 @@ func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { for j := 0; j < 8; { - // We have reached the end and are missing padding - if len(src) == 0 && enc.padChar != NoPadding { - return n, false, CorruptInputError(olen - len(src) - j) - } - - // We have reached the end and are not expecing any padding - if len(src) == 0 && enc.padChar == NoPadding { + if len(src) == 0 { + if enc.padChar != NoPadding { + // We have reached the end and are missing padding + return n, false, CorruptInputError(olen - len(src) - j) + } + // We have reached the end and are not expecing any padding dlen, end = j, true break } - in := src[0] src = src[1:] if in == byte(enc.padChar) && j >= 2 && len(src) < 8 { @@ -339,37 +342,26 @@ func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { // quantum switch dlen { case 8: - dst[4] = dbuf[6]<<5 | dbuf[7] + dst[dsti+4] = dbuf[6]<<5 | dbuf[7] + n++ fallthrough case 7: - dst[3] = dbuf[4]<<7 | dbuf[5]<<2 | dbuf[6]>>3 + dst[dsti+3] = dbuf[4]<<7 | dbuf[5]<<2 | dbuf[6]>>3 + n++ fallthrough case 5: - dst[2] = dbuf[3]<<4 | dbuf[4]>>1 + dst[dsti+2] = dbuf[3]<<4 | dbuf[4]>>1 + n++ fallthrough case 4: - dst[1] = dbuf[1]<<6 | dbuf[2]<<1 | dbuf[3]>>4 + dst[dsti+1] = dbuf[1]<<6 | dbuf[2]<<1 | dbuf[3]>>4 + n++ fallthrough case 2: - dst[0] = dbuf[0]<<3 | dbuf[1]>>2 - } - - if !end { - dst = dst[5:] - } - - switch dlen { - case 2: - n += 1 - case 4: - n += 2 - case 5: - n += 3 - case 7: - n += 4 - case 8: - n += 5 + dst[dsti+0] = dbuf[0]<<3 | dbuf[1]>>2 + n++ } + dsti += 5 } return n, end, nil } diff --git a/libgo/go/encoding/base32/base32_test.go b/libgo/go/encoding/base32/base32_test.go index b74054ba402..eb14f1eb26a 100644 --- a/libgo/go/encoding/base32/base32_test.go +++ b/libgo/go/encoding/base32/base32_test.go @@ -119,7 +119,7 @@ func TestDecoder(t *testing.T) { testEqual(t, "Read from %q = length %v, want %v", p.encoded, count, len(p.decoded)) testEqual(t, "Decoding of %q = %q, want %q", p.encoded, string(dbuf[0:count]), p.decoded) if err != io.EOF { - count, err = decoder.Read(dbuf) + _, err = decoder.Read(dbuf) } testEqual(t, "Read from %q = %v, want %v", p.encoded, err, io.EOF) } @@ -539,52 +539,52 @@ func TestBufferedDecodingSameError(t *testing.T) { // NBSWY3DPO5XXE3DE == helloworld // Test with "ZZ" as extra input {"helloworld", [][]string{ - []string{"NBSW", "Y3DP", "O5XX", "E3DE", "ZZ"}, - []string{"NBSWY3DPO5XXE3DE", "ZZ"}, - []string{"NBSWY3DPO5XXE3DEZZ"}, - []string{"NBS", "WY3", "DPO", "5XX", "E3D", "EZZ"}, - []string{"NBSWY3DPO5XXE3", "DEZZ"}, + {"NBSW", "Y3DP", "O5XX", "E3DE", "ZZ"}, + {"NBSWY3DPO5XXE3DE", "ZZ"}, + {"NBSWY3DPO5XXE3DEZZ"}, + {"NBS", "WY3", "DPO", "5XX", "E3D", "EZZ"}, + {"NBSWY3DPO5XXE3", "DEZZ"}, }, io.ErrUnexpectedEOF}, // Test with "ZZY" as extra input {"helloworld", [][]string{ - []string{"NBSW", "Y3DP", "O5XX", "E3DE", "ZZY"}, - []string{"NBSWY3DPO5XXE3DE", "ZZY"}, - []string{"NBSWY3DPO5XXE3DEZZY"}, - []string{"NBS", "WY3", "DPO", "5XX", "E3D", "EZZY"}, - []string{"NBSWY3DPO5XXE3", "DEZZY"}, + {"NBSW", "Y3DP", "O5XX", "E3DE", "ZZY"}, + {"NBSWY3DPO5XXE3DE", "ZZY"}, + {"NBSWY3DPO5XXE3DEZZY"}, + {"NBS", "WY3", "DPO", "5XX", "E3D", "EZZY"}, + {"NBSWY3DPO5XXE3", "DEZZY"}, }, io.ErrUnexpectedEOF}, // Normal case, this is valid input {"helloworld", [][]string{ - []string{"NBSW", "Y3DP", "O5XX", "E3DE"}, - []string{"NBSWY3DPO5XXE3DE"}, - []string{"NBS", "WY3", "DPO", "5XX", "E3D", "E"}, - []string{"NBSWY3DPO5XXE3", "DE"}, + {"NBSW", "Y3DP", "O5XX", "E3DE"}, + {"NBSWY3DPO5XXE3DE"}, + {"NBS", "WY3", "DPO", "5XX", "E3D", "E"}, + {"NBSWY3DPO5XXE3", "DE"}, }, nil}, // MZXW6YTB = fooba {"fooba", [][]string{ - []string{"MZXW6YTBZZ"}, - []string{"MZXW6YTBZ", "Z"}, - []string{"MZXW6YTB", "ZZ"}, - []string{"MZXW6YT", "BZZ"}, - []string{"MZXW6Y", "TBZZ"}, - []string{"MZXW6Y", "TB", "ZZ"}, - []string{"MZXW6", "YTBZZ"}, - []string{"MZXW6", "YTB", "ZZ"}, - []string{"MZXW6", "YT", "BZZ"}, + {"MZXW6YTBZZ"}, + {"MZXW6YTBZ", "Z"}, + {"MZXW6YTB", "ZZ"}, + {"MZXW6YT", "BZZ"}, + {"MZXW6Y", "TBZZ"}, + {"MZXW6Y", "TB", "ZZ"}, + {"MZXW6", "YTBZZ"}, + {"MZXW6", "YTB", "ZZ"}, + {"MZXW6", "YT", "BZZ"}, }, io.ErrUnexpectedEOF}, // Normal case, this is valid input {"fooba", [][]string{ - []string{"MZXW6YTB"}, - []string{"MZXW6YT", "B"}, - []string{"MZXW6Y", "TB"}, - []string{"MZXW6", "YTB"}, - []string{"MZXW6", "YT", "B"}, - []string{"MZXW", "6YTB"}, - []string{"MZXW", "6Y", "TB"}, + {"MZXW6YTB"}, + {"MZXW6YT", "B"}, + {"MZXW6Y", "TB"}, + {"MZXW6", "YTB"}, + {"MZXW6", "YT", "B"}, + {"MZXW", "6YTB"}, + {"MZXW", "6Y", "TB"}, }, nil}, } diff --git a/libgo/go/encoding/base64/base64.go b/libgo/go/encoding/base64/base64.go index 0bb37b311a0..082210198f3 100644 --- a/libgo/go/encoding/base64/base64.go +++ b/libgo/go/encoding/base64/base64.go @@ -123,6 +123,10 @@ func (enc *Encoding) Encode(dst, src []byte) { if len(src) == 0 { return } + // enc is a pointer receiver, so the use of enc.encode within the hot + // loop below means a nil check at every operation. Lift that nil check + // outside of the loop to speed up the encoder. + _ = enc.encode di, si := 0, 0 n := (len(src) / 3) * 3 @@ -278,7 +282,10 @@ func (e CorruptInputError) Error() string { func (enc *Encoding) decodeQuantum(dst, src []byte, si int) (nsi, n int, err error) { // Decode quantum using the base64 alphabet var dbuf [4]byte - dinc, dlen := 3, 4 + dlen := 4 + + // Lift the nil check outside of the loop. + _ = enc.decodeMap for j := 0; j < len(dbuf); j++ { if len(src) == si { @@ -288,7 +295,7 @@ func (enc *Encoding) decodeQuantum(dst, src []byte, si int) (nsi, n int, err err case j == 1, enc.padChar != NoPadding: return si, 0, CorruptInputError(si - j) } - dinc, dlen = j-1, j + dlen = j break } in := src[si] @@ -340,7 +347,7 @@ func (enc *Encoding) decodeQuantum(dst, src []byte, si int) (nsi, n int, err err // trailing garbage err = CorruptInputError(si) } - dinc, dlen = 3, j + dlen = j break } @@ -365,7 +372,6 @@ func (enc *Encoding) decodeQuantum(dst, src []byte, si int) (nsi, n int, err err return si, 0, CorruptInputError(si - 2) } } - dst = dst[dinc:] return si, dlen - 1, err } @@ -464,9 +470,23 @@ func (enc *Encoding) Decode(dst, src []byte) (n int, err error) { return 0, nil } + // Lift the nil check outside of the loop. enc.decodeMap is directly + // used later in this function, to let the compiler know that the + // receiver can't be nil. + _ = enc.decodeMap + si := 0 for strconv.IntSize >= 64 && len(src)-si >= 8 && len(dst)-n >= 8 { - if dn, ok := enc.decode64(src[si:]); ok { + if dn, ok := assemble64( + enc.decodeMap[src[si+0]], + enc.decodeMap[src[si+1]], + enc.decodeMap[src[si+2]], + enc.decodeMap[src[si+3]], + enc.decodeMap[src[si+4]], + enc.decodeMap[src[si+5]], + enc.decodeMap[src[si+6]], + enc.decodeMap[src[si+7]], + ); ok { binary.BigEndian.PutUint64(dst[n:], dn) n += 6 si += 8 @@ -481,7 +501,12 @@ func (enc *Encoding) Decode(dst, src []byte) (n int, err error) { } for len(src)-si >= 4 && len(dst)-n >= 4 { - if dn, ok := enc.decode32(src[si:]); ok { + if dn, ok := assemble32( + enc.decodeMap[src[si+0]], + enc.decodeMap[src[si+1]], + enc.decodeMap[src[si+2]], + enc.decodeMap[src[si+3]], + ); ok { binary.BigEndian.PutUint32(dst[n:], dn) n += 3 si += 4 @@ -506,70 +531,40 @@ func (enc *Encoding) Decode(dst, src []byte) (n int, err error) { return n, err } -// decode32 tries to decode 4 base64 characters into 3 bytes, and returns those -// bytes. len(src) must be >= 4. -// Returns (0, false) if decoding failed. -func (enc *Encoding) decode32(src []byte) (dn uint32, ok bool) { - var n uint32 - _ = src[3] - if n = uint32(enc.decodeMap[src[0]]); n == 0xff { - return 0, false - } - dn |= n << 26 - if n = uint32(enc.decodeMap[src[1]]); n == 0xff { - return 0, false - } - dn |= n << 20 - if n = uint32(enc.decodeMap[src[2]]); n == 0xff { +// assemble32 assembles 4 base64 digits into 3 bytes. +// Each digit comes from the decode map, and will be 0xff +// if it came from an invalid character. +func assemble32(n1, n2, n3, n4 byte) (dn uint32, ok bool) { + // Check that all the digits are valid. If any of them was 0xff, their + // bitwise OR will be 0xff. + if n1|n2|n3|n4 == 0xff { return 0, false } - dn |= n << 14 - if n = uint32(enc.decodeMap[src[3]]); n == 0xff { - return 0, false - } - dn |= n << 8 - return dn, true + return uint32(n1)<<26 | + uint32(n2)<<20 | + uint32(n3)<<14 | + uint32(n4)<<8, + true } -// decode64 tries to decode 8 base64 characters into 6 bytes, and returns those -// bytes. len(src) must be >= 8. -// Returns (0, false) if decoding failed. -func (enc *Encoding) decode64(src []byte) (dn uint64, ok bool) { - var n uint64 - _ = src[7] - if n = uint64(enc.decodeMap[src[0]]); n == 0xff { - return 0, false - } - dn |= n << 58 - if n = uint64(enc.decodeMap[src[1]]); n == 0xff { - return 0, false - } - dn |= n << 52 - if n = uint64(enc.decodeMap[src[2]]); n == 0xff { - return 0, false - } - dn |= n << 46 - if n = uint64(enc.decodeMap[src[3]]); n == 0xff { - return 0, false - } - dn |= n << 40 - if n = uint64(enc.decodeMap[src[4]]); n == 0xff { - return 0, false - } - dn |= n << 34 - if n = uint64(enc.decodeMap[src[5]]); n == 0xff { - return 0, false - } - dn |= n << 28 - if n = uint64(enc.decodeMap[src[6]]); n == 0xff { - return 0, false - } - dn |= n << 22 - if n = uint64(enc.decodeMap[src[7]]); n == 0xff { +// assemble64 assembles 8 base64 digits into 6 bytes. +// Each digit comes from the decode map, and will be 0xff +// if it came from an invalid character. +func assemble64(n1, n2, n3, n4, n5, n6, n7, n8 byte) (dn uint64, ok bool) { + // Check that all the digits are valid. If any of them was 0xff, their + // bitwise OR will be 0xff. + if n1|n2|n3|n4|n5|n6|n7|n8 == 0xff { return 0, false } - dn |= n << 16 - return dn, true + return uint64(n1)<<58 | + uint64(n2)<<52 | + uint64(n3)<<46 | + uint64(n4)<<40 | + uint64(n5)<<34 | + uint64(n6)<<28 | + uint64(n7)<<22 | + uint64(n8)<<16, + true } type newlineFilteringReader struct { diff --git a/libgo/go/encoding/base64/base64_test.go b/libgo/go/encoding/base64/base64_test.go index f7f312ca393..bc67036f5bc 100644 --- a/libgo/go/encoding/base64/base64_test.go +++ b/libgo/go/encoding/base64/base64_test.go @@ -11,6 +11,7 @@ import ( "io" "io/ioutil" "reflect" + "runtime/debug" "strings" "testing" "time" @@ -175,7 +176,7 @@ func TestDecoder(t *testing.T) { testEqual(t, "Read from %q = length %v, want %v", p.encoded, count, len(p.decoded)) testEqual(t, "Decoding of %q = %q, want %q", p.encoded, string(dbuf[0:count]), p.decoded) if err != io.EOF { - count, err = decoder.Read(dbuf) + _, err = decoder.Read(dbuf) } testEqual(t, "Read from %q = %v, want %v", p.encoded, err, io.EOF) } @@ -247,6 +248,20 @@ func TestDecodeCorrupt(t *testing.T) { } } +func TestDecodeBounds(t *testing.T) { + var buf [32]byte + s := StdEncoding.EncodeToString(buf[:]) + defer func() { + if err := recover(); err != nil { + t.Fatalf("Decode panicked unexpectedly: %v\n%s", err, debug.Stack()) + } + }() + n, err := StdEncoding.Decode(buf[:], []byte(s)) + if n != len(buf) || err != nil { + t.Fatalf("StdEncoding.Decode = %d, %v, want %d, nil", n, err, len(buf)) + } +} + func TestEncodedLen(t *testing.T) { for _, tt := range []struct { enc *Encoding diff --git a/libgo/go/encoding/csv/fuzz.go b/libgo/go/encoding/csv/fuzz.go new file mode 100644 index 00000000000..dc33893dd74 --- /dev/null +++ b/libgo/go/encoding/csv/fuzz.go @@ -0,0 +1,70 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build gofuzz + +package csv + +import ( + "bytes" + "fmt" + "reflect" +) + +func Fuzz(data []byte) int { + score := 0 + buf := new(bytes.Buffer) + + for _, tt := range []Reader{ + Reader{}, + Reader{Comma: ';'}, + Reader{Comma: '\t'}, + Reader{LazyQuotes: true}, + Reader{TrimLeadingSpace: true}, + Reader{Comment: '#'}, + Reader{Comment: ';'}, + } { + r := NewReader(bytes.NewReader(data)) + r.Comma = tt.Comma + r.Comment = tt.Comment + r.LazyQuotes = tt.LazyQuotes + r.TrimLeadingSpace = tt.TrimLeadingSpace + + records, err := r.ReadAll() + if err != nil { + continue + } + score = 1 + + buf.Reset() + w := NewWriter(buf) + w.Comma = tt.Comma + err = w.WriteAll(records) + if err != nil { + fmt.Printf("writer = %#v\n", w) + fmt.Printf("records = %v\n", records) + panic(err) + } + + r = NewReader(buf) + r.Comma = tt.Comma + r.Comment = tt.Comment + r.LazyQuotes = tt.LazyQuotes + r.TrimLeadingSpace = tt.TrimLeadingSpace + result, err := r.ReadAll() + if err != nil { + fmt.Printf("reader = %#v\n", r) + fmt.Printf("records = %v\n", records) + panic(err) + } + + if !reflect.DeepEqual(records, result) { + fmt.Println("records = \n", records) + fmt.Println("result = \n", records) + panic("not equal") + } + } + + return score +} diff --git a/libgo/go/encoding/csv/reader.go b/libgo/go/encoding/csv/reader.go index a2fd4c0970d..c40aa506b0c 100644 --- a/libgo/go/encoding/csv/reader.go +++ b/libgo/go/encoding/csv/reader.go @@ -80,6 +80,8 @@ func (e *ParseError) Error() string { return fmt.Sprintf("parse error on line %d, column %d: %v", e.Line, e.Column, e.Err) } +func (e *ParseError) Unwrap() error { return e.Err } + // These are the errors that can be returned in ParseError.Err. var ( ErrTrailingComma = errors.New("extra delimiter at end of line") // Deprecated: No longer used. diff --git a/libgo/go/encoding/csv/writer.go b/libgo/go/encoding/csv/writer.go index 31c4f9c22dc..b18996a930d 100644 --- a/libgo/go/encoding/csv/writer.go +++ b/libgo/go/encoding/csv/writer.go @@ -12,7 +12,7 @@ import ( "unicode/utf8" ) -// A Writer writes records to a CSV encoded file. +// A Writer writes records using CSV encoding. // // As returned by NewWriter, a Writer writes records terminated by a // newline and uses ',' as the field delimiter. The exported fields can be @@ -21,6 +21,12 @@ import ( // Comma is the field delimiter. // // If UseCRLF is true, the Writer ends each output line with \r\n instead of \n. +// +// The writes of individual records are buffered. +// After all data has been written, the client should call the +// Flush method to guarantee all data has been forwarded to +// the underlying io.Writer. Any errors that occurred should +// be checked by calling the Error method. type Writer struct { Comma rune // Field delimiter (set to ',' by NewWriter) UseCRLF bool // True to use \r\n as the line terminator @@ -37,6 +43,8 @@ func NewWriter(w io.Writer) *Writer { // Writer writes a single CSV record to w along with any necessary quoting. // A record is a slice of strings with each string being one field. +// Writes are buffered, so Flush must eventually be called to ensure +// that the record is written to the underlying io.Writer. func (w *Writer) Write(record []string) error { if !validDelim(w.Comma) { return errInvalidDelim @@ -122,7 +130,8 @@ func (w *Writer) Error() error { return err } -// WriteAll writes multiple CSV records to w using Write and then calls Flush. +// WriteAll writes multiple CSV records to w using Write and then calls Flush, +// returning any error from the Flush. func (w *Writer) WriteAll(records [][]string) error { for _, record := range records { err := w.Write(record) diff --git a/libgo/go/encoding/gob/codec_test.go b/libgo/go/encoding/gob/codec_test.go index 520afde34d5..494abc9b913 100644 --- a/libgo/go/encoding/gob/codec_test.go +++ b/libgo/go/encoding/gob/codec_test.go @@ -1421,8 +1421,7 @@ func encFuzzDec(rng *rand.Rand, in interface{}) error { // This does some "fuzz testing" by attempting to decode a sequence of random bytes. func TestFuzz(t *testing.T) { if !*doFuzzTests { - t.Logf("disabled; run with -gob.fuzz to enable") - return + t.Skipf("disabled; run with -gob.fuzz to enable") } // all possible inputs @@ -1441,8 +1440,7 @@ func TestFuzz(t *testing.T) { func TestFuzzRegressions(t *testing.T) { if !*doFuzzTests { - t.Logf("disabled; run with -gob.fuzz to enable") - return + t.Skipf("disabled; run with -gob.fuzz to enable") } // An instance triggering a type name of length ~102 GB. @@ -1465,6 +1463,10 @@ func testFuzz(t *testing.T, seed int64, n int, input ...interface{}) { // TestFuzzOneByte tries to decode corrupted input sequences // and checks that no panic occurs. func TestFuzzOneByte(t *testing.T) { + if !*doFuzzTests { + t.Skipf("disabled; run with -gob.fuzz to enable") + } + buf := new(bytes.Buffer) Register(OnTheFly{}) dt := newDT() diff --git a/libgo/go/encoding/gob/decgen.go b/libgo/go/encoding/gob/decgen.go index bad4fe5d926..1c31e66625f 100644 --- a/libgo/go/encoding/gob/decgen.go +++ b/libgo/go/encoding/gob/decgen.go @@ -185,10 +185,12 @@ func main() { log.Fatal("source format error:", err) } fd, err := os.Create(*output) - _, err = fd.Write(source) if err != nil { log.Fatal(err) } + if _, err := fd.Write(source); err != nil { + log.Fatal(err) + } } func printMaps(b *bytes.Buffer, upperClass string) { diff --git a/libgo/go/encoding/gob/doc.go b/libgo/go/encoding/gob/doc.go index fa534313cc9..c7657071398 100644 --- a/libgo/go/encoding/gob/doc.go +++ b/libgo/go/encoding/gob/doc.go @@ -193,10 +193,14 @@ pair (-type id, encoded-type) where encoded-type is the gob encoding of a wireTy description, constructed from these types: type wireType struct { - ArrayT *ArrayType - SliceT *SliceType - StructT *StructType - MapT *MapType + ArrayT *ArrayType + SliceT *SliceType + StructT *StructType + MapT *MapType + GobEncoderT *gobEncoderType + BinaryMarshalerT *gobEncoderType + TextMarshalerT *gobEncoderType + } type arrayType struct { CommonType @@ -224,6 +228,9 @@ description, constructed from these types: Key typeId Elem typeId } + type gobEncoderType struct { + CommonType + } If there are nested type ids, the types for all inner type ids must be defined before the top-level type id is used to describe an encoded-v. diff --git a/libgo/go/encoding/gob/encgen.go b/libgo/go/encoding/gob/encgen.go index 0c051d2e844..409b8c9d952 100644 --- a/libgo/go/encoding/gob/encgen.go +++ b/libgo/go/encoding/gob/encgen.go @@ -164,10 +164,12 @@ func main() { log.Fatal("source format error:", err) } fd, err := os.Create(*output) - _, err = fd.Write(source) if err != nil { log.Fatal(err) } + if _, err := fd.Write(source); err != nil { + log.Fatal(err) + } } func printMaps(b *bytes.Buffer, upperClass string) { diff --git a/libgo/go/encoding/gob/encode.go b/libgo/go/encoding/gob/encode.go index 5371e7245f4..8f8f170c164 100644 --- a/libgo/go/encoding/gob/encode.go +++ b/libgo/go/encoding/gob/encode.go @@ -47,7 +47,7 @@ var encBufferPool = sync.Pool{ }, } -func (e *encBuffer) WriteByte(c byte) { +func (e *encBuffer) writeByte(c byte) { e.data = append(e.data, c) } @@ -106,7 +106,7 @@ func (enc *Encoder) freeEncoderState(e *encoderState) { // encodeUint writes an encoded unsigned integer to state.b. func (state *encoderState) encodeUint(x uint64) { if x <= 0x7F { - state.b.WriteByte(uint8(x)) + state.b.writeByte(uint8(x)) return } diff --git a/libgo/go/encoding/hex/hex.go b/libgo/go/encoding/hex/hex.go index 2bb2b57df9c..fbba78ffd21 100644 --- a/libgo/go/encoding/hex/hex.go +++ b/libgo/go/encoding/hex/hex.go @@ -23,11 +23,12 @@ func EncodedLen(n int) int { return n * 2 } // of bytes written to dst, but this value is always EncodedLen(len(src)). // Encode implements hexadecimal encoding. func Encode(dst, src []byte) int { - for i, v := range src { - dst[i*2] = hextable[v>>4] - dst[i*2+1] = hextable[v&0x0f] + j := 0 + for _, v := range src { + dst[j] = hextable[v>>4] + dst[j+1] = hextable[v&0x0f] + j += 2 } - return len(src) * 2 } @@ -55,23 +56,24 @@ func DecodedLen(x int) int { return x / 2 } // If the input is malformed, Decode returns the number // of bytes decoded before the error. func Decode(dst, src []byte) (int, error) { - var i int - for i = 0; i < len(src)/2; i++ { - a, ok := fromHexChar(src[i*2]) + i, j := 0, 1 + for ; j < len(src); j += 2 { + a, ok := fromHexChar(src[j-1]) if !ok { - return i, InvalidByteError(src[i*2]) + return i, InvalidByteError(src[j-1]) } - b, ok := fromHexChar(src[i*2+1]) + b, ok := fromHexChar(src[j]) if !ok { - return i, InvalidByteError(src[i*2+1]) + return i, InvalidByteError(src[j]) } dst[i] = (a << 4) | b + i++ } if len(src)%2 == 1 { // Check for invalid char before reporting bad length, // since the invalid char (if present) is an earlier problem. - if _, ok := fromHexChar(src[i*2]); !ok { - return i, InvalidByteError(src[i*2]) + if _, ok := fromHexChar(src[j-1]); !ok { + return i, InvalidByteError(src[j-1]) } return i, ErrLength } diff --git a/libgo/go/encoding/hex/hex_test.go b/libgo/go/encoding/hex/hex_test.go index e9f4b3a53ad..dbb00b94cac 100644 --- a/libgo/go/encoding/hex/hex_test.go +++ b/libgo/go/encoding/hex/hex_test.go @@ -242,6 +242,7 @@ func BenchmarkEncode(b *testing.B) { sink = make([]byte, 2*size) b.Run(fmt.Sprintf("%v", size), func(b *testing.B) { + b.SetBytes(int64(size)) for i := 0; i < b.N; i++ { Encode(sink, src) } @@ -249,12 +250,27 @@ func BenchmarkEncode(b *testing.B) { } } +func BenchmarkDecode(b *testing.B) { + for _, size := range []int{256, 1024, 4096, 16384} { + src := bytes.Repeat([]byte{'2', 'b', '7', '4', '4', 'f', 'a', 'a'}, size/8) + sink = make([]byte, size/2) + + b.Run(fmt.Sprintf("%v", size), func(b *testing.B) { + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + Decode(sink, src) + } + }) + } +} + func BenchmarkDump(b *testing.B) { for _, size := range []int{256, 1024, 4096, 16384} { src := bytes.Repeat([]byte{2, 3, 5, 7, 9, 11, 13, 17}, size/8) sink = make([]byte, 2*size) b.Run(fmt.Sprintf("%v", size), func(b *testing.B) { + b.SetBytes(int64(size)) for i := 0; i < b.N; i++ { Dump(src) } diff --git a/libgo/go/encoding/json/bench_test.go b/libgo/go/encoding/json/bench_test.go index 72cb349062c..f2592e3dbdf 100644 --- a/libgo/go/encoding/json/bench_test.go +++ b/libgo/go/encoding/json/bench_test.go @@ -82,6 +82,7 @@ func codeInit() { } func BenchmarkCodeEncoder(b *testing.B) { + b.ReportAllocs() if codeJSON == nil { b.StopTimer() codeInit() @@ -99,6 +100,7 @@ func BenchmarkCodeEncoder(b *testing.B) { } func BenchmarkCodeMarshal(b *testing.B) { + b.ReportAllocs() if codeJSON == nil { b.StopTimer() codeInit() @@ -133,6 +135,7 @@ func benchMarshalBytes(n int) func(*testing.B) { } func BenchmarkMarshalBytes(b *testing.B) { + b.ReportAllocs() // 32 fits within encodeState.scratch. b.Run("32", benchMarshalBytes(32)) // 256 doesn't fit in encodeState.scratch, but is small enough to @@ -143,6 +146,7 @@ func BenchmarkMarshalBytes(b *testing.B) { } func BenchmarkCodeDecoder(b *testing.B) { + b.ReportAllocs() if codeJSON == nil { b.StopTimer() codeInit() @@ -167,6 +171,7 @@ func BenchmarkCodeDecoder(b *testing.B) { } func BenchmarkUnicodeDecoder(b *testing.B) { + b.ReportAllocs() j := []byte(`"\uD83D\uDE01"`) b.SetBytes(int64(len(j))) r := bytes.NewReader(j) @@ -182,6 +187,7 @@ func BenchmarkUnicodeDecoder(b *testing.B) { } func BenchmarkDecoderStream(b *testing.B) { + b.ReportAllocs() b.StopTimer() var buf bytes.Buffer dec := NewDecoder(&buf) @@ -204,6 +210,7 @@ func BenchmarkDecoderStream(b *testing.B) { } func BenchmarkCodeUnmarshal(b *testing.B) { + b.ReportAllocs() if codeJSON == nil { b.StopTimer() codeInit() @@ -221,6 +228,7 @@ func BenchmarkCodeUnmarshal(b *testing.B) { } func BenchmarkCodeUnmarshalReuse(b *testing.B) { + b.ReportAllocs() if codeJSON == nil { b.StopTimer() codeInit() @@ -234,10 +242,11 @@ func BenchmarkCodeUnmarshalReuse(b *testing.B) { } } }) - // TODO(bcmills): Is there a missing b.SetBytes here? + b.SetBytes(int64(len(codeJSON))) } func BenchmarkUnmarshalString(b *testing.B) { + b.ReportAllocs() data := []byte(`"hello, world"`) b.RunParallel(func(pb *testing.PB) { var s string @@ -250,6 +259,7 @@ func BenchmarkUnmarshalString(b *testing.B) { } func BenchmarkUnmarshalFloat64(b *testing.B) { + b.ReportAllocs() data := []byte(`3.14`) b.RunParallel(func(pb *testing.PB) { var f float64 @@ -262,6 +272,7 @@ func BenchmarkUnmarshalFloat64(b *testing.B) { } func BenchmarkUnmarshalInt64(b *testing.B) { + b.ReportAllocs() data := []byte(`3`) b.RunParallel(func(pb *testing.PB) { var x int64 @@ -300,6 +311,7 @@ func BenchmarkUnmapped(b *testing.B) { } func BenchmarkTypeFieldsCache(b *testing.B) { + b.ReportAllocs() var maxTypes int = 1e6 if testenv.Builder() != "" { maxTypes = 1e3 // restrict cache sizes on builders diff --git a/libgo/go/encoding/json/decode.go b/libgo/go/encoding/json/decode.go index 731553dca6b..bdd94e34ce6 100644 --- a/libgo/go/encoding/json/decode.go +++ b/libgo/go/encoding/json/decode.go @@ -8,12 +8,12 @@ package json import ( - "bytes" "encoding" "encoding/base64" "fmt" "reflect" "strconv" + "strings" "unicode" "unicode/utf16" "unicode/utf8" @@ -125,7 +125,7 @@ type UnmarshalTypeError struct { Type reflect.Type // type of Go value it could not be assigned to Offset int64 // error occurred after reading Offset bytes Struct string // name of the struct type containing the field - Field string // name of the field holding the Go value + Field string // the full path from root node to the field } func (e *UnmarshalTypeError) Error() string { @@ -266,12 +266,15 @@ type decodeState struct { opcode int // last read result scan scanner errorContext struct { // provides context for type errors - Struct reflect.Type - Field string + Struct reflect.Type + FieldStack []string } savedError error useNumber bool disallowUnknownFields bool + // safeUnquote is the number of current string literal bytes that don't + // need to be unquoted. When negative, no bytes need unquoting. + safeUnquote int } // readIndex returns the position of the last byte read. @@ -289,7 +292,9 @@ func (d *decodeState) init(data []byte) *decodeState { d.off = 0 d.savedError = nil d.errorContext.Struct = nil - d.errorContext.Field = "" + + // Reuse the allocated space for the FieldStack slice. + d.errorContext.FieldStack = d.errorContext.FieldStack[:0] return d } @@ -303,11 +308,11 @@ func (d *decodeState) saveError(err error) { // addErrorContext returns a new error enhanced with information from d.errorContext func (d *decodeState) addErrorContext(err error) error { - if d.errorContext.Struct != nil || d.errorContext.Field != "" { + if d.errorContext.Struct != nil || len(d.errorContext.FieldStack) > 0 { switch err := err.(type) { case *UnmarshalTypeError: err.Struct = d.errorContext.Struct.Name() - err.Field = d.errorContext.Field + err.Field = strings.Join(d.errorContext.FieldStack, ".") return err } } @@ -358,6 +363,66 @@ func (d *decodeState) scanWhile(op int) { d.opcode = d.scan.eof() } +// rescanLiteral is similar to scanWhile(scanContinue), but it specialises the +// common case where we're decoding a literal. The decoder scans the input +// twice, once for syntax errors and to check the length of the value, and the +// second to perform the decoding. +// +// Only in the second step do we use decodeState to tokenize literals, so we +// know there aren't any syntax errors. We can take advantage of that knowledge, +// and scan a literal's bytes much more quickly. +func (d *decodeState) rescanLiteral() { + data, i := d.data, d.off +Switch: + switch data[i-1] { + case '"': // string + // safeUnquote is initialized at -1, which means that all bytes + // checked so far can be unquoted at a later time with no work + // at all. When reaching the closing '"', if safeUnquote is + // still -1, all bytes can be unquoted with no work. Otherwise, + // only those bytes up until the first '\\' or non-ascii rune + // can be safely unquoted. + safeUnquote := -1 + for ; i < len(data); i++ { + if c := data[i]; c == '\\' { + if safeUnquote < 0 { // first unsafe byte + safeUnquote = int(i - d.off) + } + i++ // escaped char + } else if c == '"' { + d.safeUnquote = safeUnquote + i++ // tokenize the closing quote too + break Switch + } else if c >= utf8.RuneSelf { + if safeUnquote < 0 { // first unsafe byte + safeUnquote = int(i - d.off) + } + } + } + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-': // number + for ; i < len(data); i++ { + switch data[i] { + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + '.', 'e', 'E', '+', '-': + default: + break Switch + } + } + case 't': // true + i += len("rue") + case 'f': // false + i += len("alse") + case 'n': // null + i += len("ull") + } + if i < len(data) { + d.opcode = stateEndValue(&d.scan, data[i]) + } else { + d.opcode = scanEnd + } + d.off = i + 1 +} + // value consumes a JSON value from d.data[d.off-1:], decoding into v, and // reads the following byte ahead. If v is invalid, the value is discarded. // The first byte of the value has been read already. @@ -389,7 +454,7 @@ func (d *decodeState) value(v reflect.Value) error { case scanBeginLiteral: // All bytes inside literal return scanContinue op code. start := d.readIndex() - d.scanWhile(scanContinue) + d.rescanLiteral() if v.IsValid() { if err := d.literalStore(d.data[start:d.readIndex()], v, false); err != nil { @@ -470,6 +535,14 @@ func indirect(v reflect.Value, decodingNull bool) (Unmarshaler, encoding.TextUnm if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { break } + + // Prevent infinite loop if v is an interface pointing to its own address: + // var v interface{} + // v = &v + if v.Elem().Kind() == reflect.Interface && v.Elem().Elem() == v { + v = v.Elem() + break + } if v.IsNil() { v.Set(reflect.New(v.Type().Elem())) } @@ -625,7 +698,7 @@ func (d *decodeState) object(v reflect.Value) error { return nil } - var fields []field + var fields structFields // Check type of target: // struct or @@ -659,7 +732,7 @@ func (d *decodeState) object(v reflect.Value) error { } var mapElem reflect.Value - originalErrorContext := d.errorContext + origErrorContext := d.errorContext for { // Read opening " of string key or closing }. @@ -674,9 +747,9 @@ func (d *decodeState) object(v reflect.Value) error { // Read key. start := d.readIndex() - d.scanWhile(scanContinue) + d.rescanLiteral() item := d.data[start:d.readIndex()] - key, ok := unquoteBytes(item) + key, ok := d.unquoteBytes(item) if !ok { panic(phasePanicMsg) } @@ -695,14 +768,18 @@ func (d *decodeState) object(v reflect.Value) error { subv = mapElem } else { var f *field - for i := range fields { - ff := &fields[i] - if bytes.Equal(ff.nameBytes, key) { - f = ff - break - } - if f == nil && ff.equalFold(ff.nameBytes, key) { - f = ff + if i, ok := fields.nameIndex[string(key)]; ok { + // Found an exact name match. + f = &fields.list[i] + } else { + // Fall back to the expensive case-insensitive + // linear search. + for i := range fields.list { + ff := &fields.list[i] + if ff.equalFold(ff.nameBytes, key) { + f = ff + break + } } } if f != nil { @@ -730,7 +807,7 @@ func (d *decodeState) object(v reflect.Value) error { } subv = subv.Field(i) } - d.errorContext.Field = f.name + d.errorContext.FieldStack = append(d.errorContext.FieldStack, f.name) d.errorContext.Struct = t } else if d.disallowUnknownFields { d.saveError(fmt.Errorf("json: unknown field %q", key)) @@ -810,14 +887,17 @@ func (d *decodeState) object(v reflect.Value) error { if d.opcode == scanSkipSpace { d.scanWhile(scanSkipSpace) } + // Reset errorContext to its original state. + // Keep the same underlying array for FieldStack, to reuse the + // space and avoid unnecessary allocs. + d.errorContext.FieldStack = d.errorContext.FieldStack[:len(origErrorContext.FieldStack)] + d.errorContext.Struct = origErrorContext.Struct if d.opcode == scanEndObject { break } if d.opcode != scanObjectValue { panic(phasePanicMsg) } - - d.errorContext = originalErrorContext } return nil } @@ -870,7 +950,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool d.saveError(&UnmarshalTypeError{Value: val, Type: v.Type(), Offset: int64(d.readIndex())}) return nil } - s, ok := unquoteBytes(item) + s, ok := d.unquoteBytes(item) if !ok { if fromQuoted { return fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()) @@ -921,7 +1001,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool } case '"': // string - s, ok := unquoteBytes(item) + s, ok := d.unquoteBytes(item) if !ok { if fromQuoted { return fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()) @@ -1077,9 +1157,9 @@ func (d *decodeState) objectInterface() map[string]interface{} { // Read string key. start := d.readIndex() - d.scanWhile(scanContinue) + d.rescanLiteral() item := d.data[start:d.readIndex()] - key, ok := unquote(item) + key, ok := d.unquote(item) if !ok { panic(phasePanicMsg) } @@ -1116,7 +1196,7 @@ func (d *decodeState) objectInterface() map[string]interface{} { func (d *decodeState) literalInterface() interface{} { // All bytes inside literal return scanContinue op code. start := d.readIndex() - d.scanWhile(scanContinue) + d.rescanLiteral() item := d.data[start:d.readIndex()] @@ -1128,7 +1208,7 @@ func (d *decodeState) literalInterface() interface{} { return c == 't' case '"': // string - s, ok := unquote(item) + s, ok := d.unquote(item) if !ok { panic(phasePanicMsg) } @@ -1171,38 +1251,21 @@ func getu4(s []byte) rune { // unquote converts a quoted JSON string literal s into an actual string t. // The rules are different than for Go, so cannot use strconv.Unquote. -func unquote(s []byte) (t string, ok bool) { - s, ok = unquoteBytes(s) +func (d *decodeState) unquote(s []byte) (t string, ok bool) { + s, ok = d.unquoteBytes(s) t = string(s) return } -func unquoteBytes(s []byte) (t []byte, ok bool) { - if len(s) < 2 || s[0] != '"' || s[len(s)-1] != '"' { - return - } +func (d *decodeState) unquoteBytes(s []byte) (t []byte, ok bool) { + r := d.safeUnquote + // The bytes have been scanned, so we know that the first and last bytes + // are double quotes. s = s[1 : len(s)-1] - // Check for unusual characters. If there are none, - // then no unquoting is needed, so return a slice of the - // original bytes. - r := 0 - for r < len(s) { - c := s[r] - if c == '\\' || c == '"' || c < ' ' { - break - } - if c < utf8.RuneSelf { - r++ - continue - } - rr, size := utf8.DecodeRune(s[r:]) - if rr == utf8.RuneError && size == 1 { - break - } - r += size - } - if r == len(s) { + // If there are no unusual characters, no unquoting is needed, so return + // a slice of the original bytes. + if r == -1 { return s, true } diff --git a/libgo/go/encoding/json/decode_test.go b/libgo/go/encoding/json/decode_test.go index 54432600a53..719a9fa290c 100644 --- a/libgo/go/encoding/json/decode_test.go +++ b/libgo/go/encoding/json/decode_test.go @@ -45,6 +45,15 @@ type W struct { S SS } +type P struct { + PP PP +} + +type PP struct { + T T + Ts []T +} + type SS string func (*SS) UnmarshalJSON(data []byte) error { @@ -816,7 +825,7 @@ var unmarshalTests = []unmarshalTest{ err: &UnmarshalTypeError{ Value: "string", Struct: "V", - Field: "F2", + Field: "V.F2", Type: reflect.TypeOf(int32(0)), Offset: 20, }, @@ -827,7 +836,7 @@ var unmarshalTests = []unmarshalTest{ err: &UnmarshalTypeError{ Value: "string", Struct: "V", - Field: "F2", + Field: "V.F2", Type: reflect.TypeOf(int32(0)), Offset: 30, }, @@ -923,6 +932,29 @@ var unmarshalTests = []unmarshalTest{ ptr: new(MustNotUnmarshalText), err: &UnmarshalTypeError{Value: "object", Type: reflect.TypeOf(&MustNotUnmarshalText{}), Offset: 1}, }, + // #22369 + { + in: `{"PP": {"T": {"Y": "bad-type"}}}`, + ptr: new(P), + err: &UnmarshalTypeError{ + Value: "string", + Struct: "T", + Field: "PP.T.Y", + Type: reflect.TypeOf(int(0)), + Offset: 29, + }, + }, + { + in: `{"Ts": [{"Y": 1}, {"Y": 2}, {"Y": "bad-type"}]}`, + ptr: new(PP), + err: &UnmarshalTypeError{ + Value: "string", + Struct: "T", + Field: "Ts.Y", + Type: reflect.TypeOf(int(0)), + Offset: 29, + }, + }, } func TestMarshal(t *testing.T) { @@ -1021,12 +1053,22 @@ func TestMarshalEmbeds(t *testing.T) { } } +func equalError(a, b error) bool { + if a == nil { + return b == nil + } + if b == nil { + return a == nil + } + return a.Error() == b.Error() +} + func TestUnmarshal(t *testing.T) { for i, tt := range unmarshalTests { var scan scanner in := []byte(tt.in) if err := checkValid(in, &scan); err != nil { - if !reflect.DeepEqual(err, tt.err) { + if !equalError(err, tt.err) { t.Errorf("#%d: checkValid: %#v", i, err) continue } @@ -1044,7 +1086,7 @@ func TestUnmarshal(t *testing.T) { if tt.disallowUnknownFields { dec.DisallowUnknownFields() } - if err := dec.Decode(v.Interface()); !reflect.DeepEqual(err, tt.err) { + if err := dec.Decode(v.Interface()); !equalError(err, tt.err) { t.Errorf("#%d: %v, want %v", i, err, tt.err) continue } else if err != nil { @@ -2270,7 +2312,7 @@ func TestUnmarshalEmbeddedUnexported(t *testing.T) { for i, tt := range tests { err := Unmarshal([]byte(tt.in), tt.ptr) - if !reflect.DeepEqual(err, tt.err) { + if !equalError(err, tt.err) { t.Errorf("#%d: %v, want %v", i, err, tt.err) } if !reflect.DeepEqual(tt.ptr, tt.out) { @@ -2292,3 +2334,15 @@ func TestUnmarshalPanic(t *testing.T) { Unmarshal([]byte("{}"), &unmarshalPanic{}) t.Fatalf("Unmarshal should have panicked") } + +// The decoder used to hang if decoding into an interface pointing to its own address. +// See golang.org/issues/31740. +func TestUnmarshalRecursivePointer(t *testing.T) { + var v interface{} + v = &v + data := []byte(`{"a": "b"}`) + + if err := Unmarshal(data, v); err != nil { + t.Fatal(err) + } +} diff --git a/libgo/go/encoding/json/encode.go b/libgo/go/encoding/json/encode.go index dea63f1850f..464ee3ece4f 100644 --- a/libgo/go/encoding/json/encode.go +++ b/libgo/go/encoding/json/encode.go @@ -45,11 +45,12 @@ import ( // // String values encode as JSON strings coerced to valid UTF-8, // replacing invalid bytes with the Unicode replacement rune. -// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e" -// to keep some browsers from misinterpreting JSON output as HTML. -// Ampersand "&" is also escaped to "\u0026" for the same reason. -// This escaping can be disabled using an Encoder that had SetEscapeHTML(false) -// called on it. +// So that the JSON will be safe to embed inside HTML